[PATCH] putpmsg/getpmsg: check for syscall, not function

Roland McGrath roland at redhat.com
Mon Dec 16 02:02:05 UTC 2002


I had a Linux system with no putpmsg function in libc but with the
putpmsg/getpmsg system calls, and strace would not compile.  This patch
changes the #ifdef's on the sys_{get,put}pmsg printer functions so as to
check for the syscall number in <sys/syscall.h> rather than checking for
library function.  It doesn't make sense to me to use library function
checks as a condition for including particular system call printing code.
The kernel can support system calls the library doesn't, and you might as
well support printing them.  

Ok to commit?

Thanks,
Roland


2002-12-15  Roland McGrath  <roland at redhat.com>

	* configure.in: Don't check for putpmsg.
	* stream.c (sys_getpmsg, sys_putpmsg): Make these conditional on
	#ifdef SYS_*, rather than on HAVE_PUTPMSG.

Index: configure.in
===================================================================
RCS file: /cvsroot/strace/strace/configure.in,v
retrieving revision 1.39
diff -b -p -u -r1.39 configure.in
--- configure.in	7 Oct 2002 14:31:05 -0000	1.39
+++ configure.in	16 Dec 2002 09:55:43 -0000
@@ -172,7 +172,7 @@ AC_STRUCT_T_OPTHDR
 if test x$OPSYS != xLINUX; then
 AC_CHECK_LIB(nsl, main)
 fi
-AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl putpmsg prctl sendmsg inet_ntop if_indextoname)
+AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
 AC_CHECK_HEADERS(sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h asm/sigcontext.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h linux/icmp.h linux/in6.h sys/uio.h sys/aio.h linux/netlink.h linux/if_packet.h poll.h sys/poll.h sys/vfs.h netinet/tcp.h netinet/udp.h asm/sysmips.h linux/utsname.h sys/nscsys.h)
 AC_DECL_SYS_ERRLIST
 AC_DECL_SYS_SIGLIST
Index: stream.c
===================================================================
RCS file: /cvsroot/strace/strace/stream.c,v
retrieving revision 1.14
diff -b -p -u -r1.14 stream.c
--- stream.c	7 Oct 2002 14:31:10 -0000	1.14
+++ stream.c	16 Dec 2002 09:55:43 -0000
@@ -29,6 +29,7 @@
  */
 
 #include "defs.h"
+#include <sys/syscall.h>
 
 #ifdef HAVE_POLL_H
 #include <poll.h>
@@ -177,8 +178,7 @@ struct tcb *tcp;
 	return RVAL_HEX | RVAL_STR;
 }
 
-#ifdef HAVE_PUTPMSG
-
+#if defined SYS_putpmsg || defined SYS_getpmsg
 static struct xlat pmsgflags[] = {
 #ifdef MSG_HIPRI
 	{ MSG_HIPRI,	"MSG_HIPRI"	},
@@ -191,7 +191,9 @@ static struct xlat pmsgflags[] = {
 #endif
 	{ 0,		NULL		},
 };
+#endif
 
+#ifdef SYS_putpmsg
 int
 sys_putpmsg(tcp)
 struct tcb *tcp;
@@ -212,7 +214,9 @@ struct tcb *tcp;
 	}
 	return 0;
 }
+#endif /* SYS_putpmsg */
 
+#ifdef SYS_getpmsg
 int
 sys_getpmsg(tcp)
 struct tcb *tcp;
@@ -263,8 +267,8 @@ struct tcb *tcp;
 	}
 	return RVAL_HEX | RVAL_STR;
 }
+#endif /* SYS_getpmsg */
 
-#endif /* HAVE_PUTPMSG */
 #endif /* !FREEBSD */
 
 
@@ -1290,4 +1294,3 @@ int code, arg;
 #endif /* !linux && !FREEBSD */ 
 
 #endif /* HAVE_SYS_STREAM_H || linux || FREEBSD */




More information about the Strace-devel mailing list