Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Oct 2023 02:45:20 +0200
From:      Konstantin Belousov <kib@freebsd.org>
To:        Alexander <bsdunix5@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: system calls on FreeBSD
Message-ID:  <ZUBOILU92LHDUebr@kib.kiev.ua>
In-Reply-To: <CAP9cUsN_t9Ob=nw00Qzsq_145jru%2BYEOz1zCJoDcoz8eN_o3ng@mail.gmail.com>
References:  <CAP9cUsN_t9Ob=nw00Qzsq_145jru%2BYEOz1zCJoDcoz8eN_o3ng@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 31, 2023 at 12:33:35AM +0200, Alexander wrote:
> Greetings !
> 
> I am a newbie FreeBSD user, and I want to write one or two system calls on
> FreeBSD.
> 
> I have a question, please :
> 
> Why FreeBSD system calls take as an argument struct thread *t, en lieu de
> struct proc *p ?

Because sometimes we need to know context which called the syscall, and
passing process instead of thread means loosing this information. For
instance, SIGSYS must be delivered exactly to the thread that called
non-existing syscall, not to the process.

More reasonable question is why do we pass the context argument at all,
since it can be reconstructed by the curthread expression.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ZUBOILU92LHDUebr>