]> granicus.if.org Git - strace/commitdiff
test/clone.c: minor fixup
authorWichert Akkerman <wichert@deephackmode.org>
Thu, 10 Aug 2000 02:14:04 +0000 (02:14 +0000)
committerWichert Akkerman <wichert@deephackmode.org>
Thu, 10 Aug 2000 02:14:04 +0000 (02:14 +0000)
Another bunch of patches from John Hughes merged:
signal.c:
+ SVR4 printcontext(): sigset_t != sigset_t*
+ getcontext returns a value, so print on exit of syscall
+ add UC_FP to ucontext_flags for OS writers that can't spell
+ sys_signal(): special case SIG_{ERR,DFL,IGN}
+ decode_subcall(): only do subcall range checking when needed
bunch of UnixWare updates
aclocal.m4, acconfig.h, configure.in: add test for long long type

15 files changed:
ChangeLog
acconfig.h
aclocal.m4
configure.in
defs.h
file.c
net.c
signal.c
strace.c
svr4/dummy.h
svr4/syscall.h
svr4/syscallent.h
syscall.c
system.c
test/clone.c

index 2e0a8947051b2e6d533cd143da6c47d8e47e7942..b6c9cd0c48b76da787bf862337d935cc2cd4e9b9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2000-08-09  Wichert Akkerman <wakkerma@debian.org>
+
+  * test/clone.c: minor fixup
+  * Another bunch of patches from John Hughes merged:
+  * signal.c:
+    + SVR4 printcontext(): sigset_t != sigset_t*
+    + getcontext returns a value, so print on exit of syscall
+    + add UC_FP to ucontext_flags for OS writers that can't spell
+    + sys_signal(): special case SIG_{ERR,DFL,IGN}
+    + decode_subcall(): only do subcall range checking when needed
+  * bunch of UnixWare updates
+  * aclocal.m4, acconfig.h, configure.in: add test for long long type
+
 2000-07-04  Wichert Akkerman <wakkerma@debian.org>
 
   * net.c: add SOL_PACKET and SOL_RAW socket options, update
index 0adf54890801e7d31f678c4b680efee74703222b..2a711d903c2578743f91b11c654a2f4c2e781a7b 100644 (file)
@@ -71,3 +71,6 @@
 
 /* Define if stat64 is available in asm/stat.h.  */
 #undef HAVE_STAT64
+
+/* Define if yor compilers know abuot long long */
+#undef HAVE_LONG_LONG
index f665a41ba6e60263aca59788c46070ddfd2fbbb3..6854e87fd9662fe8cd767caea17d80f9d1389821 100644 (file)
@@ -299,3 +299,18 @@ then
        AC_DEFINE(HAVE_STAT64)
 fi
 ])
+
+dnl ### A macro to determine whether we have long long
+AC_DEFUN(AC_LONG_LONG,
+[AC_MSG_CHECKING(for long long)
+AC_CACHE_VAL(ac_cv_type_long_long,
+[AC_TRY_COMPILE([],
+[long long x = 20;],
+ac_cv_type_long_long=yes,
+ac_cv_type_long_long=no)])
+AC_MSG_RESULT($ac_cv_type_long_long)
+if test "$ac_cv_type_long_long" = yes
+then
+       AC_DEFINE(HAVE_LONG_LONG)
+fi
+])
index 75a1a191328701a32cbd8f9f51710e896d76116f..c59e583455895161f17e7cb75fc81479c5e6740c 100644 (file)
@@ -143,6 +143,7 @@ AC_TYPE_GETGROUPS
 AC_HEADER_MAJOR
 AC_SIG_ATOMIC_T
 AC_STAT64
+AC_LONG_LONG
 if test x$OPSYS != xLINUX; then
 AC_CHECK_LIB(nsl, main)
 fi
diff --git a/defs.h b/defs.h
index f4d4c48d5b6715493fcb2bfbc834d7e43c37e114..906d62e209afe9e0b955e1313f83953a8fab1738 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -158,7 +158,7 @@ extern int mp_ioctl (int f, int c, void *a, int s);
 #define IOCTL_STATUS(t) \
         pread (t->pfd_stat, &t->status, sizeof t->status, 0)
 #define IOCTL_WSTOP(t)                                         \
-       (IOCTL (t->pfd, PCWSTOP, NULL) < 0 ? -1 :               \
+       (IOCTL (t->pfd, PCWSTOP, (char *)NULL) < 0 ? -1 :               \
         IOCTL_STATUS (t))
 #define PR_WHY         pr_lwp.pr_why
 #define PR_WHAT                pr_lwp.pr_what
@@ -194,6 +194,9 @@ struct tcb {
        long u_arg[MAX_ARGS];   /* System call arguments */
        int u_error;            /* Error code */
        long u_rval;            /* (first) return value */
+#ifdef HAVE_LONG_LONG
+       long long u_lrval;      /* long long return value */
+#endif
        FILE *outf;             /* Output file for this process */
        const char *auxstr;     /* Auxiliary info from syscall (see RVAL_STR) */
        struct timeval stime;   /* System time usage as of last process wait */
@@ -266,6 +269,8 @@ struct xlat {
 #define RVAL_HEX       001     /* hex format */
 #define RVAL_OCTAL     002     /* octal format */
 #define RVAL_UDECIMAL  003     /* unsigned decimal format */
+#define RVAL_LDECIMAL  004     /* long long format */
+                               /* Maybe add long long hex, octal, unsigned */
 #define RVAL_MASK      007     /* mask for these values */
 
 #define RVAL_STR       010     /* Print `auxstr' field after return val */
diff --git a/file.c b/file.c
index ac512b19733dcbe7d13d281ccd05e62164804944..e285c5872cb43ac1fd79ab6048ec62b69d008492 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1741,3 +1741,20 @@ struct tcb *tcp;
 }
 
 #endif /* HAVE_SYS_ASYNCH_H */
+
+#if UNIXWARE >= 7
+int
+sys_lseek64 (tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               long long offset = * (long long *) & tcp->u_arg [1];
+               if (tcp->u_arg[3] == SEEK_SET)
+                       tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
+               else
+                       tprintf("%ld, %lld, ", tcp->u_arg[0], offset);
+               printxval(whence, tcp->u_arg[3], "SEEK_???");
+       }
+       return RVAL_LDECIMAL;
+}
+#endif
diff --git a/net.c b/net.c
index 2a20f875cd51efff51f64f1e61a1fec789d84a28..db88c6d6df91a62ca463007e7cc62953b4438d5c 100644 (file)
--- a/net.c
+++ b/net.c
 #define PF_UNSPEC AF_UNSPEC
 #endif
 
+#if UNIXWARE >= 7
+#define HAVE_SENDMSG           1               /* HACK - *FIXME* */
+#endif
+
 #ifdef LINUX
 /* Under Linux these are enums so we can't test for them with ifdef. */
 #define IPPROTO_EGP IPPROTO_EGP
@@ -476,6 +480,7 @@ static struct xlat icmpfilterflags[] = {
 };
 #endif /* SOL_RAW */
 
+
 void
 printsock(tcp, addr, addrlen)
 struct tcb *tcp;
@@ -1164,3 +1169,157 @@ struct tcb *tcp;
        }
        return 0;
 }
+
+#if UNIXWARE >= 7
+
+static struct xlat sock_version[] = {
+       { __NETLIB_UW211_SVR4,  "UW211_SVR4" },
+       { __NETLIB_UW211_XPG4,  "UW211_XPG4" },
+       { __NETLIB_GEMINI_SVR4, "GEMINI_SVR4" },
+       { __NETLIB_GEMINI_XPG4, "GEMINI_XPG4" },
+       { __NETLIB_FP1_SVR4,    "FP1_SVR4" },
+       { __NETLIB_FP1_XPG4,    "FP1_XPG4" },
+       { 0,            NULL            },
+};
+
+
+int
+netlib_call(tcp, func)
+struct tcb *tcp;
+int (*func) ();
+{
+       if (entering(tcp)) {
+               int i;
+               printxval (sock_version, tcp->u_arg[0], "__NETLIB_???");
+               tprintf(", ");
+               --tcp->u_nargs;
+               for (i = 0; i < tcp->u_nargs; i++)
+                       tcp->u_arg[i] = tcp->u_arg[i + 1];
+               return func (tcp);
+               
+       }
+
+       return func (tcp);
+}
+
+int
+sys_xsocket(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_socket);
+}
+
+int
+sys_xsocketpair(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_socketpair);
+}
+
+int
+sys_xbind(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_bind);
+}
+
+int
+sys_xconnect(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_connect);
+}
+
+int
+sys_xlisten(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_listen);
+}
+
+int
+sys_xaccept(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_accept);
+}
+
+int
+sys_xsendmsg(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_sendmsg);
+}
+
+int
+sys_xrecvmsg(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_recvmsg);
+}
+
+int
+sys_xgetsockaddr(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               printxval (sock_version, tcp->u_arg[0], "__NETLIB_???");
+               tprintf(", ");
+               if (tcp->u_arg[1] == 0) {
+                       tprintf ("LOCALNAME, ");
+               }
+               else if (tcp->u_arg[1] == 1) {
+                       tprintf ("REMOTENAME, ");
+               }
+               else {
+                       tprintf ("%ld, ", tcp->u_arg [1]);
+               }
+               tprintf ("%ld, ", tcp->u_arg [2]);
+       } 
+       else {
+               if (tcp->u_arg[3] == 0 || syserror(tcp)) {
+                       tprintf("%#lx", tcp->u_arg[3]);
+               } else {
+                       printsock(tcp, tcp->u_arg[3], tcp->u_arg[4]);
+               }
+               tprintf(", ");
+               printnum(tcp, tcp->u_arg[4], "%lu");
+       }
+
+       return 0;
+
+}
+
+#if 0
+
+int
+sys_xsetsockaddr(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_setsockaddr);
+}
+
+#endif
+
+int
+sys_xgetsockopt(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_getsockopt);
+}
+
+int
+sys_xsetsockopt(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_setsockopt);
+}
+
+int
+sys_xshutdown(tcp)
+struct tcb *tcp;
+{
+       return netlib_call (tcp, sys_shutdown);
+}
+
+#endif
index b786edf98d71d2702ddc4b44597d594775cd644f..90ac5fe8896cf1cad4a66950afb3b610addfa723 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -665,6 +665,7 @@ struct tcb *tcp;
 {
        if (entering(tcp)) {
                printsignal(tcp->u_arg[0]);
+               tprintf(", ");
                switch (tcp->u_arg[1]) {
                case (int) SIG_ERR:
                        tprintf("SIG_ERR");
@@ -690,6 +691,29 @@ struct tcb *tcp;
 #endif /* !SVR4 */
                        tprintf("%#lx", tcp->u_arg[1]);
                }
+               return 0;
+       }
+       else {
+               switch (tcp->u_rval) {
+                   case (int) SIG_ERR:
+                       tcp->auxstr = "SIG_ERR"; break;
+                   case (int) SIG_DFL:
+                       tcp->auxstr = "SIG_DFL"; break;
+                   case (int) SIG_IGN:
+                       tcp->auxstr = "SIG_IGN"; break;
+                   default:
+                       tcp->auxstr = NULL;
+               }
+               return RVAL_HEX | RVAL_STR;
+       }
+}
+
+int
+sys_sighold(tcp)
+struct tcb *tcp;
+{
+       if (entering(tcp)) {
+               printsignal(tcp->u_arg[0]);
        }
        return 0;
 }
@@ -1020,8 +1044,10 @@ struct tcb *tcp;
 {
        ucontext_t uc;
 
-       if (entering(tcp)) {
-               if (!tcp->u_arg[0])
+       if (exiting(tcp)) {
+               if (tcp->u_error)
+                       tprintf("%#lx", tcp->u_arg[0]);
+               else if (!tcp->u_arg[0])
                        tprintf("NULL");
                else if (umove(tcp, tcp->u_arg[0], &uc) < 0)
                        tprintf("{...}");
index 4a46877888e291bcdb5d13c24798a95d02f6460d..f96eaa04d88c45fd2132078972343445f33feab4 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -660,7 +660,7 @@ int attaching;
                }
        }
        /* Stop the process so that we own the stop. */
-       if (IOCTL(tcp->pfd, PIOCSTOP, NULL) < 0) {
+       if (IOCTL(tcp->pfd, PIOCSTOP, (char *)NULL) < 0) {
                perror("strace: PIOCSTOP");
                return -1;
        }
index 61e3e85bb653871cd1f07ffdef9dab937a44e1b7..e026c6f1e945d8d15b396d122acbc0d371f85bf2 100644 (file)
 #define sys_timer_settime printargs
 #define sys_timer_gettime printargs
 #define sys_timer_getoverrun printargs
-#define sys_signal printargs
-#define sys_sigset printargs
-#define sys_sighold printargs
-#define sys_sigrelse printargs
-#define sys_sigignore printargs
-#define sys_sigpause printargs
 #define sys_msgctl printargs
 #define sys_msgget printargs
 #define sys_msgrcv printargs
 #define sys_sysfs1 printargs
 #define sys_sysfs2 printargs
 #define sys_sysfs3 printargs
+#define sys_xsetsockaddr printargs
 
 /* like another call */
 #define sys_lchown sys_chown
 #define sys_BSDgetpgrp sys_getpgrp
 #define sys_BSDsetpgrp sys_setpgrp
 #define sys_waitsys sys_waitid
+#define sys_sigset sys_signal
+#define sys_sigrelse sys_sighold
+#define sys_sigignore sys_sighold
+#define sys_sigpause sys_sighold
 
 /* printargs does the right thing */
 #define sys_sync printargs
index f663cb2691098c1baa1820b9b49b902b55b13270..a6c347f057f4ca641001ef14d859d77711bc13a7 100644 (file)
@@ -301,6 +301,27 @@ extern int sys_aclipc();
 #ifdef HAVE_SYS_DOOR_H
 extern int sys_door();
 #endif
+#if UNIXWARE >= 2
+extern int sys_truncate();
+extern int sys_ftruncate();
+extern int sys_getksym ();
+#endif
+#if UNIXWARE >= 7
+extern int sys_lseek64 ();
+extern int sys_xsocket ();
+extern int sys_xsocketpair ();
+extern int sys_xbind ();
+extern int sys_xconnect ();
+extern int sys_xlisten ();
+extern int sys_xaccept ();
+extern int sys_xrecvmsg ();
+extern int sys_xsendmsg ();
+extern int sys_xgetsockaddr ();
+extern int sys_xsetsockaddr ();
+extern int sys_xgetsockopt ();
+extern int sys_xsetsockopt ();
+extern int sys_xshutdown ();
+#endif
 #endif /* !MIPS */
 
 #ifdef MIPS
index 429f3e09bdc4793a081f040520e9ee2bce641e7e..723c2160bd4feafdbb54b692ed0175504d761b00 100644 (file)
        { -1,   0,      printargs,              "unblock"       }, /* 186 */
        { -1,   0,      printargs,              "cancelblock"   }, /* 187 */
        { -1,   0,      printargs,              "SYS_188"       }, /* 188 */
-       { -1,   0,      sys_pread,              "pread"         }, /* 189 */
-       { -1,   0,      sys_pwrite,             "pwrite"        }, /* 190 */
-       { -1,   0,      printargs,              "truncate"      }, /* 191 */
-       { -1,   0,      printargs,              "ftruncate"     }, /* 192 */
+       { -1,   TF,     sys_pread,              "pread"         }, /* 189 */
+       { -1,   TF,     sys_pwrite,             "pwrite"        }, /* 190 */
+       { -1,   TF,     sys_truncate,           "truncate"      }, /* 191 */
+       { -1,   TF,     sys_ftruncate,          "ftruncate"     }, /* 192 */
        { -1,   0,      printargs,              "lwpkill"       }, /* 193 */
        { -1,   0,      printargs,              "sigwait"       }, /* 194 */
        { -1,   0,      printargs,              "fork1"         }, /* 195 */
        { -1,   0,      printargs,              "modpath"       }, /* 199 */
        { -1,   0,      printargs,              "modstat"       }, /* 200 */
        { -1,   0,      printargs,              "modadm"        }, /* 201 */
-       { -1,   0,      printargs,              "getksym"       }, /* 202 */
+       { -1,   0,      sys_getksym,            "getksym"       }, /* 202 */
        { -1,   0,      printargs,              "lwpsuspend"    }, /* 203 */
        { -1,   0,      printargs,              "lwpcontinue"   }, /* 204 */
        { -1,   0,      printargs,              "priocntllst"   }, /* 205 */
        { -1,   0,      printargs,              "SYS_213"       }, /* 213 */
        { -1,   0,      printargs,              "SYS_214"       }, /* 214 */
        { -1,   0,      printargs,              "SYS_215"       }, /* 215 */
+#if UNIXWARE >= 7
+       { -1,   0,      printargs,              "fstatvfs64"    }, /* 216 */
+       { -1,   0,      printargs,              "statvfs64"     }, /* 217 */
+       { -1,   0,      printargs,              "ftruncate64"   }, /* 218 */
+       { -1,   0,      printargs,              "truncate64"    }, /* 219 */
+       { -1,   0,      printargs,              "getrlimit64"   }, /* 220 */
+       { -1,   0,      printargs,              "setrlimit64"   }, /* 221 */
+       { -1,   TF,     sys_lseek64,            "lseek64"       }, /* 222 */
+       { -1,   0,      printargs,              "mmap64"        }, /* 223 */
+       { -1,   0,      printargs,              "pread64"       }, /* 224 */
+       { -1,   0,      printargs,              "pwrite64"      }, /* 225 */
+       { -1,   0,      printargs,              "creat64"       }, /* 226 */
+       { -1,   0,      printargs,              "dshmsys"       }, /* 227 */
+       { -1,   0,      printargs,              "invlpg"        }, /* 228 */
+       { -1,   0,      printargs,              "rfork1"        }, /* 229 */
+       { -1,   0,      printargs,              "rforkall"      }, /* 230 */
+       { -1,   0,      printargs,              "rexecve"       }, /* 231 */
+       { -1,   0,      printargs,              "migrate"       }, /* 232 */
+       { -1,   0,      printargs,              "kill3"         }, /* 233 */
+       { -1,   0,      printargs,              "ssisys"        }, /* 234 */
+       { -1,   TN,     sys_xaccept,            "xaccept"       }, /* 235 */
+       { -1,   TN,     sys_xbind,              "xbind"         }, /* 236 */
+       { -1,   TN,     sys_xbind,              "xbindresport"  }, /* 237 */
+       { -1,   TN,     sys_xconnect,           "xconnect"      }, /* 238 */
+       { -1,   TN,     sys_xgetsockaddr,       "xgetsockaddr"  }, /* 239 */
+       { -1,   TN,     sys_xgetsockopt,        "xgetsockopt"   }, /* 240 */
+       { -1,   TN,     sys_xlisten,            "xlisten"       }, /* 241 */
+       { -1,   TN,     sys_xrecvmsg,           "xrecvmsg"      }, /* 242 */
+       { -1,   TN,     sys_xsendmsg,           "xsendmsg"      }, /* 243 */
+       { -1,   TN,     sys_xsetsockaddr,       "xsetsockaddr"  }, /* 244 */
+       { -1,   TN,     sys_xsetsockopt,        "xsetsockopt"   }, /* 245 */
+       { -1,   TN,     sys_xshutdown,          "xshutdown"     }, /* 246 */
+       { -1,   TN,     sys_xsocket,            "xsocket"       }, /* 247 */
+       { -1,   TN,     sys_xsocketpair,        "xsocketpair"   }, /* 248 */
+#else
        { -1,   0,      printargs,              "SYS_216"       }, /* 216 */
        { -1,   0,      printargs,              "SYS_217"       }, /* 217 */
        { -1,   0,      printargs,              "SYS_218"       }, /* 218 */
        { -1,   0,      printargs,              "SYS_246"       }, /* 246 */
        { -1,   0,      printargs,              "SYS_247"       }, /* 247 */
        { -1,   0,      printargs,              "SYS_248"       }, /* 248 */
+#endif
        { -1,   0,      printargs,              "SYS_249"       }, /* 249 */
        { -1,   0,      printargs,              "SYS_250"       }, /* 250 */
 #endif /* !MIPS */
index 29a805e3b01995fb0f63a6b573b509a78ea8fc5f..96424460de3368595c1f1d3d8cfc4df850cd43f3 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -464,11 +464,10 @@ int nsubcalls;
 enum subcall_style style;
 {
        int i, addr, mask, arg;
-
-       if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= nsubcalls)
-               return;
        switch (style) {
        case shift_style:
+               if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= nsubcalls)
+                       return;
                tcp->scno = subcall + tcp->u_arg[0];
                if (sysent[tcp->scno].nargs != -1)
                        tcp->u_nargs = sysent[tcp->scno].nargs;
@@ -478,6 +477,8 @@ enum subcall_style style;
                        tcp->u_arg[i] = tcp->u_arg[i + 1];
                break;
        case deref_style:
+               if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= nsubcalls)
+                       return;
                tcp->scno = subcall + tcp->u_arg[0];
                addr = tcp->u_arg[1];
                for (i = 0; i < sysent[tcp->scno].nargs; i++) {
@@ -490,9 +491,11 @@ enum subcall_style style;
                break;
        case mask_style:
                mask = (tcp->u_arg[0] >> 8) & 0xff;
-               tcp->u_arg[0] &= 0xff;
                for (i = 0; mask; i++)
                        mask >>= 1;
+               if (i >= nsubcalls)
+                       return;
+               tcp->u_arg[0] &= 0xff;
                tcp->scno = subcall + i;
                if (sysent[tcp->scno].nargs != -1)
                        tcp->u_nargs = sysent[tcp->scno].nargs;
@@ -500,7 +503,10 @@ enum subcall_style style;
        case door_style:
                /*
                 * Oh, yuck.  The call code is the *sixth* argument.
+                * (don't you mean the *last* argument? - JH)
                 */
+               if (tcp->u_arg[5] < 0 || tcp->u_arg[5] >= nsubcalls)
+                       return;
                tcp->scno = subcall + tcp->u_arg[5];
                if (sysent[tcp->scno].nargs != -1)
                        tcp->u_nargs = sysent[tcp->scno].nargs;
@@ -1029,6 +1035,11 @@ struct tcb *tcp;
                }
                else {
                        tcp->u_rval = tcp->status.PR_REG[EAX];
+#ifdef HAVE_LONG_LONG
+                       tcp->u_lrval =
+                               ((unsigned long long) tcp->status.PR_REG[EDX] << 32) +
+                               tcp->status.PR_REG[EAX];
+#endif
                        u_error = 0;
                }
 #endif /* I386 */
@@ -1337,6 +1348,12 @@ struct tcb *tcp;
                                case RVAL_DECIMAL:
                                        tprintf("= %ld", tcp->u_rval);
                                        break;
+#ifdef HAVE_LONG_LONG
+                               case RVAL_LDECIMAL:
+                                       tprintf ("= %lld", tcp->u_lrval);
+                                       break;
+                                       /* LHEX, LOCTAL, LUDECIMAL... */
+#endif
                                default:
                                        fprintf(stderr,
                                                "invalid rval format\n");
index 218e1379be6815083aed3285bfbb053f02b87538..f16b711c6ef91b50fd87a1dfb8d00a0af929265c 100644 (file)
--- a/system.c
+++ b/system.c
@@ -1903,3 +1903,48 @@ struct tcb *tcp;
 }
 #endif
 
+
+#if UNIXWARE >= 2
+
+#include <sys/ksym.h>
+#include <sys/elf.h>
+
+static struct xlat ksym_flags[] = {
+       { STT_NOTYPE,   "STT_NOTYPE"    },      
+       { STT_FUNC,     "STT_FUNC"      },      
+       { STT_OBJECT,   "STT_OBJECT"    },      
+       { 0,            NULL            },
+};
+
+int
+sys_getksym(tcp)
+struct tcb *tcp;
+{
+       if (entering (tcp)) {
+               printstr(tcp, tcp->u_arg[0], -1);
+               tprintf(", ");
+       }
+       else {
+               if (syserror(tcp)) {
+                       tprintf("%#lx, %#lx",
+                               tcp->u_arg[1], tcp->u_arg[2]);
+               }
+               else {
+                       int val;
+                       printnum (tcp, tcp->u_arg[1], "%#lx");
+                       tprintf(", ");
+                       if (umove(tcp, tcp->u_arg[2], &val) < 0) {
+                               tprintf("%#lx", tcp->u_arg[2]);
+                       }
+                       else {
+                               tprintf("[");
+                               printxval (ksym_flags, val, "STT_???");
+                               tprintf("]");
+                       }
+               }
+       }
+
+       return 0;
+}
+
+#endif
index 4fb661306b338edd40defd6161b415d082b85a13..1395b6b95ba2f968b8f09a9d7a6db531a397bd14 100644 (file)
@@ -10,7 +10,7 @@ int
 main()
 {
        char    stack[4096];
-       if (clone(child, stack+4000, CLONE_VM|CLONE_FS|CLONE_FILES, NULL) == 0)
+       if (clone(child, stack+4000, CLONE_VM|CLONE_FS|CLONE_FILES, NULL) != 0)
                write(1, "original\n", 9);
        exit(0);
 }