Discussion:
syscall stub
Emmanuel Dreyfus
2014-09-25 08:43:04 UTC
Permalink
Hi

I need to add a layer in libc for posix_allocate() because the
system call argument list does not match the prototype exposed
to userland.

How can I do it? My problem is that the system call and the libc
function have the same name. Do I need to rename the system call,
to something like _posix_fallocate ? Or is there a trick to do
it otherwise.
--
Emmanuel Dreyfus
***@netbsd.org
Emmanuel Dreyfus
2014-09-25 12:19:07 UTC
Permalink
Post by Emmanuel Dreyfus
How can I do it? My problem is that the system call and the libc
function have the same name. Do I need to rename the system call,
to something like _posix_fallocate ? Or is there a trick to do
it otherwise.
Replaying to myself: copy sys/pread.c and carefully substitute
strings. The build seems extremely picky about what is in the
file in ordre to acheive the proper result.
--
Emmanuel Dreyfus
***@netbsd.org
Martin Husemann
2014-09-25 15:19:40 UTC
Permalink
Post by Emmanuel Dreyfus
How can I do it? My problem is that the system call and the libc
function have the same name. Do I need to rename the system call,
to something like _posix_fallocate ? Or is there a trick to do
it otherwise.
Yes, see src/lib/libc/sys/mknodat.c for an unversioned one and
posix_fadvise.c for a versioned variant.

Since you need to allow old binaries (and 64bit architectures were
not affected by the bug, so there are valid, working ones) you need
to rename the old syscall to a compat one, create a new syscall with
proper padding and use the same sheme as posix_fadvise.c (but it should
be 70 instead of 50 now, I guess).

Martin
Emmanuel Dreyfus
2014-09-25 17:47:27 UTC
Permalink
Post by Martin Husemann
Since you need to allow old binaries (and 64bit architectures were
not affected by the bug, so there are valid, working ones) you need
to rename the old syscall to a compat one,
As I understand this syscall is in a release for the first time, and no
filesystem support the operation right now (although I am willing to
change that).
--
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
***@netbsd.org
Loading...