Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Feb 2005 23:22:03 -0800 (PST)
From:      Yan Yu <yanyu@CS.UCLA.EDU>
To:        freebsd-hackers@freebsd.org
Subject:   function prototype of fdrop() and fdrop_locked() in kern_descrip.c
Message-ID:  <Pine.GSO.4.58.0502262309170.29499@panther.cs.ucla.edu>
In-Reply-To: <Pine.GSO.4.58.0502260111400.13229@panther.cs.ucla.edu>
References:  <20050226072645.76950.qmail@web26802.mail.ukl.yahoo.com> <Pine.GSO.4.58.0502260043200.12442@panther.cs.ucla.edu> <Pine.GSO.4.58.0502260103420.13229@panther.cs.ucla.edu> <Pine.GSO.4.58.0502260111400.13229@panther.cs.ucla.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
HI, all,
  I have a Q on the input parameter of fdrop() and fdrop_locked() in
kern/kern_descrip.c.

i am curious about the design choice of their input parameter.
currently, it is defined as
----------------------------------------
A) fdrop( struct file *, struct thread *)
----------------------------------------
I added some field in the file descriptor table, and need to do some
bookkeeping whenever a file descriptor is freed. It would be much easier
for me if fdrop() is defined as
---------------------------------
B) fdrop( int fd, struct thread *)
---------------------------------
then i could just instrument the fdrop function as opposed to change every
place that calls the fdrop() function. btw, there are more than 100 places
that calls fdrop():(

I am wondering about what is the motivation of fdrop is defined as
A) as opposed to B).. or it is an arbitrary design choice?

it seems to me fdrop is called usually when an fd is freed(or is there
other reason that fdrop get called?),
then fdrop(int fd, thread *) seems a natural choice..

many thanks,
yan





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