2006-10-13 Ulrich Drepper <drepper@redhat.com>
Bernhard Kaindl <bk@suse.de>
Dmitry V. Levin <ldv@altlinux.org>
Michael Holzheu <holzheu@de.ibm.com>
Add hooks for new syscalls. Add decoders for *at, inotify*,
pselect6, ppoll and unshare syscalls.
* defs.h: Declare print_sigset.
* desc.c (sys_pselect6): New function.
* file.c (decode_open, decode_access, decode_mkdir,
decode_readlink, decode_chmod, decode_utimes, decode_mknod):
New functions.
(sys_open, sys_access, sys_mkdir, sys_readlink, sys_chmod,
sys_utimes, sys_mknod): Use them.
[LINUX] (fstatatflags, unlinkatflags, inotify_modes): New
variables.
[LINUX] (print_dirfd, sys_openat, sys_faccessat,
sys_newfstatat, sys_mkdirat, sys_linkat, sys_unlinkat,
sys_symlinkat, sys_readlinkat, sys_renameat, sys_fchownat,
sys_fchmodat, sys_futimesat, sys_mknodat, sys_inotify_add_watch,
sys_inotify_rm_watch): New functions.
* process.c [LINUX] (sys_unshare): New function.
* signal.c (print_sigset): New function.
(sys_sigprocmask): Use it.
* stream.c (decode_poll): New function.
(sys_poll): Use it.
[LINUX] (sys_ppoll): New function.
* linux/syscall.h: Delcare new syscall handlers.
* linux/syscallent.h: Hook up new syscalls.
* linux/alpha/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
Fixes RH#178633.
diff --git a/stream.c b/stream.c
index f01fe99..eb72d62 100644
--- a/stream.c
+++ b/stream.c
@@ -294,9 +294,8 @@
{ 0, NULL },
};
-int
-sys_poll(tcp)
-struct tcb *tcp;
+static int
+decode_poll(struct tcb *tcp)
{
struct pollfd fds;
unsigned nfds;
@@ -311,8 +310,8 @@
start = tcp->u_arg[0];
end = start + size;
if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
- tprintf("%#lx, %d, %ld",
- tcp->u_arg[0], nfds, tcp->u_arg[2]);
+ tprintf("%#lx, %d, ",
+ tcp->u_arg[0], nfds);
return 0;
}
if (abbrev(tcp)) {
@@ -351,15 +350,41 @@
if (failed)
tprintf(" %#lx", start);
tprintf(", %d, ", nfds);
-#ifdef INFTIM
- if (tcp->u_arg[2] == INFTIM)
- tprintf("INFTIM");
- else
-#endif
- tprintf("%ld", tcp->u_arg[2]);
return 0;
}
+int
+sys_poll(struct tcb *tcp)
+{
+ int rc = decode_poll(tcp);
+ if (exiting(tcp)) {
+#ifdef INFTIM
+ if (tcp->u_arg[2] == INFTIM)
+ tprintf("INFTIM");
+ else
+#endif
+ tprintf("%ld", tcp->u_arg[2]);
+ }
+ return rc;
+}
+
+#ifdef LINUX
+int
+sys_ppoll(struct tcb *tcp)
+{
+ int rc = decode_poll(tcp);
+ if (exiting(tcp)) {
+ struct timespec ts;
+ if (umove(tcp, tcp->u_arg[2], &ts) == 0)
+ tprintf("{%lu, %lu}, ", ts.tv_sec, ts.tv_nsec);
+ else
+ tprintf("{...}, ");
+ print_sigset(tcp, tcp->u_arg[3], 0);
+ tprintf(", %lu", tcp->u_arg[4]);
+ }
+ return rc;
+}
+#endif
#else /* !HAVE_SYS_POLL_H */
int