-.SH EXAMPLE
-.nf
-#include <linux/unistd.h>
-#include <linux/types.h>
-#include <linux/sysctl.h>
-
-_syscall1(int, _sysctl, struct __sysctl_args *, args);
-int sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
- void *newval, size_t newlen)
-{
- struct __sysctl_args args = { name, nlen, oldval, oldlenp,
- newval, newlen };
- return _sysctl(&args);
-}
-
-#define SIZE(x) sizeof(x)/sizeof(x[0])
-#define OSNAMESZ 100
-
-char osname[OSNAMESZ];
-int osnamelth;
-int name[] = { CTL_KERN, KERN_OSTYPE };
-
-int
-main(void)
-{
- osnamelth = sizeof(osname);
- if (sysctl(name, SIZE(name), osname, &osnamelth, 0, 0))
- perror("sysctl");
- else
- printf("This machine is running %*s\en", osnamelth, osname);
- return 0;
-}
-.fi
-.SH "RETURN VALUE"