OSSP CVS Repository

ossp - Check-in [2778]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2778
Date: 2002-Nov-08 17:05:54 (local)
2002-Nov-08 16:05:54 (UTC)
User:rse
Branch:
Comment: Added soft and hard syscall mapping for nanosleep(3) and usleep(3) functions.
Tickets:
Inspections:
Files:
ossp-pkg/pth/ChangeLog      1.593 -> 1.594     4 inserted, 0 deleted
ossp-pkg/pth/pth.h.in      1.138 -> 1.139     2 inserted, 0 deleted
ossp-pkg/pth/pth.pod      1.160 -> 1.161     5 inserted, 5 deleted
ossp-pkg/pth/pth_syscall.c      1.27 -> 1.28     47 inserted, 17 deleted

ossp-pkg/pth/ChangeLog 1.593 -> 1.594

--- 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 <bonzini@gnu.org>]


ossp-pkg/pth/pth.h.in 1.138 -> 1.139

--- 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


ossp-pkg/pth/pth.pod 1.160 -> 1.161

--- 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<Pth> with C<--enable-syscall-soft>. This then triggers some
 C<#define>'s in the C<pth.h> 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<Pth> library which internally call the real B<Pth>
 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


ossp-pkg/pth/pth_syscall.c 1.27 -> 1.28

--- 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)

CVSTrac 2.0.1