Author: arekm Date: Sun Feb 22 13:46:03 2009 GMT Module: SOURCES Tag: HEAD ---- Log message: - more definitions
---- Files affected: SOURCES: strace-fd.patch (1.1 -> 1.2) ---- Diffs: ================================================================ Index: SOURCES/strace-fd.patch diff -u SOURCES/strace-fd.patch:1.1 SOURCES/strace-fd.patch:1.2 --- SOURCES/strace-fd.patch:1.1 Sun Feb 22 14:39:46 2009 +++ SOURCES/strace-fd.patch Sun Feb 22 14:45:57 2009 @@ -296,3 +296,120 @@ + return do_signalfd(tcp, 3); +} #endif /* LINUX */ +commit feeceab4c8bfde6542d78048854c3bdc7ea9c99b +Author: ldv <ldv> +Date: Mon Nov 10 17:21:23 2008 +0000 + + 2008-10-22 Dmitry V. Levin <[email protected]> + + Handle socket type flags introduced in linux 2.6.27. + * net.c (socktypes): Add SOCK_DCCP. + (sock_type_flags): New xlat structure. + (tprint_sock_type): New function. + (sys_socket, sys_socketpair): Use it to parse socket type and + socket type flags. + +diff --git a/net.c b/net.c +index c302b1f..f5426b2 100644 +--- a/net.c ++++ b/net.c +@@ -27,7 +27,7 @@ + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * +- * $Id$ ++ * $Id$ + */ + + #include "defs.h" +@@ -320,17 +320,32 @@ static const struct xlat socktypes[] = { + #ifdef SOCK_RAW + { SOCK_RAW, "SOCK_RAW" }, + #endif ++#ifdef SOCK_RDM ++ { SOCK_RDM, "SOCK_RDM" }, ++#endif + #ifdef SOCK_SEQPACKET + { SOCK_SEQPACKET,"SOCK_SEQPACKET"}, + #endif +-#ifdef SOCK_RDM +- { SOCK_RDM, "SOCK_RDM" }, ++#ifdef SOCK_DCCP ++ { SOCK_DCCP, "SOCK_DCCP" }, + #endif + #ifdef SOCK_PACKET + { SOCK_PACKET, "SOCK_PACKET" }, + #endif + { 0, NULL }, + }; ++const struct xlat sock_type_flags[] = { ++#ifdef SOCK_CLOEXEC ++ { SOCK_CLOEXEC, "SOCK_CLOEXEC" }, ++#endif ++#ifdef SOCK_NONBLOCK ++ { SOCK_NONBLOCK,"SOCK_NONBLOCK" }, ++#endif ++ { 0, NULL }, ++}; ++#ifndef SOCK_TYPE_MASK ++# define SOCK_TYPE_MASK 0xf ++#endif + static const struct xlat socketlayers[] = { + #if defined(SOL_IP) + { SOL_IP, "SOL_IP" }, +@@ -1182,14 +1197,33 @@ long addr; + + #endif /* HAVE_SENDMSG */ + ++/* ++ * low bits of the socket type define real socket type, ++ * other bits are socket type flags. ++ */ ++static void ++tprint_sock_type(struct tcb *tcp, int flags) ++{ ++ const char *str = xlookup(socktypes, flags & SOCK_TYPE_MASK); ++ ++ if (str) ++ { ++ tprintf("%s", str); ++ flags &= ~SOCK_TYPE_MASK; ++ if (!flags) ++ return; ++ tprintf("|"); ++ } ++ printflags(sock_type_flags, flags, "SOCK_???"); ++} ++ + int +-sys_socket(tcp) +-struct tcb *tcp; ++sys_socket(struct tcb *tcp) + { + if (entering(tcp)) { + printxval(domains, tcp->u_arg[0], "PF_???"); + tprintf(", "); +- printxval(socktypes, tcp->u_arg[1], "SOCK_???"); ++ tprint_sock_type(tcp, tcp->u_arg[1]); + tprintf(", "); + switch (tcp->u_arg[0]) { + case PF_INET: +@@ -1489,8 +1523,7 @@ struct tcb *tcp; + } + + int +-sys_socketpair(tcp) +-struct tcb *tcp; ++sys_socketpair(struct tcb *tcp) + { + #ifdef LINUX + int fds[2]; +@@ -1499,7 +1532,7 @@ struct tcb *tcp; + if (entering(tcp)) { + printxval(domains, tcp->u_arg[0], "PF_???"); + tprintf(", "); +- printxval(socktypes, tcp->u_arg[1], "SOCK_???"); ++ tprint_sock_type(tcp, tcp->u_arg[1]); + tprintf(", "); + switch (tcp->u_arg[0]) { + case PF_INET: ================================================================ ---- CVS-web: http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/strace-fd.patch?r1=1.1&r2=1.2&f=u _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
