Do not use SYS_ipc and SYS_socketcall

* linux/dummy.h (sys_ipc, sys_socketcall): Remove redirections to
printargs.
* linux/ia64/syscallent.h: Likewise.
* linux/i386/syscallent.h: Remove native_scno initialization for "ipc"
and "socketcall".
* linux/syscall.h (sys_ipc, sys_socketcall): New prototypes.
(SYS_ipc, SYS_socketcall): Remove no longer used constants.
[IA64]: Remove undefining of ipc and socket SYS_* constants.
[SPARC || SPARC64]: Remove unused ipc SYS_* constants.
* ipc.c (sys_ipc): New function.
* sock.c (sys_socketcall): Likewise.
* syscall.c (trace_syscall_entering): Use sys_func to check for ipc and
socket subcalls.
diff --git a/ipc.c b/ipc.c
index bac9938..c956b19 100644
--- a/ipc.c
+++ b/ipc.c
@@ -560,3 +560,9 @@
 	return 0;
 }
 #endif
+
+int
+sys_ipc(struct tcb *tcp)
+{
+	return printargs(tcp);
+}
diff --git a/linux/dummy.h b/linux/dummy.h
index e7ed992..0def94c 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -114,10 +114,6 @@
 #define	sys_timer_getoverrun	printargs
 #define	sys_vhangup		printargs
 
-/* subcall entry points */
-#define	sys_socketcall		printargs
-#define	sys_ipc			printargs
-
 /* unimplemented */
 #define	sys_afs_syscall		printargs
 #define	sys_break		printargs
diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h
index 77543fe..46d61f9 100644
--- a/linux/i386/syscallent.h
+++ b/linux/i386/syscallent.h
@@ -130,7 +130,7 @@
 	{ 2,	TF,	sys_statfs,		"statfs"	}, /* 99 */
 	{ 2,	TD,	sys_fstatfs,		"fstatfs"	}, /* 100 */
 	{ 3,	0,	sys_ioperm,		"ioperm"	}, /* 101 */
-	{ 2,	TD,	sys_socketcall,		"socketcall", SYS_socketcall }, /* 102 */
+	{ 2,	TD,	sys_socketcall,		"socketcall"	}, /* 102 */
 	{ 3,	0,	sys_syslog,		"syslog"	}, /* 103 */
 	{ 3,	0,	sys_setitimer,		"setitimer"	}, /* 104 */
 	{ 2,	0,	sys_getitimer,		"getitimer"	}, /* 105 */
@@ -145,7 +145,7 @@
 	{ 4,	TP,	sys_wait4,		"wait4",	}, /* 114 */
 	{ 1,	TF,	sys_swapoff,		"swapoff"	}, /* 115 */
 	{ 1,	0,	sys_sysinfo,		"sysinfo"	}, /* 116 */
-	{ 6,	TI,	sys_ipc,		"ipc", SYS_ipc }, /* 117 */
+	{ 6,	TI,	sys_ipc,		"ipc",		}, /* 117 */
 	{ 1,	TD,	sys_fsync,		"fsync"		}, /* 118 */
 	{ 0,	TS,	sys_sigreturn,		"sigreturn"	}, /* 119 */
 	{ 5,	TP,	sys_clone,		"clone", SYS_clone }, /* 120 */
diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h
index a588aed..25f7402 100644
--- a/linux/ia64/syscallent.h
+++ b/linux/ia64/syscallent.h
@@ -80,7 +80,6 @@
 #define sys_statfs		printargs
 #define sys_fstatfs		printargs
 #define sys_ioperm		printargs
-#define sys_socketcall		printargs
 #define sys_setitimer		printargs
 #define sys_getitimer		printargs
 #define sys_stat		printargs
@@ -92,7 +91,6 @@
 #define sys_vm86old		printargs
 #define sys_wait4		printargs
 #define sys_sysinfo		printargs
-#define sys_ipc			printargs
 #define sys_sigreturn		printargs
 #define sys_uname		printargs
 #define sys_modify_ldt		printargs
@@ -184,7 +182,6 @@
 #undef sys_statfs
 #undef sys_fstatfs
 #undef sys_ioperm
-#undef sys_socketcall
 #undef sys_setitimer
 #undef sys_getitimer
 #undef sys_stat
@@ -196,7 +193,6 @@
 #undef sys_vm86old
 #undef sys_wait4
 #undef sys_sysinfo
-#undef sys_ipc
 #undef sys_sigreturn
 #undef sys_uname
 #undef sys_modify_ldt
diff --git a/linux/syscall.h b/linux/syscall.h
index f1833b8..de33c10 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -122,6 +122,7 @@
 int sys_io_setup();
 int sys_io_submit();
 int sys_ioctl();
+int sys_ipc();
 int sys_kill();
 int sys_link();
 int sys_linkat();
@@ -259,6 +260,7 @@
 int sys_sigsetmask();
 int sys_sigsuspend();
 int sys_socket();
+int sys_socketcall();
 int sys_socketpair();
 int sys_splice();
 int sys_stat();
@@ -315,32 +317,6 @@
 
 #if !defined(ALPHA) && !defined(MIPS) && !defined(HPPA) && \
 	!defined(__ARM_EABI__)
-# ifdef	IA64
-/*
- *  IA64 syscall numbers (the only ones available from standard header
- *  files) are disjoint from IA32 syscall numbers.  We need to define
- *  the IA32 socket call number here.
- */
-#  define SYS_socketcall	102
-
-#  undef SYS_socket
-#  undef SYS_bind
-#  undef SYS_connect
-#  undef SYS_listen
-#  undef SYS_accept
-#  undef SYS_getsockname
-#  undef SYS_getpeername
-#  undef SYS_socketpair
-#  undef SYS_send
-#  undef SYS_recv
-#  undef SYS_sendto
-#  undef SYS_recvfrom
-#  undef SYS_shutdown
-#  undef SYS_setsockopt
-#  undef SYS_getsockopt
-#  undef SYS_sendmsg
-#  undef SYS_recvmsg
-# endif /* IA64 */
 # if defined(SPARC) || defined(SPARC64)
 #  define SYS_socket_subcall	353
 # else
@@ -352,41 +328,10 @@
 
 #if !defined(ALPHA) && !defined(MIPS) && !defined(HPPA) && \
 	!defined(__ARM_EABI__)
-# ifdef	IA64
-   /*
-    * IA64 syscall numbers (the only ones available from standard
-    * header files) are disjoint from IA32 syscall numbers.  We need
-    * to define the IA32 socket call number here.  Fortunately, this
-    * symbol, `SYS_ipc', is not used by any of the IA64 code so
-    * re-defining this symbol will not cause a problem.
-   */
-#  undef SYS_ipc
-#  define SYS_ipc		117
-#  undef SYS_semop
-#  undef SYS_semget
-#  undef SYS_semctl
-#  undef SYS_semtimedop
-#  undef SYS_msgsnd
-#  undef SYS_msgrcv
-#  undef SYS_msgget
-#  undef SYS_msgctl
-#  undef SYS_shmat
-#  undef SYS_shmdt
-#  undef SYS_shmget
-#  undef SYS_shmctl
-# endif /* IA64 */
 #define SYS_ipc_subcall		((SYS_socket_subcall)+(SYS_socket_nsubcalls))
-
 #define SYS_ipc_nsubcalls	25
 #endif /* !(ALPHA || MIPS || HPPA) */
 
-#if defined SYS_ipc_subcall && !defined SYS_ipc
-# define SYS_ipc SYS_ipc_subcall
-#endif
-#if defined SYS_socket_subcall && !defined SYS_socketcall
-# define SYS_socketcall SYS_socket_subcall
-#endif
-
 #ifdef IA64
   /*
    * IA64 syscall numbers (the only ones available from standard header
@@ -434,19 +379,8 @@
 int sys_shmsys();
 #define SYS_semsys_subcall	200
 #define SYS_semsys_nsubcalls	3
-#define SYS_semctl		(SYS_semsys_subcall + 0)
-#define SYS_semget		(SYS_semsys_subcall + 1)
-#define SYS_semop		(SYS_semsys_subcall + 2)
 #define SYS_msgsys_subcall	203
 #define SYS_msgsys_nsubcalls	4
-#define SYS_msgget		(SYS_msgsys_subcall + 0)
-#define SYS_msgctl		(SYS_msgsys_subcall + 1)
-#define SYS_msgrcv		(SYS_msgsys_subcall + 2)
-#define SYS_msgsnd		(SYS_msgsys_subcall + 3)
 #define SYS_shmsys_subcall	207
 #define SYS_shmsys_nsubcalls	4
-#define SYS_shmat		(SYS_shmsys_subcall + 0)
-#define SYS_shmctl		(SYS_shmsys_subcall + 1)
-#define SYS_shmdt		(SYS_shmsys_subcall + 2)
-#define SYS_shmget		(SYS_shmsys_subcall + 3)
 #endif
diff --git a/sock.c b/sock.c
index f48fd46..d3a510a 100644
--- a/sock.c
+++ b/sock.c
@@ -291,3 +291,9 @@
 		return 0;
 	}
 }
+
+int
+sys_socketcall(struct tcb *tcp)
+{
+	return printargs(tcp);
+}
diff --git a/syscall.c b/syscall.c
index eaf0f45..bbd2e58 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1733,19 +1733,28 @@
 		goto ret;
 	}
 
-	switch (known_scno(tcp)) {
+#if defined(SYS_socket_subcall) || defined(SYS_ipc_subcall)
+	while (SCNO_IN_RANGE(tcp->scno)) {
 #ifdef SYS_socket_subcall
-	case SYS_socketcall:
-		decode_subcall(tcp, SYS_socket_subcall,
-			SYS_socket_nsubcalls, deref_style);
-		break;
+		if (sysent[tcp->scno].sys_func == sys_socketcall) {
+			decode_subcall(tcp, SYS_socket_subcall,
+				SYS_socket_nsubcalls, deref_style);
+			break;
+		}
 #endif
 #ifdef SYS_ipc_subcall
-	case SYS_ipc:
-		decode_subcall(tcp, SYS_ipc_subcall,
-			SYS_ipc_nsubcalls, shift_style);
-		break;
+		if (sysent[tcp->scno].sys_func == sys_ipc) {
+			decode_subcall(tcp, SYS_ipc_subcall,
+				SYS_ipc_nsubcalls, shift_style);
+			break;
+		}
 #endif
+		break;
+	}
+#endif /* SYS_socket_subcall || SYS_ipc_subcall */
+
+#if defined(SVR4) || defined(FREEBSD) || defined(SUNOS4)
+	switch (known_scno(tcp)) {
 #ifdef SVR4
 #ifdef SYS_pgrpsys_subcall
 	case SYS_pgrpsys:
@@ -1820,6 +1829,7 @@
 		break;
 #endif
 	}
+#endif /* SVR4 || FREEBSD || SUNOS4 */
 
 	internal_syscall(tcp);