summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-03-24 04:40:49 +0000
committerpeter <peter@FreeBSD.org>2001-03-24 04:40:49 +0000
commit8de1f8b9b5ad238cf0a9754e92d09f719f81ef03 (patch)
tree8775ee28f9284ae7ffe716c67b5f3f80e03d2f91 /sys
parentf9d1d96367a9e1830ed904b9e98409637499361c (diff)
downloadFreeBSD-src-8de1f8b9b5ad238cf0a9754e92d09f719f81ef03.zip
FreeBSD-src-8de1f8b9b5ad238cf0a9754e92d09f719f81ef03.tar.gz
This is kind of a hack, but it should work. Currently, world is broken
because libc/rpc/key_call.c references uname(), and ps/print.c also defines uname(), and ps is linked statically. This leads to a symbol clash. The userland uname(3) kinda sucked anyway as the hostname etc was too short. And since the libc rpc interface now uses the utsname.nodename which gets truncated, I was tempted into doing something about it. Create a new userland uname function, called __xuname() which takes an extra argument that allows you to change the size of the fields. uname() becomes a static inline function in sys/utsname.h that passes the extra argument in. struct utsname has its field members expanded by default now in userland. We still provide a 'uname' externally linkable function for things that either think that they ``know'' the utsname format and assume 32 character strings and bypass the include file, or objects that are linked against old libcs. ie: just about every plausible case that I can think of is covered. Should we ever change the default lengths again, a libc major bump should not be required as the size is now passed to the function. XXX the uname(2) in the kernel is for FreeBSD 1.1 binary compatability! All the uname(3) functions that are exported to userland are actually implemented in libc with sysctl. uname(1) uses sysctl directly and does not call uname(3). PR: bin/4688
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_xxx.c8
-rw-r--r--sys/sys/utsname.h16
2 files changed, 22 insertions, 2 deletions
diff --git a/sys/kern/kern_xxx.c b/sys/kern/kern_xxx.c
index 5009db2..4738aa1 100644
--- a/sys/kern/kern_xxx.c
+++ b/sys/kern/kern_xxx.c
@@ -138,6 +138,14 @@ oquota(p, uap)
}
#endif /* COMPAT_43 */
+/*
+ * This is the FreeBSD-1.1 compatable uname(2) interface. These
+ * days it is done in libc as a wrapper around a bunch of sysctl's.
+ * This must maintain the old 1.1 binary ABI.
+ */
+#if SYS_NMLN != 32
+#error "FreeBSD-1.1 uname syscall has been broken"
+#endif
#ifndef _SYS_SYSPROTO_H_
struct uname_args {
struct utsname *name;
diff --git a/sys/sys/utsname.h b/sys/sys/utsname.h
index 7c8b9b8..b32bdfa 100644
--- a/sys/sys/utsname.h
+++ b/sys/sys/utsname.h
@@ -40,7 +40,13 @@
#ifndef _SYS_UTSNAME_H
#define _SYS_UTSNAME_H
-#define SYS_NMLN 32
+#ifdef _KERNEL
+#define SYS_NMLN 32 /* uname(2) is FreeBSD 1.1 compatable */
+#endif
+
+#ifndef SYS_NMLN
+#define SYS_NMLN 256 /* Ask and ye shall receive */
+#endif
struct utsname {
char sysname[SYS_NMLN]; /* Name of this OS. */
@@ -54,8 +60,14 @@ struct utsname {
#ifndef _KERNEL
__BEGIN_DECLS
-int uname __P((struct utsname *));
+int __xuname(int, void *); /* Variable record size */
__END_DECLS
+
+static __inline int
+uname(struct utsname *name)
+{
+ return __xuname(SYS_NMLN, (void *)name);
+}
#endif /* _KERNEL */
#endif /* !_SYS_UTSNAME_H */
OpenPOWER on IntegriCloud