Index: ossp-pkg/pth/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/pth/ChangeLog,v rcsdiff -q -kk '-r1.593' '-r1.594' -u '/v/ossp/cvs/ossp-pkg/pth/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/11/08 12:38:39 1.593 +++ ChangeLog 2002/11/08 16:05:54 1.594 @@ -21,6 +21,10 @@ Changes between 2.0b0 and 2.0b1 (07-Nov-2002 to xx-Nov-2002) + *) Added soft and hard syscall mapping for nanosleep(3) and + usleep(3) functions. + [Ralf S. Engelschall] + *) Fix poll(2) semantics: remove POLLRDNORM from polling result if POLLHUP is detected. [Paolo Bonzini ] Index: ossp-pkg/pth/pth.h.in RCS File: /v/ossp/cvs/ossp-pkg/pth/pth.h.in,v rcsdiff -q -kk '-r1.138' '-r1.139' -u '/v/ossp/cvs/ossp-pkg/pth/pth.h.in,v' 2>/dev/null --- pth.h.in 2002/11/05 19:39:09 1.138 +++ pth.h.in 2002/11/08 16:05:54 1.139 @@ -551,6 +551,8 @@ #define fork pth_fork #define waitpid pth_waitpid #define system pth_system +#define nanosleep pth_nanosleep +#define usleep pth_usleep #define sleep pth_sleep #define sigprocmask pth_sigmask #define sigwait pth_sigwait Index: ossp-pkg/pth/pth.pod RCS File: /v/ossp/cvs/ossp-pkg/pth/pth.pod,v rcsdiff -q -kk '-r1.160' '-r1.161' -u '/v/ossp/cvs/ossp-pkg/pth/pth.pod,v' 2>/dev/null --- pth.pod 2002/11/05 19:39:09 1.160 +++ pth.pod 2002/11/08 16:05:55 1.161 @@ -2267,9 +2267,9 @@ building B with C<--enable-syscall-soft>. This then triggers some C<#define>'s in the C header which map for instance read(3) to pth_read(3), etc. Currently the following functions are mapped: fork(2), -sleep(3), sigwait(3), waitpid(2), system(3), select(2), poll(2), -connect(2), accept(2), read(2), write(2), recv(2), send(2), recvfrom(2), -sendto(2). +nanosleep(3), usleep(3), sleep(3), sigwait(3), waitpid(2), system(3), +select(2), poll(2), connect(2), accept(2), read(2), write(2), recv(2), +send(2), recvfrom(2), sendto(2). The drawback of this approach is just that really all source files of the application where these function calls occur have to include @@ -2284,8 +2284,8 @@ C<--enable-syscall-hard>. This then builds wrapper functions (for instances read(3)) into the B library which internally call the real B replacement functions (pth_read(3)). Currently the following functions -are mapped: fork(2), sleep(3), waitpid(2), system(3), select(2), -poll(2), connect(2), accept(2), read(2), write(2). +are mapped: fork(2), nanosleep(3), usleep(3), sleep(3), waitpid(2), +system(3), select(2), poll(2), connect(2), accept(2), read(2), write(2). The drawback of this approach is that it depends on syscall(2) interface and prototype conflicts can occur while building the wrapper functions Index: ossp-pkg/pth/pth_syscall.c RCS File: /v/ossp/cvs/ossp-pkg/pth/pth_syscall.c,v rcsdiff -q -kk '-r1.27' '-r1.28' -u '/v/ossp/cvs/ossp-pkg/pth/pth_syscall.c,v' 2>/dev/null --- pth_syscall.c 2002/11/03 16:53:27 1.27 +++ pth_syscall.c 2002/11/08 16:05:55 1.28 @@ -37,6 +37,8 @@ #define fork __pth_sys_fork #define waitpid __pth_sys_waitpid #define system __pth_sys_system +#define nanosleep __pth_sys_nanosleep +#define usleep __pth_sys_usleep #define sleep __pth_sys_sleep #define sigprocmask __pth_sys_sigmask #define sigwait __pth_sys_sigwait @@ -86,6 +88,8 @@ #undef fork #undef waitpid #undef system +#undef nanosleep +#undef usleep #undef sleep #undef sigprocmask #undef sigwait @@ -134,26 +138,30 @@ #define PTH_SCF_fork 0 #define PTH_SCF_waitpid 1 #define PTH_SCF_system 2 -#define PTH_SCF_sleep 3 -#define PTH_SCF_sigprocmask 4 -#define PTH_SCF_sigwait 5 -#define PTH_SCF_select 6 -#define PTH_SCF_poll 7 -#define PTH_SCF_connect 8 -#define PTH_SCF_accept 9 -#define PTH_SCF_read 10 -#define PTH_SCF_write 11 -#define PTH_SCF_readv 12 -#define PTH_SCF_writev 13 -#define PTH_SCF_recv 14 -#define PTH_SCF_send 15 -#define PTH_SCF_recvfrom 16 -#define PTH_SCF_sendto 17 -#define PTH_SCF_pread 18 -#define PTH_SCF_pwrite 19 +#define PTH_SCF_nanosleep 3 +#define PTH_SCF_usleep 4 +#define PTH_SCF_sleep 5 +#define PTH_SCF_sigprocmask 6 +#define PTH_SCF_sigwait 7 +#define PTH_SCF_select 8 +#define PTH_SCF_poll 9 +#define PTH_SCF_connect 10 +#define PTH_SCF_accept 11 +#define PTH_SCF_read 12 +#define PTH_SCF_write 13 +#define PTH_SCF_readv 14 +#define PTH_SCF_writev 15 +#define PTH_SCF_recv 16 +#define PTH_SCF_send 17 +#define PTH_SCF_recvfrom 18 +#define PTH_SCF_sendto 19 +#define PTH_SCF_pread 20 +#define PTH_SCF_pwrite 21 { "fork", NULL }, { "waitpid", NULL }, { "system", NULL }, + { "nanosleep", NULL }, + { "usleep", NULL }, { "sleep", NULL }, { "sigprocmask", NULL }, { "sigwait", NULL }, @@ -301,6 +309,28 @@ #endif } +/* ==== Pth hard syscall wrapper for nanosleep(3) ==== */ +int nanosleep(const struct timespec *, struct timespec *); +int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) +{ + /* external entry point for application */ + pth_implicit_init(); + return pth_nanosleep(rqtp, rmtp); +} +/* NOTICE: internally fully emulated, so still no + internal exit point pth_sc_nanosleep necessary! */ + +/* ==== Pth hard syscall wrapper for usleep(3) ==== */ +int usleep(unsigned int); +int usleep(unsigned int sec) +{ + /* external entry point for application */ + pth_implicit_init(); + return pth_usleep(sec); +} +/* NOTICE: internally fully emulated, so still no + internal exit point pth_sc_usleep necessary! */ + /* ==== Pth hard syscall wrapper for sleep(3) ==== */ unsigned int sleep(unsigned int); unsigned int sleep(unsigned int sec)