New module 'sys_utsname'.
[gnulib.git] / lib / sys_utsname.in.h
1 /* Substitute for <sys/utsname.h>.
2    Copyright (C) 2009 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17
18 #ifndef _GL_SYS_UTSNAME_H
19 #define _GL_SYS_UTSNAME_H
20
21 /* The definition of GL_LINK_WARNING is copied here.  */
22
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28
29 /* Length of the entries in 'struct utsname' is 256.  */
30 #define _UTSNAME_LENGTH 256
31
32 #ifndef _UTSNAME_NODENAME_LENGTH
33 # define _UTSNAME_NODENAME_LENGTH _UTSNAME_LENGTH
34 #endif
35 #ifndef _UTSNAME_SYSNAME_LENGTH
36 # define _UTSNAME_SYSNAME_LENGTH _UTSNAME_LENGTH
37 #endif
38 #ifndef _UTSNAME_RELEASE_LENGTH
39 # define _UTSNAME_RELEASE_LENGTH _UTSNAME_LENGTH
40 #endif
41 #ifndef _UTSNAME_VERSION_LENGTH
42 # define _UTSNAME_VERSION_LENGTH _UTSNAME_LENGTH
43 #endif
44 #ifndef _UTSNAME_MACHINE_LENGTH
45 # define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH
46 #endif
47
48 /* Structure describing the system and machine.  */
49 struct utsname
50   {
51     /* Name of this node on the network.  */
52     char nodename[_UTSNAME_NODENAME_LENGTH];
53
54     /* Name of the implementation of the operating system.  */
55     char sysname[_UTSNAME_SYSNAME_LENGTH];
56     /* Current release level of this implementation.  */
57     char release[_UTSNAME_RELEASE_LENGTH];
58     /* Current version level of this release.  */
59     char version[_UTSNAME_VERSION_LENGTH];
60
61     /* Name of the hardware type the system is running on.  */
62     char machine[_UTSNAME_MACHINE_LENGTH];
63   };
64
65
66 #if @GNULIB_UNAME@
67 # if !@HAVE_UNAME@
68 extern int uname (struct utsname *buf);
69 # endif
70 #elif defined GNULIB_POSIXCHECK
71 # undef uname
72 # define uname(b) \
73     (GL_LINK_WARNING ("uname is unportable - " \
74                       "use gnulib module uname for portability"), \
75      uname (b))
76 #endif
77
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83
84 #endif /* _GL_SYS_UTSNAME_H */