mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 11:48:30 +00:00
Auto merge of #21959 - dhuseby:bitrig-support, r=brson
This patch adds the necessary pieces to support rust on Bitrig https://bitrig.org
This commit is contained in:
commit
2b01a37ec3
13
configure
vendored
13
configure
vendored
@ -374,8 +374,12 @@ case $CFG_OSTYPE in
|
|||||||
CFG_OSTYPE=unknown-dragonfly
|
CFG_OSTYPE=unknown-dragonfly
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
Bitrig)
|
||||||
|
CFG_OSTYPE=unknown-bitrig
|
||||||
|
;;
|
||||||
|
|
||||||
OpenBSD)
|
OpenBSD)
|
||||||
CFG_OSTYPE=unknown-openbsd
|
CFG_OSTYPE=unknown-openbsd
|
||||||
;;
|
;;
|
||||||
|
|
||||||
Darwin)
|
Darwin)
|
||||||
@ -747,6 +751,13 @@ then
|
|||||||
CFG_ENABLE_CLANG=1
|
CFG_ENABLE_CLANG=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Force bitrig to build with clang; gcc doesn't like us there
|
||||||
|
if [ $CFG_OSTYPE = unknown-bitrig ]
|
||||||
|
then
|
||||||
|
step_msg "on Bitrig, forcing use of clang"
|
||||||
|
CFG_ENABLE_CLANG=1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
|
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
|
||||||
then
|
then
|
||||||
err "either clang or gcc is required"
|
err "either clang or gcc is required"
|
||||||
|
26
mk/cfg/x86_64-unknown-bitrig.mk
Normal file
26
mk/cfg/x86_64-unknown-bitrig.mk
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# x86_64-unknown-bitrig-elf configuration
|
||||||
|
CC_x86_64-unknown-bitrig=$(CC)
|
||||||
|
CXX_x86_64-unknown-bitrig=$(CXX)
|
||||||
|
CPP_x86_64-unknown-bitrig=$(CPP)
|
||||||
|
AR_x86_64-unknown-bitrig=$(AR)
|
||||||
|
CFG_LIB_NAME_x86_64-unknown-bitrig=lib$(1).so
|
||||||
|
CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a
|
||||||
|
CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so
|
||||||
|
CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM
|
||||||
|
CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS)
|
||||||
|
CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIC -m64 -I/usr/include $(CFLAGS)
|
||||||
|
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS)
|
||||||
|
CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list=
|
||||||
|
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-pic -Wl,-whole-archive
|
||||||
|
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-no-whole-archive
|
||||||
|
CFG_DEF_SUFFIX_x86_64-unknown-bitrig := .bsd.def
|
||||||
|
CFG_LLC_FLAGS_x86_64-unknown-bitrig :=
|
||||||
|
CFG_INSTALL_NAME_x86_64-unknown-bitrig =
|
||||||
|
CFG_EXE_SUFFIX_x86_64-unknown-bitrig :=
|
||||||
|
CFG_WINDOWSY_x86_64-unknown-bitrig :=
|
||||||
|
CFG_UNIXY_x86_64-unknown-bitrig := 1
|
||||||
|
CFG_PATH_MUNGE_x86_64-unknown-bitrig :=
|
||||||
|
CFG_LDPATH_x86_64-unknown-bitrig :=
|
||||||
|
CFG_RUN_x86_64-unknown-bitrig=$(2)
|
||||||
|
CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2))
|
||||||
|
CFG_GNU_TRIPLE_x86_64-unknown-bitrig := x86_64-unknown-bitrig
|
@ -144,14 +144,14 @@ FIND_COMPILER = $(word 1,$(1:ccache=))
|
|||||||
define CFG_MAKE_TOOLCHAIN
|
define CFG_MAKE_TOOLCHAIN
|
||||||
# Prepend the tools with their prefix if cross compiling
|
# Prepend the tools with their prefix if cross compiling
|
||||||
ifneq ($(CFG_BUILD),$(1))
|
ifneq ($(CFG_BUILD),$(1))
|
||||||
CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
|
CC_$(1)=$(CROSS_PREFIX_$(1))$(CC_$(1))
|
||||||
CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
|
CXX_$(1)=$(CROSS_PREFIX_$(1))$(CXX_$(1))
|
||||||
CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
|
CPP_$(1)=$(CROSS_PREFIX_$(1))$(CPP_$(1))
|
||||||
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
|
AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1))
|
||||||
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \
|
RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(CC_$(1))) \
|
||||||
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
|
-C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1))
|
||||||
|
|
||||||
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
|
RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFG_COMPILE_C_$(1) = $$(CC_$(1)) \
|
CFG_COMPILE_C_$(1) = $$(CC_$(1)) \
|
||||||
@ -179,11 +179,19 @@ define CFG_MAKE_TOOLCHAIN
|
|||||||
|
|
||||||
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
|
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
|
||||||
|
|
||||||
|
# On Bitrig, we need the relocation model to be PIC for everthing
|
||||||
|
ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
|
||||||
|
LLVM_MC_RELOCATION_MODEL="pic"
|
||||||
|
else
|
||||||
|
LLVM_MC_RELOCATION_MODEL="default"
|
||||||
|
endif
|
||||||
|
|
||||||
# We're using llvm-mc as our assembler because it supports
|
# We're using llvm-mc as our assembler because it supports
|
||||||
# .cfi pseudo-ops on mac
|
# .cfi pseudo-ops on mac
|
||||||
CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(CFG_DEPEND_FLAGS) $$(2) | \
|
CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(CFG_DEPEND_FLAGS) $$(2) | \
|
||||||
$$(LLVM_MC_$$(CFG_BUILD)) \
|
$$(LLVM_MC_$$(CFG_BUILD)) \
|
||||||
-assemble \
|
-assemble \
|
||||||
|
-relocation-model=$$(LLVM_MC_RELOCATION_MODEL) \
|
||||||
-filetype=obj \
|
-filetype=obj \
|
||||||
-triple=$(1) \
|
-triple=$(1) \
|
||||||
-o=$$(1)
|
-o=$$(1)
|
||||||
@ -192,7 +200,7 @@ define CFG_MAKE_TOOLCHAIN
|
|||||||
# For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler
|
# For the ARM, AARCH64, MIPS and POWER crosses, use the toolchain assembler
|
||||||
# FIXME: We should be able to use the LLVM assembler
|
# FIXME: We should be able to use the LLVM assembler
|
||||||
CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
|
CFG_ASSEMBLE_$(1)=$$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
|
||||||
$$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
|
$$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ static OS_TABLE: &'static [(&'static str, &'static str)] = &[
|
|||||||
("linux", "linux"),
|
("linux", "linux"),
|
||||||
("freebsd", "freebsd"),
|
("freebsd", "freebsd"),
|
||||||
("dragonfly", "dragonfly"),
|
("dragonfly", "dragonfly"),
|
||||||
|
("bitrig", "bitrig"),
|
||||||
("openbsd", "openbsd"),
|
("openbsd", "openbsd"),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -2188,8 +2188,8 @@ The following configurations must be defined by the implementation:
|
|||||||
`"unix"` or `"windows"`. The value of this configuration option is defined
|
`"unix"` or `"windows"`. The value of this configuration option is defined
|
||||||
as a configuration itself, like `unix` or `windows`.
|
as a configuration itself, like `unix` or `windows`.
|
||||||
* `target_os = "..."`. Operating system of the target, examples include
|
* `target_os = "..."`. Operating system of the target, examples include
|
||||||
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"` or
|
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
|
||||||
`"openbsd"`.
|
`"bitrig"` or `"openbsd"`.
|
||||||
* `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
|
* `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
|
||||||
for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
|
for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
|
||||||
pointers.
|
pointers.
|
||||||
|
@ -18,7 +18,7 @@ LIB_PREFIX=lib
|
|||||||
|
|
||||||
OS=`uname -s`
|
OS=`uname -s`
|
||||||
case $OS in
|
case $OS in
|
||||||
("Linux"|"FreeBSD"|"DragonFly"|"OpenBSD")
|
("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD")
|
||||||
BIN_SUF=
|
BIN_SUF=
|
||||||
LIB_SUF=.so
|
LIB_SUF=.so
|
||||||
;;
|
;;
|
||||||
|
@ -57,7 +57,16 @@ else:
|
|||||||
args.extend(components)
|
args.extend(components)
|
||||||
out = run(args)
|
out = run(args)
|
||||||
for lib in out.strip().replace("\n", ' ').split(' '):
|
for lib in out.strip().replace("\n", ' ').split(' '):
|
||||||
lib = lib.strip()[2:] # chop of the leading '-l'
|
if len(lib) == 0:
|
||||||
|
continue
|
||||||
|
# in some cases we get extra spaces in between libs so ignore those
|
||||||
|
if len(lib) == 1 and lib == ' ':
|
||||||
|
continue
|
||||||
|
# not all libs strictly follow -lfoo, on Bitrig, there is -pthread
|
||||||
|
if lib[0:2] == '-l':
|
||||||
|
lib = lib.strip()[2:]
|
||||||
|
elif lib[0] == '-':
|
||||||
|
lib = lib.strip()[1:]
|
||||||
f.write("#[link(name = \"" + lib + "\"")
|
f.write("#[link(name = \"" + lib + "\"")
|
||||||
# LLVM libraries are all static libraries
|
# LLVM libraries are all static libraries
|
||||||
if 'LLVM' in lib:
|
if 'LLVM' in lib:
|
||||||
|
@ -46,13 +46,13 @@ snapshot_files = {
|
|||||||
"winnt": ["bin/rustc.exe"],
|
"winnt": ["bin/rustc.exe"],
|
||||||
"freebsd": ["bin/rustc"],
|
"freebsd": ["bin/rustc"],
|
||||||
"dragonfly": ["bin/rustc"],
|
"dragonfly": ["bin/rustc"],
|
||||||
|
"bitrig": ["bin/rustc"],
|
||||||
"openbsd": ["bin/rustc"],
|
"openbsd": ["bin/rustc"],
|
||||||
}
|
}
|
||||||
|
|
||||||
winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
|
winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
|
||||||
winnt_runtime_deps_64 = ["libgcc_s_seh-1.dll", "libstdc++-6.dll"]
|
winnt_runtime_deps_64 = ["libgcc_s_seh-1.dll", "libstdc++-6.dll"]
|
||||||
|
|
||||||
|
|
||||||
def parse_line(n, line):
|
def parse_line(n, line):
|
||||||
global snapshotfile
|
global snapshotfile
|
||||||
|
|
||||||
@ -101,6 +101,8 @@ def get_kernel(triple):
|
|||||||
return "freebsd"
|
return "freebsd"
|
||||||
if os_name == "dragonfly":
|
if os_name == "dragonfly":
|
||||||
return "dragonfly"
|
return "dragonfly"
|
||||||
|
if os_name == "bitrig":
|
||||||
|
return "bitrig"
|
||||||
if os_name == "openbsd":
|
if os_name == "openbsd":
|
||||||
return "openbsd"
|
return "openbsd"
|
||||||
return "linux"
|
return "linux"
|
||||||
|
4
src/libbacktrace/configure
vendored
4
src/libbacktrace/configure
vendored
@ -5650,7 +5650,7 @@ else
|
|||||||
lt_cv_sys_max_cmd_len=8192;
|
lt_cv_sys_max_cmd_len=8192;
|
||||||
;;
|
;;
|
||||||
|
|
||||||
netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
|
netbsd* | freebsd* | openbsd* | darwin* | dragonfly* | bitrig*)
|
||||||
# This has been around since 386BSD, at least. Likely further.
|
# This has been around since 386BSD, at least. Likely further.
|
||||||
if test -x /sbin/sysctl; then
|
if test -x /sbin/sysctl; then
|
||||||
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
|
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
|
||||||
@ -9332,7 +9332,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
|
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
|
||||||
freebsd* | dragonfly* | openbsd*)
|
freebsd* | dragonfly* | bitrig* | openbsd*)
|
||||||
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
|
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
|
||||||
hardcode_libdir_flag_spec='-R$libdir'
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
hardcode_direct=yes
|
hardcode_direct=yes
|
||||||
|
@ -4741,7 +4741,7 @@ func_mode_link ()
|
|||||||
# These systems don't actually have a C library (as such)
|
# These systems don't actually have a C library (as such)
|
||||||
test "X$arg" = "X-lc" && continue
|
test "X$arg" = "X-lc" && continue
|
||||||
;;
|
;;
|
||||||
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
|
||||||
# Do not include libc due to us having libc/libc_r.
|
# Do not include libc due to us having libc/libc_r.
|
||||||
test "X$arg" = "X-lc" && continue
|
test "X$arg" = "X-lc" && continue
|
||||||
;;
|
;;
|
||||||
|
@ -281,6 +281,7 @@ pub use funcs::bsd43::{shutdown};
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
|
pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ pub use types::os::arch::extra::{sockaddr_ll};
|
|||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
pub use consts::os::extra::{AF_PACKET};
|
pub use consts::os::extra::{AF_PACKET};
|
||||||
|
|
||||||
#[cfg(all(unix, not(any(target_os = "freebsd", target_os = "openbsd"))))]
|
#[cfg(all(unix, not(any(target_os = "freebsd", target_os = "bitrig", target_os = "openbsd"))))]
|
||||||
pub use consts::os::extra::{MAP_STACK};
|
pub use consts::os::extra::{MAP_STACK};
|
||||||
|
|
||||||
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
||||||
@ -1322,7 +1323,7 @@ pub mod types {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
pub mod os {
|
pub mod os {
|
||||||
pub mod common {
|
pub mod common {
|
||||||
pub mod posix01 {
|
pub mod posix01 {
|
||||||
@ -1333,6 +1334,24 @@ pub mod types {
|
|||||||
|
|
||||||
pub type pthread_t = uintptr_t;
|
pub type pthread_t = uintptr_t;
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy)] pub struct glob_t {
|
||||||
|
pub gl_pathc: c_int,
|
||||||
|
pub gl_matchc: c_int,
|
||||||
|
pub gl_offs: c_int,
|
||||||
|
pub gl_flags: c_int,
|
||||||
|
pub gl_pathv: *mut *mut c_char,
|
||||||
|
pub __unused1: *mut c_void,
|
||||||
|
pub __unused2: *mut c_void,
|
||||||
|
pub __unused3: *mut c_void,
|
||||||
|
pub __unused4: *mut c_void,
|
||||||
|
pub __unused5: *mut c_void,
|
||||||
|
pub __unused6: *mut c_void,
|
||||||
|
pub __unused7: *mut c_void,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "openbsd")]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy)] pub struct glob_t {
|
#[derive(Copy)] pub struct glob_t {
|
||||||
pub gl_pathc: c_int,
|
pub gl_pathc: c_int,
|
||||||
@ -1451,7 +1470,6 @@ pub mod types {
|
|||||||
pub ifa_dstaddr: *mut sockaddr,
|
pub ifa_dstaddr: *mut sockaddr,
|
||||||
pub ifa_data: *mut c_void
|
pub ifa_data: *mut c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1485,15 +1503,16 @@ pub mod types {
|
|||||||
pub type uintmax_t = u64;
|
pub type uintmax_t = u64;
|
||||||
}
|
}
|
||||||
pub mod posix88 {
|
pub mod posix88 {
|
||||||
|
use types::os::arch::c95::{c_long};
|
||||||
pub type off_t = i64;
|
pub type off_t = i64;
|
||||||
pub type dev_t = u32;
|
pub type dev_t = i32;
|
||||||
pub type ino_t = u64;
|
pub type ino_t = u64;
|
||||||
pub type pid_t = i32;
|
pub type pid_t = i32;
|
||||||
pub type uid_t = u32;
|
pub type uid_t = u32;
|
||||||
pub type gid_t = u32;
|
pub type gid_t = u32;
|
||||||
pub type useconds_t = u32;
|
pub type useconds_t = u32;
|
||||||
pub type mode_t = u32;
|
pub type mode_t = u32;
|
||||||
pub type ssize_t = i64;
|
pub type ssize_t = c_long;
|
||||||
}
|
}
|
||||||
pub mod posix01 {
|
pub mod posix01 {
|
||||||
use types::common::c95::{c_void};
|
use types::common::c95::{c_void};
|
||||||
@ -1503,7 +1522,7 @@ pub mod types {
|
|||||||
use types::os::arch::posix88::{mode_t, off_t};
|
use types::os::arch::posix88::{mode_t, off_t};
|
||||||
use types::os::arch::posix88::{uid_t};
|
use types::os::arch::posix88::{uid_t};
|
||||||
|
|
||||||
pub type nlink_t = u32;
|
pub type nlink_t = uint32_t;
|
||||||
pub type blksize_t = uint32_t;
|
pub type blksize_t = uint32_t;
|
||||||
pub type ino_t = uint64_t;
|
pub type ino_t = uint64_t;
|
||||||
pub type blkcnt_t = i64;
|
pub type blkcnt_t = i64;
|
||||||
@ -3892,7 +3911,7 @@ pub mod consts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
pub mod os {
|
pub mod os {
|
||||||
pub mod c95 {
|
pub mod c95 {
|
||||||
use types::os::arch::c95::{c_int, c_uint};
|
use types::os::arch::c95::{c_int, c_uint};
|
||||||
@ -3980,11 +3999,11 @@ pub mod consts {
|
|||||||
pub const MCL_CURRENT : c_int = 0x0001;
|
pub const MCL_CURRENT : c_int = 0x0001;
|
||||||
pub const MCL_FUTURE : c_int = 0x0002;
|
pub const MCL_FUTURE : c_int = 0x0002;
|
||||||
|
|
||||||
pub const MS_SYNC : c_int = 0x0002; // changed
|
|
||||||
pub const MS_ASYNC : c_int = 0x0001;
|
pub const MS_ASYNC : c_int = 0x0001;
|
||||||
pub const MS_INVALIDATE : c_int = 0x0004; // changed
|
pub const MS_SYNC : c_int = 0x0002;
|
||||||
|
pub const MS_INVALIDATE : c_int = 0x0004;
|
||||||
|
|
||||||
pub const EPERM : c_int = 1; // not checked
|
pub const EPERM : c_int = 1;
|
||||||
pub const ENOENT : c_int = 2;
|
pub const ENOENT : c_int = 2;
|
||||||
pub const ESRCH : c_int = 3;
|
pub const ESRCH : c_int = 3;
|
||||||
pub const EINTR : c_int = 4;
|
pub const EINTR : c_int = 4;
|
||||||
@ -4066,25 +4085,17 @@ pub mod consts {
|
|||||||
pub const EFTYPE : c_int = 79;
|
pub const EFTYPE : c_int = 79;
|
||||||
pub const EAUTH : c_int = 80;
|
pub const EAUTH : c_int = 80;
|
||||||
pub const ENEEDAUTH : c_int = 81;
|
pub const ENEEDAUTH : c_int = 81;
|
||||||
pub const EIDRM : c_int = 82;
|
pub const EIPSEC : c_int = 82;
|
||||||
pub const ENOMSG : c_int = 83;
|
pub const ENOATTR : c_int = 83;
|
||||||
pub const EOVERFLOW : c_int = 84;
|
pub const EILSEQ : c_int = 84;
|
||||||
pub const ECANCELED : c_int = 85;
|
pub const ENOMEDIUM : c_int = 85;
|
||||||
pub const EILSEQ : c_int = 86;
|
pub const EMEDIUMTYPE : c_int = 86;
|
||||||
pub const ENOATTR : c_int = 87;
|
pub const EOVERFLOW : c_int = 87;
|
||||||
pub const EDOOFUS : c_int = 88;
|
pub const ECANCELED : c_int = 88;
|
||||||
pub const EBADMSG : c_int = 89;
|
pub const EIDRM : c_int = 89;
|
||||||
pub const EMULTIHOP : c_int = 90;
|
pub const ENOMSG : c_int = 90;
|
||||||
pub const ENOLINK : c_int = 91;
|
pub const ENOTSUP : c_int = 91;
|
||||||
pub const EPROTO : c_int = 92;
|
pub const ELAST : c_int = 91; // must be equal to largest errno
|
||||||
pub const ENOMEDIUM : c_int = 93;
|
|
||||||
pub const EUNUSED94 : c_int = 94;
|
|
||||||
pub const EUNUSED95 : c_int = 95;
|
|
||||||
pub const EUNUSED96 : c_int = 96;
|
|
||||||
pub const EUNUSED97 : c_int = 97;
|
|
||||||
pub const EUNUSED98 : c_int = 98;
|
|
||||||
pub const EASYNC : c_int = 99;
|
|
||||||
pub const ELAST : c_int = 99;
|
|
||||||
}
|
}
|
||||||
pub mod posix01 {
|
pub mod posix01 {
|
||||||
use types::os::arch::c95::{c_int, size_t};
|
use types::os::arch::c95::{c_int, size_t};
|
||||||
@ -4094,6 +4105,12 @@ pub mod consts {
|
|||||||
pub const F_SETFD : c_int = 2;
|
pub const F_SETFD : c_int = 2;
|
||||||
pub const F_GETFL : c_int = 3;
|
pub const F_GETFL : c_int = 3;
|
||||||
pub const F_SETFL : c_int = 4;
|
pub const F_SETFL : c_int = 4;
|
||||||
|
pub const F_GETOWN : c_int = 5;
|
||||||
|
pub const F_SETOWN : c_int = 6;
|
||||||
|
pub const F_GETLK : c_int = 7;
|
||||||
|
pub const F_SETLK : c_int = 8;
|
||||||
|
pub const F_SETLKW : c_int = 9;
|
||||||
|
pub const F_DUPFD_CLOEXEC : c_int = 10;
|
||||||
|
|
||||||
pub const SIGTRAP : c_int = 5;
|
pub const SIGTRAP : c_int = 5;
|
||||||
pub const SIGPIPE: c_int = 13;
|
pub const SIGPIPE: c_int = 13;
|
||||||
@ -4105,11 +4122,12 @@ pub mod consts {
|
|||||||
pub const GLOB_MARK : c_int = 0x0008;
|
pub const GLOB_MARK : c_int = 0x0008;
|
||||||
pub const GLOB_NOCHECK : c_int = 0x0010;
|
pub const GLOB_NOCHECK : c_int = 0x0010;
|
||||||
pub const GLOB_NOSORT : c_int = 0x0020;
|
pub const GLOB_NOSORT : c_int = 0x0020;
|
||||||
pub const GLOB_NOESCAPE : c_int = 0x1000; // changed
|
pub const GLOB_NOESCAPE : c_int = 0x1000;
|
||||||
|
|
||||||
pub const GLOB_NOSPACE : c_int = -1;
|
pub const GLOB_NOSPACE : c_int = -1;
|
||||||
pub const GLOB_ABORTED : c_int = -2;
|
pub const GLOB_ABORTED : c_int = -2;
|
||||||
pub const GLOB_NOMATCH : c_int = -3;
|
pub const GLOB_NOMATCH : c_int = -3;
|
||||||
|
pub const GLOB_NOSYS : c_int = -4;
|
||||||
|
|
||||||
pub const POSIX_MADV_NORMAL : c_int = 0;
|
pub const POSIX_MADV_NORMAL : c_int = 0;
|
||||||
pub const POSIX_MADV_RANDOM : c_int = 1;
|
pub const POSIX_MADV_RANDOM : c_int = 1;
|
||||||
@ -4117,7 +4135,7 @@ pub mod consts {
|
|||||||
pub const POSIX_MADV_WILLNEED : c_int = 3;
|
pub const POSIX_MADV_WILLNEED : c_int = 3;
|
||||||
pub const POSIX_MADV_DONTNEED : c_int = 4;
|
pub const POSIX_MADV_DONTNEED : c_int = 4;
|
||||||
|
|
||||||
pub const _SC_IOV_MAX : c_int = 51; // all changed...
|
pub const _SC_IOV_MAX : c_int = 51;
|
||||||
pub const _SC_GETGR_R_SIZE_MAX : c_int = 100;
|
pub const _SC_GETGR_R_SIZE_MAX : c_int = 100;
|
||||||
pub const _SC_GETPW_R_SIZE_MAX : c_int = 101;
|
pub const _SC_GETPW_R_SIZE_MAX : c_int = 101;
|
||||||
pub const _SC_LOGIN_NAME_MAX : c_int = 102;
|
pub const _SC_LOGIN_NAME_MAX : c_int = 102;
|
||||||
@ -4144,14 +4162,13 @@ pub mod consts {
|
|||||||
pub const _SC_XOPEN_SHM : c_int = 30;
|
pub const _SC_XOPEN_SHM : c_int = 30;
|
||||||
pub const _SC_XOPEN_UNIX : c_int = 123;
|
pub const _SC_XOPEN_UNIX : c_int = 123;
|
||||||
pub const _SC_XOPEN_VERSION : c_int = 125;
|
pub const _SC_XOPEN_VERSION : c_int = 125;
|
||||||
//pub const _SC_XOPEN_XCU_VERSION : c_int = ;
|
|
||||||
|
|
||||||
pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
|
pub const PTHREAD_CREATE_JOINABLE : c_int = 0;
|
||||||
pub const PTHREAD_CREATE_DETACHED: c_int = 1;
|
pub const PTHREAD_CREATE_DETACHED : c_int = 1;
|
||||||
pub const PTHREAD_STACK_MIN: size_t = 2048;
|
pub const PTHREAD_STACK_MIN : size_t = 2048;
|
||||||
|
|
||||||
pub const CLOCK_REALTIME: c_int = 0;
|
pub const CLOCK_REALTIME : c_int = 0;
|
||||||
pub const CLOCK_MONOTONIC: c_int = 3;
|
pub const CLOCK_MONOTONIC : c_int = 3;
|
||||||
}
|
}
|
||||||
pub mod posix08 {
|
pub mod posix08 {
|
||||||
}
|
}
|
||||||
@ -4163,23 +4180,11 @@ pub mod consts {
|
|||||||
pub const MADV_SEQUENTIAL : c_int = 2;
|
pub const MADV_SEQUENTIAL : c_int = 2;
|
||||||
pub const MADV_WILLNEED : c_int = 3;
|
pub const MADV_WILLNEED : c_int = 3;
|
||||||
pub const MADV_DONTNEED : c_int = 4;
|
pub const MADV_DONTNEED : c_int = 4;
|
||||||
pub const MADV_FREE : c_int = 6; // changed
|
pub const MADV_FREE : c_int = 6;
|
||||||
//pub const MADV_NOSYNC : c_int = ;
|
|
||||||
//pub const MADV_AUTOSYNC : c_int = ;
|
|
||||||
//pub const MADV_NOCORE : c_int = ;
|
|
||||||
//pub const MADV_CORE : c_int = ;
|
|
||||||
//pub const MADV_PROTECT : c_int = ;
|
|
||||||
|
|
||||||
//pub const MINCORE_INCORE : c_int = ;
|
|
||||||
//pub const MINCORE_REFERENCED : c_int = ;
|
|
||||||
//pub const MINCORE_MODIFIED : c_int = ;
|
|
||||||
//pub const MINCORE_REFERENCED_OTHER : c_int = ;
|
|
||||||
//pub const MINCORE_MODIFIED_OTHER : c_int = ;
|
|
||||||
//pub const MINCORE_SUPER : c_int = ;
|
|
||||||
|
|
||||||
pub const AF_INET: c_int = 2;
|
|
||||||
pub const AF_INET6: c_int = 24; // changed
|
|
||||||
pub const AF_UNIX: c_int = 1;
|
pub const AF_UNIX: c_int = 1;
|
||||||
|
pub const AF_INET: c_int = 2;
|
||||||
|
pub const AF_INET6: c_int = 24;
|
||||||
pub const SOCK_STREAM: c_int = 1;
|
pub const SOCK_STREAM: c_int = 1;
|
||||||
pub const SOCK_DGRAM: c_int = 2;
|
pub const SOCK_DGRAM: c_int = 2;
|
||||||
pub const SOCK_RAW: c_int = 3;
|
pub const SOCK_RAW: c_int = 3;
|
||||||
@ -4192,13 +4197,10 @@ pub mod consts {
|
|||||||
pub const IP_HDRINCL: c_int = 2;
|
pub const IP_HDRINCL: c_int = 2;
|
||||||
pub const IP_ADD_MEMBERSHIP: c_int = 12;
|
pub const IP_ADD_MEMBERSHIP: c_int = 12;
|
||||||
pub const IP_DROP_MEMBERSHIP: c_int = 13;
|
pub const IP_DROP_MEMBERSHIP: c_int = 13;
|
||||||
// don't exist, keep same as IP_ADD_MEMBERSHIP
|
pub const IPV6_ADD_MEMBERSHIP: c_int = 12; // don't exist
|
||||||
pub const IPV6_ADD_MEMBERSHIP: c_int = 12;
|
pub const IPV6_DROP_MEMBERSHIP: c_int = 13; // don't exist
|
||||||
// don't exist, keep same as IP_DROP_MEMBERSHIP
|
|
||||||
pub const IPV6_DROP_MEMBERSHIP: c_int = 13;
|
|
||||||
|
|
||||||
pub const TCP_NODELAY: c_int = 1;
|
pub const TCP_NODELAY: c_int = 0x01;
|
||||||
//pub const TCP_KEEPIDLE: c_int = ;
|
|
||||||
pub const SOL_SOCKET: c_int = 0xffff;
|
pub const SOL_SOCKET: c_int = 0xffff;
|
||||||
pub const SO_KEEPALIVE: c_int = 0x0008;
|
pub const SO_KEEPALIVE: c_int = 0x0008;
|
||||||
pub const SO_BROADCAST: c_int = 0x0020;
|
pub const SO_BROADCAST: c_int = 0x0020;
|
||||||
@ -4214,20 +4216,21 @@ pub mod consts {
|
|||||||
pub mod extra {
|
pub mod extra {
|
||||||
use types::os::arch::c95::c_int;
|
use types::os::arch::c95::c_int;
|
||||||
|
|
||||||
|
pub const O_DSYNC : c_int = 128; // same as SYNC
|
||||||
pub const O_SYNC : c_int = 128;
|
pub const O_SYNC : c_int = 128;
|
||||||
pub const O_NONBLOCK : c_int = 4;
|
pub const O_NONBLOCK : c_int = 4;
|
||||||
pub const CTL_KERN: c_int = 1;
|
pub const CTL_KERN : c_int = 1;
|
||||||
pub const KERN_PROC: c_int = 66;
|
pub const KERN_PROC : c_int = 66;
|
||||||
|
|
||||||
pub const MAP_COPY : c_int = 0x0002;
|
pub const MAP_COPY : c_int = 0x0002;
|
||||||
pub const MAP_RENAME : c_int = 0x0000; // changed
|
pub const MAP_RENAME : c_int = 0x0000;
|
||||||
pub const MAP_NORESERVE : c_int = 0x0000; // changed
|
pub const MAP_NORESERVE : c_int = 0x0000;
|
||||||
pub const MAP_HASSEMAPHORE : c_int = 0x0000; // changed
|
pub const MAP_NOEXTEND : c_int = 0x0000;
|
||||||
//pub const MAP_STACK : c_int = ;
|
pub const MAP_HASSEMAPHORE : c_int = 0x0000;
|
||||||
//pub const MAP_NOSYNC : c_int = ;
|
|
||||||
//pub const MAP_NOCORE : c_int = ;
|
|
||||||
|
|
||||||
pub const IPPROTO_RAW : c_int = 255;
|
pub const IPPROTO_RAW : c_int = 255;
|
||||||
|
|
||||||
|
pub const PATH_MAX: c_int = 1024;
|
||||||
}
|
}
|
||||||
pub mod sysconf {
|
pub mod sysconf {
|
||||||
use types::os::arch::c95::c_int;
|
use types::os::arch::c95::c_int;
|
||||||
@ -4259,31 +4262,31 @@ pub mod consts {
|
|||||||
pub const _SC_2_UPE : c_int = 25;
|
pub const _SC_2_UPE : c_int = 25;
|
||||||
pub const _SC_STREAM_MAX : c_int = 26;
|
pub const _SC_STREAM_MAX : c_int = 26;
|
||||||
pub const _SC_TZNAME_MAX : c_int = 27;
|
pub const _SC_TZNAME_MAX : c_int = 27;
|
||||||
pub const _SC_ASYNCHRONOUS_IO : c_int = 45; // changed...
|
pub const _SC_PAGESIZE : c_int = 28;
|
||||||
|
pub const _SC_FSYNC : c_int = 29;
|
||||||
|
pub const _SC_SEM_NSEMS_MAX : c_int = 31;
|
||||||
|
pub const _SC_SEM_VALUE_MAX : c_int = 32;
|
||||||
|
pub const _SC_AIO_LISTIO_MAX : c_int = 42;
|
||||||
|
pub const _SC_AIO_MAX : c_int = 43;
|
||||||
|
pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
|
||||||
|
pub const _SC_ASYNCHRONOUS_IO : c_int = 45;
|
||||||
|
pub const _SC_DELAYTIMER_MAX : c_int = 50;
|
||||||
pub const _SC_MAPPED_FILES : c_int = 53;
|
pub const _SC_MAPPED_FILES : c_int = 53;
|
||||||
pub const _SC_MEMLOCK : c_int = 54;
|
pub const _SC_MEMLOCK : c_int = 54;
|
||||||
pub const _SC_MEMLOCK_RANGE : c_int = 55;
|
pub const _SC_MEMLOCK_RANGE : c_int = 55;
|
||||||
pub const _SC_MEMORY_PROTECTION : c_int = 56;
|
pub const _SC_MEMORY_PROTECTION : c_int = 56;
|
||||||
pub const _SC_MESSAGE_PASSING : c_int = 57;
|
pub const _SC_MESSAGE_PASSING : c_int = 57;
|
||||||
|
pub const _SC_MQ_OPEN_MAX : c_int = 58;
|
||||||
pub const _SC_PRIORITIZED_IO : c_int = 60;
|
pub const _SC_PRIORITIZED_IO : c_int = 60;
|
||||||
pub const _SC_PRIORITY_SCHEDULING : c_int = 61;
|
pub const _SC_PRIORITY_SCHEDULING : c_int = 61;
|
||||||
pub const _SC_REALTIME_SIGNALS : c_int = 64;
|
pub const _SC_REALTIME_SIGNALS : c_int = 64;
|
||||||
pub const _SC_SEMAPHORES : c_int = 67;
|
|
||||||
pub const _SC_FSYNC : c_int = 29;
|
|
||||||
pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68;
|
|
||||||
pub const _SC_SYNCHRONIZED_IO : c_int = 75;
|
|
||||||
pub const _SC_TIMERS : c_int = 94; // ...changed
|
|
||||||
pub const _SC_AIO_LISTIO_MAX : c_int = 42;
|
|
||||||
pub const _SC_AIO_MAX : c_int = 43;
|
|
||||||
pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
|
|
||||||
pub const _SC_DELAYTIMER_MAX : c_int = 50; // changed...
|
|
||||||
pub const _SC_MQ_OPEN_MAX : c_int = 58;
|
|
||||||
pub const _SC_PAGESIZE : c_int = 28;
|
|
||||||
pub const _SC_RTSIG_MAX : c_int = 66;
|
pub const _SC_RTSIG_MAX : c_int = 66;
|
||||||
pub const _SC_SEM_NSEMS_MAX : c_int = 31;
|
pub const _SC_SEMAPHORES : c_int = 67;
|
||||||
pub const _SC_SEM_VALUE_MAX : c_int = 32;
|
pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68;
|
||||||
pub const _SC_SIGQUEUE_MAX : c_int = 70;
|
pub const _SC_SIGQUEUE_MAX : c_int = 70;
|
||||||
|
pub const _SC_SYNCHRONIZED_IO : c_int = 75;
|
||||||
pub const _SC_TIMER_MAX : c_int = 93;
|
pub const _SC_TIMER_MAX : c_int = 93;
|
||||||
|
pub const _SC_TIMERS : c_int = 94;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5005,6 +5008,7 @@ pub mod funcs {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub mod posix88 {
|
pub mod posix88 {
|
||||||
pub mod stat_ {
|
pub mod stat_ {
|
||||||
@ -5019,6 +5023,7 @@ pub mod funcs {
|
|||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "ios"))]
|
target_os = "ios"))]
|
||||||
@ -5034,6 +5039,7 @@ pub mod funcs {
|
|||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "ios"))]
|
target_os = "ios"))]
|
||||||
@ -5228,6 +5234,7 @@ pub mod funcs {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub mod posix01 {
|
pub mod posix01 {
|
||||||
pub mod stat_ {
|
pub mod stat_ {
|
||||||
@ -5238,6 +5245,7 @@ pub mod funcs {
|
|||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "ios"))]
|
target_os = "ios"))]
|
||||||
@ -5347,6 +5355,7 @@ pub mod funcs {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub mod posix08 {
|
pub mod posix08 {
|
||||||
pub mod unistd {
|
pub mod unistd {
|
||||||
@ -5434,6 +5443,7 @@ pub mod funcs {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub mod bsd44 {
|
pub mod bsd44 {
|
||||||
use types::common::c95::{c_void};
|
use types::common::c95::{c_void};
|
||||||
@ -5463,10 +5473,11 @@ pub mod funcs {
|
|||||||
-> c_int;
|
-> c_int;
|
||||||
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
|
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
|
||||||
-> c_int;
|
-> c_int;
|
||||||
|
pub fn realpath(pathname: *const c_char, resolved: *mut c_char)
|
||||||
|
-> *mut c_char;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
pub mod bsd44 {
|
pub mod bsd44 {
|
||||||
use types::common::c95::{c_void};
|
use types::common::c95::{c_void};
|
||||||
@ -5500,6 +5511,7 @@ pub mod funcs {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "freebsd",
|
#[cfg(any(target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub mod extra {
|
pub mod extra {
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
|
|||||||
-a:0:64-n32".to_string()
|
-a:0:64-n32".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsOpenbsd => {
|
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
|
||||||
"e-p:32:32:32\
|
"e-p:32:32:32\
|
||||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||||
-f32:32:32-f64:64:64\
|
-f32:32:32-f64:64:64\
|
||||||
|
@ -56,7 +56,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
|
|||||||
-a:0:64-n32".to_string()
|
-a:0:64-n32".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsOpenbsd => {
|
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
|
||||||
"E-p:32:32:32\
|
"E-p:32:32:32\
|
||||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||||
-f32:32:32-f64:64:64\
|
-f32:32:32-f64:64:64\
|
||||||
|
@ -56,7 +56,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
|
|||||||
-a:0:64-n32".to_string()
|
-a:0:64-n32".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsOpenbsd => {
|
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
|
||||||
"e-p:32:32:32\
|
"e-p:32:32:32\
|
||||||
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
|
||||||
-f32:32:32-f64:64:64\
|
-f32:32:32-f64:64:64\
|
||||||
|
@ -212,6 +212,7 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(target_os = "freebsd",
|
#[cfg(any(target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
fn test_rpath_relative() {
|
fn test_rpath_relative() {
|
||||||
let config = &mut RPathConfig {
|
let config = &mut RPathConfig {
|
||||||
|
28
src/librustc_back/target/bitrig_base.rs
Normal file
28
src/librustc_back/target/bitrig_base.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
use target::TargetOptions;
|
||||||
|
use std::default::Default;
|
||||||
|
|
||||||
|
pub fn opts() -> TargetOptions {
|
||||||
|
TargetOptions {
|
||||||
|
linker: "cc".to_string(),
|
||||||
|
dynamic_linking: true,
|
||||||
|
executables: true,
|
||||||
|
morestack: false,
|
||||||
|
linker_is_gnu: true,
|
||||||
|
has_rpath: true,
|
||||||
|
position_independent_executables: true,
|
||||||
|
pre_link_args: vec!(
|
||||||
|
),
|
||||||
|
|
||||||
|
.. Default::default()
|
||||||
|
}
|
||||||
|
}
|
@ -56,6 +56,7 @@ mod apple_base;
|
|||||||
mod apple_ios_base;
|
mod apple_ios_base;
|
||||||
mod freebsd_base;
|
mod freebsd_base;
|
||||||
mod dragonfly_base;
|
mod dragonfly_base;
|
||||||
|
mod bitrig_base;
|
||||||
mod openbsd_base;
|
mod openbsd_base;
|
||||||
|
|
||||||
mod armv7_apple_ios;
|
mod armv7_apple_ios;
|
||||||
@ -80,6 +81,7 @@ mod x86_64_apple_ios;
|
|||||||
mod x86_64_pc_windows_gnu;
|
mod x86_64_pc_windows_gnu;
|
||||||
mod x86_64_unknown_freebsd;
|
mod x86_64_unknown_freebsd;
|
||||||
mod x86_64_unknown_dragonfly;
|
mod x86_64_unknown_dragonfly;
|
||||||
|
mod x86_64_unknown_bitrig;
|
||||||
mod x86_64_unknown_linux_gnu;
|
mod x86_64_unknown_linux_gnu;
|
||||||
mod x86_64_unknown_openbsd;
|
mod x86_64_unknown_openbsd;
|
||||||
|
|
||||||
@ -361,6 +363,7 @@ impl Target {
|
|||||||
i686_unknown_dragonfly,
|
i686_unknown_dragonfly,
|
||||||
x86_64_unknown_dragonfly,
|
x86_64_unknown_dragonfly,
|
||||||
|
|
||||||
|
x86_64_unknown_bitrig,
|
||||||
x86_64_unknown_openbsd,
|
x86_64_unknown_openbsd,
|
||||||
|
|
||||||
x86_64_apple_darwin,
|
x86_64_apple_darwin,
|
||||||
|
28
src/librustc_back/target/x86_64_unknown_bitrig.rs
Normal file
28
src/librustc_back/target/x86_64_unknown_bitrig.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
use target::Target;
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
let mut base = super::bitrig_base::opts();
|
||||||
|
base.pre_link_args.push("-m64".to_string());
|
||||||
|
|
||||||
|
Target {
|
||||||
|
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
||||||
|
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\
|
||||||
|
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
|
||||||
|
llvm_target: "x86_64-unknown-bitrig".to_string(),
|
||||||
|
target_endian: "little".to_string(),
|
||||||
|
target_pointer_width: "64".to_string(),
|
||||||
|
arch: "x86_64".to_string(),
|
||||||
|
target_os: "bitrig".to_string(),
|
||||||
|
options: base,
|
||||||
|
}
|
||||||
|
}
|
@ -45,13 +45,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os)
|
|||||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
abi::OsFreebsd => {
|
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
|
||||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
|
||||||
}
|
|
||||||
abi::OsDragonfly => {
|
|
||||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
|
||||||
}
|
|
||||||
abi::OsOpenbsd => {
|
|
||||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,17 +47,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
|
|||||||
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
|
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
abi::OsFreebsd => {
|
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
|
||||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
|
||||||
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
|
|
||||||
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
|
|
||||||
}
|
|
||||||
abi::OsDragonfly => {
|
|
||||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
|
||||||
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
|
|
||||||
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
|
|
||||||
}
|
|
||||||
abi::OsOpenbsd => {
|
|
||||||
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
||||||
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
|
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
|
||||||
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
|
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
|
||||||
|
@ -64,7 +64,9 @@ mod imp {
|
|||||||
pub const F_SETLKW: libc::c_int = 13;
|
pub const F_SETLKW: libc::c_int = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
|
#[cfg(any(target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
|
target_os = "openbsd"))]
|
||||||
mod os {
|
mod os {
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
|
@ -165,6 +165,7 @@ mod test {
|
|||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
fn test_errors_do_not_crash() {
|
fn test_errors_do_not_crash() {
|
||||||
// Open /dev/null as a library to get an error, and make sure
|
// Open /dev/null as a library to get an error, and make sure
|
||||||
@ -183,6 +184,7 @@ mod test {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
mod dl {
|
mod dl {
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
@ -655,6 +655,38 @@ pub mod consts {
|
|||||||
pub const EXE_EXTENSION: &'static str = "";
|
pub const EXE_EXTENSION: &'static str = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Constants associated with the current target
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
pub mod consts {
|
||||||
|
pub use super::arch_consts::ARCH;
|
||||||
|
|
||||||
|
pub const FAMILY: &'static str = "unix";
|
||||||
|
|
||||||
|
/// A string describing the specific operating system in use: in this
|
||||||
|
/// case, `bitrig`.
|
||||||
|
pub const OS: &'static str = "bitrig";
|
||||||
|
|
||||||
|
/// Specifies the filename prefix used for shared libraries on this
|
||||||
|
/// platform: in this case, `lib`.
|
||||||
|
pub const DLL_PREFIX: &'static str = "lib";
|
||||||
|
|
||||||
|
/// Specifies the filename suffix used for shared libraries on this
|
||||||
|
/// platform: in this case, `.so`.
|
||||||
|
pub const DLL_SUFFIX: &'static str = ".so";
|
||||||
|
|
||||||
|
/// Specifies the file extension used for shared libraries on this
|
||||||
|
/// platform that goes after the dot: in this case, `so`.
|
||||||
|
pub const DLL_EXTENSION: &'static str = "so";
|
||||||
|
|
||||||
|
/// Specifies the filename suffix used for executable binaries on this
|
||||||
|
/// platform: in this case, the empty string.
|
||||||
|
pub const EXE_SUFFIX: &'static str = "";
|
||||||
|
|
||||||
|
/// Specifies the file extension, if any, used for executable binaries
|
||||||
|
/// on this platform: in this case, the empty string.
|
||||||
|
pub const EXE_EXTENSION: &'static str = "";
|
||||||
|
}
|
||||||
|
|
||||||
/// Constants associated with the current target
|
/// Constants associated with the current target
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(target_os = "openbsd")]
|
||||||
pub mod consts {
|
pub mod consts {
|
||||||
@ -663,7 +695,7 @@ pub mod consts {
|
|||||||
pub const FAMILY: &'static str = "unix";
|
pub const FAMILY: &'static str = "unix";
|
||||||
|
|
||||||
/// A string describing the specific operating system in use: in this
|
/// A string describing the specific operating system in use: in this
|
||||||
/// case, `dragonfly`.
|
/// case, `openbsd`.
|
||||||
pub const OS: &'static str = "openbsd";
|
pub const OS: &'static str = "openbsd";
|
||||||
|
|
||||||
/// Specifies the filename prefix used for shared libraries on this
|
/// Specifies the filename prefix used for shared libraries on this
|
||||||
|
@ -641,6 +641,7 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
fn real_args_as_bytes() -> Vec<Vec<u8>> {
|
fn real_args_as_bytes() -> Vec<Vec<u8>> {
|
||||||
use rt;
|
use rt;
|
||||||
@ -1289,6 +1290,39 @@ pub mod consts {
|
|||||||
pub const EXE_EXTENSION: &'static str = "";
|
pub const EXE_EXTENSION: &'static str = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
#[deprecated(since = "1.0.0", reason = "renamed to env::consts")]
|
||||||
|
#[unstable(feature = "os")]
|
||||||
|
pub mod consts {
|
||||||
|
pub use os::arch_consts::ARCH;
|
||||||
|
|
||||||
|
pub const FAMILY: &'static str = "unix";
|
||||||
|
|
||||||
|
/// A string describing the specific operating system in use: in this
|
||||||
|
/// case, `bitrig`.
|
||||||
|
pub const SYSNAME: &'static str = "bitrig";
|
||||||
|
|
||||||
|
/// Specifies the filename prefix used for shared libraries on this
|
||||||
|
/// platform: in this case, `lib`.
|
||||||
|
pub const DLL_PREFIX: &'static str = "lib";
|
||||||
|
|
||||||
|
/// Specifies the filename suffix used for shared libraries on this
|
||||||
|
/// platform: in this case, `.so`.
|
||||||
|
pub const DLL_SUFFIX: &'static str = ".so";
|
||||||
|
|
||||||
|
/// Specifies the file extension used for shared libraries on this
|
||||||
|
/// platform that goes after the dot: in this case, `so`.
|
||||||
|
pub const DLL_EXTENSION: &'static str = "so";
|
||||||
|
|
||||||
|
/// Specifies the filename suffix used for executable binaries on this
|
||||||
|
/// platform: in this case, the empty string.
|
||||||
|
pub const EXE_SUFFIX: &'static str = "";
|
||||||
|
|
||||||
|
/// Specifies the file extension, if any, used for executable binaries
|
||||||
|
/// on this platform: in this case, the empty string.
|
||||||
|
pub const EXE_EXTENSION: &'static str = "";
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(target_os = "openbsd")]
|
||||||
#[deprecated(since = "1.0.0", reason = "renamed to env::consts")]
|
#[deprecated(since = "1.0.0", reason = "renamed to env::consts")]
|
||||||
#[unstable(feature = "os")]
|
#[unstable(feature = "os")]
|
||||||
|
@ -43,6 +43,7 @@ pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
mod imp {
|
mod imp {
|
||||||
use prelude::v1::*;
|
use prelude::v1::*;
|
||||||
|
@ -109,6 +109,10 @@ extern {}
|
|||||||
#[link(name = "gcc_pic")]
|
#[link(name = "gcc_pic")]
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
#[link(name = "c++abi")]
|
||||||
|
extern {}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// iOS on armv7 uses SjLj exceptions and requires to link
|
// iOS on armv7 uses SjLj exceptions and requires to link
|
||||||
// against corresponding routine (..._SjLj_...)
|
// against corresponding routine (..._SjLj_...)
|
||||||
|
@ -39,7 +39,9 @@ extern {}
|
|||||||
#[link(name = "pthread")]
|
#[link(name = "pthread")]
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
#[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
|
#[cfg(any(target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
|
target_os = "openbsd"))]
|
||||||
#[link(name = "pthread")]
|
#[link(name = "pthread")]
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
|
@ -694,7 +694,8 @@ impl TcpStream {
|
|||||||
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
|
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
|
||||||
seconds as libc::c_int)
|
seconds as libc::c_int)
|
||||||
}
|
}
|
||||||
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
#[cfg(any(target_os = "freebsd",
|
||||||
|
target_os = "dragonfly"))]
|
||||||
fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
|
fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
|
||||||
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
|
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
|
||||||
seconds as libc::c_int)
|
seconds as libc::c_int)
|
||||||
|
@ -189,7 +189,8 @@ pub unsafe fn record_sp_limit(limit: uint) {
|
|||||||
unsafe fn target_record_sp_limit(limit: uint) {
|
unsafe fn target_record_sp_limit(limit: uint) {
|
||||||
asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile")
|
asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile")
|
||||||
}
|
}
|
||||||
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)]
|
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))]
|
||||||
|
#[inline(always)]
|
||||||
unsafe fn target_record_sp_limit(limit: uint) {
|
unsafe fn target_record_sp_limit(limit: uint) {
|
||||||
asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile")
|
asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile")
|
||||||
}
|
}
|
||||||
@ -233,6 +234,7 @@ pub unsafe fn record_sp_limit(limit: uint) {
|
|||||||
#[cfg(any(target_arch = "aarch64",
|
#[cfg(any(target_arch = "aarch64",
|
||||||
target_arch = "powerpc",
|
target_arch = "powerpc",
|
||||||
all(target_arch = "arm", target_os = "ios"),
|
all(target_arch = "arm", target_os = "ios"),
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
unsafe fn target_record_sp_limit(_: uint) {
|
unsafe fn target_record_sp_limit(_: uint) {
|
||||||
}
|
}
|
||||||
@ -276,14 +278,14 @@ pub unsafe fn get_sp_limit() -> uint {
|
|||||||
asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile");
|
asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile");
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)]
|
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))]
|
||||||
|
#[inline(always)]
|
||||||
unsafe fn target_get_sp_limit() -> uint {
|
unsafe fn target_get_sp_limit() -> uint {
|
||||||
let limit;
|
let limit;
|
||||||
asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile");
|
asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile");
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// x86
|
// x86
|
||||||
#[cfg(all(target_arch = "x86",
|
#[cfg(all(target_arch = "x86",
|
||||||
any(target_os = "macos", target_os = "ios")))]
|
any(target_os = "macos", target_os = "ios")))]
|
||||||
@ -331,6 +333,7 @@ pub unsafe fn get_sp_limit() -> uint {
|
|||||||
#[cfg(any(target_arch = "aarch64",
|
#[cfg(any(target_arch = "aarch64",
|
||||||
target_arch = "powerpc",
|
target_arch = "powerpc",
|
||||||
all(target_arch = "arm", target_os = "ios"),
|
all(target_arch = "arm", target_os = "ios"),
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
unsafe fn target_get_sp_limit() -> uint {
|
unsafe fn target_get_sp_limit() -> uint {
|
||||||
|
@ -319,6 +319,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
|
|||||||
if !STATE.is_null() { return STATE }
|
if !STATE.is_null() { return STATE }
|
||||||
let selfname = if cfg!(target_os = "freebsd") ||
|
let selfname = if cfg!(target_os = "freebsd") ||
|
||||||
cfg!(target_os = "dragonfly") ||
|
cfg!(target_os = "dragonfly") ||
|
||||||
|
cfg!(target_os = "bitrig") ||
|
||||||
cfg!(target_os = "openbsd") {
|
cfg!(target_os = "openbsd") {
|
||||||
env::current_exe().ok()
|
env::current_exe().ok()
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,6 +24,7 @@ use libc;
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub const FIONBIO: libc::c_ulong = 0x8004667e;
|
pub const FIONBIO: libc::c_ulong = 0x8004667e;
|
||||||
#[cfg(any(all(target_os = "linux",
|
#[cfg(any(all(target_os = "linux",
|
||||||
@ -43,6 +44,7 @@ pub const FIONBIO: libc::c_ulong = 0x667e;
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub const FIOCLEX: libc::c_ulong = 0x20006601;
|
pub const FIOCLEX: libc::c_ulong = 0x20006601;
|
||||||
#[cfg(any(all(target_os = "linux",
|
#[cfg(any(all(target_os = "linux",
|
||||||
@ -62,6 +64,7 @@ pub const FIOCLEX: libc::c_ulong = 0x6601;
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub const MSG_DONTWAIT: libc::c_int = 0x80;
|
pub const MSG_DONTWAIT: libc::c_int = 0x80;
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
@ -75,7 +78,8 @@ pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 70;
|
|||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly"))]
|
target_os = "dragonfly"))]
|
||||||
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 71;
|
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 71;
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig",
|
||||||
|
target_os = "openbsd"))]
|
||||||
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 101;
|
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 101;
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 0x0048;
|
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 0x0048;
|
||||||
@ -96,6 +100,7 @@ pub struct passwd {
|
|||||||
#[cfg(any(target_os = "macos",
|
#[cfg(any(target_os = "macos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub struct passwd {
|
pub struct passwd {
|
||||||
pub pw_name: *mut libc::c_char,
|
pub pw_name: *mut libc::c_char,
|
||||||
@ -177,6 +182,7 @@ mod select {
|
|||||||
#[cfg(any(target_os = "android",
|
#[cfg(any(target_os = "android",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "linux"))]
|
target_os = "linux"))]
|
||||||
mod select {
|
mod select {
|
||||||
@ -302,8 +308,7 @@ mod signal {
|
|||||||
#[cfg(any(target_os = "macos",
|
#[cfg(any(target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly"))]
|
||||||
target_os = "openbsd"))]
|
|
||||||
mod signal {
|
mod signal {
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
@ -317,8 +322,7 @@ mod signal {
|
|||||||
pub const SIGCHLD: libc::c_int = 20;
|
pub const SIGCHLD: libc::c_int = 20;
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos",
|
#[cfg(any(target_os = "macos",
|
||||||
target_os = "ios",
|
target_os = "ios"))]
|
||||||
target_os = "openbsd"))]
|
|
||||||
pub type sigset_t = u32;
|
pub type sigset_t = u32;
|
||||||
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -345,3 +349,41 @@ mod signal {
|
|||||||
pub sa_mask: sigset_t,
|
pub sa_mask: sigset_t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
|
mod signal {
|
||||||
|
use libc;
|
||||||
|
|
||||||
|
pub const SA_ONSTACK: libc::c_int = 0x0001;
|
||||||
|
pub const SA_RESTART: libc::c_int = 0x0002;
|
||||||
|
pub const SA_RESETHAND: libc::c_int = 0x0004;
|
||||||
|
pub const SA_NOCLDSTOP: libc::c_int = 0x0008;
|
||||||
|
pub const SA_NODEFER: libc::c_int = 0x0010;
|
||||||
|
pub const SA_NOCLDWAIT: libc::c_int = 0x0020;
|
||||||
|
pub const SA_SIGINFO: libc::c_int = 0x0040;
|
||||||
|
pub const SIGCHLD: libc::c_int = 20;
|
||||||
|
|
||||||
|
pub type sigset_t = libc::c_uint;
|
||||||
|
|
||||||
|
// This structure has more fields, but we're not all that interested in
|
||||||
|
// them.
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct siginfo {
|
||||||
|
pub si_signo: libc::c_int,
|
||||||
|
pub si_code: libc::c_int,
|
||||||
|
pub si_errno: libc::c_int,
|
||||||
|
// FIXME: Bitrig has a crazy union here in the siginfo, I think this
|
||||||
|
// layout will still work tho. The status might be off by the size of
|
||||||
|
// a clock_t by my reading, but we can fix this later.
|
||||||
|
pub pid: libc::pid_t,
|
||||||
|
pub uid: libc::uid_t,
|
||||||
|
pub status: libc::c_int,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct sigaction {
|
||||||
|
pub sa_handler: extern fn(libc::c_int),
|
||||||
|
pub sa_mask: sigset_t,
|
||||||
|
pub sa_flags: libc::c_int,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -291,6 +291,33 @@ fn mkstat(stat: &libc::stat) -> FileStat {
|
|||||||
// FileStat times are in milliseconds
|
// FileStat times are in milliseconds
|
||||||
fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 }
|
fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 }
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
fn ctime(stat: &libc::stat) -> u64 {
|
||||||
|
mktime(stat.st_ctim.tv_sec as u64, stat.st_ctim.tv_nsec as u64)
|
||||||
|
}
|
||||||
|
#[cfg(not(target_os = "bitrig"))]
|
||||||
|
fn ctime(stat: &libc::stat) -> u64 {
|
||||||
|
mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
fn atime(stat: &libc::stat) -> u64 {
|
||||||
|
mktime(stat.st_atim.tv_sec as u64, stat.st_atim.tv_nsec as u64)
|
||||||
|
}
|
||||||
|
#[cfg(not(target_os = "bitrig"))]
|
||||||
|
fn atime(stat: &libc::stat) -> u64 {
|
||||||
|
mktime(stat.st_atime as u64, stat.st_atime_nsec as u64)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
fn mtime(stat: &libc::stat) -> u64 {
|
||||||
|
mktime(stat.st_mtim.tv_sec as u64, stat.st_mtim.tv_nsec as u64)
|
||||||
|
}
|
||||||
|
#[cfg(not(target_os = "bitrig"))]
|
||||||
|
fn mtime(stat: &libc::stat) -> u64 {
|
||||||
|
mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||||
fn flags(stat: &libc::stat) -> u64 { stat.st_flags as u64 }
|
fn flags(stat: &libc::stat) -> u64 { stat.st_flags as u64 }
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
@ -312,9 +339,9 @@ fn mkstat(stat: &libc::stat) -> FileStat {
|
|||||||
_ => old_io::FileType::Unknown,
|
_ => old_io::FileType::Unknown,
|
||||||
},
|
},
|
||||||
perm: FilePermission::from_bits_truncate(stat.st_mode as u32),
|
perm: FilePermission::from_bits_truncate(stat.st_mode as u32),
|
||||||
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
|
created: ctime(stat),
|
||||||
modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64),
|
modified: mtime(stat),
|
||||||
accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64),
|
accessed: atime(stat),
|
||||||
unstable: UnstableFileStat {
|
unstable: UnstableFileStat {
|
||||||
device: stat.st_dev as u64,
|
device: stat.st_dev as u64,
|
||||||
inode: stat.st_ino as u64,
|
inode: stat.st_ino as u64,
|
||||||
|
@ -42,6 +42,16 @@ pub fn errno() -> i32 {
|
|||||||
__error()
|
__error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
fn errno_location() -> *const c_int {
|
||||||
|
extern {
|
||||||
|
fn __errno() -> *const c_int;
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
__errno()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "dragonfly")]
|
#[cfg(target_os = "dragonfly")]
|
||||||
unsafe fn errno_location() -> *const c_int {
|
unsafe fn errno_location() -> *const c_int {
|
||||||
extern { fn __dfly_error() -> *const c_int; }
|
extern { fn __dfly_error() -> *const c_int; }
|
||||||
@ -194,10 +204,9 @@ pub fn current_exe() -> IoResult<Path> {
|
|||||||
fs::readlink(&Path::new("/proc/curproc/file"))
|
fs::readlink(&Path::new("/proc/curproc/file"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
pub fn current_exe() -> IoResult<Path> {
|
pub fn current_exe() -> IoResult<Path> {
|
||||||
use sync::{StaticMutex, MUTEX_INIT};
|
use sync::{StaticMutex, MUTEX_INIT};
|
||||||
|
|
||||||
static LOCK: StaticMutex = MUTEX_INIT;
|
static LOCK: StaticMutex = MUTEX_INIT;
|
||||||
|
|
||||||
extern {
|
extern {
|
||||||
@ -336,6 +345,7 @@ pub fn args() -> Args {
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub fn args() -> Args {
|
pub fn args() -> Args {
|
||||||
use rt;
|
use rt;
|
||||||
|
@ -856,6 +856,7 @@ fn translate_status(status: c_int) -> ProcessExit {
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
mod imp {
|
mod imp {
|
||||||
pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 }
|
pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 }
|
||||||
|
@ -34,6 +34,7 @@ impl Drop for Handler {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
mod imp {
|
mod imp {
|
||||||
use core::prelude::*;
|
use core::prelude::*;
|
||||||
@ -205,7 +206,9 @@ mod imp {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
|
#[cfg(any(target_os = "macos",
|
||||||
|
target_os = "bitrig",
|
||||||
|
target_os = "openbsd"))]
|
||||||
mod signal {
|
mod signal {
|
||||||
use libc;
|
use libc;
|
||||||
use super::sighandler_t;
|
use super::sighandler_t;
|
||||||
@ -216,7 +219,7 @@ mod imp {
|
|||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub const SIGSTKSZ: libc::size_t = 131072;
|
pub const SIGSTKSZ: libc::size_t = 131072;
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
pub const SIGSTKSZ: libc::size_t = 40960;
|
pub const SIGSTKSZ: libc::size_t = 40960;
|
||||||
|
|
||||||
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
|
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
|
||||||
@ -237,14 +240,14 @@ mod imp {
|
|||||||
pub si_addr: *mut libc::c_void
|
pub si_addr: *mut libc::c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct siginfo {
|
pub struct siginfo {
|
||||||
pub si_signo: libc::c_int,
|
pub si_signo: libc::c_int,
|
||||||
pub si_code: libc::c_int,
|
pub si_code: libc::c_int,
|
||||||
pub si_errno: libc::c_int,
|
pub si_errno: libc::c_int,
|
||||||
// union
|
//union
|
||||||
pub si_addr: *mut libc::c_void,
|
pub si_addr: *mut libc::c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@ -277,6 +280,7 @@ mod imp {
|
|||||||
|
|
||||||
#[cfg(not(any(target_os = "linux",
|
#[cfg(not(any(target_os = "linux",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd")))]
|
target_os = "openbsd")))]
|
||||||
mod imp {
|
mod imp {
|
||||||
use libc;
|
use libc;
|
||||||
|
@ -46,6 +46,7 @@ extern {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "freebsd",
|
#[cfg(any(target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
mod os {
|
mod os {
|
||||||
use libc;
|
use libc;
|
||||||
|
@ -34,6 +34,7 @@ pub extern fn thread_start(main: *mut libc::c_void) -> rust_thread_return {
|
|||||||
|
|
||||||
#[cfg(all(not(target_os = "linux"),
|
#[cfg(all(not(target_os = "linux"),
|
||||||
not(target_os = "macos"),
|
not(target_os = "macos"),
|
||||||
|
not(target_os = "bitrig"),
|
||||||
not(target_os = "openbsd")))]
|
not(target_os = "openbsd")))]
|
||||||
pub mod guard {
|
pub mod guard {
|
||||||
pub unsafe fn current() -> uint {
|
pub unsafe fn current() -> uint {
|
||||||
@ -51,11 +52,13 @@ pub mod guard {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub mod guard {
|
pub mod guard {
|
||||||
use super::*;
|
use super::*;
|
||||||
#[cfg(any(target_os = "linux",
|
#[cfg(any(target_os = "linux",
|
||||||
target_os = "android",
|
target_os = "android",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
use mem;
|
use mem;
|
||||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||||
@ -72,7 +75,9 @@ pub mod guard {
|
|||||||
static mut PAGE_SIZE: uint = 0;
|
static mut PAGE_SIZE: uint = 0;
|
||||||
static mut GUARD_PAGE: uint = 0;
|
static mut GUARD_PAGE: uint = 0;
|
||||||
|
|
||||||
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
|
#[cfg(any(target_os = "macos",
|
||||||
|
target_os = "bitrig",
|
||||||
|
target_os = "openbsd"))]
|
||||||
unsafe fn get_stack_start() -> *mut libc::c_void {
|
unsafe fn get_stack_start() -> *mut libc::c_void {
|
||||||
current() as *mut libc::c_void
|
current() as *mut libc::c_void
|
||||||
}
|
}
|
||||||
@ -190,6 +195,22 @@ pub mod guard {
|
|||||||
|
|
||||||
stackaddr as uint + guardsize as uint
|
stackaddr as uint + guardsize as uint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
pub unsafe fn current() -> uint {
|
||||||
|
let mut current_stack: stack_t = mem::zeroed();
|
||||||
|
if pthread_stackseg_np(pthread_self(), &mut current_stack) != 0 {
|
||||||
|
panic!("failed to get current stack: pthread_stackseg_np")
|
||||||
|
}
|
||||||
|
|
||||||
|
if pthread_main_np() == 1 {
|
||||||
|
// main thread
|
||||||
|
current_stack.ss_sp as uint - current_stack.ss_size as uint + 3 * PAGE_SIZE as uint
|
||||||
|
} else {
|
||||||
|
// new thread
|
||||||
|
current_stack.ss_sp as uint - current_stack.ss_size as uint
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
|
pub unsafe fn create(stack: uint, p: Thunk) -> io::Result<rust_thread> {
|
||||||
@ -252,6 +273,7 @@ pub unsafe fn set_name(name: &str) {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "freebsd",
|
#[cfg(any(target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub unsafe fn set_name(name: &str) {
|
pub unsafe fn set_name(name: &str) {
|
||||||
// pthread_set_name_np() since almost forever on all BSDs
|
// pthread_set_name_np() since almost forever on all BSDs
|
||||||
@ -334,6 +356,15 @@ extern {
|
|||||||
fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int;
|
fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
extern {
|
||||||
|
pub fn pthread_self() -> libc::pthread_t;
|
||||||
|
pub fn pthread_stackseg_np(thread: libc::pthread_t,
|
||||||
|
sinfo: *mut stack_t) -> libc::c_uint;
|
||||||
|
pub fn pthread_main_np() -> libc::c_uint;
|
||||||
|
fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char);
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(target_os = "openbsd")]
|
||||||
extern {
|
extern {
|
||||||
pub fn pthread_stackseg_np(thread: libc::pthread_t,
|
pub fn pthread_stackseg_np(thread: libc::pthread_t,
|
||||||
@ -341,7 +372,7 @@ extern {
|
|||||||
pub fn pthread_main_np() -> libc::c_uint;
|
pub fn pthread_main_np() -> libc::c_uint;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct stack_t {
|
pub struct stack_t {
|
||||||
pub ss_sp: *mut libc::c_void,
|
pub ss_sp: *mut libc::c_void,
|
||||||
|
@ -43,6 +43,7 @@ type pthread_key_t = ::libc::c_ulong;
|
|||||||
|
|
||||||
#[cfg(any(target_os = "freebsd",
|
#[cfg(any(target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
type pthread_key_t = ::libc::c_int;
|
type pthread_key_t = ::libc::c_int;
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ type pthread_key_t = ::libc::c_int;
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd")))]
|
target_os = "openbsd")))]
|
||||||
type pthread_key_t = ::libc::c_uint;
|
type pthread_key_t = ::libc::c_uint;
|
||||||
|
|
||||||
|
@ -80,8 +80,11 @@ mod inner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apparently android provides this in some other library?
|
// Apparently android provides this in some other library?
|
||||||
|
// Bitrig's RT extensions are in the C library, not a separate librt
|
||||||
// OpenBSD provide it via libc
|
// OpenBSD provide it via libc
|
||||||
#[cfg(not(any(target_os = "android", target_os = "openbsd")))]
|
#[cfg(not(any(target_os = "android",
|
||||||
|
target_os = "bitrig",
|
||||||
|
target_os = "openbsd")))]
|
||||||
#[link(name = "rt")]
|
#[link(name = "rt")]
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ pub struct TTY {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "macos",
|
#[cfg(any(target_os = "macos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
const TIOCGWINSZ: c_ulong = 0x40087468;
|
const TIOCGWINSZ: c_ulong = 0x40087468;
|
||||||
|
|
||||||
@ -55,6 +56,7 @@ impl TTY {
|
|||||||
target_os = "android",
|
target_os = "android",
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd"))]
|
target_os = "openbsd"))]
|
||||||
pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
|
pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -24,6 +24,7 @@ pub enum Os {
|
|||||||
OsFreebsd,
|
OsFreebsd,
|
||||||
OsiOS,
|
OsiOS,
|
||||||
OsDragonfly,
|
OsDragonfly,
|
||||||
|
OsBitrig,
|
||||||
OsOpenbsd,
|
OsOpenbsd,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ impl fmt::Display for Os {
|
|||||||
OsAndroid => "android".fmt(f),
|
OsAndroid => "android".fmt(f),
|
||||||
OsFreebsd => "freebsd".fmt(f),
|
OsFreebsd => "freebsd".fmt(f),
|
||||||
OsDragonfly => "dragonfly".fmt(f),
|
OsDragonfly => "dragonfly".fmt(f),
|
||||||
|
OsBitrig => "bitrig".fmt(f),
|
||||||
OsOpenbsd => "openbsd".fmt(f),
|
OsOpenbsd => "openbsd".fmt(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#define EXHAUSTED _rust_stack_exhausted
|
#define EXHAUSTED _rust_stack_exhausted
|
||||||
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__Bitrig__)
|
||||||
#define EXHAUSTED rust_stack_exhausted@PLT
|
#define EXHAUSTED rust_stack_exhausted@PLT
|
||||||
#else
|
#else
|
||||||
#define EXHAUSTED rust_stack_exhausted
|
#define EXHAUSTED rust_stack_exhausted
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__Bitrig__)
|
||||||
.hidden MORESTACK
|
.hidden MORESTACK
|
||||||
#else
|
#else
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
@ -47,8 +47,8 @@ extern char **environ;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__linux__) || defined(__ANDROID__) \
|
#if defined(__FreeBSD__) || defined(__linux__) || defined(__ANDROID__) || \
|
||||||
|| defined(__DragonFly__) || defined(__OpenBSD__)
|
defined(__DragonFly__) || defined(__Bitrig__) || defined(__OpenBSD__)
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -200,7 +200,282 @@ rust_unset_sigprocmask() {
|
|||||||
int *__dfly_error(void) { return __error(); }
|
int *__dfly_error(void) { return __error(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__OpenBSD__)
|
#if defined(__Bitrig__)
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
int rust_get_path(void *p, size_t* sz)
|
||||||
|
{
|
||||||
|
int mib[4];
|
||||||
|
char *eq = NULL;
|
||||||
|
char *key = NULL;
|
||||||
|
char *val = NULL;
|
||||||
|
char **menv = NULL;
|
||||||
|
size_t maxlen, len;
|
||||||
|
int nenv = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((p == NULL) && (sz == NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* get the argv array */
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_PROC_ARGS;
|
||||||
|
mib[2] = getpid();
|
||||||
|
mib[3] = KERN_PROC_ENV;
|
||||||
|
|
||||||
|
/* get the number of bytes needed to get the env */
|
||||||
|
maxlen = 0;
|
||||||
|
if (sysctl(mib, 4, NULL, &maxlen, NULL, 0) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* allocate the buffer */
|
||||||
|
if ((menv = calloc(maxlen, sizeof(char))) == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* get the env array */
|
||||||
|
if (sysctl(mib, 4, menv, &maxlen, NULL, 0) == -1)
|
||||||
|
{
|
||||||
|
free(menv);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mib[3] = KERN_PROC_NENV;
|
||||||
|
len = sizeof(int);
|
||||||
|
/* get the length of env array */
|
||||||
|
if (sysctl(mib, 4, &nenv, &len, NULL, 0) == -1)
|
||||||
|
{
|
||||||
|
free(menv);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find _ key and resolve the value */
|
||||||
|
for (i = 0; i < nenv; i++)
|
||||||
|
{
|
||||||
|
if ((eq = strstr(menv[i], "=")) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
key = menv[i];
|
||||||
|
val = eq + 1;
|
||||||
|
*eq = '\0';
|
||||||
|
|
||||||
|
if (strncmp(key, "PATH", maxlen) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
|
{
|
||||||
|
/* return the length of the value + NUL */
|
||||||
|
*sz = strnlen(val, maxlen) + 1;
|
||||||
|
free(menv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* copy *sz bytes to the output buffer */
|
||||||
|
memcpy(p, val, *sz);
|
||||||
|
free(menv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(menv);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rust_get_path_array(void * p, size_t * sz)
|
||||||
|
{
|
||||||
|
char *path, *str;
|
||||||
|
char **buf;
|
||||||
|
int i, num;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if ((p == NULL) && (sz == NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* get the length of the PATH value */
|
||||||
|
if (rust_get_path(NULL, &len) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (len == 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* allocate the buffer */
|
||||||
|
if ((path = calloc(len, sizeof(char))) == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* get the PATH value */
|
||||||
|
if (rust_get_path(path, &len) == -1)
|
||||||
|
{
|
||||||
|
free(path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* count the number of parts in the PATH */
|
||||||
|
num = 1;
|
||||||
|
for(str = path; *str != '\0'; str++)
|
||||||
|
{
|
||||||
|
if (*str == ':')
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate the size of the buffer for the 2D array */
|
||||||
|
len = (num * sizeof(char*) + 1) + strlen(path) + 1;
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
|
{
|
||||||
|
free(path);
|
||||||
|
*sz = len;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* make sure we have enough buffer space */
|
||||||
|
if (*sz < len)
|
||||||
|
{
|
||||||
|
free(path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* zero out the buffer */
|
||||||
|
buf = (char**)p;
|
||||||
|
memset(buf, 0, *sz);
|
||||||
|
|
||||||
|
/* copy the data into the right place */
|
||||||
|
str = p + ((num+1) * sizeof(char*));
|
||||||
|
memcpy(str, path, strlen(path));
|
||||||
|
|
||||||
|
/* parse the path into it's parts */
|
||||||
|
for (i = 0; i < num && (buf[i] = strsep(&str, ":")) != NULL; i++) {;}
|
||||||
|
buf[num] = NULL;
|
||||||
|
|
||||||
|
free(path);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rust_get_argv_zero(void* p, size_t* sz)
|
||||||
|
{
|
||||||
|
int mib[4];
|
||||||
|
char **argv = NULL;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if ((p == NULL) && (sz == NULL))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* get the argv array */
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_PROC_ARGS;
|
||||||
|
mib[2] = getpid();
|
||||||
|
mib[3] = KERN_PROC_ARGV;
|
||||||
|
|
||||||
|
/* request KERN_PROC_ARGV size */
|
||||||
|
len = 0;
|
||||||
|
if (sysctl(mib, 4, NULL, &len, NULL, 0) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* allocate buffer to receive the values */
|
||||||
|
if ((argv = malloc(len)) == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* get the argv array */
|
||||||
|
if (sysctl(mib, 4, argv, &len, NULL, 0) == -1)
|
||||||
|
{
|
||||||
|
free(argv);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get length of argv[0] */
|
||||||
|
len = strnlen(argv[0], len) + 1;
|
||||||
|
|
||||||
|
if (p == NULL)
|
||||||
|
{
|
||||||
|
*sz = len;
|
||||||
|
free(argv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*sz < len)
|
||||||
|
{
|
||||||
|
free(argv);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(p, 0, len);
|
||||||
|
memcpy(p, argv[0], len);
|
||||||
|
free(argv);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * rust_current_exe()
|
||||||
|
{
|
||||||
|
static char *self = NULL;
|
||||||
|
char *argv0;
|
||||||
|
char **paths;
|
||||||
|
size_t sz;
|
||||||
|
int i;
|
||||||
|
char buf[2*PATH_MAX], exe[2*PATH_MAX];
|
||||||
|
|
||||||
|
if (self != NULL)
|
||||||
|
return self;
|
||||||
|
|
||||||
|
if (rust_get_argv_zero(NULL, &sz) == -1)
|
||||||
|
return NULL;
|
||||||
|
if ((argv0 = calloc(sz, sizeof(char))) == NULL)
|
||||||
|
return NULL;
|
||||||
|
if (rust_get_argv_zero(argv0, &sz) == -1)
|
||||||
|
{
|
||||||
|
free(argv0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if argv0 is a relative or absolute path, resolve it with realpath */
|
||||||
|
if ((*argv0 == '.') || (*argv0 == '/') || (strstr(argv0, "/") != NULL))
|
||||||
|
{
|
||||||
|
self = realpath(argv0, NULL);
|
||||||
|
free(argv0);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the path array */
|
||||||
|
if (rust_get_path_array(NULL, &sz) == -1)
|
||||||
|
{
|
||||||
|
free(argv0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if ((paths = calloc(sz, sizeof(char))) == NULL)
|
||||||
|
{
|
||||||
|
free(argv0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (rust_get_path_array(paths, &sz) == -1)
|
||||||
|
{
|
||||||
|
free(argv0);
|
||||||
|
free(paths);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; paths[i] != NULL; i++)
|
||||||
|
{
|
||||||
|
snprintf(buf, 2*PATH_MAX, "%s/%s", paths[i], argv0);
|
||||||
|
if (realpath(buf, exe) == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (access(exe, F_OK | X_OK) == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
self = strdup(exe);
|
||||||
|
free(argv0);
|
||||||
|
free(paths);
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(argv0);
|
||||||
|
free(paths);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
@ -248,6 +523,7 @@ const char * rust_current_exe() {
|
|||||||
|
|
||||||
return (self);
|
return (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -26,6 +26,9 @@ mod hello;
|
|||||||
#[cfg(target_os = "dragonfly")]
|
#[cfg(target_os = "dragonfly")]
|
||||||
mod hello;
|
mod hello;
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
mod hello;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
mod hello;
|
mod hello;
|
||||||
|
|
||||||
|
@ -42,6 +42,18 @@ mod m {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
mod m {
|
||||||
|
#[main]
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
pub fn main() {
|
||||||
|
unsafe {
|
||||||
|
assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
|
||||||
|
assert_eq!(::rusti::min_align_of::<u64>(), 8u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod m {
|
mod m {
|
||||||
#[main]
|
#[main]
|
||||||
|
@ -37,7 +37,7 @@ extern {}
|
|||||||
#[link(name = "c")]
|
#[link(name = "c")]
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
#[cfg(target_os = "openbsd")]
|
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||||
#[link(name = "c")]
|
#[link(name = "c")]
|
||||||
extern {}
|
extern {}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
//ignore-freebsd
|
//ignore-freebsd
|
||||||
//ignore-ios
|
//ignore-ios
|
||||||
//ignore-dragonfly
|
//ignore-dragonfly
|
||||||
|
//ignore-bitrig
|
||||||
|
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
//ignore-freebsd
|
//ignore-freebsd
|
||||||
//ignore-ios
|
//ignore-ios
|
||||||
//ignore-dragonfly
|
//ignore-dragonfly
|
||||||
|
//ignore-bitrig
|
||||||
|
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
|
|
||||||
|
@ -55,6 +55,15 @@ mod m {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "bitrig")]
|
||||||
|
mod m {
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
pub mod m {
|
||||||
|
pub fn align() -> uint { 8u }
|
||||||
|
pub fn size() -> uint { 16u }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod m {
|
mod m {
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
|
@ -34,6 +34,7 @@ pub fn main() {
|
|||||||
target_os = "linux",
|
target_os = "linux",
|
||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "dragonfly",
|
target_os = "dragonfly",
|
||||||
|
target_os = "bitrig",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "android"))]
|
target_os = "android"))]
|
||||||
pub fn main() { }
|
pub fn main() { }
|
||||||
|
Loading…
Reference in New Issue
Block a user