Skip to contentSkip to conversation

sem* and msg* for qemu

Qemu-devel Kirill A. Shutemov 3 participants 4 messages Jan 31, 2007 – Feb 1, 2007

lore
Share & tools
lore
#0 lore raw

In the attachment patches to add support System V semaphores and message queues. This is fixed and tested debian patch.

#1 lore raw

attached? where?

Thanks,
Hetz

Quoted 17 lines · Kirill A. Shutemov

In the attachment patches to add support System V semaphores and message queues. This is fixed and tested debian patch.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFwQtmbWYnhzC5v6oRAl/oAJ0T4X44En/65pE4H4EzFVJemtbZhQCcCIh5 RG1cpmTCmKn0fMSb62DKa24=
=6Ius
-----END PGP SIGNATURE-----

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Signature · 3 lines
Skepticism is the lazy person's default position.
Visit my blog (hebrew) for things that (sometimes) matter:
http://wp.dad-answers.com
#2 lore raw
Quoted 1 line · Hetz Ben Hamo

attached? where?

Oh... Sorry. Attached now.

linux-user/syscall.c +24 -0
@@ -43,6 +43,7 @@
 #include <sys/poll.h>
 #include <sys/times.h>
 #include <sys/shm.h>
+#include <sys/sem.h>
 #include <sys/statfs.h>
 #include <utime.h>
 #include <sys/sysinfo.h>
@@ -1188,6 +1189,12 @@
     uint32_t	size;
 } shm_regions[N_SHM_REGIONS];
 
+union semun {
+	int val;
+	struct senid_ds *buf;
+	unsigned short *array;
+};
+
 /* ??? This only works with linear mappings.  */
 static long do_ipc(long call, long first, long second, long third,
 		   long ptr, long fifth)
@@ -1202,6 +1209,23 @@
     call &= 0xffff;
 
     switch (call) {
+    case IPCOP_semop:
+        ret = get_errno(semop(first,(struct sembuf *) ptr, second));
+        break;
+
+    case IPCOP_semget:
+        ret = get_errno(semget(first, second, third));
+        break;
+
+    case IPCOP_semctl:
+        ret = get_errno(semctl(first, second, third, ((union semun*)ptr)->val));
+
+        break;
+
+    case IPCOP_semtimedop:
+        gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version);
+        ret = -ENOSYS;
+        break;
     case IPCOP_shmat:
 	/* SHM_* flags are the same on all linux platforms */
 	ret = get_errno((long) shmat(first, (void *) ptr, second));
linux-user/syscall.c renamed from linux-user/syscall.c.orig +29 -0
@@ -1226,6 +1226,35 @@
         gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version);
         ret = -ENOSYS;
         break;
+
+	case IPCOP_msgget:
+		ret = get_errno(msgget(first, second));
+		break;
+
+	case IPCOP_msgsnd:
+		ret = get_errno(msgsnd(first, (struct msgbuf *) ptr, second, third));
+		break;
+
+	case IPCOP_msgctl:
+		ret = get_errno(msgctl(first, second, (struct msqid_ds *) ptr));
+		break;
+
+	case IPCOP_msgrcv:
+		{
+			struct ipc_kludge
+			{
+				void *__unbounded msgp;
+				long int msgtyp;
+			};
+
+			struct ipc_kludge *foo = (struct ipc_kludge *) ptr;
+			struct msgbuf *msgp = (struct msgbuf *) foo->msgp;
+
+			ret = get_errno(msgrcv(first, msgp, second, 0, third));
+
+		}
+		break;
+
     case IPCOP_shmat:
 	/* SHM_* flags are the same on all linux platforms */
 	ret = get_errno((long) shmat(first, (void *) ptr, second));
#3 lore raw
In reply to Hetz Ben Hamo
Quoted 1 line · Hetz Ben Hamo

attached? where?

Sorry. Attached now.

linux-user/syscall.c renamed from linux-user/syscall.c.orig +29 -0
@@ -1226,6 +1226,35 @@
         gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version);
         ret = -ENOSYS;
         break;
+
+	case IPCOP_msgget:
+		ret = get_errno(msgget(first, second));
+		break;
+
+	case IPCOP_msgsnd:
+		ret = get_errno(msgsnd(first, (struct msgbuf *) ptr, second, third));
+		break;
+
+	case IPCOP_msgctl:
+		ret = get_errno(msgctl(first, second, (struct msqid_ds *) ptr));
+		break;
+
+	case IPCOP_msgrcv:
+		{
+			struct ipc_kludge
+			{
+				void *__unbounded msgp;
+				long int msgtyp;
+			};
+
+			struct ipc_kludge *foo = (struct ipc_kludge *) ptr;
+			struct msgbuf *msgp = (struct msgbuf *) foo->msgp;
+
+			ret = get_errno(msgrcv(first, msgp, second, 0, third));
+
+		}
+		break;
+
     case IPCOP_shmat:
 	/* SHM_* flags are the same on all linux platforms */
 	ret = get_errno((long) shmat(first, (void *) ptr, second));
linux-user/syscall.c +24 -0
@@ -43,6 +43,7 @@
 #include <sys/poll.h>
 #include <sys/times.h>
 #include <sys/shm.h>
+#include <sys/sem.h>
 #include <sys/statfs.h>
 #include <utime.h>
 #include <sys/sysinfo.h>
@@ -1188,6 +1189,12 @@
     uint32_t	size;
 } shm_regions[N_SHM_REGIONS];
 
+union semun {
+	int val;
+	struct senid_ds *buf;
+	unsigned short *array;
+};
+
 /* ??? This only works with linear mappings.  */
 static long do_ipc(long call, long first, long second, long third,
 		   long ptr, long fifth)
@@ -1202,6 +1209,23 @@
     call &= 0xffff;
 
     switch (call) {
+    case IPCOP_semop:
+        ret = get_errno(semop(first,(struct sembuf *) ptr, second));
+        break;
+
+    case IPCOP_semget:
+        ret = get_errno(semget(first, second, third));
+        break;
+
+    case IPCOP_semctl:
+        ret = get_errno(semctl(first, second, third, ((union semun*)ptr)->val));
+
+        break;
+
+    case IPCOP_semtimedop:
+        gemu_log("Unsupported ipc call: %ld (version %d)\n", call, version);
+        ret = -ENOSYS;
+        break;
     case IPCOP_shmat:
 	/* SHM_* flags are the same on all linux platforms */
 	ret = get_errno((long) shmat(first, (void *) ptr, second));