Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 01 Jan 1997 19:15:55 -0800
From:      David Greenman <dg@root.com>
To:        Julian Assange <proff@iq.org>
Cc:        hackers@freebsd.org
Subject:   Re: struct file locking 
Message-ID:  <199701020315.TAA13645@root.com>

next in thread | raw e-mail | index | archive | help
>>In the socket structure I intend to create a back-pointer to
>>originating struct file's->u_cred. What do I need to do to insure
>>these last two structures are reliably locked and in memory?

(To which I said):

>   See crhold() in sys/ucred.h and crfree() in sys/kern/kern_prot.c. They
>manage the cr_ref reference count.

   ...err, I should have read your message more carefully. f_count on the file
descriptor is what holds the references to the descriptor, but I don't think
you can do precisely what you want without actually doing a dup. You might be
able to do a fp->f_count++, and later a closef() to lose the reference, but
that depends entirely on the context of things.

-DG

David Greenman
Core-team/Principal Architect, The FreeBSD Project



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199701020315.TAA13645>