function prototype of fdrop() and fdrop_locked() in kern_descrip.c

Yan Yu yanyu at CS.UCLA.EDU
Sun Feb 27 07:22:03 GMT 2005


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





More information about the freebsd-hackers mailing list