From: Roland McGrath Date: Sun, 15 Dec 2002 23:58:23 +0000 (+0000) Subject: 2002-12-15 Roland McGrath X-Git-Tag: v4.5.18~961 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=186c5acdb9af627e0844cf82ed68d0da6dbe13de;p=strace 2002-12-15 Roland McGrath * configure.in: Check for linux/xattr.h and linux/futex.h headers. * linux/syscall.h: Add sys_* decls for new syscalls getpmsg, putpmsg, readahead, sendfile64, setxattr, fsetxattr, getxattr, fgetxattr, int listxattr, flistxattr, removexattr, fremovexattr, sched_setaffinity, sched_getaffinity, futex. * linux/syscallent.h: Update the table. * io.c: Add sys_sendfile64. * file.c: Add sys_readahead, sys_*xattr. * process.c: Add sys_futex, sys_*affinity. --- diff --git a/file.c b/file.c index 5b30eba7..addea3e3 100644 --- a/file.c +++ b/file.c @@ -133,6 +133,13 @@ struct stat { #include #endif +#ifdef HAVE_LINUX_XATTR_H +#include +#elif defined linux +#define XATTR_CREATE 1 +#define XATTR_REPLACE 2 +#endif + #ifdef FREEBSD #include #include @@ -255,7 +262,7 @@ struct xlat openmodes[] = { #endif #ifdef FNOCTTY { FNOCTTY, "FNOCTTY" }, -#endif +#endif #ifdef O_SHLOCK { O_SHLOCK, "O_SHLOCK" }, #endif @@ -389,9 +396,9 @@ struct tcb *tcp; if (_whence == SEEK_SET) tprintf("%lu, ", offset); else - tprintf("%ld, ", offset); + tprintf("%ld, ", offset); printxval(whence, _whence, "SEEK_???"); - } + } return RVAL_UDECIMAL; } #endif @@ -421,6 +428,24 @@ struct tcb *tcp; } return 0; } + +int +sys_readahead (tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, %lld, %ld", tcp->u_arg[0], +# if defined IA64 || defined X86_64 || defined ALPHA + (long long int) tcp->u_arg[1], tcp->u_arg[2] +# else + (((long long int) tcp->u_arg[1]) << 32 + | ((unsigned long *) tcp->u_arg)[2]), + tcp->u_arg[3] +# endif + ); + } + return 0; +} #endif #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T @@ -1167,11 +1192,11 @@ struct tcb *tcp; tprintf(", makedev(%lu, %lu)", (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff), (unsigned long) (tcp->u_arg[3] & 0x3ffff)); -#else +#else tprintf(", makedev(%lu, %lu)", (unsigned long) major(tcp->u_arg[3]), (unsigned long) minor(tcp->u_arg[3])); -#endif +#endif break; default: break; @@ -1196,13 +1221,13 @@ struct xlat aclcmds[] = { #endif #ifdef ACL_GET { ACL_GET, "ACL_GET" }, -#endif +#endif #ifdef ACL_SET { ACL_SET, "ACL_SET" }, -#endif +#endif #ifdef ACL_CNT { ACL_CNT, "ACL_CNT" }, -#endif +#endif { 0, NULL }, }; @@ -1252,13 +1277,13 @@ struct tcb *tcp; struct xlat aclipc[] = { #ifdef IPC_SHM { IPC_SHM, "IPC_SHM" }, -#endif +#endif #ifdef IPC_SEM { IPC_SEM, "IPC_SEM" }, -#endif +#endif #ifdef IPC_MSG { IPC_MSG, "IPC_MSG" }, -#endif +#endif { 0, NULL }, }; @@ -1723,7 +1748,7 @@ struct tcb *tcp; (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff), (unsigned long) (tcp->u_arg[2] & 0x3ffff)); else -#endif +#endif tprintf(", makedev(%lu, %lu)", (unsigned long) major(tcp->u_arg[2]), (unsigned long) minor(tcp->u_arg[2])); @@ -1854,7 +1879,9 @@ struct tcb *tcp; #ifdef SVR4 if (!abbrev(tcp)) { tprintf("%s{d_ino=%lu, d_off=%lu, ", - i ? " " : "", d->d_ino, d->d_off); + i ? " " : "", + (unsigned long) d->d_ino, + (unsigned long) d->d_off); tprintf("d_reclen=%u, d_name=\"%s\"}", d->d_reclen, d->d_name); } @@ -1876,7 +1903,7 @@ struct tcb *tcp; tprintf(", d_namlen=%u, d_name=\"%.*s\"}", d->d_namlen, d->d_namlen, d->d_name); } -#endif /* FREEBSD */ +#endif /* FREEBSD */ if (!d->d_reclen) { tprintf("/* d_reclen == 0, problem here */"); break; @@ -1927,8 +1954,8 @@ struct tcb *tcp; #if defined(LINUX) || defined(SVR4) if (!abbrev(tcp)) { tprintf("%s{d_ino=%lu, d_off=%lu, ", - i ? " " : "", - (unsigned long)d->d_ino, + i ? " " : "", + (unsigned long)d->d_ino, (unsigned long)d->d_off); tprintf("d_reclen=%u, d_name=\"%s\"}", d->d_reclen, d->d_name); @@ -1955,7 +1982,7 @@ struct tcb *tcp; return 0; } #endif - + #ifdef FREEBSD int sys_getdirentries(tcp) @@ -2124,3 +2151,120 @@ struct tcb *tcp; } #endif /* HAVE_SYS_ASYNCH_H */ + +#ifdef XATTR_CREATE + +struct xlat xattrflags[] = { + { XATTR_CREATE, "XATTR_CREATE" }, + { XATTR_REPLACE, "XATTR_REPLACE" }, + { 0, NULL } +}; + +int +sys_setxattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printstr(tcp, tcp->u_arg[1], -1); + /* XXX Print value in format */ + tprintf(", %p, %ld, ", (void *) tcp->u_arg[2], tcp->u_arg[3]); + printflags(xattrflags, tcp->u_arg[4]); + } + return 0; +} + +int +sys_fsetxattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], -1); + /* XXX Print value in format */ + tprintf(", %p, %ld, ", (void *) tcp->u_arg[2], tcp->u_arg[3]); + printflags(xattrflags, tcp->u_arg[4]); + } + return 0; +} + +int +sys_getxattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printstr(tcp, tcp->u_arg[1], -1); + } else { + /* XXX Print value in format */ + tprintf(", %p, %ld", (void *) tcp->u_arg[2], tcp->u_arg[3]); + } + return 0; +} + +int +sys_fgetxattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], -1); + } else { + /* XXX Print value in format */ + tprintf(", %p, %ld", (void *) tcp->u_arg[2], tcp->u_arg[3]); + } + return 0; +} + +int +sys_listxattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + } else { + /* XXX Print value in format */ + tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]); + } + return 0; +} + +int +sys_flistxattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld", tcp->u_arg[0]); + } else { + /* XXX Print value in format */ + tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]); + } + return 0; +} + +int +sys_removexattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printstr(tcp, tcp->u_arg[1], -1); + } + return 0; +} + +int +sys_fremovexattr(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], -1); + } + return 0; +} + +#endif diff --git a/io.c b/io.c index 3bb77988..471879cc 100644 --- a/io.c +++ b/io.c @@ -89,7 +89,7 @@ long addr; tprintf("[]"); return; } - + if ((iov = (struct iovec *) malloc(len * sizeof *iov)) == NULL) { fprintf(stderr, "No memory"); return; @@ -280,6 +280,25 @@ struct tcb *tcp; return 0; } +int +sys_sendfile64(tcp) +struct tcb *tcp; +{ + if (entering(tcp)) { + loff_t offset; + + tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]); + if (!tcp->u_arg[2]) + tprintf("NULL"); + else if (umove(tcp, tcp->u_arg[2], &offset) < 0) + tprintf("%#lx", tcp->u_arg[2]); + else + tprintf("[%llu]", (unsigned long long int) offset); + tprintf(", %lu", tcp->u_arg[3]); + } + return 0; +} + #endif /* LINUX */ #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T @@ -315,7 +334,7 @@ struct tcb *tcp; return 0; } #endif - + int sys_ioctl(tcp) struct tcb *tcp;