xref: /illumos-gate/usr/src/uts/common/sys/utsname.h (revision dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28  * Use is subject to license terms.
29  */
30 
31 #ifndef _SYS_UTSNAME_H
32 #define	_SYS_UTSNAME_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 
36 #include <sys/feature_tests.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define	_SYS_NMLN	257	/* 4.0 size of utsname elements	*/
43 				/* Must be at least 257 to	*/
44 				/* support Internet hostnames.	*/
45 
46 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
47 #ifndef	SYS_NMLN
48 #define	SYS_NMLN	_SYS_NMLN
49 #endif
50 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
51 
52 struct utsname {
53 	char	sysname[_SYS_NMLN];
54 	char	nodename[_SYS_NMLN];
55 	char	release[_SYS_NMLN];
56 	char	version[_SYS_NMLN];
57 	char	machine[_SYS_NMLN];
58 };
59 
60 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
61 extern struct utsname utsname;
62 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
63 
64 #if !defined(_KERNEL)
65 
66 #if defined(__i386) && !defined(__amd64)
67 
68 #if defined(__STDC__)
69 
70 #if !defined(__lint)
71 static int uname(struct utsname *);
72 static int _uname(struct utsname *);
73 #else
74 extern int uname(struct utsname *);
75 extern int _uname(struct utsname *);
76 #endif
77 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
78 extern int nuname(struct utsname *);
79 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
80 extern int _nuname(struct utsname *);
81 
82 #else	/* defined(__STDC__) */
83 
84 #if !defined(__lint)
85 static int uname();
86 static int _uname();
87 #else
88 extern int uname();
89 extern int _uname();
90 #endif
91 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
92 extern int nuname();
93 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
94 extern int _nuname();
95 
96 #endif	/* defined(__STDC__) */
97 
98 
99 #if !defined(__lint)
100 static int
101 #if defined(__STDC__)
102 _uname(struct utsname *_buf)
103 #else
104 _uname(_buf)
105 struct utsname *_buf;
106 #endif
107 {
108 	return (_nuname(_buf));
109 }
110 
111 static int
112 #if defined(__STDC__)
113 uname(struct utsname *_buf)
114 #else
115 uname(_buf)
116 struct utsname *_buf;
117 #endif
118 {
119 	return (_nuname(_buf));
120 }
121 #endif /* !defined(__lint) */
122 
123 #else	/* defined(__i386) */
124 
125 #if defined(__STDC__)
126 extern int uname(struct utsname *);
127 #else
128 extern int uname();
129 #endif	/* (__STDC__) */
130 
131 #endif	/* defined(__i386) */
132 
133 #else	/* !(_KERNEL) */
134 /*
135  * Routine to retrieve the nodename as seen in the current process's zone.
136  */
137 extern char *uts_nodename(void);
138 #endif	/* !(_KERNEL) */
139 
140 #ifdef	__cplusplus
141 }
142 #endif
143 
144 #endif	/* _SYS_UTSNAME_H */
145