From owner-freebsd-arch@FreeBSD.ORG Mon Jun 5 13:08:09 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 0030F16A739 for ; Mon, 5 Jun 2006 13:08:08 +0000 (UTC) (envelope-from guomingyan@gmail.com) Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id C82A243D60 for ; Mon, 5 Jun 2006 13:08:04 +0000 (GMT) (envelope-from guomingyan@gmail.com) Received: by wx-out-0102.google.com with SMTP id i31so731060wxd for ; Mon, 05 Jun 2006 06:08:04 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=n5ZAKJUbbXEB8e/t3ilNREVTJISPJEBDZGn3NiRbuLK1pGsGEvbate0V+emJ/WRcXS/0DrGbK0Go8wH2JuwmFV60OpXROjCpSObrFGkh3MihgDTqeaM3DevD8+lLuP86wh20qtWL+33rJ07tVyzGLBDjy4W9fGUGn2kZ326YZpI= Received: by 10.70.122.15 with SMTP id u15mr3951836wxc; Mon, 05 Jun 2006 06:08:04 -0700 (PDT) Received: by 10.70.39.18 with HTTP; Mon, 5 Jun 2006 06:08:04 -0700 (PDT) Message-ID: <1fa17f810606050608l5bd2ec5ch37663375f6fa5b64@mail.gmail.com> Date: Mon, 5 Jun 2006 21:08:04 +0800 From: MingyanGuo To: "Daniel Eischen" In-Reply-To: MIME-Version: 1.0 References: <1fa17f810606050044k2847e4a2i150eb934ed84006f@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 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 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 13:08:16 -0000 On 6/5/06, Daniel Eischen wrote: > > 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 > They are the same questions, I think ;-). Now would you please explain "why use `proc' as an argument of Syscalls" to me :)? I've read some source code of the kernel, but no comments about it found. Thanks. Regards, -- Three passions, simple but overwhelmingly strong, have governed my life: the longing for love, the search for knowledge, and unbearable pity for the suffering of mankind. ---------Bertrand Russell