On 20 August 2013 07:26, Petr Salinger <petr.salin...@seznam.cz> wrote: >>> It is planned, but (e)glibc 2.18 upload have to go first, due to changes >>> of >>> idtype_t values. See also 218_waitid* in >>> http://anonscm.debian.org/viewvc/glibc-bsd/trunk/glibc-ports/ >>> >>> We also have to provide (reasonable) fallback implementation >>> under wheezy kernels. >> >> >> Cool! Excellent stuff! I've tried applying 218_waitid* things against >> the eglibc-package as is in the debian trunk (2.17 based) and failed >> to compile it properly. >> Is there a way for me to compile debs > > > The 218_waitid_common.diff is against main tree, > the 218_waitid_kbsd.diff is against kfreebsd/ subdir > and 218_waitid.c have to be placed as waitid.c in kfreebsd/ subdir. > > It worked a month ago ;-)
Right, and it still "works", well at raising system errors =) I've now tried it from the eglibc-2.18 packaging branch. I've tried adding wait6 syscall & implementing waitid using it, but it didn't quite managed to make it compile (i got linker errors waying it cannot find __GI___syscall_wait6). Can we set minimal kfreebsd kernel version when configuring/compiling eglibc such that if compatibility with older freebsd kernels is needed the wrapper implementation is used, otherwise if compiled for freebsd kernels >= 9.2, wait6 version is used? And then distributions, e.g. kfreebsd/Debian can choose where to cut the line. Can you see what I have done wrong? (it's my first time trying to hack on glibc) Regards, Dmitrijs.
--- foo/eglibc-2.18/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/syscalls-inline.h 2013-11-01 12:33:10.000000000 +0000 +++ eglibc-2.18/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/syscalls-inline.h 2013-11-01 01:12:34.000000000 +0000 @@ -45,14 +45,16 @@ int __syscall_fcntl(int fd, int cmd, ...); int __syscall_fork(void); int __syscall_wait4(int pid, int *status, int options, struct rusage *rusage); +int __syscall_wait6(idtype_t itype, id_t id, int *status, int options, struct rusage *rusage, siginfo_t *infop); int __syscall_sigsuspend (const sigset_t *set); int __syscall_sigprocmask (int how, const sigset_t *set, sigset_t *oldset); int __syscall_nanosleep (const struct timespec *requested_time, struct timespec *remaining); libc_hidden_proto (__syscall_fcntl) libc_hidden_proto (__syscall_fork) libc_hidden_proto (__syscall_wait4) +libc_hidden_proto (__syscall_wait6) libc_hidden_proto (__syscall_sigsuspend) libc_hidden_proto (__syscall_sigprocmask) libc_hidden_proto (__syscall_nanosleep) --- foo/eglibc-2.18/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/syscalls.list 2013-11-01 12:33:10.000000000 +0000 +++ eglibc-2.18/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/syscalls.list 2013-11-01 01:07:26.000000000 +0000 @@ -206,7 +206,8 @@ unlinkat - unlinkat i:isi unlinkat unmount - unmount i:si unmount utrace - utrace i:bn utrace wait4 - wait4 i:iWiP __syscall_wait4 __wait4 wait4 +wait6 - wait6 i:iiWiPP __syscall_wait6 __wait6 wait6 sys_write - write i:ibn __syscall_write sys_writev - writev i:ipi __syscall_writev yield - yield i: __syscall_yield --- foo/eglibc-2.18/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/waitid.c 2013-11-01 12:33:10.000000000 +0000 +++ eglibc-2.18/ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/waitid.c 2013-11-01 01:26:07.000000000 +0000 @@ -21,15 +21,33 @@ #include <errno.h> #include <sys/wait.h> #include <sysdep.h> -/* for now only the wrapper implementation */ -/* later on we will try to use wait6 when available */ +extern int __syscall_wait6 (idtype_t itype, id_t id, + int *status, int options, + struct rusage *rusage, siginfo_t *infop); +libc_hidden_proto (__syscall_wait6) #define waitid __unused_waitid_alias +static inline int +do_waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options) +{ + int ret; + int status; + + ret = INLINE_SYSCALL (wait6, 6, idtype, id, &status, options, NULL, infop); + + if (ret > 0) + ret = 0; + + return ret; +} + +#define NO_DO_WAITID #include <sysdeps/posix/waitid.c> #undef waitid + versioned_symbol (libc, __waitid, waitid, GLIBC_2_18); #if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_18)