Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/uname.html
2024-02-19 00:21:47 -05:00

134 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>uname</title>
</head>
<body bgcolor="white">
<basefont size="3"> <a name="uname"></a> <a name="tag_03_799"></a><!-- uname -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_799_01"></a>NAME</h4>
<blockquote>uname - get the name of the current system</blockquote>
<h4><a name="tag_03_799_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;<a href="../basedefs/sys/utsname.h.html">sys/utsname.h</a>&gt;<br>
<br>
int uname(struct utsname *</tt><i>name</i><tt>);<br>
</tt></code></p>
</blockquote>
<h4><a name="tag_03_799_03"></a>DESCRIPTION</h4>
<blockquote>
<p>The <i>uname</i>() function shall store information identifying the current system in the structure pointed to by
<i>name</i>.</p>
<p>The <i>uname</i>() function uses the <b>utsname</b> structure defined in <a href=
"../basedefs/sys/utsname.h.html"><i>&lt;sys/utsname.h&gt;</i></a>.</p>
<p>The <i>uname</i>() function shall return a string naming the current system in the character array <i>sysname</i>. Similarly,
<i>nodename</i> shall contain the name of this node within an implementation-defined communications network. The arrays
<i>release</i> and <i>version</i> shall further identify the operating system. The array <i>machine</i> shall contain a name that
identifies the hardware that the system is running on.</p>
<p>The format of each member is implementation-defined.</p>
</blockquote>
<h4><a name="tag_03_799_04"></a>RETURN VALUE</h4>
<blockquote>
<p>Upon successful completion, a non-negative value shall be returned. Otherwise, -1 shall be returned and <i>errno</i> set to
indicate the error.</p>
</blockquote>
<h4><a name="tag_03_799_05"></a>ERRORS</h4>
<blockquote>
<p>No errors are defined.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_799_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_799_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>The inclusion of the <i>nodename</i> member in this structure does not imply that it is sufficient information for interfacing
to communications networks.</p>
</blockquote>
<h4><a name="tag_03_799_08"></a>RATIONALE</h4>
<blockquote>
<p>The values of the structure members are not constrained to have any relation to the version of this volume of
IEEE&nbsp;Std&nbsp;1003.1-2001 implemented in the operating system. An application should instead depend on _POSIX_VERSION and
related constants defined in <a href="../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a>.</p>
<p>This volume of IEEE&nbsp;Std&nbsp;1003.1-2001 does not define the sizes of the members of the structure and permits them to be
of different sizes, although most implementations define them all to be the same size: eight bytes plus one byte for the string
terminator. That size for <i>nodename</i> is not enough for use with many networks.</p>
<p>The <i>uname</i>() function originated in System III, System V, and related implementations, and it does not exist in Version 7
or 4.3 BSD. The values it returns are set at system compile time in those historical implementations.</p>
<p>4.3 BSD has <a href="../functions/gethostname.html"><i>gethostname</i>()</a> and <a href=
"../functions/gethostid.html"><i>gethostid</i>()</a>, which return a symbolic name and a numeric value, respectively. There are
related <i>sethostname</i>() and <i>sethostid</i>() functions that are used to set the values the other two functions return. The
former functions are included in this specification, the latter are not.</p>
</blockquote>
<h4><a name="tag_03_799_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_799_10"></a>SEE ALSO</h4>
<blockquote>
<p>The Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href=
"../basedefs/sys/utsname.h.html"><i>&lt;sys/utsname.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_799_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>