lkml.org 
[lkml]   [2000]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjectsysctl (CTL_KERN,...) broken in 2.3.99pre2 :-(
From
Date

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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.222 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site