Messages in this thread | | | Subject | sysctl (CTL_KERN,...) broken in 2.3.99pre2 :-( | From | Andreas Jaeger <> | Date | 21 Mar 2000 10:12:14 +0100 |
| |
With kernel 2.3.99pre2 sysctl fails for me - it worked with 2.3.48 (last kernel I tried).
CONFIG_SYSCTL is enabled: gromit:/usr/src/linux-2.3.x:[0]$ grep SYSCTL .config CONFIG_SYSCTL=y
strace outputs for the appended program: [...] _sysctl({{CTL_KERN, KERN_OSRELEASE}, 2, "", 64, NULL, 0}) = -1 ENOTDIR (Not a directory) write(2, "sysctl failed: Not a directory\n", 31sysctl failed: Not a directory ) = 31
The proc file system works: cat /proc/sys/kernel/osrelease 2.3.99-pre2
Is this an error with the used list implementation in kernel/sysctl.c? Andreas
P.S. Here's my test program: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include <unistd.h> #include <sys/param.h> #include <sys/sysctl.h> #include <stdio.h>
int main (void) { static const int sysctl_args[] = { CTL_KERN, KERN_OSRELEASE }; static char buf[64]; size_t reslen = sizeof (buf); /* Try reading the number using `sysctl' first. */ if (sysctl ((int *) sysctl_args, sizeof (sysctl_args) / sizeof (sysctl_args[0]), buf, &reslen, NULL, 0) < 0) { perror ("sysctl failed"); } else { buf[MIN (reslen, sizeof (buf) - 1)] = '\0'; printf ("Returned: %s\n", buf); }
return 0; }
-- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.rhein-neckar.de
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |