r0ller <r0l...@freemail.hu> writes:

> Hi All,
>
> I'm trying to add a new linux syscall called fallocate just to map it
> to the existing posix_fallocate whenever it's possible (as it is
> nonportable for its mode as far as I can see). I've read some docs
> (but certain things may have been overlooked) like:
>
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
> http://man7.org/linux/man-pages/man2/fallocate.2.html
> https://www.netbsd.org/docs/internals/en/chap-processes.html#syscall_howto
> https://www.netbsd.org/docs/kernel/programming.html#adding_a_system_call
>
> What I've done so far on a NetBSD-8.0 VM after pulling its source:
>
> 1) modified: /usr/src/sys/compat/linux/arch/amd64/syscalls.master like:
> 285 STD { int|linux_sys||fallocate(int fd, int mode, linux_off_t offset, 
> linux_off_t len); }
>
> 2) added linux_sys_fallocate() to 
> /usr/src/sys/compat/linux/common/linux_file.c like:
> int linux_sys_fallocate(int fd, int mode, linux_off_t offset, linux_off_t 
> len){<!-- -->
>     printf("Calling linux_sys_fallocate\n");
>     return EOPNOTSUPP;
> }
>
> Question: is that the right place to add linux_sys_fallocate()?

I am not sure but it does not strike me as obviously wrong.

> 3) issued make in /usr/src/sys/compat/linux/arch/amd64 which seems to have 
> done its job right but do I need to do so as well in 
> /usr/src/sys/compat/linux??? If I do so I get:
> don't know how to make syscalls.master. Stop.

I would rerun the entire build.sh, with -j1.

Keep in mind that by default the NetBSD build is cross, and thus you
would be running $TOOLDIR/bin/nbmake-amd64 instead.

Also, you may need to run nbconfig on the kernel.

> 4) rebuilt the GENERIC kernel which stopped when it got to linux_file.o. The 
> error message didn't say anything more only that it stopped there but judging 
> by that compiling linux_file.c went fine but linking failed.

Avoid using -j when having trouble; it makes things harder to figure out.


Reply via email to