summaryrefslogtreecommitdiff
path: root/stream.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2006-10-13 20:25:12 +0000
committerDmitry V. Levin <ldv@altlinux.org>2006-10-13 20:25:12 +0000
commit95ebf5abfc1f3ed8b451b7816aa51b93a49e3ef7 (patch)
treeacc4e6439988379ca8ffc1eafb1118ed12a87e85 /stream.c
parent9633942c07427ed51caea0e73f139e964d1a19cc (diff)
downloadstrace-95ebf5abfc1f3ed8b451b7816aa51b93a49e3ef7.tar.gz
strace-95ebf5abfc1f3ed8b451b7816aa51b93a49e3ef7.tar.bz2
strace-95ebf5abfc1f3ed8b451b7816aa51b93a49e3ef7.tar.xz
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.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/stream.c b/stream.c
index f01fe99..eb72d62 100644
--- a/stream.c
+++ b/stream.c
@@ -294,9 +294,8 @@ static const struct xlat pollflags[] = {
{ 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 @@ struct tcb *tcp;
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 @@ struct tcb *tcp;
if (failed)
tprintf(" %#lx", start);
tprintf(", %d, ", nfds);
+ 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
+ if (tcp->u_arg[2] == INFTIM)
+ tprintf("INFTIM");
+ else
#endif
- tprintf("%ld", tcp->u_arg[2]);
- return 0;
+ 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