From efd0f91f512d544fb87389a9dc1f249067c3da52 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Mon, 24 Jul 2017 09:27:13 +0300 Subject: [PATCH] uname.2: replace with version based on openbsd uname.3 --- lib/libc/Makefile | 6 ++-- lib/libc/uname.2 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ share/man/man2/Makefile | 1 - share/man/man2/uname.2 | 85 -------------------------------------------- 4 files changed, 96 insertions(+), 89 deletions(-) create mode 100644 lib/libc/uname.2 delete mode 100644 share/man/man2/uname.2 diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 59ed5b74ab..a8c7b68329 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -1,7 +1,7 @@ MAN= accept.2 bind.2 connect.2 getpeername.2 getsockname.2 getsockopt.2 \ - listen.2 recv.2 send.2 shutdown.2 socket.2 socketpair.2 CMSG_DATA.3 \ - alloca.3 err.3 fts.3 malloc.3 readdir.3 sockatmark.3 posix_memalign.3 \ - valloc.3 unvis.3 vis.3 + listen.2 recv.2 send.2 shutdown.2 socket.2 socketpair.2 uname.2 \ + CMSG_DATA.3 alloca.3 err.3 fts.3 malloc.3 readdir.3 sockatmark.3 \ + posix_memalign.3 valloc.3 unvis.3 vis.3 # no source yet. NOOBJ= diff --git a/lib/libc/uname.2 b/lib/libc/uname.2 new file mode 100644 index 0000000000..a1d35ce00c --- /dev/null +++ b/lib/libc/uname.2 @@ -0,0 +1,93 @@ +.\" $OpenBSD: uname.3,v 1.15 2014/01/21 03:15:45 schwarze Exp $ +.\" +.\" Copyright (c) 1994 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd $Mdocdate: January 21 2014 $ +.Dt UNAME 2 +.Os +.Sh NAME +.Nm uname +.Nd get system identification +.Sh SYNOPSIS +.In sys/utsname.h +.Ft int +.Fn uname "struct utsname *name" +.Sh DESCRIPTION +The +.Fn uname +function stores NUL-terminated strings of information identifying +the current system into the structure referenced by +.Fa name . +.Pp +The +.Li utsname +structure is defined in the +.In sys/utsname.h +header file, and contains the following members: +.Pp +.Bl -tag -width nodenameXXXX -offset indent -compact +.It Fa sysname +Name of the operating system implementation. +.It Fa nodename +Network name of this machine. +.It Fa release +Release level of the operating system. +.It Fa version +Version level of the operating system. +.It Fa machine +Machine hardware platform. +.El +.Sh RETURN VALUES +The +.Fn uname +function returns a non-negative value if successful; +otherwise the value -1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn uname +function will fail if: +.Bl -tag -width Er +.It Bq Er EFAULT +.Fa name +contains an invalid address. +.El +.Sh SEE ALSO +.Xr uname 1 , +.Xr puname 1 +.Sh STANDARDS +The +.Fn uname +function conforms to +.St -p1003.1-88 . +.Sh HISTORY +The +.Fn uname +function first appeared in +.Bx 4.4 . diff --git a/share/man/man2/Makefile b/share/man/man2/Makefile index b62a7c4b73..900a2f99b4 100644 --- a/share/man/man2/Makefile +++ b/share/man/man2/Makefile @@ -128,7 +128,6 @@ MAN = Intro.2 \ ulimit.2 \ umask.2 \ umount.2 \ - uname.2 \ unlink.2 \ ustat.2 \ utime.2 \ diff --git a/share/man/man2/uname.2 b/share/man/man2/uname.2 deleted file mode 100644 index 3006877357..0000000000 --- a/share/man/man2/uname.2 +++ /dev/null @@ -1,85 +0,0 @@ -'\" te -.\" Copyright 1989 AT&T Copyright (c) 1999, Sun Microsystems, Inc. All Rights Reserved -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH UNAME 2 "Jul 21, 1999" -.SH NAME -uname \- get name of current operating system -.SH SYNOPSIS -.LP -.nf -#include - -\fBint\fR \fBuname\fR(\fBstruct utsname *\fR\fIname\fR); -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBuname()\fR function stores information identifying the current operating -system in the structure pointed to by \fIname\fR. -.sp -.LP -The \fBuname()\fR function uses the \fButsname\fR structure, defined in -<\fBsys/utsname.h\fR>, whose members include: -.sp -.in +2 -.nf -char sysname[SYS_NMLN]; -char nodename[SYS_NMLN]; -char release[SYS_NMLN]; -char version[SYS_NMLN]; -char machine[SYS_NMLN]; -.fi -.in -2 - -.sp -.LP -The \fBuname()\fR function returns a null-terminated character string naming -the current operating system in the character array \fBsysname\fR. Similarly, -the \fBnodename\fR member contains the name by which the system is known on a -communications network. The \fBrelease\fR and \fBversion\fR members further -identify the operating system. The \fBmachine\fR member contains a standard -name that identifies the hardware on which the operating system is running. -.SH RETURN VALUES -.sp -.LP -Upon successful completion, a non-negative value is returned. Otherwise, -\fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the error. -.SH ERRORS -.sp -.LP -The \fBuname()\fR function will fail if: -.sp -.ne 2 -.na -\fB\fBEFAULT\fR\fR -.ad -.RS 10n -The \fIname\fR argument points to an illegal address. -.RE - -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -Interface Stability Standard -_ -MT-Level Async-Signal-Safe -.TE - -.SH SEE ALSO -.sp -.LP -\fBuname\fR(1), \fBsysinfo\fR(2), \fBsysconf\fR(3C), \fBattributes\fR(5), -\fBstandards\fR(5) -- 2.11.4.GIT