Skip to content

Commit 4ec241f

Browse files
committed
libc: Deglob reexports. rust-lang#11870
1 parent 9a33330 commit 4ec241f

File tree

1 file changed

+56
-59
lines changed

1 file changed

+56
-59
lines changed

src/liblibc/lib.rs

+56-59
Original file line numberDiff line numberDiff line change
@@ -81,73 +81,20 @@
8181
#[cfg(test)] extern crate test;
8282
#[cfg(test)] extern crate native;
8383

84-
// Initial glob-exports mean that all the contents of all the modules
85-
// wind up exported, if you're interested in writing platform-specific code.
86-
87-
pub use types::common::c95::*;
88-
pub use types::common::c99::*;
89-
pub use types::common::posix88::*;
90-
pub use types::common::posix01::*;
91-
pub use types::common::posix08::*;
92-
pub use types::common::bsd44::*;
93-
pub use types::os::common::posix01::*;
94-
pub use types::os::common::bsd44::*;
95-
pub use types::os::arch::c95::*;
96-
pub use types::os::arch::c99::*;
97-
pub use types::os::arch::posix88::*;
98-
pub use types::os::arch::posix01::*;
99-
pub use types::os::arch::posix08::*;
100-
pub use types::os::arch::bsd44::*;
101-
pub use types::os::arch::extra::*;
102-
103-
pub use consts::os::c95::*;
104-
pub use consts::os::c99::*;
105-
pub use consts::os::posix88::*;
106-
pub use consts::os::posix01::*;
107-
pub use consts::os::posix08::*;
108-
pub use consts::os::bsd44::*;
109-
pub use consts::os::extra::*;
110-
pub use consts::os::sysconf::*;
111-
112-
pub use funcs::c95::ctype::*;
113-
pub use funcs::c95::stdio::*;
114-
pub use funcs::c95::stdlib::*;
115-
pub use funcs::c95::string::*;
116-
117-
pub use funcs::posix88::stat_::*;
118-
pub use funcs::posix88::stdio::*;
119-
pub use funcs::posix88::fcntl::*;
120-
pub use funcs::posix88::dirent::*;
121-
pub use funcs::posix88::unistd::*;
122-
pub use funcs::posix88::mman::*;
123-
124-
pub use funcs::posix01::stat_::*;
125-
pub use funcs::posix01::unistd::*;
126-
pub use funcs::posix01::glob::*;
127-
pub use funcs::posix01::mman::*;
128-
pub use funcs::posix08::unistd::*;
129-
130-
pub use funcs::bsd43::*;
131-
pub use funcs::bsd44::*;
132-
pub use funcs::extra::*;
133-
134-
#[cfg(target_os = "win32")]
135-
pub use funcs::extra::kernel32::*;
136-
#[cfg(target_os = "win32")]
137-
pub use funcs::extra::msvcrt::*;
138-
13984
// Explicit export lists for the intersection (provided here) mean that
14085
// you can write more-platform-agnostic code if you stick to just these
14186
// symbols.
14287

14388
pub use types::common::c95::{FILE, c_void, fpos_t};
89+
pub use types::common::c99::{int8_t, int16_t, int32_t, int64_t};
90+
pub use types::common::c99::{uint8_t, uint16_t, uint32_t, uint64_t};
14491
pub use types::common::posix88::{DIR, dirent_t};
145-
pub use types::os::arch::c95::{c_char, c_double, c_float, c_int};
92+
pub use types::os::arch::c95::{c_char, c_double, c_float, c_int, c_uint};
14693
pub use types::os::arch::c95::{c_long, c_short, c_uchar, c_ulong};
14794
pub use types::os::arch::c95::{c_ushort, clock_t, ptrdiff_t};
14895
pub use types::os::arch::c95::{size_t, time_t};
149-
pub use types::os::arch::c99::{c_longlong, c_ulonglong, intptr_t};
150-
pub use types::os::arch::c99::{uintptr_t};
96+
pub use types::os::arch::c99::{c_longlong, c_ulonglong};
97+
pub use types::os::arch::c99::{intptr_t, uintptr_t};
15198
pub use types::os::arch::posix88::{dev_t, dirent_t, ino_t, mode_t};
15299
pub use types::os::arch::posix88::{off_t, pid_t, ssize_t};
153100

@@ -171,7 +118,7 @@ pub use funcs::c95::ctype::{isupper, isxdigit, tolower, toupper};
171118
pub use funcs::c95::stdio::{fclose, feof, ferror, fflush, fgetc};
172119
pub use funcs::c95::stdio::{fgetpos, fgets, fopen, fputc, fputs};
173120
pub use funcs::c95::stdio::{fread, freopen, fseek, fsetpos, ftell};
174-
pub use funcs::c95::stdio::{fwrite, perror, puts, remove, rewind};
121+
pub use funcs::c95::stdio::{fwrite, perror, puts, remove, rename, rewind};
175122
pub use funcs::c95::stdio::{setbuf, setvbuf, tmpfile, ungetc};
176123

177124
pub use funcs::c95::stdlib::{abs, atof, atoi, calloc, exit, _exit};
@@ -194,6 +141,56 @@ pub use funcs::posix88::unistd::{execv, execve, execvp, getcwd};
194141
pub use funcs::posix88::unistd::{getpid, isatty, lseek, pipe, read};
195142
pub use funcs::posix88::unistd::{rmdir, unlink, write};
196143

144+
// But we also reexport most everything
145+
// if you're interested in writing platform-specific code.
146+
147+
#[cfg(unix)] pub use consts::os::sysconf::{_SC_PAGESIZE};
148+
#[cfg(unix)] pub use consts::os::posix88::{PROT_READ, PROT_WRITE, PROT_EXEC};
149+
#[cfg(unix)] pub use consts::os::posix88::{MAP_FIXED, MAP_FILE, MAP_ANON, MAP_PRIVATE, MAP_FAILED};
150+
#[cfg(unix)] pub use consts::os::posix88::{EACCES, EBADF, EINVAL, ENODEV, ENOMEM};
151+
#[cfg(unix)] pub use consts::os::posix88::{ECONNREFUSED, ECONNRESET, EPERM, EPIPE};
152+
#[cfg(unix)] pub use consts::os::posix88::{ENOTCONN, ECONNABORTED, EADDRNOTAVAIL, EINTR};
153+
#[cfg(unix)] pub use consts::os::posix88::{EADDRINUSE, ENOENT, EISDIR, EAGAIN, EWOULDBLOCK};
154+
#[cfg(unix)] pub use consts::os::posix88::{ECANCELED};
155+
#[cfg(unix)] pub use consts::os::posix88::{SIGTERM, SIGKILL, SIGPIPE, PROT_NONE};
156+
#[cfg(unix)] pub use consts::os::posix01::{SIG_IGN, WNOHANG};
157+
#[cfg(unix)] pub use consts::os::bsd44::{AF_INET, AF_INET6, AF_UNIX, SOCK_STREAM, SOCK_DGRAM};
158+
#[cfg(unix)] pub use consts::os::bsd44::{IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP, TCP_NODELAY};
159+
#[cfg(unix)] pub use consts::os::bsd44::{SOL_SOCKET, SO_KEEPALIVE};
160+
#[cfg(unix)] pub use consts::os::bsd44::{SO_REUSEADDR, SO_BROADCAST, SHUT_WR, IP_MULTICAST_LOOP};
161+
#[cfg(unix)] pub use consts::os::bsd44::{IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP};
162+
#[cfg(unix)] pub use consts::os::bsd44::{IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP};
163+
#[cfg(unix)] pub use consts::os::bsd44::{IP_MULTICAST_TTL, IP_TTL};
164+
165+
#[cfg(unix)] pub use types::os::common::posix01::{pthread_t, timespec};
166+
#[cfg(unix)] pub use types::os::common::bsd44::{addrinfo, in_addr, in6_addr, sockaddr_storage};
167+
#[cfg(unix)] pub use types::os::common::bsd44::{ip_mreq, ip6_mreq, sockaddr, sockaddr_un};
168+
#[cfg(unix)] pub use types::os::common::bsd44::{sa_family_t, sockaddr_in, sockaddr_in6, socklen_t};
169+
#[cfg(unix)] pub use types::os::arch::posix88::{uid_t, gid_t};
170+
#[cfg(unix)] pub use types::os::arch::posix01::{pthread_attr_t, utimbuf, stat};
171+
172+
#[cfg(unix)] pub use funcs::posix88::unistd::{sysconf, setgid, setsid, setuid, pread, pwrite};
173+
#[cfg(unix)] pub use funcs::posix88::unistd::{_PC_NAME_MAX, utime, nanosleep, pathconf, link};
174+
#[cfg(unix)] pub use funcs::posix88::unistd::{chown};
175+
#[cfg(unix)] pub use funcs::posix88::mman::{mmap, munmap, mprotect};
176+
#[cfg(unix)] pub use funcs::posix88::dirent::{opendir, readdir_r, closedir};
177+
#[cfg(unix)] pub use funcs::posix88::stat_::{fstat, stat};
178+
#[cfg(unix)] pub use funcs::posix88::fcntl::{fcntl};
179+
#[cfg(unix)] pub use funcs::posix01::stat_::{lstat};
180+
#[cfg(unix)] pub use funcs::posix01::unistd::{fsync, ftruncate};
181+
#[cfg(unix)] pub use funcs::posix01::unistd::{readlink, symlink};
182+
#[cfg(unix)] pub use funcs::bsd43::{socket, setsockopt, bind, send, recv, recvfrom};
183+
#[cfg(unix)] pub use funcs::bsd43::{listen, sendto, accept, connect, getpeername, getsockname};
184+
#[cfg(unix)] pub use funcs::bsd43::{shutdown};
185+
186+
#[cfg(target_os = "linux")] #[cfg(target_os = "android")]
187+
pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
188+
#[cfg(target_os = "linux")] #[cfg(target_os = "android")]
189+
pub use funcs::posix01::unistd::{fdatasync};
190+
191+
#[cfg(unix, not(target_os = "freebsd"))]
192+
pub use consts::os::extra::{MAP_STACK};
193+
197194
#[cfg(not(windows))]
198195
#[link(name = "c")]
199196
#[link(name = "m")]

0 commit comments

Comments
 (0)