From owner-freebsd-arch@FreeBSD.ORG Mon Jun 5 11:50:30 2006 Return-Path: X-Original-To: freebsd-arch@freebsd.org Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 319F716A618 for ; Mon, 5 Jun 2006 11:50:30 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD2C643D67 for ; Mon, 5 Jun 2006 11:50:26 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.6/8.13.6/NETPLEX) with ESMTP id k55BoPUY011125; Mon, 5 Jun 2006 07:50:25 -0400 (EDT) Date: Mon, 5 Jun 2006 07:50:25 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: MingyanGuo In-Reply-To: <1fa17f810606050044k2847e4a2i150eb934ed84006f@mail.gmail.com> Message-ID: References: <1fa17f810606050044k2847e4a2i150eb934ed84006f@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: delphij@gmail.com, freebsd-arch@freebsd.org Subject: Re: Why use `thread' as an argument of Syscalls? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2006 11:50:32 -0000 On Mon, 5 Jun 2006, MingyanGuo wrote: > Hi all, > I find that FreeBSD Syscalls always have an `thread' > argument, for example, preadv(/sys/kern/sys_generic.c) > has a `td' argument. But some Syscalls may rarely use > this argument, and thay ( and functions they invoke) can > get the `thread' who make the Syscall _easily_ via > `curthread' macro if needed. So the `thread' argument > seems not needed. > Can anybody tell me why use `thread' as an argument > of Syscalls? You could have asked "why use 'proc' as an argument of Syscalls" 12 years ago (or more). When the kernel became thread-aware (almost 5 years ago), most 'struct proc' arguments were changed to 'struct thread'. -- DE