From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 27 07:22:03 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBFC016A4CE for ; Sun, 27 Feb 2005 07:22:03 +0000 (GMT) Received: from panther.cs.ucla.edu (Panther.CS.UCLA.EDU [131.179.128.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id A205643D4C for ; Sun, 27 Feb 2005 07:22:03 +0000 (GMT) (envelope-from yanyu@CS.UCLA.EDU) Received: from localhost (yanyu@localhost)j1R7M3504447 for ; Sat, 26 Feb 2005 23:22:03 -0800 (PST) Date: Sat, 26 Feb 2005 23:22:03 -0800 (PST) From: Yan Yu To: freebsd-hackers@freebsd.org In-Reply-To: Message-ID: References: <20050226072645.76950.qmail@web26802.mail.ukl.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: function prototype of fdrop() and fdrop_locked() in kern_descrip.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Feb 2005 07:22:03 -0000 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