From: Timo Savola <tsavola@movial.fi>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] sysctl
Date: Tue, 6 Apr 2004 13:01:11 +0300 [thread overview]
Message-ID: <20040406100111.GD9385@held085.hel.creanor.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
Hello,
Since the user-mode qemu doesn't support sysctl (syscall 149) and
linuxthreads uses it to check kernel/version, some programs fail. sysctl
is an obsolete syscall and seems like a big job to support since you'd
have to know what kind of data goes in and out with each parameter, so
I'm not surprised why it's not supported. However, implementing only the
kernel/version case seems worthwhile. I tested this patch with qemu-arm
and it seems to help.
Extending this patch to implement all cases that copy string (or integer)
values would be straightforward, but I wanted to keep the patch simple.
Timo
[-- Attachment #2: sysctl.patch --]
[-- Type: text/plain, Size: 1575 bytes --]
--- qemu-0.5.3/linux-user/syscall.c.orig 2004-04-06 12:07:48.000000000 +0300
+++ qemu-0.5.3/linux-user/syscall.c 2004-04-06 12:15:07.000000000 +0300
@@ -46,6 +46,7 @@
//#include <sys/user.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
+#include <sys/sysctl.h>
#define termios host_termios
#define winsize host_winsize
@@ -2565,7 +2566,31 @@
ret = get_errno(fdatasync(arg1));
break;
case TARGET_NR__sysctl:
- goto unimplemented;
+ {
+ struct __sysctl_args *args = (struct __sysctl_args *) arg1;
+ int *name, nlen, *oldlenp, oldlen, newlen;
+ void *oldval, *newval;
+
+ name = (int *) tswapl((long) args->name);
+ nlen = tswapl(args->nlen);
+ oldval = (void *) tswapl((long) args->oldval);
+ oldlenp = (int *) tswapl((long) args->oldlenp);
+ oldlen = tswapl(*oldlenp);
+ newval = (void *) tswapl((long) args->newval);
+ newlen = tswapl(args->newlen);
+
+ if (nlen == 2 && name[0] == CTL_KERN && name[1] == KERN_VERSION) {
+ ret = get_errno(
+ sysctl(name, nlen, oldval, &oldlen, newval, newlen));
+ if (!is_error(ret)) {
+ *oldlenp = tswapl(oldlen);
+ }
+ } else {
+ gemu_log("qemu: Unsupported sysctl name\n");
+ ret = -ENOSYS;
+ }
+ }
+ break;
case TARGET_NR_sched_setparam:
{
struct sched_param *target_schp = (void *)arg2;
reply other threads:[~2004-04-06 10:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040406100111.GD9385@held085.hel.creanor.com \
--to=tsavola@movial.fi \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).