1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" 2007-07-05 mtk: Added details on underlying system call interfaces
25 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
26 .\" all rights reserved.
27 .\" Translated Thu Jun 26 21:23:19 JST 1997
28 .\" by SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
29 .\" Updated & Modified Thu Feb 14 21:53:41 JST 2002
30 .\" by Yuichi SATO <ysato@h4.dion.ne.jp>
31 .\" Updated 2007-09-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.64
33 .TH UNAME 2 2008-12-03 "Linux" "Linux Programmer's Manual"
36 .\"O uname \- get name and information about current kernel
37 uname \- 現在稼働中のカーネルについての名前と情報を得る
40 .B #include <sys/utsname.h>
42 .BI "int uname(struct utsname *" buf );
46 .\"O returns system information in the structure pointed to by
54 .\"O struct is defined in
55 .\"O .IR <sys/utsname.h> :
64 .\"O char sysname[]; /* Operating system name (e.g., "Linux") */
65 .\"O char nodename[]; /* Name within "some implementation-defined
67 .\"O char release[]; /* OS release (e.g., "2.6.28") */
68 .\"O char version[]; /* OS version */
69 .\"O char machine[]; /* Hardware identifier */
70 char sysname[]; /* OS の名前 (例: "Linux") */
71 char nodename[]; /* 「実装時に定義された、何らかの
73 char release[]; /* OS のリリース (例: "2.6.28") */
74 char version[]; /* OS のバージョン */
75 char machine[]; /* ハードウェア識別子 */
77 .\"O char domainname[]; /* NIS or YP domain name */
78 char domainname[]; /* NIS や YP のドメイン名 */
84 .\"O The length of the arrays in a
85 .\"O .I struct utsname
86 .\"O is unspecified (see NOTES);
87 .\"O the fields are terminated by a null byte (\(aq\\0\(aq).
89 にある配列の長さは指定されていない (「注意」の節を参照)。
90 フィールドは NULL バイト (\(aq\\0\(aq) で終端される。
91 .\"O .SH "RETURN VALUE"
93 .\"O On success, zero is returned.
94 .\"O On error, \-1 is returned, and
96 .\"O is set appropriately.
97 成功した場合 0 が返る。失敗した場合 \-1 が返り、
108 .\"O .SH "CONFORMING TO"
120 .\"O member (the NIS or YP domain name) is a GNU extension.
122 メンバー (NIS または YP ドメイン名) は GNU の拡張である。
125 .\"O This is a system call, and the operating system presumably knows
126 .\"O its name, release and version.
127 .\"O It also knows what hardware it runs on.
128 .\"O So, four of the fields of the struct are meaningful.
129 これはシステムコールであり、OS は名前・リリース・バージョンなどを
131 さらにそれが稼働しているハードウェアも分かっているだろう。
132 よって構造体の 4 つのフィールドには意味がある。
133 .\"O On the other hand, the field \fInodename\fP is meaningless:
134 .\"O it gives the name of the present machine in some undefined
135 .\"O network, but typically machines are in more than one network
136 .\"O and have several names.
137 .\"O Moreover, the kernel has no way of knowing
138 .\"O about such things, so it has to be told what to answer here.
139 .\"O The same holds for the additional \fIdomainname\fP field.
140 一方、\fInodename\fP フィールドには意味がない:
141 このフィールドは現在のマシンの (定義されていない)
142 どこかのネットワークにおける名前を与えるが、
143 通常マシンは複数のネットワークに属し、複数の名前を持つ。
144 さらに、カーネルはこのような情報を知る術を持たないので、
145 ここでの答えは前もって教えてやらなければならない。
146 これは追加フィールドである \fIdomainname\fP についても同様である。
148 .\"O To this end Linux uses the system calls
149 .\"O .BR sethostname (2)
151 .\"O .BR setdomainname (2).
155 .BR setdomainname (2)
157 .\"O Note that there is no standard that says that the hostname set by
158 .\"O .BR sethostname (2)
159 .\"O is the same string as the \fInodename\fP field of the struct returned by
161 .RB 「 sethostname (2)
164 で返される構造体の \fInodename\fP フィールドと同じ文字列である」
166 .\"O (indeed, some systems allow a 256-byte hostname and an 8-byte nodename),
167 .\"O but this is true on Linux.
168 .\"O The same holds for
169 .\"O .BR setdomainname (2)
170 .\"O and the \fIdomainname\fP field.
171 (実際、256 バイトのホスト名と 8 バイトのノード名を許可しているシステムもある)。
172 しかし、Linux では同じ文字列が返される。
173 .BR setdomainname (2)
174 と \fIdomainname\fP フィールドについても同じことが成り立つ。
176 .\"O The length of the fields in the struct varies.
177 .\"O Some operating systems
178 .\"O or libraries use a hardcoded 9 or 33 or 65 or 257.
179 .\"O Other systems use
186 .\"O .BR _UTSNAME_LENGTH .
187 .\"O Clearly, it is a bad
188 .\"O idea to use any of these constants; just use sizeof(...).
189 .\"O Often 257 is chosen in order to have room for an internet hostname.
190 構造体のフィールドの長さはさまざまである。
192 ハードコードされた 9, 33, 65, 257 などの値を使っているものもある。
199 はっきり言って、これらの定数を使うのは悪い考え方であり、
200 sizeof(...) を使うべきである。
201 インターネットホスト名で使う領域を持たせるために、
204 .\"O Part of the utsname information is also accessible via
205 .\"O .IR /proc/sys/kernel/ { ostype ,
209 .\"O .IR domainname }.
211 .IR /proc/sys/kernel/ { ostype ,
217 .\"O .SS Underlying kernel interface
220 .\"O Over time, increases in the size of the
222 .\"O structure have led to three successive versions of
229 .\"O .IR sys_olduname ()
231 .\"O .IR __NR_oldolduname ),
232 .\"O .IR sys_uname ()
234 .\"O .IR __NR_olduname ),
236 .\"O .IR sys_newuname ()
238 .\"O .IR __NR_uname) .
241 .IR __NR_oldolduname )、
249 .\"O .\" That was back before Linux 1.0
250 .\"O used length 9 for all fields;
252 .\"O .\" That was also back before Linux 1.0
254 .\"O the third also uses 65 but adds the \fIdomainname\fP field.
256 .\" これは Linux 1.0 より前に遡る話である。
257 はすべてのフィールドが長さ 9 を使っていた。
259 .\" これも Linux 1.0 より前に遡る話である。
263 \fIdomainname\fP フィールドが追加されている。
266 .\"O wrapper function hides these details from applications,
267 .\"O invoking the most recent version of the system call provided by the kernel.
270 ラッパー関数は、これらの詳細をアプリケーションから隠蔽し、
271 カーネルが提供しているシステムコールのうち最新のバージョンを起動する。
275 .BR getdomainname (2),