patch-1.3.2 linux/ipc/util.c

Next file: linux/kernel/ksyms.c
Previous file: linux/ipc/shm.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.1/linux/ipc/util.c linux/ipc/util.c
@@ -13,25 +13,9 @@
 #include <linux/shm.h>
 #include <linux/stat.h>
 
-void ipc_init (void);
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth);
-
 #ifdef CONFIG_SYSVIPC
 
-int ipcperms (struct ipc_perm *ipcp, short flag);
 extern void sem_init (void), msg_init (void), shm_init (void);
-extern int sys_semget (key_t key, int nsems, int semflg);
-extern int sys_semop (int semid, struct sembuf *sops, unsigned nsops);
-extern int sys_semctl (int semid, int semnum, int cmd, union semun arg);
-extern int sys_msgget (key_t key, int msgflg);
-extern int sys_msgsnd (int msqid, struct msgbuf *msgp, int msgsz, int msgflg);
-extern int sys_msgrcv (int msqid, struct msgbuf *msgp, int msgsz, long msgtyp,
-		       int msgflg);
-extern int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
-extern int sys_shmget (key_t key, int size, int flag);
-extern int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *addr);
-extern int sys_shmdt (char *shmaddr);
-extern int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf);
 
 void ipc_init (void)
 {
@@ -63,112 +47,75 @@
 	return 0;
 }
 
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
+#else
+/*
+ * Dummy functions when SYSV IPC isn't configured
+ */
+
+void sem_exit (void)
 {
-	int version;
+    return;
+}
 
-	version = call >> 16; /* hack for backward compatibility */
-	call &= 0xffff;
+int shm_swap (int prio)
+{
+    return 0;
+}
 
-	if (call <= SEMCTL)
-		switch (call) {
-		case SEMOP:
-			return sys_semop (first, (struct sembuf *)ptr, second);
-		case SEMGET:
-			return sys_semget (first, second, third);
-		case SEMCTL: {
-			union semun fourth;
-			int err;
-			if (!ptr)
-				return -EINVAL;
-			if ((err = verify_area (VERIFY_READ, ptr, sizeof(long))))
-				return err;
-			fourth.__pad = (void *) get_fs_long(ptr);
-			return sys_semctl (first, second, third, fourth);
-			}
-		default:
-			return -EINVAL;
-		}
-	if (call <= MSGCTL) 
-		switch (call) {
-		case MSGSND:
-			return sys_msgsnd (first, (struct msgbuf *) ptr, 
-					   second, third);
-		case MSGRCV:
-			switch (version) {
-			case 0: {
-				struct ipc_kludge tmp;
-				int err;
-				if (!ptr)
-					return -EINVAL;
-				if ((err = verify_area (VERIFY_READ, ptr, sizeof(tmp))))
-					return err;
-				memcpy_fromfs (&tmp,(struct ipc_kludge *) ptr,
-					       sizeof (tmp));
-				return sys_msgrcv (first, tmp.msgp, second, tmp.msgtyp, third);
-				}
-			case 1: default:
-				return sys_msgrcv (first, (struct msgbuf *) ptr, second, fifth, third);
-			}
-		case MSGGET:
-			return sys_msgget ((key_t) first, second);
-		case MSGCTL:
-			return sys_msgctl (first, second, (struct msqid_ds *) ptr);
-		default:
-			return -EINVAL;
-		}
-	if (call <= SHMCTL) 
-		switch (call) {
-		case SHMAT:
-			switch (version) {
-			case 0: default: {
-				ulong raddr;
-				int err;
-				if ((err = verify_area(VERIFY_WRITE, (ulong*) third, sizeof(ulong))))
-					return err;
-				err = sys_shmat (first, (char *) ptr, second, &raddr);
-				if (err)
-					return err;
-				put_fs_long (raddr, (ulong *) third);
-				return 0;
-				}
-			case 1:	/* iBCS2 emulator entry point */
-				if (get_fs() != get_ds())
-					return -EINVAL;
-				return sys_shmat (first, (char *) ptr, second, (ulong *) third);
-			}
-		case SHMDT: 
-			return sys_shmdt ((char *)ptr);
-		case SHMGET:
-			return sys_shmget (first, second, third);
-		case SHMCTL:
-			return sys_shmctl (first, second, (struct shmid_ds *) ptr);
-		default:
-			return -EINVAL;
-		}
-	return -EINVAL;
+asmlinkage int sys_semget (key_t key, int nsems, int semflg)
+{
+	return -ENOSYS;
 }
 
-#else /* not CONFIG_SYSVIPC */
+asmlinkage int sys_semop (int semid, struct sembuf *sops, unsigned nsops)
+{
+	return -ENOSYS;
+}
 
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth) 
+asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg)
 {
-    return -ENOSYS;
+	return -ENOSYS;
 }
 
-void sem_exit (void)
+asmlinkage int sys_msgget (key_t key, int msgflg)
 {
-    return;
+	return -ENOSYS;
 }
 
-int shm_swap (int prio)
+asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg)
 {
-    return 0;
+	return -ENOSYS;
 }
 
-void shm_no_page (unsigned long *ptent)
+asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp,
+		       int msgflg)
 {
-    return;
+	return -ENOSYS;
+}
+
+asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf)
+{
+	return -ENOSYS;
+}
+
+asmlinkage int sys_shmget (key_t key, int size, int flag)
+{
+	return -ENOSYS;
+}
+
+asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *addr)
+{
+	return -ENOSYS;
+}
+
+asmlinkage int sys_shmdt (char *shmaddr)
+{
+	return -ENOSYS;
+}
+
+asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf)
+{
+	return -ENOSYS;
 }
 
 #endif /* CONFIG_SYSVIPC */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this