7979#[ cfg( test) ] extern crate test;
8080#[ cfg( test) ] extern crate native;
8181
82- // Initial glob-exports mean that all the contents of all the modules
83- // wind up exported, if you're interested in writing platform-specific code.
84-
85- pub use types:: common:: c95:: * ;
86- pub use types:: common:: c99:: * ;
87- pub use types:: common:: posix88:: * ;
88- pub use types:: common:: posix01:: * ;
89- pub use types:: common:: posix08:: * ;
90- pub use types:: common:: bsd44:: * ;
91- pub use types:: os:: common:: posix01:: * ;
92- pub use types:: os:: common:: bsd44:: * ;
93- pub use types:: os:: arch:: c95:: * ;
94- pub use types:: os:: arch:: c99:: * ;
95- pub use types:: os:: arch:: posix88:: * ;
96- pub use types:: os:: arch:: posix01:: * ;
97- pub use types:: os:: arch:: posix08:: * ;
98- pub use types:: os:: arch:: bsd44:: * ;
99- pub use types:: os:: arch:: extra:: * ;
100-
101- pub use consts:: os:: c95:: * ;
102- pub use consts:: os:: c99:: * ;
103- pub use consts:: os:: posix88:: * ;
104- pub use consts:: os:: posix01:: * ;
105- pub use consts:: os:: posix08:: * ;
106- pub use consts:: os:: bsd44:: * ;
107- pub use consts:: os:: extra:: * ;
108- pub use consts:: os:: sysconf:: * ;
109-
110- pub use funcs:: c95:: ctype:: * ;
111- pub use funcs:: c95:: stdio:: * ;
112- pub use funcs:: c95:: stdlib:: * ;
113- pub use funcs:: c95:: string:: * ;
114-
115- pub use funcs:: posix88:: stat_:: * ;
116- pub use funcs:: posix88:: stdio:: * ;
117- pub use funcs:: posix88:: fcntl:: * ;
118- pub use funcs:: posix88:: dirent:: * ;
119- pub use funcs:: posix88:: unistd:: * ;
120- pub use funcs:: posix88:: mman:: * ;
121-
122- pub use funcs:: posix01:: stat_:: * ;
123- pub use funcs:: posix01:: unistd:: * ;
124- pub use funcs:: posix01:: glob:: * ;
125- pub use funcs:: posix01:: mman:: * ;
126- pub use funcs:: posix08:: unistd:: * ;
127-
128- pub use funcs:: bsd43:: * ;
129- pub use funcs:: bsd44:: * ;
130- pub use funcs:: extra:: * ;
131-
132- #[ cfg( target_os = "win32" ) ]
133- pub use funcs:: extra:: kernel32:: * ;
134- #[ cfg( target_os = "win32" ) ]
135- pub use funcs:: extra:: msvcrt:: * ;
136-
13782// Explicit export lists for the intersection (provided here) mean that
13883// you can write more-platform-agnostic code if you stick to just these
13984// symbols.
14085
14186pub use types:: common:: c95:: { FILE , c_void, fpos_t} ;
87+ pub use types:: common:: c99:: { int8_t, int16_t, int32_t, int64_t} ;
88+ pub use types:: common:: c99:: { uint8_t, uint16_t, uint32_t, uint64_t} ;
14289pub use types:: common:: posix88:: { DIR , dirent_t} ;
143- pub use types:: os:: arch:: c95:: { c_char, c_double, c_float, c_int} ;
90+ pub use types:: os:: common:: bsd44:: { addrinfo, in_addr, in6_addr, sockaddr_storage} ;
91+ pub use types:: os:: common:: bsd44:: { ip_mreq, ip6_mreq, sockaddr, sockaddr_un} ;
92+ pub use types:: os:: common:: bsd44:: { sa_family_t, sockaddr_in, sockaddr_in6, socklen_t} ;
93+ pub use types:: os:: arch:: c95:: { c_char, c_double, c_float, c_int, c_uint} ;
14494pub use types:: os:: arch:: c95:: { c_long, c_short, c_uchar, c_ulong} ;
14595pub use types:: os:: arch:: c95:: { c_ushort, clock_t, ptrdiff_t} ;
14696pub use types:: os:: arch:: c95:: { size_t, time_t} ;
147- pub use types:: os:: arch:: c99:: { c_longlong, c_ulonglong, intptr_t } ;
148- pub use types:: os:: arch:: c99:: { uintptr_t} ;
97+ pub use types:: os:: arch:: c99:: { c_longlong, c_ulonglong} ;
98+ pub use types:: os:: arch:: c99:: { intptr_t , uintptr_t} ;
14999pub use types:: os:: arch:: posix88:: { dev_t, ino_t, mode_t} ;
150100pub use types:: os:: arch:: posix88:: { off_t, pid_t, ssize_t} ;
151101
@@ -159,8 +109,15 @@ pub use consts::os::posix88::{O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};
159109pub use consts:: os:: posix88:: { R_OK , S_IEXEC , S_IFBLK , S_IFCHR } ;
160110pub use consts:: os:: posix88:: { S_IFDIR , S_IFIFO , S_IFMT , S_IFREG , S_IFLNK } ;
161111pub use consts:: os:: posix88:: { S_IREAD , S_IRUSR , S_IRWXU , S_IWUSR } ;
162- pub use consts:: os:: posix88:: { STDERR_FILENO , STDIN_FILENO } ;
112+ pub use consts:: os:: posix88:: { STDERR_FILENO , STDIN_FILENO , S_IXUSR } ;
163113pub use consts:: os:: posix88:: { STDOUT_FILENO , W_OK , X_OK } ;
114+ pub use consts:: os:: bsd44:: { AF_INET , AF_INET6 , SOCK_STREAM , SOCK_DGRAM } ;
115+ pub use consts:: os:: bsd44:: { IPPROTO_IP , IPPROTO_IPV6 , IPPROTO_TCP , TCP_NODELAY } ;
116+ pub use consts:: os:: bsd44:: { SOL_SOCKET , SO_KEEPALIVE } ;
117+ pub use consts:: os:: bsd44:: { SO_REUSEADDR , SO_BROADCAST , SHUT_WR , IP_MULTICAST_LOOP } ;
118+ pub use consts:: os:: bsd44:: { IP_ADD_MEMBERSHIP , IP_DROP_MEMBERSHIP } ;
119+ pub use consts:: os:: bsd44:: { IPV6_ADD_MEMBERSHIP , IPV6_DROP_MEMBERSHIP } ;
120+ pub use consts:: os:: bsd44:: { IP_MULTICAST_TTL , IP_TTL } ;
164121
165122pub use funcs:: c95:: ctype:: { isalnum, isalpha, iscntrl, isdigit} ;
166123pub use funcs:: c95:: ctype:: { islower, isprint, ispunct, isspace} ;
@@ -169,7 +126,7 @@ pub use funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
169126pub use funcs:: c95:: stdio:: { fclose, feof, ferror, fflush, fgetc} ;
170127pub use funcs:: c95:: stdio:: { fgetpos, fgets, fopen, fputc, fputs} ;
171128pub use funcs:: c95:: stdio:: { fread, freopen, fseek, fsetpos, ftell} ;
172- pub use funcs:: c95:: stdio:: { fwrite, perror, puts, remove, rewind} ;
129+ pub use funcs:: c95:: stdio:: { fwrite, perror, puts, remove, rename , rewind} ;
173130pub use funcs:: c95:: stdio:: { setbuf, setvbuf, tmpfile, ungetc} ;
174131
175132pub use funcs:: c95:: stdlib:: { abs, atof, atoi, calloc, exit, _exit} ;
@@ -192,6 +149,135 @@ pub use funcs::posix88::unistd::{execv, execve, execvp, getcwd};
192149pub use funcs:: posix88:: unistd:: { getpid, isatty, lseek, pipe, read} ;
193150pub use funcs:: posix88:: unistd:: { rmdir, unlink, write} ;
194151
152+ pub use funcs:: bsd43:: { socket, setsockopt, bind, send, recv, recvfrom} ;
153+ pub use funcs:: bsd43:: { listen, sendto, accept, connect, getpeername, getsockname} ;
154+ pub use funcs:: bsd43:: { shutdown} ;
155+
156+ // But we also reexport most everything
157+ // if you're interested in writing platform-specific code.
158+
159+ // FIXME: This is a mess, but the design of this entire module needs to be
160+ // reconsidered, so I'm not inclined to do better right now. As part of
161+ // #11870 I removed all the pub globs here, leaving explicit reexports
162+ // of everything that is actually used in-tree.
163+ //
164+ // So the following exports don't follow any particular plan.
165+
166+ #[ cfg( unix) ] pub use consts:: os:: sysconf:: { _SC_PAGESIZE} ;
167+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { PROT_READ , PROT_WRITE , PROT_EXEC } ;
168+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { MAP_FIXED , MAP_FILE , MAP_ANON , MAP_PRIVATE , MAP_FAILED } ;
169+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { EACCES , EBADF , EINVAL , ENODEV , ENOMEM } ;
170+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { ECONNREFUSED , ECONNRESET , EPERM , EPIPE } ;
171+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { ENOTCONN , ECONNABORTED , EADDRNOTAVAIL , EINTR } ;
172+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { EADDRINUSE , ENOENT , EISDIR , EAGAIN , EWOULDBLOCK } ;
173+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { ECANCELED , SIGINT } ;
174+ #[ cfg( unix) ] pub use consts:: os:: posix88:: { SIGTERM , SIGKILL , SIGPIPE , PROT_NONE } ;
175+ #[ cfg( unix) ] pub use consts:: os:: posix01:: { SIG_IGN , WNOHANG } ;
176+ #[ cfg( unix) ] pub use consts:: os:: bsd44:: { AF_UNIX } ;
177+
178+ #[ cfg( unix) ] pub use types:: os:: common:: posix01:: { pthread_t, timespec, timezone, timeval} ;
179+
180+ #[ cfg( unix) ] pub use types:: os:: arch:: c95:: { suseconds_t} ;
181+ #[ cfg( unix) ] pub use types:: os:: arch:: posix88:: { uid_t, gid_t} ;
182+ #[ cfg( unix) ] pub use types:: os:: arch:: posix01:: { pthread_attr_t} ;
183+ #[ cfg( unix) ] pub use types:: os:: arch:: posix01:: { stat, utimbuf} ;
184+ #[ cfg( unix) ] pub use funcs:: posix88:: unistd:: { sysconf, setgid, setsid, setuid, pread, pwrite} ;
185+ #[ cfg( unix) ] pub use funcs:: posix88:: unistd:: { getgid, getuid} ;
186+ #[ cfg( unix) ] pub use funcs:: posix88:: unistd:: { _PC_NAME_MAX, utime, nanosleep, pathconf, link} ;
187+ #[ cfg( unix) ] pub use funcs:: posix88:: unistd:: { chown} ;
188+ #[ cfg( unix) ] pub use funcs:: posix88:: mman:: { mmap, munmap, mprotect} ;
189+ #[ cfg( unix) ] pub use funcs:: posix88:: dirent:: { opendir, readdir_r, closedir} ;
190+ #[ cfg( unix) ] pub use funcs:: posix88:: fcntl:: { fcntl} ;
191+ #[ cfg( unix) ] pub use funcs:: posix01:: stat_:: { lstat} ;
192+ #[ cfg( unix) ] pub use funcs:: posix01:: unistd:: { fsync, ftruncate} ;
193+ #[ cfg( unix) ] pub use funcs:: posix01:: unistd:: { readlink, symlink} ;
194+
195+ #[ cfg( windows) ] pub use consts:: os:: c95:: { WSAECONNREFUSED , WSAECONNRESET , WSAEACCES } ;
196+ #[ cfg( windows) ] pub use consts:: os:: c95:: { WSAEWOULDBLOCK , WSAENOTCONN , WSAECONNABORTED } ;
197+ #[ cfg( windows) ] pub use consts:: os:: c95:: { WSAEADDRNOTAVAIL , WSAEADDRINUSE , WSAEINTR } ;
198+ #[ cfg( windows) ] pub use consts:: os:: extra:: { ERROR_INSUFFICIENT_BUFFER } ;
199+ #[ cfg( windows) ] pub use consts:: os:: extra:: { O_BINARY , O_NOINHERIT , PAGE_NOACCESS } ;
200+ #[ cfg( windows) ] pub use consts:: os:: extra:: { PAGE_READONLY , PAGE_READWRITE , PAGE_EXECUTE } ;
201+ #[ cfg( windows) ] pub use consts:: os:: extra:: { PAGE_EXECUTE_READ , PAGE_EXECUTE_READWRITE } ;
202+ #[ cfg( windows) ] pub use consts:: os:: extra:: { MEM_COMMIT , MEM_RESERVE , MEM_RELEASE } ;
203+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_MAP_READ , FILE_MAP_WRITE , FILE_MAP_EXECUTE } ;
204+ #[ cfg( windows) ] pub use consts:: os:: extra:: { ERROR_ALREADY_EXISTS , ERROR_NO_DATA } ;
205+ #[ cfg( windows) ] pub use consts:: os:: extra:: { ERROR_FILE_NOT_FOUND , ERROR_INVALID_NAME } ;
206+ #[ cfg( windows) ] pub use consts:: os:: extra:: { ERROR_BROKEN_PIPE , ERROR_INVALID_FUNCTION } ;
207+ #[ cfg( windows) ] pub use consts:: os:: extra:: { TRUE , FALSE , INFINITE } ;
208+ #[ cfg( windows) ] pub use consts:: os:: extra:: { PROCESS_TERMINATE , PROCESS_QUERY_INFORMATION } ;
209+ #[ cfg( windows) ] pub use consts:: os:: extra:: { STILL_ACTIVE , DETACHED_PROCESS } ;
210+ #[ cfg( windows) ] pub use consts:: os:: extra:: { CREATE_NEW_PROCESS_GROUP } ;
211+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_BEGIN , FILE_END , FILE_CURRENT } ;
212+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_GENERIC_READ , FILE_GENERIC_WRITE } ;
213+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_SHARE_READ , FILE_SHARE_WRITE , FILE_SHARE_DELETE } ;
214+ #[ cfg( windows) ] pub use consts:: os:: extra:: { TRUNCATE_EXISTING , CREATE_ALWAYS , OPEN_EXISTING } ;
215+ #[ cfg( windows) ] pub use consts:: os:: extra:: { CREATE_NEW , FILE_APPEND_DATA , FILE_WRITE_DATA } ;
216+ #[ cfg( windows) ] pub use consts:: os:: extra:: { OPEN_ALWAYS , FILE_ATTRIBUTE_NORMAL } ;
217+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_FLAG_BACKUP_SEMANTICS , INVALID_HANDLE_VALUE } ;
218+ #[ cfg( windows) ] pub use consts:: os:: extra:: { MOVEFILE_REPLACE_EXISTING } ;
219+ #[ cfg( windows) ] pub use consts:: os:: extra:: { GENERIC_READ , GENERIC_WRITE } ;
220+ #[ cfg( windows) ] pub use consts:: os:: extra:: { VOLUME_NAME_DOS , FILE_ATTRIBUTE_NORMAL } ;
221+ #[ cfg( windows) ] pub use consts:: os:: extra:: { PIPE_ACCESS_DUPLEX , FILE_FLAG_FIRST_PIPE_INSTANCE } ;
222+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_FLAG_OVERLAPPED , PIPE_TYPE_BYTE } ;
223+ #[ cfg( windows) ] pub use consts:: os:: extra:: { PIPE_READMODE_BYTE , PIPE_WAIT } ;
224+ #[ cfg( windows) ] pub use consts:: os:: extra:: { PIPE_UNLIMITED_INSTANCES , ERROR_ACCESS_DENIED } ;
225+ #[ cfg( windows) ] pub use consts:: os:: extra:: { FILE_WRITE_ATTRIBUTES , FILE_READ_ATTRIBUTES } ;
226+ #[ cfg( windows) ] pub use consts:: os:: extra:: { ERROR_PIPE_BUSY , ERROR_IO_PENDING } ;
227+ #[ cfg( windows) ] pub use consts:: os:: extra:: { ERROR_PIPE_CONNECTED } ;
228+ #[ cfg( windows) ] pub use types:: os:: common:: bsd44:: { SOCKET } ;
229+ #[ cfg( windows) ] pub use types:: os:: common:: posix01:: { stat, utimbuf} ;
230+ #[ cfg( windows) ] pub use types:: os:: arch:: extra:: { HANDLE , BOOL , LPSECURITY_ATTRIBUTES } ;
231+ #[ cfg( windows) ] pub use types:: os:: arch:: extra:: { LPCSTR , WORD , DWORD , BYTE , FILETIME } ;
232+ #[ cfg( windows) ] pub use types:: os:: arch:: extra:: { LARGE_INTEGER , LPVOID , LONG } ;
233+ #[ cfg( windows) ] pub use types:: os:: arch:: extra:: { time64_t, OVERLAPPED } ;
234+ #[ cfg( windows) ] pub use types:: os:: arch:: extra:: { LPOVERLAPPED , SIZE_T , LPDWORD } ;
235+ #[ cfg( windows) ] pub use funcs:: c95:: string:: { wcslen} ;
236+ #[ cfg( windows) ] pub use funcs:: posix88:: stat_:: { wstat, wutime, wchmod, wrmdir} ;
237+ #[ cfg( windows) ] pub use funcs:: bsd43:: { closesocket} ;
238+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetCurrentDirectoryW , GetLastError } ;
239+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetEnvironmentVariableW , SetEnvironmentVariableW } ;
240+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetModuleFileNameW , SetCurrentDirectoryW } ;
241+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetSystemInfo , VirtualAlloc , VirtualFree } ;
242+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { CreateFileMappingW , MapViewOfFile } ;
243+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { UnmapViewOfFile , CloseHandle } ;
244+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { WaitForSingleObject , GetSystemTimeAsFileTime } ;
245+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { QueryPerformanceCounter } ;
246+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { WaitForSingleObject , QueryPerformanceFrequency } ;
247+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetExitCodeProcess , TerminateProcess } ;
248+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { ReadFile , WriteFile , SetFilePointerEx } ;
249+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { FlushFileBuffers , SetEndOfFile , CreateFileW } ;
250+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { CreateDirectoryW , FindFirstFileW } ;
251+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { FindNextFileW , FindClose , DeleteFileW } ;
252+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetFinalPathNameByHandleW , CreateSymbolicLinkW } ;
253+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { CreateHardLinkW , CreateEventW } ;
254+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { FlushFileBuffers , CreateNamedPipeW } ;
255+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { SetNamedPipeHandleState , WaitNamedPipeW } ;
256+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { GetOverlappedResult , ConnectNamedPipe } ;
257+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { DisconnectNamedPipe , OpenProcess } ;
258+ #[ cfg( windows) ] pub use funcs:: extra:: kernel32:: { MoveFileExW , VirtualProtect } ;
259+ #[ cfg( windows) ] pub use funcs:: extra:: msvcrt:: { get_osfhandle, open_osfhandle} ;
260+
261+ #[ cfg( target_os = "linux" ) ] #[ cfg( target_os = "android" ) ] #[ cfg( target_os = "freebsd" ) ]
262+ pub use consts:: os:: posix01:: { CLOCK_REALTIME , CLOCK_MONOTONIC } ;
263+
264+ #[ cfg( target_os = "linux" ) ] #[ cfg( target_os = "android" ) ]
265+ pub use funcs:: posix01:: unistd:: { fdatasync} ;
266+
267+ #[ cfg( unix, not( target_os = "freebsd" ) ) ]
268+ pub use consts:: os:: extra:: { MAP_STACK } ;
269+
270+ #[ cfg( target_os = "freebsd" ) ]
271+ pub use consts:: os:: bsd44:: { TCP_KEEPIDLE } ;
272+
273+ #[ cfg( target_os = "macos" ) ]
274+ pub use consts:: os:: bsd44:: { TCP_KEEPALIVE } ;
275+ #[ cfg( target_os = "macos" ) ]
276+ pub use consts:: os:: extra:: { F_FULLFSYNC } ;
277+ #[ cfg( target_os = "macos" ) ]
278+ pub use types:: os:: arch:: extra:: { mach_timebase_info} ;
279+
280+
195281#[ cfg( not( windows) ) ]
196282#[ link( name = "c" ) ]
197283#[ link( name = "m" ) ]
@@ -3028,7 +3114,6 @@ pub mod consts {
30283114 pub static MAP_PRIVATE : c_int = 0x0002 ;
30293115 pub static MAP_FIXED : c_int = 0x0010 ;
30303116 pub static MAP_ANON : c_int = 0x1000 ;
3031- pub static MAP_STACK : c_int = 0 ;
30323117
30333118 pub static MAP_FAILED : * c_void = -1 as * c_void ;
30343119
@@ -3274,6 +3359,7 @@ pub mod consts {
32743359 pub static MAP_HASSEMAPHORE : c_int = 0x0200 ;
32753360 pub static MAP_NOCACHE : c_int = 0x0400 ;
32763361 pub static MAP_JIT : c_int = 0x0800 ;
3362+ pub static MAP_STACK : c_int = 0 ;
32773363 }
32783364 pub mod sysconf {
32793365 use types:: os:: arch:: c95:: c_int;
0 commit comments