Fix linkage on OSX
This commit is contained in:
parent
e8606192d8
commit
45ae2f4cd0
139
src/lib.rs
139
src/lib.rs
|
@ -5330,8 +5330,12 @@ pub mod funcs {
|
|||
use types::os::arch::c95::{c_char, c_int, c_long, size_t};
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fopen$UNIX2003")]
|
||||
pub fn fopen(filename: *const c_char,
|
||||
mode: *const c_char) -> *mut FILE;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "freopen$UNIX2003")]
|
||||
pub fn freopen(filename: *const c_char, mode: *const c_char,
|
||||
file: *mut FILE)
|
||||
-> *mut FILE;
|
||||
|
@ -5352,6 +5356,8 @@ pub mod funcs {
|
|||
pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
|
||||
-> *mut c_char;
|
||||
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fputs$UNIX2003")]
|
||||
pub fn fputs(s: *const c_char, stream: *mut FILE)-> c_int;
|
||||
// Omitted: getc, getchar (might be macros).
|
||||
|
||||
|
@ -5366,6 +5372,8 @@ pub mod funcs {
|
|||
nobj: size_t,
|
||||
stream: *mut FILE)
|
||||
-> size_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fwrite$UNIX2003")]
|
||||
pub fn fwrite(ptr: *const c_void,
|
||||
size: size_t,
|
||||
nobj: size_t,
|
||||
|
@ -5395,6 +5403,8 @@ pub mod funcs {
|
|||
// Omitted: div, ldiv (return pub type incomplete).
|
||||
pub fn atof(s: *const c_char) -> c_double;
|
||||
pub fn atoi(s: *const c_char) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "strtod$UNIX2003")]
|
||||
pub fn strtod(s: *const c_char,
|
||||
endp: *mut *mut c_char) -> c_double;
|
||||
pub fn strtol(s: *const c_char,
|
||||
|
@ -5408,6 +5418,8 @@ pub mod funcs {
|
|||
pub fn exit(status: c_int) -> !;
|
||||
pub fn _exit(status: c_int) -> !;
|
||||
pub fn atexit(cb: extern fn()) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "system$UNIX2003")]
|
||||
pub fn system(s: *const c_char) -> c_int;
|
||||
pub fn getenv(s: *const c_char) -> *mut c_char;
|
||||
// Omitted: bsearch, qsort
|
||||
|
@ -5442,6 +5454,8 @@ pub mod funcs {
|
|||
pub fn strstr(cs: *const c_char,
|
||||
ct: *const c_char) -> *mut c_char;
|
||||
pub fn strlen(cs: *const c_char) -> size_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "strerror$UNIX2003")]
|
||||
pub fn strerror(n: c_int) -> *mut c_char;
|
||||
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
|
||||
pub fn strxfrm(s: *mut c_char, ct: *const c_char,
|
||||
|
@ -5603,41 +5617,21 @@ pub mod funcs {
|
|||
use types::os::arch::posix88::mode_t;
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "chmod$UNIX2003")]
|
||||
pub fn chmod(path: *const c_char, mode: mode_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fchmod$UNIX2003")]
|
||||
pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
|
||||
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "android",
|
||||
target_os = "ios",
|
||||
target_os = "nacl"))]
|
||||
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "fstat64"]
|
||||
#[cfg_attr(target_os = "macos", link_name = "fstat64")]
|
||||
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int;
|
||||
#[cfg(not(target_os = "nacl"))]
|
||||
pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int;
|
||||
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "android",
|
||||
target_os = "ios",
|
||||
target_os = "nacl"))]
|
||||
pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "stat64"]
|
||||
#[cfg_attr(target_os = "macos", link_name = "stat64")]
|
||||
pub fn stat(path: *const c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
@ -5647,9 +5641,13 @@ pub mod funcs {
|
|||
use types::os::arch::c95::{c_char, c_int};
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "popen$UNIX2003")]
|
||||
pub fn popen(command: *const c_char,
|
||||
mode: *const c_char) -> *mut FILE;
|
||||
pub fn pclose(stream: *mut FILE) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fdopen$UNIX2003")]
|
||||
pub fn fdopen(fd: c_int, mode: *const c_char) -> *mut FILE;
|
||||
pub fn fileno(stream: *mut FILE) -> c_int;
|
||||
}
|
||||
|
@ -5660,8 +5658,14 @@ pub mod funcs {
|
|||
use types::os::arch::posix88::mode_t;
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "open$UNIX2003")]
|
||||
pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "creat$UNIX2003")]
|
||||
pub fn creat(path: *const c_char, mode: mode_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fcntl$UNIX2003")]
|
||||
pub fn fcntl(fd: c_int, cmd: c_int, ...) -> c_int;
|
||||
}
|
||||
}
|
||||
|
@ -5671,15 +5675,31 @@ pub mod funcs {
|
|||
use types::os::arch::c95::{c_char, c_int, c_long};
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "opendir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "opendir$INODE64$UNIX2003")]
|
||||
pub fn opendir(dirname: *const c_char) -> *mut DIR;
|
||||
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
|
||||
pub fn readdir_r(dirp: *mut DIR, entry: *mut dirent,
|
||||
result: *mut *mut dirent) -> c_int;
|
||||
}
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "closedir$UNIX2003")]
|
||||
pub fn closedir(dirp: *mut DIR) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "rewinddir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "rewinddir$INODE64$UNIX2003")]
|
||||
pub fn rewinddir(dirp: *mut DIR);
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "seekdir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "seekdir$INODE64$UNIX2003")]
|
||||
pub fn seekdir(dirp: *mut DIR, loc: c_long);
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
|
||||
link_name = "telldir$INODE64")]
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "telldir$INODE64$UNIX2003")]
|
||||
pub fn telldir(dirp: *mut DIR) -> c_long;
|
||||
}
|
||||
}
|
||||
|
@ -5705,6 +5725,8 @@ pub mod funcs {
|
|||
pub fn chdir(dir: *const c_char) -> c_int;
|
||||
pub fn chown(path: *const c_char, uid: uid_t,
|
||||
gid: gid_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "close$UNIX2003")]
|
||||
pub fn close(fd: c_int) -> c_int;
|
||||
pub fn dup(fd: c_int) -> c_int;
|
||||
pub fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
|
@ -5738,8 +5760,12 @@ pub mod funcs {
|
|||
pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
|
||||
-> off_t;
|
||||
pub fn pathconf(path: *const c_char, name: c_int) -> c_long;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pause$UNIX2003")]
|
||||
pub fn pause() -> c_int;
|
||||
pub fn pipe(fds: *mut c_int) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "read$UNIX2003")]
|
||||
pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
|
||||
-> ssize_t;
|
||||
pub fn rmdir(path: *const c_char) -> c_int;
|
||||
|
@ -5747,21 +5773,37 @@ pub mod funcs {
|
|||
pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
|
||||
pub fn setsid() -> pid_t;
|
||||
pub fn setuid(uid: uid_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sleep$UNIX2003")]
|
||||
pub fn sleep(secs: c_uint) -> c_uint;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "usleep$UNIX2003")]
|
||||
pub fn usleep(secs: c_uint) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "nanosleep$UNIX2003")]
|
||||
pub fn nanosleep(rqtp: *const timespec,
|
||||
rmtp: *mut timespec) -> c_int;
|
||||
pub fn sysconf(name: c_int) -> c_long;
|
||||
pub fn tcgetpgrp(fd: c_int) -> pid_t;
|
||||
pub fn ttyname(fd: c_int) -> *mut c_char;
|
||||
pub fn unlink(c: *const c_char) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "wait$UNIX2003")]
|
||||
pub fn wait(status: *mut c_int) -> pid_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "waitpid$UNIX2003")]
|
||||
pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int)
|
||||
-> pid_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "write$UNIX2003")]
|
||||
pub fn write(fd: c_int, buf: *const c_void, count: size_t)
|
||||
-> ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pread$UNIX2003")]
|
||||
pub fn pread(fd: c_int, buf: *mut c_void, count: size_t,
|
||||
offset: off_t) -> ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "pwrite$UNIX2003")]
|
||||
pub fn pwrite(fd: c_int, buf: *const c_void, count: size_t,
|
||||
offset: off_t) -> ssize_t;
|
||||
pub fn utime(file: *const c_char, buf: *const utimbuf) -> c_int;
|
||||
|
@ -5827,6 +5869,8 @@ pub mod funcs {
|
|||
use types::os::arch::posix88::{pid_t};
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "kill$UNIX2003")]
|
||||
pub fn kill(pid: pid_t, sig: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
@ -5843,9 +5887,13 @@ pub mod funcs {
|
|||
pub fn mlockall(flags: c_int) -> c_int;
|
||||
pub fn munlockall() -> c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "mprotect$UNIX2003")]
|
||||
pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int)
|
||||
-> c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "msync$UNIX2003")]
|
||||
pub fn msync(addr: *mut c_void, len: size_t, flags: c_int)
|
||||
-> c_int;
|
||||
#[cfg(target_os = "macos")]
|
||||
|
@ -5858,6 +5906,8 @@ pub mod funcs {
|
|||
}
|
||||
|
||||
extern {
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "mmap$UNIX2003")]
|
||||
pub fn mmap(addr: *mut c_void,
|
||||
len: size_t,
|
||||
prot: c_int,
|
||||
|
@ -5865,6 +5915,8 @@ pub mod funcs {
|
|||
fd: c_int,
|
||||
offset: off_t)
|
||||
-> *mut c_void;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "munmap$UNIX2003")]
|
||||
pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
|
||||
|
||||
}
|
||||
|
@ -5923,14 +5975,22 @@ pub mod funcs {
|
|||
bufsz: size_t)
|
||||
-> ssize_t;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "fsync$UNIX2003")]
|
||||
pub fn fsync(fd: c_int) -> c_int;
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub fn fdatasync(fd: c_int) -> c_int;
|
||||
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "setenv$UNIX2003")]
|
||||
pub fn setenv(name: *const c_char, val: *const c_char,
|
||||
overwrite: c_int) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "unsetenv$UNIX2003")]
|
||||
pub fn unsetenv(name: *const c_char) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "putenv$UNIX2003")]
|
||||
pub fn putenv(string: *mut c_char) -> c_int;
|
||||
|
||||
pub fn symlink(path1: *const c_char,
|
||||
|
@ -6044,27 +6104,47 @@ pub mod funcs {
|
|||
|
||||
extern "system" {
|
||||
pub fn socket(domain: c_int, ty: c_int, protocol: c_int) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "connect$UNIX2003")]
|
||||
pub fn connect(socket: c_int, address: *const sockaddr,
|
||||
len: socklen_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "bind$UNIX2003")]
|
||||
pub fn bind(socket: c_int, address: *const sockaddr,
|
||||
address_len: socklen_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "listen$UNIX2003")]
|
||||
pub fn listen(socket: c_int, backlog: c_int) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "accept$UNIX2003")]
|
||||
pub fn accept(socket: c_int, address: *mut sockaddr,
|
||||
address_len: *mut socklen_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getpeername$UNIX2003")]
|
||||
pub fn getpeername(socket: c_int, address: *mut sockaddr,
|
||||
address_len: *mut socklen_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "getsockname$UNIX2003")]
|
||||
pub fn getsockname(socket: c_int, address: *mut sockaddr,
|
||||
address_len: *mut socklen_t) -> c_int;
|
||||
pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
|
||||
value: *const c_void,
|
||||
option_len: socklen_t) -> c_int;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "recv$UNIX2003")]
|
||||
pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
|
||||
flags: c_int) -> ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "send$UNIX2003")]
|
||||
pub fn send(socket: c_int, buf: *const c_void, len: size_t,
|
||||
flags: c_int) -> ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "recvfrom$UNIX2003")]
|
||||
pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
|
||||
flags: c_int, addr: *mut sockaddr,
|
||||
addrlen: *mut socklen_t) -> ssize_t;
|
||||
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
|
||||
link_name = "sendto$UNIX2003")]
|
||||
pub fn sendto(socket: c_int, buf: *const c_void, len: size_t,
|
||||
flags: c_int, addr: *const sockaddr,
|
||||
addrlen: socklen_t) -> ssize_t;
|
||||
|
@ -6146,6 +6226,7 @@ pub mod funcs {
|
|||
-> c_int;
|
||||
pub fn mincore(addr: *const c_void, len: size_t, vec: *mut c_char)
|
||||
-> c_int;
|
||||
#[cfg_attr(target_os = "macos", link_name = "realpath$DARWIN_EXTSN")]
|
||||
pub fn realpath(pathname: *const c_char, resolved: *mut c_char)
|
||||
-> *mut c_char;
|
||||
pub fn flock(fd: c_int, operation: c_int) -> c_int;
|
||||
|
|
Loading…
Reference in New Issue