syscalls from loadable modules compiled in statically into the kernel
Mateusz Guzik
mjguzik at gmail.com
Sat Oct 25 02:28:14 UTC 2014
The kernel has the following mechanism:
int
syscall_thread_enter(struct thread *td, struct sysent *se)
{
u_int32_t cnt, oldcnt;
do {
oldcnt = se->sy_thrcnt;
if ((oldcnt & SY_THR_STATIC) != 0)
return (0);
if ((oldcnt & (SY_THR_DRAINING | SY_THR_ABSENT)) != 0)
return (ENOSYS);
cnt = oldcnt + SY_THR_INCR;
} while (atomic_cmpset_acq_32(&se->sy_thrcnt, oldcnt, cnt) == 0);
return (0);
}
Except it turns out that it is used even if given module (here: sysvshm) is
compiled in statically.
So my proposal is to give modules an easy way to tell whether they got
compiled in and extend syscall_register interface so that it would allow
registering static syscalls.
The latter could also be used by modules which are loadable, but don't
support unloads.
I don't have any good idea how to provide aforementioned detection
method though.
Also, please see https://reviews.freebsd.org/D1007 which moves
SY_THR_STATIC check to an inline function, saving us 2 function calls on
each syscall.
--
Mateusz Guzik <mjguzik gmail.com>
More information about the freebsd-arch
mailing list