Skip to contentSkip to conversation

Make _sysctl less broken

PATCH Applied Paul Brook 2 participants 2 messages Sep 11, 2004 – Sep 13, 2004

lore
Share & tools
lore

Paul Brook

author
#0 lore raw

PATCH 1/1 Make _sysctl less broken

Qemu doesn't currently implement the _sysctl linux syscall, and complains loudly when it is used.

For some reason my Debian arm-linux chroot calls this syscall extensively, and the "Unsupported syscall" errors were causing problems.

The patch below makes it always return ENOTDIR. The sysctl names vary between kernel versions, so user applications should already gracefully accept this.

Paul

Index: syscall.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/syscall.c,v retrieving revision 1.50

syscall.c 11 Sep 2004 18:35:28 -0000 renamed from syscall.c 19 Jun 2004 16:59:03 -0000 1.50 +3 -1
diff -u -p -r1.50 syscall.c
@@ -2600,7 +2624,9 @@ long do_syscall(void *cpu_env, int num, 
         ret = get_errno(fdatasync(arg1));
         break;
     case TARGET_NR__sysctl:
-        goto unimplemented;
+        /* We don't implement this, but ENODIR is always a safe
+           return value. */
+        return -ENOTDIR;
     case TARGET_NR_sched_setparam:
         {
             struct sched_param *target_schp = (void *)arg2;
#1 lore raw

Applied.

Fabrice.

Quoted 34 lines · Paul Brook

Qemu doesn't currently implement the _sysctl linux syscall, and complains loudly when it is used.

For some reason my Debian arm-linux chroot calls this syscall extensively, and the "Unsupported syscall" errors were causing problems.

The patch below makes it always return ENOTDIR. The sysctl names vary between kernel versions, so user applications should already gracefully accept this.

Paul

Index: syscall.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/syscall.c,v retrieving revision 1.50
diff -u -p -r1.50 syscall.c

syscall.c 11 Sep 2004 18:35:28 -0000 renamed from syscall.c 19 Jun 2004 16:59:03 -0000 1.50 +3 -1
@@ -2600,7 +2624,9 @@ long do_syscall(void *cpu_env, int num, 
         ret = get_errno(fdatasync(arg1));
         break;
     case TARGET_NR__sysctl:
-        goto unimplemented;
+        /* We don't implement this, but ENODIR is always a safe
+           return value. */
+        return -ENOTDIR;
     case TARGET_NR_sched_setparam:
         {
             struct sched_param *target_schp = (void *)arg2;

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