Now that uname(3) uses sysctl(2), we no longer need sysuname(2).
Backward compatibility is retained for old statically linked
binaries for a short while.
Also remove the now-obsolete MINIX3-specific "arch" field from the
utsname structure. While this is an ABI break at the libc level,
it should pose no problems in practice, because:
- statically linked programs (i.e., all of the base system) are not
affected, as they will use headers synchronized with libc;
- the structure is getting smaller, thus, older dynamically linked
programs (typically in pkgsrc) using the new libc will end up with
garbage in the "arch" field, but it is unlikely they will use this
field anyway, since it was specific to MINIX3;
- new dynamically linked programs using an old libc could end up with
memory corruption, but this is not a scenario that is expected to
occur in the first place - certainly not with programs from pkgsrc.
Change-Id: I29c76576f509feacc8f996f0bd353ca8961d4917
}
if (do_hostname)
{
-#if __minix_vmd
- if (sysuname(_UTS_SET, _UTS_NODENAME,
- nodename, strlen(nodename)+1) == -1)
- {
- fprintf(stderr, "%s: Unable to set nodename: %s\n",
- prog_name, strerror(errno));
- exit(1);
- }
-
- if (sysuname(_UTS_SET, _UTS_HOSTNAME,
- hostname, strlen(hostname)+1) == -1)
- {
- fprintf(stderr, "%s: Unable to set hostname: %s\n",
- prog_name, strerror(errno));
- exit(1);
- }
-#else
FILE *fp;
if ((fp= fopen("/etc/hostname.file", "w")) == NULL
prog_name, strerror(errno));
exit(1);
}
-#endif
}
if (!first_print) printf("\n");
exit(0);
#define PM_SIGPENDING (PM_BASE + 22)
#define PM_SIGPROCMASK (PM_BASE + 23)
#define PM_SIGRETURN (PM_BASE + 24)
-#define PM_SYSUNAME (PM_BASE + 25)
+#define PM_SYSUNAME (PM_BASE + 25) /* obsolete */
#define PM_GETPRIORITY (PM_BASE + 26)
#define PM_SETPRIORITY (PM_BASE + 27)
#define PM_GETTIMEOFDAY (PM_BASE + 28)
vectorio.c shutdown.c sigaction.c sigpending.c sigreturn.c sigsuspend.c\
sigprocmask.c socket.c socketpair.c stat.c statvfs.c svrctl.c \
symlink.c \
- sync.c syscall.c sysuname.c truncate.c umask.c unlink.c \
+ sync.c syscall.c truncate.c umask.c unlink.c \
wait4.c write.c \
utimensat.c utimes.c futimes.c lutimes.c futimens.c \
_exit.c _ucontext.c environ.c __getcwd.c vfork.c sizeup.c init.c \
+++ /dev/null
-/* sysuname(2) - transfer uname(3) strings. Author: Kees J. Bot
- * 5 Dec 1992
- */
-
-#include <sys/cdefs.h>
-#include "namespace.h"
-#include <lib.h>
-#include <string.h>
-#include <sys/utsname.h>
-
-int sysuname(int req, int field, char *value, size_t len)
-{
- message m;
-
- memset(&m, 0, sizeof(m));
- m.m_lc_pm_sysuname.req = req;
- m.m_lc_pm_sysuname.field = field;
- m.m_lc_pm_sysuname.len = len;
- m.m_lc_pm_sysuname.value = (vir_bytes)value;
-
- return _syscall(PM_PROC_NR, PM_SYSUNAME, &m);
-}
-
-/*
- * $PchId: _sysuname.c,v 1.4 1995/11/27 19:42:09 philip Exp $
- */
#include "mproc.h"
#include "kernel/proc.h"
+/* START OF COMPATIBILITY BLOCK */
struct utsname uts_val = {
OS_NAME, /* system name */
"noname", /* node/network name */
OS_VERSION, /* O.S. version (e.g. Minix 3.3.0 (GENERIC)) */
#if defined(__i386__)
"i386", /* machine (cpu) type */
- "i386", /* architecture */
#elif defined(__arm__)
- "earm", /* machine (cpu) type */
- "earm", /* architecture */
+ "evbarm", /* machine (cpu) type */
#else
#error /* oops, no 'uname -mk' */
#endif
};
static char *uts_tbl[] = {
- uts_val.arch,
+#if defined(__i386__)
+ "i386", /* architecture */
+#elif defined(__arm__)
+ "evbarm", /* architecture */
+#endif
NULL, /* No kernel architecture */
uts_val.machine,
NULL, /* No hostname */
uts_val.sysname,
NULL, /* No bus */ /* No bus */
};
+/* END OF COMPATIBILITY BLOCK */
#if ENABLE_SYSCALL_STATS
unsigned long calls_stats[NR_PM_CALLS];
#endif
+/* START OF COMPATIBILITY BLOCK */
/*===========================================================================*
* do_sysuname *
*===========================================================================*/
int r;
size_t n;
char *string;
-#if 0 /* for updates */
- char tmp[sizeof(uts_val.nodename)];
- static short sizes[] = {
- 0, /* arch, (0 = read-only) */
- 0, /* kernel */
- 0, /* machine */
- 0, /* sizeof(uts_val.hostname), */
- sizeof(uts_val.nodename),
- 0, /* release */
- 0, /* version */
- 0, /* sysname */
- };
-#endif
- if (m_in.m_lc_pm_sysuname.field >= _UTS_MAX) return(EINVAL);
+ if (m_in.m_lc_pm_sysuname.field >= __arraycount(uts_tbl)) return(EINVAL);
string = uts_tbl[m_in.m_lc_pm_sysuname.field];
if (string == NULL)
return EINVAL; /* Unsupported field */
switch (m_in.m_lc_pm_sysuname.req) {
- case _UTS_GET:
+ case 0:
/* Copy an uname string to the user. */
n = strlen(string) + 1;
if (n > m_in.m_lc_pm_sysuname.len) n = m_in.m_lc_pm_sysuname.len;
if (r < 0) return(r);
break;
-#if 0 /* no updates yet */
- case _UTS_SET:
- /* Set an uname string, needs root power. */
- len = sizes[m_in.m_lc_pm_sysuname.field];
- if (mp->mp_effuid != 0 || len == 0) return(EPERM);
- n = len < m_in.m_lc_pm_sysuname.len ? len : m_in.m_lc_pm_sysuname.len;
- if (n <= 0) return(EINVAL);
- r = sys_datacopy(mp->mp_endpoint, m_in.m_lc_pm_sysuname.value, SELF,
- (phys_bytes)tmp, (phys_bytes)n);
- if (r < 0) return(r);
- tmp[n-1] = 0;
- strcpy(string, tmp);
- break;
-#endif
-
default:
return(EINVAL);
}
/* Return the number of bytes moved. */
return(n);
}
+/* END OF COMPATIBILITY BLOCK */
/*===========================================================================*
}
}
-static void
-put_sysuname_field(struct trace_proc * proc, const char * name, int field)
-{
- const char *text = NULL;
-
- if (!valuesonly) {
- switch (field) {
- TEXT(_UTS_ARCH);
- TEXT(_UTS_KERNEL);
- TEXT(_UTS_MACHINE);
- TEXT(_UTS_HOSTNAME);
- TEXT(_UTS_NODENAME);
- TEXT(_UTS_RELEASE);
- TEXT(_UTS_VERSION);
- TEXT(_UTS_SYSNAME);
- TEXT(_UTS_BUS);
- }
- }
-
- if (text != NULL)
- put_field(proc, name, text);
- else
- put_value(proc, name, "%d", field);
-}
-
-static int
-pm_sysuname_out(struct trace_proc * proc, const message * m_out)
-{
-
- if (!valuesonly && m_out->m_lc_pm_sysuname.req == _UTS_GET)
- put_field(proc, "req", "_UTS_GET");
- else if (!valuesonly && m_out->m_lc_pm_sysuname.req == _UTS_SET)
- put_field(proc, "req", "_UTS_SET");
- else
- put_value(proc, "req", "%d", m_out->m_lc_pm_sysuname.req);
- put_sysuname_field(proc, "field", m_out->m_lc_pm_sysuname.field);
-
- if (m_out->m_lc_pm_sysuname.req == _UTS_GET)
- return CT_NOTDONE;
-
- put_buf(proc, "value", PF_STRING, m_out->m_lc_pm_sysuname.value,
- m_out->m_lc_pm_sysuname.len);
- put_value(proc, "len", "%zu", m_out->m_lc_pm_sysuname.len);
- return CT_DONE;
-}
-
-static void
-pm_sysuname_in(struct trace_proc * proc, const message * m_out,
- const message * m_in, int failed)
-{
-
- if (m_out->m_lc_pm_sysuname.req == _UTS_GET) {
- put_buf(proc, "value", failed | PF_STRING,
- m_out->m_lc_pm_sysuname.value, m_in->m_type);
- put_value(proc, "len", "%zu", m_out->m_lc_pm_sysuname.len);
- put_equals(proc);
- }
- put_result(proc);
-}
-
static void
put_priority_which(struct trace_proc * proc, const char * name, int which)
{
pm_sigprocmask_in),
PM_CALL(SIGRETURN) = HANDLER("sigreturn", pm_sigreturn_out,
pm_sigreturn_in),
- PM_CALL(SYSUNAME) = HANDLER("sysuname", pm_sysuname_out,
- pm_sysuname_in),
PM_CALL(GETPRIORITY) = HANDLER("getpriority", pm_getpriority_out,
pm_getpriority_in),
PM_CALL(SETPRIORITY) = HANDLER("setpriority", pm_setpriority_out,
char release[_SYS_NMLN]; /* Release level. */
char version[_SYS_NMLN]; /* Version level. */
char machine[_SYS_NMLN]; /* Hardware type. */
-#if defined(__minix)
- char arch[_SYS_NMLN];
-#endif /* defined(__minix) */
};
#include <sys/cdefs.h>
__BEGIN_DECLS
int uname(struct utsname *);
-#if defined(__minix)
-#include <sys/types.h>
-int sysuname(int _req, int _field, char *_value, size_t _len);
-#endif /* defined(__minix) */
__END_DECLS
-#if defined(__minix)
-/* req: Get or set a string. */
-#define _UTS_GET 0
-#define _UTS_SET 1
-
-/* field: What field to get or set. These values can't be changed lightly. */
-#define _UTS_ARCH 0
-#define _UTS_KERNEL 1
-#define _UTS_MACHINE 2
-#define _UTS_HOSTNAME 3
-#define _UTS_NODENAME 4
-#define _UTS_RELEASE 5
-#define _UTS_VERSION 6
-#define _UTS_SYSNAME 7
-#define _UTS_BUS 8
-#define _UTS_MAX 9 /* Number of strings. */
-#endif /* defined(__minix) */
-
#endif /* !_SYS_UTSNAME_H_ */