Start using sysctl(3) throughout userland

This patch mostly removes MINIX3-specific workarounds for missing
sysctl support.

Change-Id: I21e35e887359619ba72c252aa43d9017301a46ac
This commit is contained in:
David van Moolenbroek 2015-10-28 15:06:03 +00:00 committed by Lionel Sambuc
parent 25d39513e7
commit d2532d3d42
23 changed files with 12 additions and 437 deletions

View File

@ -631,12 +631,9 @@ out:
static const char * static const char *
syspath(void) syspath(void)
{ {
#if !defined(__minix)
static char *sys_path = NULL; static char *sys_path = NULL;
static int mib[] = {CTL_USER, USER_CS_PATH}; static int mib[] = {CTL_USER, USER_CS_PATH};
#endif /* !defined(__minix) */
static char def_path[] = "PATH=/usr/bin:/bin:/usr/sbin:/sbin"; static char def_path[] = "PATH=/usr/bin:/bin:/usr/sbin:/sbin";
#if !defined(__minix)
size_t len; size_t len;
if (sys_path == NULL) { if (sys_path == NULL) {
@ -651,10 +648,6 @@ syspath(void)
} }
} }
return sys_path; return sys_path;
#else
/* On Minix no support for CTL_USER. */
return def_path;
#endif /* !defined(__minix) */
} }
static int static int

View File

@ -401,6 +401,9 @@ start|autoboot)
trap 2 trap 2
fi fi
# Load the stored hostname into the sysctl database.
test -r /etc/hostname.file && hostname $(cat /etc/hostname.file)
# Recover files being edited when the system crashed. # Recover files being edited when the system crashed.
test -f /usr/bin/elvprsv && elvprsv /usr/tmp/elv* test -f /usr/bin/elvprsv && elvprsv /usr/tmp/elv*

View File

@ -300,9 +300,7 @@ __aconst char *devname(dev_t, mode_t) __RENAME(__devname50);
int humanize_number(char *, size_t, int64_t, const char *, int, int); int humanize_number(char *, size_t, int64_t, const char *, int, int);
int dehumanize_number(const char *, int64_t *); int dehumanize_number(const char *, int64_t *);
#if !defined(__minix)
devmajor_t getdevmajor(const char *, mode_t); devmajor_t getdevmajor(const char *, mode_t);
#endif /* !defined(__minix) */
int getloadavg(double [], int); int getloadavg(double [], int);
int getenv_r(const char *, char *, size_t); int getenv_r(const char *, char *, size_t);

View File

@ -20,7 +20,7 @@ SRCS+= _errno.c
.if defined(__MINIX) .if defined(__MINIX)
# Unsupported by Minix. # Unsupported by Minix.
# closefrom.c confstr.c extattr.c getdevmajor.c \ # closefrom.c confstr.c extattr.c \
# pthread_atfork.c # pthread_atfork.c
# #
# To be ported # To be ported
@ -36,7 +36,7 @@ SRCS+= alarm.c alphasort.c arc4random.c assert.c asysctl.c \
errc.c errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \ errc.c errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \
fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \ fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \
fts.c ftw.c getbsize.c getcap.c getcwd.c \ fts.c ftw.c getbsize.c getcap.c getcwd.c \
getdomainname.c getgrent.c \ getdevmajor.c getdomainname.c getgrent.c \
getgrouplist.c getgroupmembership.c gethostname.c \ getgrouplist.c getgroupmembership.c gethostname.c \
getloadavg.c getlogin.c getmntinfo.c \ getloadavg.c getlogin.c getmntinfo.c \
getnetgrent.c getpagesize.c \ getnetgrent.c getpagesize.c \

View File

@ -349,8 +349,10 @@ sysconf(int name)
return _POSIX_SHARED_MEMORY_OBJECTS; return _POSIX_SHARED_MEMORY_OBJECTS;
case _SC_SHELL: case _SC_SHELL:
return _POSIX_SHELL; return _POSIX_SHELL;
#ifndef __minix
case _SC_SPAWN: case _SC_SPAWN:
return _POSIX_SPAWN; return _POSIX_SPAWN;
#endif /* !__minix */
case _SC_SYMLOOP_MAX: case _SC_SYMLOOP_MAX:
return MAXSYMLINKS; return MAXSYMLINKS;

View File

@ -62,23 +62,19 @@ static const struct {
ADD(PLATFORM) /* uname -p */ ADD(PLATFORM) /* uname -p */
}; };
#if !defined(__minix)
static int mib[3][2] = { static int mib[3][2] = {
{ CTL_KERN, KERN_OSTYPE }, { CTL_KERN, KERN_OSTYPE },
{ CTL_KERN, KERN_OSRELEASE }, { CTL_KERN, KERN_OSRELEASE },
{ CTL_HW, HW_MACHINE_ARCH }, { CTL_HW, HW_MACHINE_ARCH },
}; };
#endif /* !defined(__minix) */
static size_t static size_t
expand(char *buf, const char *execname, int what, size_t bl) expand(char *buf, const char *execname, int what, size_t bl)
{ {
const char *p, *ep; const char *p, *ep;
char *bp = buf; char *bp = buf;
#if !defined(__minix)
size_t len; size_t len;
char name[32]; char name[32];
#endif /* !defined(__minix) */
switch (what) { switch (what) {
case 0: /* HWCAP XXX: Not yet */ case 0: /* HWCAP XXX: Not yet */
@ -92,7 +88,6 @@ expand(char *buf, const char *execname, int what, size_t bl)
xerr(1, "bad execname `%s' in AUX vector", execname); xerr(1, "bad execname `%s' in AUX vector", execname);
break; break;
#if !defined(__minix)
case 3: /* OSNAME */ case 3: /* OSNAME */
case 4: /* OSREL */ case 4: /* OSREL */
case 5: /* PLATFORM */ case 5: /* PLATFORM */
@ -103,7 +98,6 @@ expand(char *buf, const char *execname, int what, size_t bl)
} }
ep = (p = name) + len - 1; ep = (p = name) + len - 1;
break; break;
#endif /* !defined(__minix) */
default: default:
return 0; return 0;
} }

View File

@ -1,29 +0,0 @@
/* getdomainname() Author: Kees J. Bot
* 2 Dec 1994
*/
#define nil 0
#include "namespace.h"
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#ifdef __weak_alias
__weak_alias(getdomainname, _getdomainname)
#endif
int getdomainname(char *result, size_t size)
{
char nodename[256];
char *domain;
if (gethostname(nodename, sizeof(nodename)) < 0)
return -1;
nodename[sizeof(nodename)-1]= 0;
if ((domain = strchr(nodename, '.')) != NULL)
strncpy(result, domain+1, size);
else
result[0] = '\0';
if (size > 0) result[size-1]= 0;
return 0;
}

View File

@ -1,31 +0,0 @@
/* gethostname(2) system call emulation */
#include <sys/cdefs.h>
#include "namespace.h"
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <minix/paths.h>
#ifdef __weak_alias
__weak_alias(gethostname, _gethostname)
#endif
int gethostname(char *buf, size_t len)
{
int fd;
int r;
char *nl;
if ((fd= open(_PATH_HOSTNAME_FILE, O_RDONLY)) < 0) return -1;
r= read(fd, buf, len);
close(fd);
if (r == -1) return -1;
buf[len-1]= '\0';
if ((nl= strchr(buf, '\n')) != NULL) *nl= '\0';
return 0;
}

View File

@ -1,41 +0,0 @@
#include <sys/cdefs.h>
#include "namespace.h"
#include <sys/types.h>
#include <minix/paths.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <lib.h>
#ifdef __weak_alias
__weak_alias(getloadavg, _getloadavg)
#endif
/* Retrieve system load average information. */
int getloadavg(double *loadavg, int nelem)
{
FILE *fp;
int i;
if(nelem < 1) {
errno = ENOSPC;
return -1;
}
if((fp = fopen(_PATH_PROC "loadavg", "r")) == NULL)
return -1;
for(i = 0; i < nelem; i++)
if(fscanf(fp, "%lf", &loadavg[i]) != 1)
break;
fclose(fp);
if (i == 0) {
errno = ENOENT;
return -1;
}
return i;
}

View File

@ -1,20 +0,0 @@
/*
getpagesize.c
*/
#include <sys/cdefs.h>
#include <sys/types.h>
#include "namespace.h"
#include <machine/param.h>
#include <machine/vmparam.h>
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(getpagesize, _getpagesize)
#endif
int getpagesize(void)
{
return PAGE_SIZE;
}

View File

@ -1,66 +0,0 @@
/* gethostname(2) system call emulation */
#include <sys/cdefs.h>
#include "namespace.h"
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <minix/paths.h>
#ifdef __weak_alias
__weak_alias(sethostname, _sethostname)
#endif
int sethostname(const char *buf, size_t len)
{
int fd;
int r;
int tmperr;
char name[20];
strlcpy(name, "/tmp/hostname.XXXXX",sizeof(name));
fd = mkstemp(name);
if (fd == -1)
return -1;
r = fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (r == -1) {
tmperr = errno;
close(fd);
unlink(name);
errno = tmperr;
return -1;
}
r = write(fd, buf, len);
tmperr = errno;
fsync(fd);
close(fd);
if (r == -1) {
unlink(name);
errno = tmperr;
return -1;
}
if ((size_t)r < len) {
unlink(name);
errno = ENOSPC;
return -1;
}
r = rename(name, _PATH_HOSTNAME_FILE);
if (r == -1) {
tmperr = errno;
unlink(name);
errno = tmperr;
}
return 0;
}

View File

@ -1,85 +0,0 @@
/* sysconf.c POSIX 4.8.1
* long int sysconf(int name);
*
* POSIX allows some of the values in <limits.h> to be increased at
* run time. The sysconf() function allows such values to be checked
* at run time. MINIX does not use this facility - the run time
* limits are those given in <limits.h>.
*/
#include <sys/cdefs.h>
#include "namespace.h"
#include <lib.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <minix/paths.h>
#ifdef __weak_alias
__weak_alias(sysconf, __sysconf)
#endif
static u32_t get_hz(void)
{
FILE *fp;
u32_t hz;
int r;
if ((fp = fopen(_PATH_PROC "hz", "r")) != NULL)
{
r = fscanf(fp, "%u", &hz);
fclose(fp);
if (r == 1)
return hz;
}
return DEFAULT_HZ;
}
long int sysconf(name)
int name; /* property being inspected */
{
switch(name) {
case _SC_ARG_MAX:
return (long) ARG_MAX;
case _SC_CHILD_MAX:
return (long) CHILD_MAX;
case _SC_CLK_TCK:
return (long) get_hz();
case _SC_NGROUPS_MAX:
return (long) NGROUPS_MAX;
case _SC_OPEN_MAX:
return (long) OPEN_MAX;
case _SC_JOB_CONTROL:
return -1L; /* no job control */
case _SC_SAVED_IDS:
return -1L; /* no saved uid/gid */
case _SC_VERSION:
return (long) _POSIX_VERSION;
case _SC_STREAM_MAX:
return (long) _POSIX_STREAM_MAX;
case _SC_TZNAME_MAX:
return (long) _POSIX_TZNAME_MAX;
case _SC_PAGESIZE:
return getpagesize();
case _SC_LINE_MAX:
return (long) LINE_MAX;
default:
errno = EINVAL;
return -1L;
}
}

View File

@ -1,66 +0,0 @@
/* uname(3) - describe the machine. Author: Kees J. Bot
* 5 Dec 1992
*/
#include <sys/cdefs.h>
#include "namespace.h"
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/utsname.h>
#ifdef __weak_alias
__weak_alias(uname, _uname)
#endif
#define uts_get(field, string) \
if (sysuname(_UTS_GET, field, name->string, sizeof(name->string)) < 0) \
return -1; \
name->string[sizeof(name->string)-1]= 0;
int uname(struct utsname *name)
{
int hf, n, err;
char *nl;
/* Get each of the strings with a sysuname call. Null terminate them,
* because the buffers in the kernel may grow before this and the
* programs are recompiled.
*/
uts_get(_UTS_SYSNAME, sysname);
uts_get(_UTS_NODENAME, nodename);
uts_get(_UTS_RELEASE, release);
uts_get(_UTS_VERSION, version);
uts_get(_UTS_MACHINE, machine);
uts_get(_UTS_ARCH, arch);
#if 0
uts_get(_UTS_KERNEL, kernel);
uts_get(_UTS_HOSTNAME, hostname);
uts_get(_UTS_BUS, bus);
#endif
/* Try to read the node name from /etc/hostname.file. This information
* should be stored in the kernel.
*/
if ((hf = open("/etc/hostname.file", O_RDONLY)) < 0) {
if (errno != ENOENT) return(-1);
} else {
n = read(hf, name->nodename, sizeof(name->nodename) - 1);
err = errno;
close(hf);
errno = err;
if (n < 0) return(-1);
name->nodename[n] = 0;
if ((nl = strchr(name->nodename, '\n')) != NULL) {
memset(nl, 0, (name->nodename +
sizeof(name->nodename)) - nl);
}
}
return 0;
}
/*
* $PchId: _uname.c,v 1.4 1995/11/27 20:09:08 philip Exp $
*/

View File

@ -27,7 +27,6 @@ int getrlimit(int resource, struct rlimit *rlp)
case RLIMIT_CORE: case RLIMIT_CORE:
case RLIMIT_RSS: case RLIMIT_RSS:
case RLIMIT_MEMLOCK: case RLIMIT_MEMLOCK:
case RLIMIT_NPROC:
case RLIMIT_SBSIZE: case RLIMIT_SBSIZE:
case RLIMIT_AS: case RLIMIT_AS:
/* case RLIMIT_VMEM: Same as RLIMIT_AS */ /* case RLIMIT_VMEM: Same as RLIMIT_AS */
@ -38,6 +37,10 @@ int getrlimit(int resource, struct rlimit *rlp)
limit = RLIM_INFINITY; limit = RLIM_INFINITY;
break; break;
case RLIMIT_NPROC:
limit = CHILD_MAX;
break;
case RLIMIT_NOFILE: case RLIMIT_NOFILE:
limit = OPEN_MAX; limit = OPEN_MAX;
break; break;

View File

@ -251,23 +251,3 @@ minix_proc_compare(const struct minix_proc * p1, const struct minix_proc * p2)
*/ */
return p1->p_pid < p2->p_pid; return p1->p_pid < p2->p_pid;
} }
/*
* Obtain the system uptime in seconds. Return 0 on success, with the uptime
* stored in the given time_t field. Return -1 on failure.
*/
int
minix_getuptime(time_t *timep)
{
FILE *fp;
int r;
if ((fp = fopen(_PATH_PROC "uptime", "r")) == NULL)
return -1;
r = fscanf(fp, "%llu", timep);
fclose(fp);
return (r == 1) ? 0 : -1;
}

View File

@ -44,6 +44,4 @@ int minix_proc_compare(const struct minix_proc *p1,
#undef proc_compare_wrapper #undef proc_compare_wrapper
#define proc_compare_wrapper minix_proc_compare #define proc_compare_wrapper minix_proc_compare
int minix_getuptime(time_t *timep);
#endif /* !_W_MINIX_PROC_H */ #endif /* !_W_MINIX_PROC_H */

View File

@ -544,9 +544,6 @@ minixpowerdown(int sig)
static int static int
has_securelevel(void) has_securelevel(void)
{ {
#if defined(__minix)
return 0;
#else
#ifdef KERN_SECURELVL #ifdef KERN_SECURELVL
int name[2], curlevel; int name[2], curlevel;
size_t len; size_t len;
@ -563,7 +560,6 @@ has_securelevel(void)
#else #else
return 0; return 0;
#endif #endif
#endif /* defined(__minix) */
} }
/* /*
@ -1815,7 +1811,6 @@ do_setttyent(void)
static int static int
createsysctlnode(void) createsysctlnode(void)
{ {
#if !defined(__minix)
struct sysctlnode node; struct sysctlnode node;
int mib[2]; int mib[2];
size_t len; size_t len;
@ -1857,7 +1852,6 @@ createsysctlnode(void)
warning("could not create init.root node: %m"); warning("could not create init.root node: %m");
return -1; return -1;
} }
#endif /* !defined(__minix) */
return 0; return 0;
} }
@ -1865,7 +1859,6 @@ createsysctlnode(void)
static int static int
shouldchroot(void) shouldchroot(void)
{ {
#if !defined(__minix)
struct sysctlnode node; struct sysctlnode node;
size_t len, cnt; size_t len, cnt;
int mib; int mib;
@ -1904,9 +1897,6 @@ shouldchroot(void)
return 0; return 0;
return 1; return 1;
#else
return 0;
#endif /* !defined(__minix) */
} }
#endif /* !LETS_GET_SMALL && CHROOT */ #endif /* !LETS_GET_SMALL && CHROOT */

View File

@ -331,14 +331,8 @@ callPack(pack_t *f, int n, u_long *numbers)
#ifdef KERN_DRIVERS #ifdef KERN_DRIVERS
static void static void
#if defined(__minix)
__dead
#endif /* defined(__minix) */
get_device_info(void) get_device_info(void)
{ {
#if defined(__minix)
err(1, "no kern.drivers on minix" );
#else
static int mib[2] = {CTL_KERN, KERN_DRIVERS}; static int mib[2] = {CTL_KERN, KERN_DRIVERS};
size_t len; size_t len;
@ -351,7 +345,6 @@ get_device_info(void)
err(1, "kern.drivers" ); err(1, "kern.drivers" );
num_drivers = len / sizeof *kern_drivers; num_drivers = len / sizeof *kern_drivers;
#endif /* defined(__minix) */
} }
static void static void

View File

@ -885,7 +885,7 @@ main(int argc, char **argv)
} }
if (!machine_arch) { if (!machine_arch) {
#if defined(MAKE_NATIVE) && !defined(__minix) #if defined(MAKE_NATIVE)
static char machine_arch_buf[sizeof(utsname.machine)]; static char machine_arch_buf[sizeof(utsname.machine)];
const int mib[2] = { CTL_HW, HW_MACHINE_ARCH }; const int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
size_t len = sizeof(machine_arch_buf); size_t len = sizeof(machine_arch_buf);

View File

@ -44,11 +44,7 @@ __RCSID("$NetBSD: uname.c,v 1.11 2011/09/06 18:35:13 joerg Exp $");
#include <unistd.h> #include <unistd.h>
#include <err.h> #include <err.h>
#if defined(__minix)
#include <string.h>
#else
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif /* !defined(__minix) */
#include <sys/utsname.h> #include <sys/utsname.h>
__dead static void usage(void); __dead static void usage(void);
@ -117,16 +113,12 @@ main(int argc, char **argv)
/* NOTREACHED */ /* NOTREACHED */
} }
if (print_mask & PRINT_MACHINE_ARCH) { if (print_mask & PRINT_MACHINE_ARCH) {
#if defined(__minix)
strlcpy(machine_arch, u.arch, sizeof(machine_arch));
#else
int mib[2] = { CTL_HW, HW_MACHINE_ARCH }; int mib[2] = { CTL_HW, HW_MACHINE_ARCH };
size_t len = sizeof (machine_arch); size_t len = sizeof (machine_arch);
if (sysctl(mib, sizeof (mib) / sizeof (mib[0]), machine_arch, if (sysctl(mib, sizeof (mib) / sizeof (mib[0]), machine_arch,
&len, NULL, 0) < 0) &len, NULL, 0) < 0)
err(EXIT_FAILURE, "sysctl"); err(EXIT_FAILURE, "sysctl");
#endif /* defined(__minix) */
} }
if (print_mask & PRINT_SYSNAME) { if (print_mask & PRINT_SYSNAME) {

View File

@ -144,9 +144,7 @@ main(int argc, char **argv)
char *memf, *nlistf, *usrnp; char *memf, *nlistf, *usrnp;
const char *options; const char *options;
time_t then; time_t then;
#if !defined(__minix)
size_t len; size_t len;
#endif /* !defined(__minix) */
#ifdef SUPPORT_UTMP #ifdef SUPPORT_UTMP
struct utmp *ut; struct utmp *ut;
#endif #endif
@ -216,11 +214,9 @@ main(int argc, char **argv)
(void)time(&now); (void)time(&now);
if (use_sysctl) { if (use_sysctl) {
#if !defined(__minix)
len = sizeof(curtain); len = sizeof(curtain);
if (sysctlbyname("security.curtain", &curtain, &len, if (sysctlbyname("security.curtain", &curtain, &len,
NULL, 0) == -1) NULL, 0) == -1)
#endif /* !defined(__minix) */
curtain = 0; curtain = 0;
} }
@ -482,12 +478,8 @@ pr_header(time_t *nowp, int nusers)
double avenrun[3]; double avenrun[3];
time_t uptime; time_t uptime;
int days, hrs, mins; int days, hrs, mins;
#if !defined(__minix)
int mib[2]; int mib[2];
size_t size, i; size_t size, i;
#else
size_t i;
#endif /* !defined(__minix) */
char buf[256]; char buf[256];
/* /*
@ -504,16 +496,12 @@ pr_header(time_t *nowp, int nusers)
* Print how long system has been up. * Print how long system has been up.
* (Found by looking getting "boottime" from the kernel) * (Found by looking getting "boottime" from the kernel)
*/ */
#if !defined(__minix)
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME; mib[1] = KERN_BOOTTIME;
size = sizeof(boottime); size = sizeof(boottime);
if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && if (sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 &&
boottime.tv_sec != 0) { boottime.tv_sec != 0) {
uptime = now - boottime.tv_sec; uptime = now - boottime.tv_sec;
#else
if (minix_getuptime(&uptime) != -1) {
#endif /* !defined(__minix) */
uptime += 30; uptime += 30;
if (uptime > SECSPERMIN) { if (uptime > SECSPERMIN) {
days = uptime / SECSPERDAY; days = uptime / SECSPERDAY;

View File

@ -60,11 +60,7 @@ main(int argc, char *argv[])
{ {
struct stat sb; struct stat sb;
size_t len; size_t len;
#if defined(__minix)
int ch;
#else
int ch, mib[2]; int ch, mib[2];
#endif /* defined(__minix) */
char *p, *std, path[MAXPATHLEN]; char *p, *std, path[MAXPATHLEN];
const char *t; const char *t;
int which = strcmp(getprogname(), "which") == 0; int which = strcmp(getprogname(), "which") == 0;
@ -102,18 +98,6 @@ main(int argc, char *argv[])
errx(1, "PATH environment variable is not set"); errx(1, "PATH environment variable is not set");
} else { } else {
/* Retrieve the standard path. */ /* Retrieve the standard path. */
#if defined(__minix)
/*
Note: This path is currently defined here and should probably be defined
here, in "ash" or in "sh".
To minimize code changes, the path has been hard coded into this file.
However, if this path needs to be used in other ported programs, please
move this define to <minix/paths.h> and add the include to this file
and all files that use _PATH_USER_CS_PATH.
*/
#define _PATH_USER_CS_PATH "/usr/X11R7/sbin:/usr/local/sbin:/usr/pkg/sbin:/usr/sbin:/sbin:/usr/X11R7/bin:/usr/local/bin:/usr/pkg/bin:/usr/bin:/bin:/usr/games"
std = strdup(_PATH_USER_CS_PATH);
#else
mib[0] = CTL_USER; mib[0] = CTL_USER;
mib[1] = USER_CS_PATH; mib[1] = USER_CS_PATH;
if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1) if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1)
@ -124,7 +108,6 @@ main(int argc, char *argv[])
err(1, NULL); err(1, NULL);
if (sysctl(mib, 2, std, &len, NULL, 0) == -1) if (sysctl(mib, 2, std, &len, NULL, 0) == -1)
err(1, "sysctl: user.cs_path"); err(1, "sysctl: user.cs_path");
#endif /* defined(__minix) */
} }
/* For each path, for each program... */ /* For each path, for each program... */

View File

@ -4025,10 +4025,6 @@ getLocalFQDN(void)
char *hostname; char *hostname;
size_t len; size_t len;
#ifdef __minix
len = MAXHOSTNAMELEN + 1;
#endif /* __minix */
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_HOSTNAME; mib[1] = KERN_HOSTNAME;
sysctl(mib, 2, NULL, &len, NULL, 0); sysctl(mib, 2, NULL, &len, NULL, 0);