d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / libphobos / libdruntime / core / sys / posix / sys / utsname.d
blob5de50aca4654c8fc94eb0b3edb0a5bed6db67eba
2 // Interface to <sys/utsname.h>
4 module core.sys.posix.sys.utsname;
6 version (OSX)
7 version = Darwin;
8 else version (iOS)
9 version = Darwin;
10 else version (TVOS)
11 version = Darwin;
12 else version (WatchOS)
13 version = Darwin;
15 version (Posix):
16 extern(C):
17 nothrow:
18 @nogc:
20 version (CRuntime_Glibc)
22 private enum utsNameLength = 65;
24 struct utsname
26 char[utsNameLength] sysname = 0;
27 char[utsNameLength] nodename = 0;
28 char[utsNameLength] release = 0;
29 char[utsNameLength] version_ = 0;
30 // TODO Deprecate after version_ has been in an official release.
31 alias update = version_;
32 char[utsNameLength] machine = 0;
34 char[utsNameLength] __domainname = 0;
37 int uname(utsname* __name);
39 else version (Darwin)
41 private enum utsNameLength = 256;
43 struct utsname
45 char[utsNameLength] sysname = 0;
46 char[utsNameLength] nodename = 0;
47 char[utsNameLength] release = 0;
48 char[utsNameLength] version_ = 0;
49 // TODO Deprecate after version_ has been in an official release.
50 alias update = version_;
51 char[utsNameLength] machine = 0;
54 int uname(utsname* __name);
56 else version (FreeBSD)
58 //private enum SYS_NMLN = 32; // old FreeBSD 1.1 ABI
59 private enum SYS_NMLN = 256;
61 struct utsname
63 char[SYS_NMLN] sysname = 0;
64 char[SYS_NMLN] nodename = 0;
65 char[SYS_NMLN] release = 0;
66 char[SYS_NMLN] version_ = 0;
67 // TODO Deprecate after version_ has been in an official release.
68 alias update = version_;
69 char[SYS_NMLN] machine = 0;
72 int __xuname(int, void*);
73 int uname()(utsname* __name) { return __xuname(SYS_NMLN, cast(void*) __name); }
75 else version (NetBSD)
77 private enum utsNameLength = 256;
79 struct utsname
81 char[utsNameLength] sysname = 0;
82 char[utsNameLength] nodename = 0;
83 char[utsNameLength] release = 0;
84 char[utsNameLength] version_ = 0;
85 // TODO Deprecate after version_ has been in an official release.
86 alias update = version_;
87 char[utsNameLength] machine = 0;
90 int uname(utsname* __name);
92 else version (OpenBSD)
94 private enum utsNameLength = 256;
96 struct utsname
98 char[utsNameLength] sysname = 0;
99 char[utsNameLength] nodename = 0;
100 char[utsNameLength] release = 0;
101 char[utsNameLength] version_ = 0;
102 char[utsNameLength] machine = 0;
105 int uname(utsname* __name);
107 else version (DragonFlyBSD)
109 private enum utsNameLength = 32;
111 struct utsname
113 char[utsNameLength] sysname = 0;
114 char[utsNameLength] nodename = 0;
115 char[utsNameLength] release = 0;
116 char[utsNameLength] version_ = 0;
117 // TODO Deprecate after version_ has been in an official release.
118 alias update = version_;
119 char[utsNameLength] machine = 0;
122 int uname(utsname* __name);
124 else version (Solaris)
126 private enum SYS_NMLN = 257;
128 struct utsname
130 char[SYS_NMLN] sysname = 0;
131 char[SYS_NMLN] nodename = 0;
132 char[SYS_NMLN] release = 0;
133 // The field name is version but version is a keyword in D.
134 char[SYS_NMLN] _version = 0;
135 char[SYS_NMLN] machine = 0;
138 int uname(utsname* __name);
140 else version (CRuntime_Bionic)
142 private enum SYS_NMLN = 65;
144 struct utsname
146 char[SYS_NMLN] sysname = 0;
147 char[SYS_NMLN] nodename = 0;
148 char[SYS_NMLN] release = 0;
149 // The field name is version but version is a keyword in D.
150 char[SYS_NMLN] _version = 0;
151 char[SYS_NMLN] machine = 0;
152 char[SYS_NMLN] domainname = 0;
155 int uname(utsname*);
157 else version (CRuntime_Musl)
159 private enum SYS_NMLN = 65;
161 struct utsname
163 char[SYS_NMLN] sysname = 0;
164 char[SYS_NMLN] nodename = 0;
165 char[SYS_NMLN] release = 0;
166 char[SYS_NMLN] _version = 0;
167 char[SYS_NMLN] machine = 0;
168 char[SYS_NMLN] domainname = 0;
171 int uname(utsname*);
173 else version (CRuntime_UClibc)
175 private enum utsNameLength = 65;
177 struct utsname
179 char[utsNameLength] sysname = 0;
180 char[utsNameLength] nodename = 0;
181 char[utsNameLength] release = 0;
182 char[utsNameLength] version_ = 0;
183 char[utsNameLength] machine = 0;
184 char[utsNameLength] domainname = 0;
187 int uname(utsname*);
189 else
191 static assert(false, "unsupported system");