Why use `thread' as an argument of Syscalls?

Daniel Eischen deischen at freebsd.org
Mon Jun 5 04:50:32 PDT 2006


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


More information about the freebsd-arch mailing list