diff options
-rw-r--r-- | libc-test/build.rs | 81 | ||||
-rw-r--r-- | libc-test/semver/android.txt | 1 | ||||
-rw-r--r-- | libc-test/semver/apple.txt | 3 | ||||
-rw-r--r-- | libc-test/semver/freebsd.txt | 212 | ||||
-rw-r--r-- | libc-test/semver/linux-gnu.txt | 1 | ||||
-rw-r--r-- | libc-test/semver/linux.txt | 81 | ||||
-rw-r--r-- | libc-test/semver/netbsd.txt | 1 | ||||
-rw-r--r-- | src/lib.rs | 6 | ||||
-rw-r--r-- | src/unix/bsd/apple/mod.rs | 4 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs | 4 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs | 14 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs | 17 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs | 17 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/mod.rs | 968 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/mod.rs | 3 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/mod.rs | 43 | ||||
-rw-r--r-- | src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs | 7 | ||||
-rw-r--r-- | src/unix/linux_like/linux/gnu/mod.rs | 4 | ||||
-rw-r--r-- | src/unix/linux_like/linux/mod.rs | 184 | ||||
-rw-r--r-- | src/unix/linux_like/linux/uclibc/mips/mod.rs | 9 | ||||
-rw-r--r-- | src/unix/linux_like/mod.rs | 3 | ||||
-rw-r--r-- | src/xous.rs | 49 |
22 files changed, 1642 insertions, 70 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index 3ae740faf3..6cb00172d4 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -240,6 +240,7 @@ fn test_apple(target: &str) { "pthread.h", "pthread_spis.h", "pthread/introspection.h", + "pthread/stack_np.h", "pwd.h", "regex.h", "resolv.h", @@ -1935,6 +1936,7 @@ fn test_freebsd(target: &str) { "netdb.h", "netinet/ip.h", "netinet/in.h", + "netinet/sctp.h", "netinet/tcp.h", "netinet/udp.h", "poll.h", @@ -2072,6 +2074,22 @@ fn test_freebsd(target: &str) { // These constants were introduced in FreeBSD 13: "EFD_CLOEXEC" | "EFD_NONBLOCK" | "EFD_SEMAPHORE" if Some(13) > freebsd_ver => true, + // These constants were introduced in FreeBSD 12: + "AT_RESOLVE_BENEATH" | "O_RESOLVE_BENEATH" if Some(12) > freebsd_ver => true, + + // These constants were introduced in FreeBSD 13: + "O_DSYNC" | "O_PATH" | "O_EMPTY_PATH" | "AT_EMPTY_PATH" if Some(13) > freebsd_ver => { + true + } + + // These aliases were introduced in FreeBSD 13: + // (note however that the constants themselves work on any version) + "CLOCK_BOOTTIME" | "CLOCK_REALTIME_COARSE" | "CLOCK_MONOTONIC_COARSE" + if Some(13) > freebsd_ver => + { + true + } + // FIXME: These are deprecated - remove in a couple of releases. // These constants were removed in FreeBSD 11 (svn r273250) but will // still be accepted and ignored at runtime. @@ -2290,6 +2308,13 @@ fn test_freebsd(target: &str) { // Those are private types "memory_type" => true, "memory_type_list" => true, + "pidfh" => true, + "sctp_gen_error_cause" + | "sctp_error_missing_param" + | "sctp_remote_error" + | "sctp_assoc_change" + | "sctp_send_failed_event" + | "sctp_stream_reset_event" => true, _ => false, } @@ -2301,9 +2326,6 @@ fn test_freebsd(target: &str) { // FIXME: https://github.com/rust-lang/libc/issues/1272 "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - // `fspacectl` was introduced in FreeBSD 14 - "fspacectl" if Some(14) > freebsd_ver => true, - // The `uname` function in the `utsname.h` FreeBSD header is a C // inline function (has no symbol) that calls the `__xuname` symbol. // Therefore the function pointer comparison does not make sense for it. @@ -2315,26 +2337,36 @@ fn test_freebsd(target: &str) { // https://github.com/gnzlbg/ctest/issues/68 "lio_listio" => true, - // Those are introduced in FreeBSD 14. - "sched_getaffinity" | "sched_setaffinity" | "sched_getcpu" - if Some(14) > freebsd_ver => + // Those are introduced in FreeBSD 12. + "clock_nanosleep" | "getrandom" | "elf_aux_info" | "setproctitle_fast" + | "timingsafe_bcmp" | "timingsafe_memcmp" + if Some(12) > freebsd_ver => { true } - // This is not available in FreeBSD 12. - "SOCKCRED2SIZE" if Some(13) > freebsd_ver => true, - - // Those are not available in FreeBSD 12. - "memfd_create" | "shm_create_largepage" | "shm_rename" if Some(13) > freebsd_ver => { + // Those are introduced in FreeBSD 13. + "memfd_create" + | "shm_create_largepage" + | "shm_rename" + | "getentropy" + | "eventfd" + | "SOCKCRED2SIZE" + | "getlocalbase" + | "aio_readv" + | "aio_writev" + | "copy_file_range" + if Some(13) > freebsd_ver => + { true } - // Added in FreeBSD 13. - "getlocalbase" if Some(13) > freebsd_ver => true, - "aio_readv" if Some(13) > freebsd_ver => true, - "aio_writev" if Some(13) > freebsd_ver => true, - "copy_file_range" if Some(13) > freebsd_ver => true, + // Those are introduced in FreeBSD 14. + "sched_getaffinity" | "sched_setaffinity" | "sched_getcpu" | "fspacectl" + if Some(14) > freebsd_ver => + { + true + } _ => false, } @@ -2407,6 +2439,11 @@ fn test_freebsd(target: &str) { // `snap_time` is a `long double`, but it's a nightmare to bind correctly in rust // for the moment, so it's a best effort thing... ("statinfo", "snap_time") => true, + ("sctp_sndrcvinfo", "__reserve_pad") => true, + ("sctp_extrcvinfo", "__reserve_pad") => true, + // `tcp_snd_wscale` and `tcp_rcv_wscale` are bitfields + ("tcp_info", "tcp_snd_wscale") => true, + ("tcp_info", "tcp_rcv_wscale") => true, _ => false, } @@ -3229,8 +3266,8 @@ fn test_linux(target: &str) { "linux/reboot.h", "linux/rtnetlink.h", "linux/sched.h", + "linux/sctp.h", "linux/seccomp.h", - "linux/sched.h", "linux/sock_diag.h", "linux/sockios.h", "linux/uinput.h", @@ -3392,6 +3429,8 @@ fn test_linux(target: &str) { // FIXME: Unignore once we update Ubuntu to 22.04 "mallinfo2" if sparc64 => true, "ptrace_rseq_configuration" if sparc64 => true, + "sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo" + | "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true, _ => false, } @@ -3557,12 +3596,17 @@ fn test_linux(target: &str) { // present in recent kernels only "PR_SCHED_CORE" | "PR_SCHED_CORE_CREATE" | "PR_SCHED_CORE_GET" | "PR_SCHED_CORE_MAX" | "PR_SCHED_CORE_SCOPE_PROCESS_GROUP" | "PR_SCHED_CORE_SCOPE_THREAD" | "PR_SCHED_CORE_SCOPE_THREAD_GROUP" | "PR_SCHED_CORE_SHARE_FROM" | "PR_SCHED_CORE_SHARE_TO" => true, - // present in recent kernels only + // present in recent kernels only >= 5.13 "PR_PAC_SET_ENABLED_KEYS" | "PR_PAC_GET_ENABLED_KEYS" => true, + // present in recent kernels only >= 5.19 + "PR_SME_SET_VL" | "PR_SME_GET_VL" | "PR_SME_VL_LEN_MAX" | "PR_SME_SET_VL_INHERIT" | "PR_SME_SET_VL_ONE_EXEC" => true, // Added in Linux 5.14 "FUTEX_LOCK_PI2" => true, + // Added in linux 6.1 + "STATX_DIOALIGN" => true, + // FIXME: Parts of netfilter/nfnetlink*.h require more recent kernel headers: | "RTNLGRP_MCTP_IFADDR" // linux v5.17+ | "RTNLGRP_TUNNEL" // linux v5.18+ @@ -3651,6 +3695,7 @@ fn test_linux(target: &str) { | "IFLA_TSO_MAX_SEGS" // linux v5.18+ | "IFLA_ALLMULTI" // linux v6.0+ => true, + "SCTP_FUTURE_ASSOC" | "SCTP_CURRENT_ASSOC" | "SCTP_ALL_ASSOC" | "SCTP_PEER_ADDR_THLDS_V2" => true, // linux 5.5+ _ => false, } diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 72f90c8a3c..3bee01ca18 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -3498,6 +3498,7 @@ strcasecmp strcasestr strcat strchr +strchrnul strcmp strcoll strcpy diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 2980be2806..106a0d2eaf 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -2095,12 +2095,13 @@ pthread_get_stackaddr_np pthread_get_stacksize_np pthread_getname_np pthread_kill +pthread_main_np pthread_mutexattr_getpshared pthread_mutexattr_setpshared pthread_rwlockattr_getpshared pthread_rwlockattr_setpshared pthread_setname_np -pthread_main_np +pthread_stack_frame_decode_np ptrace pututxline pwritev diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index a09f45136d..429ae63eb8 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -86,6 +86,7 @@ ATF_USETRAILERS AT_BASE AT_EACCESS AT_EGID +AT_EMPTY_PATH AT_ENTRY AT_EUID AT_EXECPATH @@ -99,6 +100,7 @@ AT_PHDR AT_PHENT AT_PHNUM AT_REMOVEDIR +AT_RESOLVE_BENEATH AT_SYMLINK_FOLLOW AT_SYMLINK_NOFOLLOW AT_UID @@ -147,10 +149,13 @@ CLD_EXITED CLD_KILLED CLD_STOPPED CLD_TRAPPED +CLOCK_BOOTTIME +CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST CLOCK_MONOTONIC_PRECISE CLOCK_PROCESS_CPUTIME_ID CLOCK_PROF +CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST CLOCK_REALTIME_PRECISE CLOCK_SECOND @@ -819,14 +824,20 @@ ONOEOT OXTABS O_ASYNC O_DIRECT +O_DSYNC +O_EMPTY_PATH O_EXEC O_EXLOCK O_FSYNC O_NDELAY O_NOCTTY +O_PATH +O_RESOLVE_BENEATH +O_SEARCH O_SHLOCK O_SYNC O_TTY_INIT +O_VERIFY PD_ALLOWED_AT_FORK PD_CLOEXEC PD_DAEMON @@ -1079,6 +1090,140 @@ SCHED_RR SCM_CREDS SCM_RIGHTS SCM_TIMESTAMP +SCTP_ACTIVE +SCTP_ALL_ASSOC +SCTP_ADAPTATION_LAYER +SCTP_ADAPTION_LAYER +SCTP_ADDR_ADDED +SCTP_ADDR_AVAILABLE +SCTP_ADDR_CONFIRMED +SCTP_ADDR_MADE_PRIM +SCTP_ADDR_REMOVED +SCTP_ADDR_UNREACHABLE +SCTP_ADDR_OVER +SCTP_ASCONF_SUPPORTED +SCTP_ASSOCINFO +SCTP_ASSOC_RESET_DENIED +SCTP_ASSOC_RESET_FAILED +SCTP_ASSOC_SUPPORTS_ASCONF +SCTP_ASSOC_SUPPORTS_AUTH +SCTP_ASSOC_SUPPORTS_INTERLEAVING +SCTP_ASSOC_SUPPORTS_MAX +SCTP_ASSOC_SUPPORTS_MULTIBUF +SCTP_ASSOC_SUPPORTS_PR +SCTP_ASSOC_SUPPORTS_RE_CONFIG +SCTP_AUTHINFO +SCTP_AUTH_CHUNK +SCTP_AUTH_ACTIVE_KEY +SCTP_AUTH_DEACTIVATE_KEY +SCTP_AUTH_DELETE_KEY +SCTP_AUTH_FREE_KEY +SCTP_AUTH_KEY +SCTP_AUTH_NEWKEY +SCTP_AUTH_NEW_KEY +SCTP_AUTH_NO_AUTH +SCTP_AUTH_SUPPORTED +SCTP_AUTOCLOSE +SCTP_AUTO_ASCONF +SCTP_CANT_STR_ASSOC +SCTP_COMM_LOST +SCTP_COMM_UP +SCTP_COMPLETE +SCTP_CONTEXT +SCTP_CURRENT_ASSOC +SCTP_DATA_SENT +SCTP_DATA_UNSENT +SCTP_DEFAULT_PRINFO +SCTP_DEFAULT_SEND_PARAM +SCTP_DEFAULT_SNDINFO +SCTP_DELAYED_SACK +SCTP_DISABLE_FRAGMENTS +SCTP_DSTADDRV4 +SCTP_DSTADDRV6 +SCTP_ECN_SUPPORTED +SCTP_EOF +SCTP_EOR +SCTP_EVENT +SCTP_EVENTS +SCTP_EXPLICIT_EOR +SCTP_EXTRCV +SCTP_FRAGMENT_INTERLEAVE +SCTP_FUTURE_ASSOC +SCTP_GET_ASSOC_ID_LIST +SCTP_GET_ASSOC_NUMBER +SCTP_GET_PEER_ADDR_INFO +SCTP_HMAC_IDENT +SCTP_INACTIVE +SCTP_INIT +SCTP_INITMSG +SCTP_I_WANT_MAPPED_V4_ADDR +SCTP_LOCAL_AUTH_CHUNKS +SCTP_MAXBURST +SCTP_MAX_BURST +SCTP_MAX_CWND +SCTP_MAXSEG +SCTP_NEXT_MSG_AVAIL +SCTP_NEXT_MSG_ISCOMPLETE +SCTP_NEXT_MSG_IS_NOTIFICATION +SCTP_NEXT_MSG_IS_UNORDERED +SCTP_NODELAY +SCTP_NOTIFICATION +SCTP_NO_NEXT_MSG +SCTP_NRSACK_SUPPORTED +SCTP_NXTINFO +SCTP_PARTIAL_DELIVERY_ABORTED +SCTP_PARTIAL_DELIVERY_POINT +SCTP_PEER_ADDR_PARAMS +SCTP_PEER_ADDR_THLDS +SCTP_PEER_AUTH_CHUNKS +SCTP_PKTDROP_SUPPORTED +SCTP_PRIMARY_ADDR +SCTP_PR_ASSOC_STATUS +SCTP_PR_SCTP_ALL +SCTP_PR_SCTP_BUF +SCTP_PR_SCTP_MAX +SCTP_PR_SCTP_NONE +SCTP_PR_SCTP_PRIO +SCTP_PR_SCTP_RTX +SCTP_PR_SCTP_TTL +SCTP_PR_STREAM_STATUS +SCTP_REMOTE_UDP_ENCAPS_PORT +SCTP_RESTART +SCTP_REUSE_PORT +SCTP_PRINFO +SCTP_RECONFIG_SUPPORTED +SCTP_RECVNXTINFO +SCTP_RECVRCVINFO +SCTP_RECVV_NOINFO +SCTP_RECVV_NXTINFO +SCTP_RECVV_RCVINFO +SCTP_RECVV_RN +SCTP_RTOINFO +SCTP_SACK_IMMEDIATELY +SCTP_SENDALL +SCTP_SENDV_AUTHINFO +SCTP_SENDV_NOINFO +SCTP_SENDV_PRINFO +SCTP_SENDV_SNDINFO +SCTP_SENDV_SPA +SCTP_SEND_AUTHINFO_VALID +SCTP_SEND_PRINFO_VALID +SCTP_SEND_SNDINFO_VALID +SCTP_SET_PEER_PRIMARY_ADDR +SCTP_SHUTDOWN_COMP +SCTP_SNDINFO +SCTP_SNDRCV +SCTP_STATUS +SCTP_STREAM_CHANGE_DENIED +SCTP_STREAM_CHANGE_FAILED +SCTP_STREAM_RESET_DENIED +SCTP_STREAM_RESET_FAILED +SCTP_STREAM_RESET_INCOMING_SSN +SCTP_STREAM_RESET_OUTGOING_SSN +SCTP_TIMEOUTS +SCTP_UNCONFIRMED +SCTP_UNORDERED +SCTP_USE_EXT_RCVINFO SEEK_DATA SEEK_HOLE SEM_FAILED @@ -1140,6 +1285,13 @@ SO_REUSEPORT SO_REUSEPORT_LB SO_SETFIB SO_TIMESTAMP +SO_TS_CLOCK +SO_TS_REALTIME_MICRO +SO_TS_BINTIME +SO_TS_REALTIME +SO_TS_MONOTONIC +SO_TS_DEFAULT +SO_TS_CLOCK_MAX SO_USELOOPBACK SO_USER_COOKIE SO_VENDOR @@ -1749,6 +1901,12 @@ pause pdfork pdgetpid pdkill +pidfh +pidfile_close +pidfile_fileno +pidfile_open +pidfile_remove +pidfile_write pipe2 popen posix_fadvise @@ -1873,6 +2031,58 @@ sched_param sched_rr_get_interval sched_setparam sched_setscheduler +sctphdr +sctp_adaptation_event +sctp_assoc_change +sctp_assoc_t +sctp_authinfo +sctp_bindx +sctp_chunkhdr +sctp_connectx +sctp_default_prinfo +sctp_error_auth_invalid_hmac +sctp_error_cause +sctp_error_invalid_stream +sctp_error_missing_param +sctp_error_no_user_data +sctp_error_out_of_resource +sctp_error_stale_cookie +sctp_error_unrecognized_chunk +sctp_error_unresolv_addr +sctp_event +sctp_event_subscribe +sctp_extrcvinfo +sctp_freepaddrs +sctp_freeladdrs +sctp_getaddrlen +sctp_getladdrs +sctp_getpaddrs +sctp_gen_error_cause +sctp_initmsg +sctp_nxtinfo +sctp_opt_info +sctp_paddr_change +sctp_pdapi_event +sctp_peeloff +sctp_prinfo +sctp_rcvinfo +sctp_recvv +sctp_recvv_rn +sctp_remote_error +sctp_sender_dry_event +sctp_send_failed_event +sctp_sendv +sctp_sendv_spa +sctp_shutdown_event +sctp_sndinfo +sctp_sndrcvinfo +sctp_snd_all_completes +sctp_stream_change_event +sctp_stream_reset_event +sctp_paramhdr +sctp_pcbinfo +sctp_setadaptation +sctp_sockstat sdallocx seed48 seekdir @@ -1929,6 +2139,7 @@ stack_t statfs strcasecmp strcasestr +strchrnul strncasecmp strndup strsignal @@ -1939,6 +2150,7 @@ sysctlbyname sysctlnametomib tcp_fastopen tcp_function_set +tcp_info telldir thr_kill thr_kill2 diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 665b085a7e..aaeb408150 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -435,6 +435,7 @@ STATX_BASIC_STATS STATX_BLOCKS STATX_BTIME STATX_CTIME +STATX_DIOALIGN STATX_GID STATX_INO STATX_MNT_ID diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 2907fc09e2..daccc3c38d 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -724,6 +724,7 @@ FIONCLEX FIONREAD FLUSHO FOPEN_MAX +FUTEX_BITSET_MATCH_ANY FUTEX_CLOCK_REALTIME FUTEX_CMD_MASK FUTEX_CMP_REQUEUE @@ -731,6 +732,19 @@ FUTEX_CMP_REQUEUE_PI FUTEX_FD FUTEX_LOCK_PI FUTEX_LOCK_PI2 +FUTEX_OP +FUTEX_OP_ADD +FUTEX_OP_ANDN +FUTEX_OP_CMP_EQ +FUTEX_OP_CMP_GE +FUTEX_OP_CMP_GT +FUTEX_OP_CMP_LE +FUTEX_OP_CMP_LT +FUTEX_OP_CMP_NE +FUTEX_OP_OPARG_SHIFT +FUTEX_OP_OR +FUTEX_OP_SET +FUTEX_OP_XOR FUTEX_PRIVATE_FLAG FUTEX_REQUEUE FUTEX_TRYLOCK_PI @@ -1324,6 +1338,7 @@ MSG_INFO MSG_MORE MSG_NOERROR MSG_NOSIGNAL +MSG_NOTIFICATION MSG_RST MSG_STAT MSG_SYN @@ -2145,6 +2160,70 @@ SCM_J1939_ERRQUEUE SCM_J1939_PRIO SCM_TIMESTAMP SCM_TIMESTAMPING +SCTP_ABORT +SCTP_ADDR_OVER +SCTP_ALL_ASSOC +SCTP_ASSOCINFO +SCTP_AUTH_CHUNK +SCTP_AUTH_ACTIVE_KEY +SCTP_AUTH_DEACTIVATE_KEY +SCTP_AUTH_DELETE_KEY +SCTP_AUTH_KEY +SCTP_AUTO_ASCONF +SCTP_AUTOCLOSE +SCTP_CONTEXT +SCTP_CURRENT_ASSOC +SCTP_DELAYED_ACK +SCTP_DELAYED_ACK_TIME +SCTP_DELAYED_SACK +SCTP_DEFAULT_SEND_PARAM +SCTP_DEFAULT_SNDINFO +SCTP_ENABLE_CHANGE_ASSOC_REQ +SCTP_ENABLE_RESET_ASSOC_REQ +SCTP_ENABLE_RESET_STREAM_REQ +SCTP_ENABLE_STRRESET_MASK +SCTP_EOF +SCTP_EVENTS +SCTP_FRAGMENT_INTERLEAVE +SCTP_FUTURE_ASSOC +SCTP_GET_ASSOC_ID_LIST +SCTP_GET_ASSOC_NUMBER +SCTP_GET_PEER_ADDR_INFO +SCTP_HMAC_IDENT +SCTP_I_WANT_MAPPED_V4_ADDR +SCTP_INIT +SCTP_INITMSG +SCTP_LOCAL_AUTH_CHUNKS +SCTP_MAX_BURST +SCTP_MAXSEG +SCTP_NODELAY +SCTP_NOTIFICATION +SCTP_NXTINFO +SCTP_PARTIAL_DELIVERY_POINT +SCTP_PEER_ADDR_PARAMS +SCTP_PEER_ADDR_THLDS +SCTP_PEER_ADDR_THLDS_V2 +SCTP_PEER_AUTH_CHUNKS +SCTP_PR_SCTP_ALL +SCTP_PR_SCTP_NONE +SCTP_PR_SCTP_MASK +SCTP_PR_SCTP_MAX +SCTP_PR_SCTP_PRIO +SCTP_PR_SCTP_RTX +SCTP_PR_SCTP_TTL +SCTP_PRIMARY_ADDR +SCTP_RECVNXTINFO +SCTP_RECVRCVINFO +SCTP_REUSE_PORT +SCTP_RTOINFO +SCTP_SACK_IMMEDIATELY +SCTP_SENDALL +SCTP_SET_PEER_PRIMARY_ADDR +SCTP_SNDRCV +SCTP_STATUS +SCTP_STREAM_RESET_INCOMING +SCTP_STREAM_RESET_OUTGOING +SCTP_UNORDERED SECCOMP_FILTER_FLAG_LOG SECCOMP_FILTER_FLAG_SPEC_ALLOW SECCOMP_FILTER_FLAG_TSYNC @@ -3233,6 +3312,7 @@ sched_rr_get_interval sched_setaffinity sched_setparam sched_setscheduler +sctp_assoc_t seccomp_data seed48 seekdir @@ -3303,6 +3383,7 @@ statfs64 statvfs64 strcasecmp strcasestr +strchrnul strncasecmp strndup strsignal diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index a54221175f..174396c720 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1521,6 +1521,7 @@ syscall sysctl sysctlbyname sysctldesc +tcp_info telldir timer_create timer_delete diff --git a/src/lib.rs b/src/lib.rs index acda091592..d9bd318d1d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -151,6 +151,12 @@ cfg_if! { mod wasi; pub use wasi::*; + } else if #[cfg(target_os = "xous")] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + + mod xous; + pub use xous::*; } else { // non-supported targets: empty... } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 24a6d61033..540bf9dcb5 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -5190,6 +5190,10 @@ extern "C" { f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int; + pub fn pthread_stack_frame_decode_np( + frame_addr: ::uintptr_t, + return_addr: *mut ::uintptr_t, + ) -> ::uintptr_t; pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void; pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t; pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 563c0f936f..f2d170fb28 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -462,8 +462,8 @@ extern "C" { msgflg: ::c_int, ) -> ::c_int; - pub fn fdatasync(fd: ::c_int) -> ::c_int; - + // Type of `path` argument changed from `const void*` to `void*` + // in FreeBSD 12 pub fn dirname(path: *const ::c_char) -> *mut ::c_char; pub fn basename(path: *const ::c_char) -> *mut ::c_char; } diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index df00b6c1d6..5cd4eff26f 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -473,20 +473,6 @@ extern "C" { msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t; - pub fn clock_nanosleep( - clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec, - ) -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; - pub fn setproctitle_fast(fmt: *const ::c_char, ...); - pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index 72a38dc226..56564eeb45 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -492,23 +492,6 @@ extern "C" { msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t; - pub fn clock_nanosleep( - clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec, - ) -> ::c_int; - - pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; - pub fn setproctitle_fast(fmt: *const ::c_char, ...); - pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; pub fn cpuset_getdomain( level: ::cpulevel_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 115b47764e..d60f1a174f 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -492,23 +492,6 @@ extern "C" { msgtyp: ::c_long, msgflg: ::c_int, ) -> ::ssize_t; - pub fn clock_nanosleep( - clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec, - ) -> ::c_int; - - pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; - - pub fn fdatasync(fd: ::c_int) -> ::c_int; - - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; - pub fn setproctitle_fast(fmt: *const ::c_char, ...); - pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; - pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; pub fn cpuset_getdomain( level: ::cpulevel_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 27caa93608..b70a40f15d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -46,6 +46,8 @@ pub type au_asid_t = ::pid_t; pub type cpusetid_t = ::c_int; +pub type sctp_assoc_t = u32; + #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_support_flags { @@ -994,6 +996,68 @@ s! { pub pcbcnt: u32, } + pub struct tcp_info { + pub tcpi_state: u8, + pub __tcpi_ca_state: u8, + pub __tcpi_retransmits: u8, + pub __tcpi_probes: u8, + pub __tcpi_backoff: u8, + pub tcpi_options: u8, + pub tcp_snd_wscale: u8, + pub tcp_rcv_wscale: u8, + pub tcpi_rto: u32, + pub __tcpi_ato: u32, + pub tcpi_snd_mss: u32, + pub tcpi_rcv_mss: u32, + pub __tcpi_unacked: u32, + pub __tcpi_sacked: u32, + pub __tcpi_lost: u32, + pub __tcpi_retrans: u32, + pub __tcpi_fackets: u32, + pub __tcpi_last_data_sent: u32, + pub __tcpi_last_ack_sent: u32, + pub tcpi_last_data_recv: u32, + pub __tcpi_last_ack_recv: u32, + pub __tcpi_pmtu: u32, + pub __tcpi_rcv_ssthresh: u32, + pub tcpi_rtt: u32, + pub tcpi_rttvar: u32, + pub tcpi_snd_ssthresh: u32, + pub tcpi_snd_cwnd: u32, + pub __tcpi_advmss: u32, + pub __tcpi_reordering: u32, + pub __tcpi_rcv_rtt: u32, + pub tcpi_rcv_space: u32, + pub tcpi_snd_wnd: u32, + pub tcpi_snd_bwnd: u32, + pub tcpi_snd_nxt: u32, + pub tcpi_rcv_nxt: u32, + pub tcpi_toe_tid: u32, + pub tcpi_snd_rexmitpack: u32, + pub tcpi_rcv_ooopack: u32, + pub tcpi_snd_zerowin: u32, + #[cfg(freebsd14)] + pub tcpi_delivered_ce: u32, + #[cfg(freebsd14)] + pub tcpi_received_ce: u32, + #[cfg(freebsd14)] + pub __tcpi_delivered_e1_bytes: u32, + #[cfg(freebsd14)] + pub __tcpi_delivered_e0_bytes: u32, + #[cfg(freebsd14)] + pub __tcpi_delivered_ce_bytes: u32, + #[cfg(freebsd14)] + pub __tcpi_received_e1_bytes: u32, + #[cfg(freebsd14)] + pub __tcpi_received_e0_bytes: u32, + #[cfg(freebsd14)] + pub __tcpi_received_ce_bytes: u32, + #[cfg(freebsd14)] + pub __tcpi_pad: [u32; 19], + #[cfg(not(freebsd14))] + pub __tcpi_pad: [u32; 26], + } + pub struct _umtx_time { pub _timeout: ::timespec, pub _flags: u32, @@ -1014,6 +1078,247 @@ s! { pub struct memory_type_list { __priv: [::uintptr_t; 2], } + + pub struct pidfh { + __priva: [[::uintptr_t; 32]; 8], + __privb: [::uintptr_t; 2], + } + + pub struct sctp_event { + pub se_assoc_id: ::sctp_assoc_t, + pub se_type: u16, + pub se_on: u8, + } + + pub struct sctp_event_subscribe { + pub sctp_data_io_event: u8, + pub sctp_association_event: u8, + pub sctp_address_event: u8, + pub sctp_send_failure_event: u8, + pub sctp_peer_error_event: u8, + pub sctp_shutdown_event: u8, + pub sctp_partial_delivery_event: u8, + pub sctp_adaptation_layer_event: u8, + pub sctp_authentication_event: u8, + pub sctp_sender_dry_event: u8, + pub sctp_stream_reset_event: u8, + } + + pub struct sctp_initmsg { + pub sinit_num_ostreams: u16, + pub sinit_max_instreams: u16, + pub sinit_max_attempts: u16, + pub sinit_max_init_timeo: u16, + } + + pub struct sctp_sndrcvinfo { + pub sinfo_stream: u16, + pub sinfo_ssn: u16, + pub sinfo_flags: u16, + pub sinfo_ppid: u32, + pub sinfo_context: u32, + pub sinfo_timetolive: u32, + pub sinfo_tsn: u32, + pub sinfo_cumtsn: u32, + pub sinfo_assoc_id: ::sctp_assoc_t, + pub sinfo_keynumber: u16, + pub sinfo_keynumber_valid: u16, + pub __reserve_pad: [[u8; 23]; 4], + } + + pub struct sctp_extrcvinfo { + pub sinfo_stream: u16, + pub sinfo_ssn: u16, + pub sinfo_flags: u16, + pub sinfo_ppid: u32, + pub sinfo_context: u32, + pub sinfo_timetolive: u32, + pub sinfo_tsn: u32, + pub sinfo_cumtsn: u32, + pub sinfo_assoc_id: ::sctp_assoc_t, + pub serinfo_next_flags: u16, + pub serinfo_next_stream: u16, + pub serinfo_next_aid: u32, + pub serinfo_next_length: u32, + pub serinfo_next_ppid: u32, + pub sinfo_keynumber: u16, + pub sinfo_keynumber_valid: u16, + pub __reserve_pad: [[u8; 19]; 4], + } + + pub struct sctp_sndinfo { + pub snd_sid: u16, + pub snd_flags: u16, + pub snd_ppid: u32, + pub snd_context: u32, + pub snd_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_prinfo { + pub pr_policy: u16, + pub pr_value: u32, + } + + pub struct sctp_default_prinfo { + pub pr_policy: u16, + pub pr_value: u32, + pub pr_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_authinfo { + pub auth_keynumber: u16, + } + + pub struct sctp_rcvinfo { + pub rcv_sid: u16, + pub rcv_ssn: u16, + pub rcv_flags: u16, + pub rcv_ppid: u32, + pub rcv_tsn: u32, + pub rcv_cumtsn: u32, + pub rcv_context: u32, + pub rcv_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_nxtinfo { + pub nxt_sid: u16, + pub nxt_flags: u16, + pub nxt_ppid: u32, + pub nxt_length: u32, + pub nxt_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_recvv_rn { + pub recvv_rcvinfo: sctp_rcvinfo, + pub recvv_nxtinfo: sctp_nxtinfo, + } + + pub struct sctp_sendv_spa { + pub sendv_flags: u32, + pub sendv_sndinfo: sctp_sndinfo, + pub sendv_prinfo: sctp_prinfo, + pub sendv_authinfo: sctp_authinfo, + } + + pub struct sctp_snd_all_completes { + pub sall_stream: u16, + pub sall_flags: u16, + pub sall_ppid: u32, + pub sall_context: u32, + pub sall_num_sent: u32, + pub sall_num_failed: u32, + } + + pub struct sctp_pcbinfo { + pub ep_count: u32, + pub asoc_count: u32, + pub laddr_count: u32, + pub raddr_count: u32, + pub chk_count: u32, + pub readq_count: u32, + pub free_chunks: u32, + pub stream_oque: u32, + } + + pub struct sctp_sockstat { + pub ss_assoc_id: ::sctp_assoc_t, + pub ss_total_sndbuf: u32, + pub ss_total_recv_buf: u32, + } + + pub struct sctp_assoc_change { + pub sac_type: u16, + pub sac_flags: u16, + pub sac_length: u32, + pub sac_state: u16, + pub sac_error: u16, + pub sac_outbound_streams: u16, + pub sac_inbound_streams: u16, + pub sac_assoc_id: ::sctp_assoc_t, + pub sac_info: [u8; 0], + } + + pub struct sctp_paddr_change { + pub spc_type: u16, + pub spc_flags: u16, + pub spc_length: u32, + pub spc_aaddr: ::sockaddr_storage, + pub spc_state: u32, + pub spc_error: u32, + pub spc_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_remote_error { + pub sre_type: u16, + pub sre_flags: u16, + pub sre_length: u32, + pub sre_error: u16, + pub sre_assoc_id: ::sctp_assoc_t, + pub sre_data: [u8; 0], + } + + pub struct sctp_send_failed_event { + pub ssfe_type: u16, + pub ssfe_flags: u16, + pub ssfe_length: u32, + pub ssfe_error: u32, + pub ssfe_info: sctp_sndinfo, + pub ssfe_assoc_id: ::sctp_assoc_t, + pub ssfe_data: [u8; 0], + } + + pub struct sctp_shutdown_event { + pub sse_type: u16, + pub sse_flags: u16, + pub sse_length: u32, + pub sse_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_adaptation_event { + pub sai_type: u16, + pub sai_flags: u16, + pub sai_length: u32, + pub sai_adaptation_ind: u32, + pub sai_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_setadaptation { + pub ssb_adaptation_ind: u32, + } + + pub struct sctp_pdapi_event { + pub pdapi_type: u16, + pub pdapi_flags: u16, + pub pdapi_length: u32, + pub pdapi_indication: u32, + pub pdapi_stream: u16, + pub pdapi_seq: u16, + pub pdapi_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_sender_dry_event { + pub sender_dry_type: u16, + pub sender_dry_flags: u16, + pub sender_dry_length: u32, + pub sender_dry_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_stream_reset_event { + pub strreset_type: u16, + pub strreset_flags: u16, + pub strreset_length: u32, + pub strreset_assoc_id: ::sctp_assoc_t, + pub strreset_stream_list: [u16; 0], + } + + pub struct sctp_stream_change_event { + pub strchange_type: u16, + pub strchange_flags: u16, + pub strchange_length: u32, + pub strchange_assoc_id: ::sctp_assoc_t, + pub strchange_instrms: u16, + pub strchange_outstrms: u16, + } } s_no_extra_traits! { @@ -1224,6 +1529,88 @@ s_no_extra_traits! { pub ifdr_vendor: u32, pub ifdr_msg: [::c_char; ::IFDR_MSG_SIZE as usize], } + + #[repr(packed)] + pub struct sctphdr { + pub src_port: u16, + pub dest_port: u16, + pub v_tag: u32, + pub checksum: u32, + } + + #[repr(packed)] + pub struct sctp_chunkhdr { + pub chunk_type: u8, + pub chunk_flags: u8, + pub chunk_length: u16, + } + + #[repr(packed)] + pub struct sctp_paramhdr { + pub param_type: u16, + pub param_length: u16, + } + + #[repr(packed)] + pub struct sctp_gen_error_cause { + pub code: u16, + pub length: u16, + pub info: [u8; 0], + } + + #[repr(packed)] + pub struct sctp_error_cause { + pub code: u16, + pub length: u16, + } + + #[repr(packed)] + pub struct sctp_error_invalid_stream { + pub cause: sctp_error_cause, + pub stream_id: u16, + __reserved: u16, + } + + #[repr(packed)] + pub struct sctp_error_missing_param { + pub cause: sctp_error_cause, + pub num_missing_params: u32, + pub tpe: [u8; 0], + } + + #[repr(packed)] + pub struct sctp_error_stale_cookie { + pub cause: sctp_error_cause, + pub stale_time: u32, + } + + #[repr(packed)] + pub struct sctp_error_out_of_resource { + pub cause: sctp_error_cause, + } + + #[repr(packed)] + pub struct sctp_error_unresolv_addr { + pub cause: sctp_error_cause, + } + + #[repr(packed)] + pub struct sctp_error_unrecognized_chunk { + pub cause: sctp_error_cause, + pub ch: sctp_chunkhdr, + } + + #[repr(packed)] + pub struct sctp_error_no_user_data { + pub cause: sctp_error_cause, + pub tsn: u32, + } + + #[repr(packed)] + pub struct sctp_error_auth_invalid_hmac { + pub cause: sctp_error_cause, + pub hmac_id: u16, + } } cfg_if! { @@ -1885,6 +2272,301 @@ cfg_if! { self.__ifi_lastchange.hash(state); } } + + impl PartialEq for sctphdr { + fn eq(&self, other: &sctphdr) -> bool { + return {self.src_port} == {other.src_port} && + {self.dest_port} == {other.dest_port} && + {self.v_tag} == {other.v_tag} && + {self.checksum} == {other.checksum} + } + } + impl Eq for sctphdr {} + impl ::fmt::Debug for sctphdr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctphdr") + .field("src_port", &{self.src_port}) + .field("dest_port", &{self.dest_port}) + .field("v_tag", &{self.v_tag}) + .field("checksum", &{self.checksum}) + .finish() + } + } + impl ::hash::Hash for sctphdr { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.src_port}.hash(state); + {self.dest_port}.hash(state); + {self.v_tag}.hash(state); + {self.checksum}.hash(state); + } + } + + impl PartialEq for sctp_chunkhdr { + fn eq(&self, other: &sctp_chunkhdr) -> bool { + return {self.chunk_type} == {other.chunk_type} && + {self.chunk_flags} == {other.chunk_flags} && + {self.chunk_length} == {other.chunk_length} + } + } + impl Eq for sctp_chunkhdr {} + impl ::fmt::Debug for sctp_chunkhdr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_chunkhdr") + .field("chunk_type", &{self.chunk_type}) + .field("chunk_flags", &{self.chunk_flags}) + .field("chunk_length", &{self.chunk_length}) + .finish() + } + } + impl ::hash::Hash for sctp_chunkhdr { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.chunk_type}.hash(state); + {self.chunk_flags}.hash(state); + {self.chunk_length}.hash(state); + } + } + + impl PartialEq for sctp_paramhdr { + fn eq(&self, other: &sctp_paramhdr) -> bool { + return {self.param_type} == {other.param_type} && + {self.param_length} == {other.param_length} + } + } + impl Eq for sctp_paramhdr {} + impl ::fmt::Debug for sctp_paramhdr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_paramhdr") + .field("param_type", &{self.param_type}) + .field("param_length", &{self.param_length}) + .finish() + } + } + impl ::hash::Hash for sctp_paramhdr { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.param_type}.hash(state); + {self.param_length}.hash(state); + } + } + + impl PartialEq for sctp_gen_error_cause { + fn eq(&self, other: &sctp_gen_error_cause) -> bool { + return {self.code} == {other.code} && + {self.length} == {other.length} && + {self.info}.iter().zip({other.info}.iter()).all(|(a,b)| a == b) + } + } + impl Eq for sctp_gen_error_cause {} + impl ::fmt::Debug for sctp_gen_error_cause { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_gen_error_cause") + .field("code", &{self.code}) + .field("length", &{self.length}) + // FIXME: .field("info", &{self.info}) + .finish() + } + } + impl ::hash::Hash for sctp_gen_error_cause { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.code}.hash(state); + {self.length}.hash(state); + {self.info}.hash(state); + } + } + + impl PartialEq for sctp_error_cause { + fn eq(&self, other: &sctp_error_cause) -> bool { + return {self.code} == {other.code} && + {self.length} == {other.length} + } + } + impl Eq for sctp_error_cause {} + impl ::fmt::Debug for sctp_error_cause { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_cause") + .field("code", &{self.code}) + .field("length", &{self.length}) + .finish() + } + } + impl ::hash::Hash for sctp_error_cause { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.code}.hash(state); + {self.length}.hash(state); + } + } + + impl PartialEq for sctp_error_invalid_stream { + fn eq(&self, other: &sctp_error_invalid_stream) -> bool { + return {self.cause} == {other.cause} && + {self.stream_id} == {other.stream_id} + } + } + impl Eq for sctp_error_invalid_stream {} + impl ::fmt::Debug for sctp_error_invalid_stream { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_invalid_stream") + .field("cause", &{self.cause}) + .field("stream_id", &{self.stream_id}) + .finish() + } + } + impl ::hash::Hash for sctp_error_invalid_stream { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + {self.stream_id}.hash(state); + } + } + + impl PartialEq for sctp_error_missing_param { + fn eq(&self, other: &sctp_error_missing_param) -> bool { + return {self.cause} == {other.cause} && + {self.num_missing_params} == {other.num_missing_params} && + {self.tpe}.iter().zip({other.tpe}.iter()).all(|(a,b)| a == b) + } + } + impl Eq for sctp_error_missing_param {} + impl ::fmt::Debug for sctp_error_missing_param { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_missing_param") + .field("cause", &{self.cause}) + .field("num_missing_params", &{self.num_missing_params}) + // FIXME: .field("tpe", &{self.tpe}) + .finish() + } + } + impl ::hash::Hash for sctp_error_missing_param { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + {self.num_missing_params}.hash(state); + {self.tpe}.hash(state); + } + } + + impl PartialEq for sctp_error_stale_cookie { + fn eq(&self, other: &sctp_error_stale_cookie) -> bool { + return {self.cause} == {other.cause} && + {self.stale_time} == {other.stale_time} + } + } + impl Eq for sctp_error_stale_cookie {} + impl ::fmt::Debug for sctp_error_stale_cookie { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_stale_cookie") + .field("cause", &{self.cause}) + .field("stale_time", &{self.stale_time}) + .finish() + } + } + impl ::hash::Hash for sctp_error_stale_cookie { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + {self.stale_time}.hash(state); + } + } + + impl PartialEq for sctp_error_out_of_resource { + fn eq(&self, other: &sctp_error_out_of_resource) -> bool { + return {self.cause} == {other.cause} + } + } + impl Eq for sctp_error_out_of_resource {} + impl ::fmt::Debug for sctp_error_out_of_resource { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_out_of_resource") + .field("cause", &{self.cause}) + .finish() + } + } + impl ::hash::Hash for sctp_error_out_of_resource { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + } + } + + impl PartialEq for sctp_error_unresolv_addr { + fn eq(&self, other: &sctp_error_unresolv_addr) -> bool { + return {self.cause} == {other.cause} + } + } + impl Eq for sctp_error_unresolv_addr {} + impl ::fmt::Debug for sctp_error_unresolv_addr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_unresolv_addr") + .field("cause", &{self.cause}) + .finish() + } + } + impl ::hash::Hash for sctp_error_unresolv_addr { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + } + } + + impl PartialEq for sctp_error_unrecognized_chunk { + fn eq(&self, other: &sctp_error_unrecognized_chunk) -> bool { + return {self.cause} == {other.cause} && + {self.ch} == {other.ch} + } + } + impl Eq for sctp_error_unrecognized_chunk {} + impl ::fmt::Debug for sctp_error_unrecognized_chunk { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_unrecognized_chunk") + .field("cause", &{self.cause}) + .field("ch", &{self.ch}) + .finish() + } + } + impl ::hash::Hash for sctp_error_unrecognized_chunk { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + {self.ch}.hash(state); + } + } + + impl PartialEq for sctp_error_no_user_data { + fn eq(&self, other: &sctp_error_no_user_data) -> bool { + return {self.cause} == {other.cause} && + {self.tsn} == {other.tsn} + } + } + impl Eq for sctp_error_no_user_data {} + impl ::fmt::Debug for sctp_error_no_user_data { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_no_user_data") + .field("cause", &{self.cause}) + .field("tsn", &{self.tsn}) + .finish() + } + } + impl ::hash::Hash for sctp_error_no_user_data { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + {self.tsn}.hash(state); + } + } + + impl PartialEq for sctp_error_auth_invalid_hmac { + fn eq(&self, other: &sctp_error_auth_invalid_hmac) -> bool { + return {self.cause} == {other.cause} && + {self.hmac_id} == {other.hmac_id} + } + } + impl Eq for sctp_error_auth_invalid_hmac {} + impl ::fmt::Debug for sctp_error_auth_invalid_hmac { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sctp_error_invalid_hmac") + .field("cause", &{self.cause}) + .field("hmac_id", &{self.hmac_id}) + .finish() + } + } + impl ::hash::Hash for sctp_error_auth_invalid_hmac { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + {self.cause}.hash(state); + {self.hmac_id}.hash(state); + } + } } } @@ -1935,8 +2617,14 @@ pub const SF_USER_READAHEAD: ::c_int = 0x00000008; pub const SF_NOCACHE: ::c_int = 0x00000010; pub const O_CLOEXEC: ::c_int = 0x00100000; pub const O_DIRECTORY: ::c_int = 0x00020000; +pub const O_DSYNC: ::c_int = 0x01000000; +pub const O_EMPTY_PATH: ::c_int = 0x02000000; pub const O_EXEC: ::c_int = 0x00040000; +pub const O_PATH: ::c_int = 0x00400000; +pub const O_RESOLVE_BENEATH: ::c_int = 0x00800000; +pub const O_SEARCH: ::c_int = O_EXEC; pub const O_TTY_INIT: ::c_int = 0x00080000; +pub const O_VERIFY: ::c_int = 0x00200000; pub const F_GETLK: ::c_int = 11; pub const F_SETLK: ::c_int = 12; pub const F_SETLKW: ::c_int = 13; @@ -2313,9 +3001,17 @@ pub const SO_SETFIB: ::c_int = 0x1014; pub const SO_USER_COOKIE: ::c_int = 0x1015; pub const SO_PROTOCOL: ::c_int = 0x1016; pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL; +pub const SO_TS_CLOCK: ::c_int = 0x1017; pub const SO_DOMAIN: ::c_int = 0x1019; pub const SO_VENDOR: ::c_int = 0x80000000; +pub const SO_TS_REALTIME_MICRO: ::c_int = 0; +pub const SO_TS_BINTIME: ::c_int = 1; +pub const SO_TS_REALTIME: ::c_int = 2; +pub const SO_TS_MONOTONIC: ::c_int = 3; +pub const SO_TS_DEFAULT: ::c_int = SO_TS_REALTIME_MICRO; +pub const SO_TS_CLOCK_MAX: ::c_int = SO_TS_MONOTONIC; + pub const LOCAL_CREDS: ::c_int = 2; pub const LOCAL_CREDS_PERSISTENT: ::c_int = 3; pub const LOCAL_CONNWAIT: ::c_int = 4; @@ -3041,6 +3737,8 @@ pub const AT_EACCESS: ::c_int = 0x100; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; pub const AT_REMOVEDIR: ::c_int = 0x800; +pub const AT_RESOLVE_BENEATH: ::c_int = 0x2000; +pub const AT_EMPTY_PATH: ::c_int = 0x4000; pub const AT_NULL: ::c_int = 0; pub const AT_IGNORE: ::c_int = 1; @@ -3805,6 +4503,162 @@ pub const SIGTHR: ::c_int = 32; pub const SIGLWP: ::c_int = SIGTHR; pub const SIGLIBRT: ::c_int = 33; +// netinet/sctp.h +pub const SCTP_FUTURE_ASSOC: ::c_int = 0; +pub const SCTP_CURRENT_ASSOC: ::c_int = 1; +pub const SCTP_ALL_ASSOC: ::c_int = 2; + +pub const SCTP_NO_NEXT_MSG: ::c_int = 0x0000; +pub const SCTP_NEXT_MSG_AVAIL: ::c_int = 0x0001; +pub const SCTP_NEXT_MSG_ISCOMPLETE: ::c_int = 0x0002; +pub const SCTP_NEXT_MSG_IS_UNORDERED: ::c_int = 0x0004; +pub const SCTP_NEXT_MSG_IS_NOTIFICATION: ::c_int = 0x0008; + +pub const SCTP_RECVV_NOINFO: ::c_int = 0; +pub const SCTP_RECVV_RCVINFO: ::c_int = 1; +pub const SCTP_RECVV_NXTINFO: ::c_int = 2; +pub const SCTP_RECVV_RN: ::c_int = 3; + +pub const SCTP_SENDV_NOINFO: ::c_int = 0; +pub const SCTP_SENDV_SNDINFO: ::c_int = 1; +pub const SCTP_SENDV_PRINFO: ::c_int = 2; +pub const SCTP_SENDV_AUTHINFO: ::c_int = 3; +pub const SCTP_SENDV_SPA: ::c_int = 4; + +pub const SCTP_SEND_SNDINFO_VALID: ::c_int = 0x00000001; +pub const SCTP_SEND_PRINFO_VALID: ::c_int = 0x00000002; +pub const SCTP_SEND_AUTHINFO_VALID: ::c_int = 0x00000004; + +pub const SCTP_NOTIFICATION: ::c_int = 0x0010; +pub const SCTP_COMPLETE: ::c_int = 0x0020; +pub const SCTP_EOF: ::c_int = 0x0100; +pub const SCTP_ABORT: ::c_int = 0x0200; +pub const SCTP_UNORDERED: ::c_int = 0x0400; +pub const SCTP_ADDR_OVER: ::c_int = 0x0800; +pub const SCTP_SENDALL: ::c_int = 0x1000; +pub const SCTP_EOR: ::c_int = 0x2000; +pub const SCTP_SACK_IMMEDIATELY: ::c_int = 0x4000; +pub const SCTP_PR_SCTP_NONE: ::c_int = 0x0000; +pub const SCTP_PR_SCTP_TTL: ::c_int = 0x0001; +pub const SCTP_PR_SCTP_PRIO: ::c_int = 0x0002; +pub const SCTP_PR_SCTP_BUF: ::c_int = SCTP_PR_SCTP_PRIO; +pub const SCTP_PR_SCTP_RTX: ::c_int = 0x0003; +pub const SCTP_PR_SCTP_MAX: ::c_int = SCTP_PR_SCTP_RTX; +pub const SCTP_PR_SCTP_ALL: ::c_int = 0x000f; + +pub const SCTP_INIT: ::c_int = 0x0001; +pub const SCTP_SNDRCV: ::c_int = 0x0002; +pub const SCTP_EXTRCV: ::c_int = 0x0003; +pub const SCTP_SNDINFO: ::c_int = 0x0004; +pub const SCTP_RCVINFO: ::c_int = 0x0005; +pub const SCTP_NXTINFO: ::c_int = 0x0006; +pub const SCTP_PRINFO: ::c_int = 0x0007; +pub const SCTP_AUTHINFO: ::c_int = 0x0008; +pub const SCTP_DSTADDRV4: ::c_int = 0x0009; +pub const SCTP_DSTADDRV6: ::c_int = 0x000a; + +pub const SCTP_RTOINFO: ::c_int = 0x00000001; +pub const SCTP_ASSOCINFO: ::c_int = 0x00000002; +pub const SCTP_INITMSG: ::c_int = 0x00000003; +pub const SCTP_NODELAY: ::c_int = 0x00000004; +pub const SCTP_AUTOCLOSE: ::c_int = 0x00000005; +pub const SCTP_SET_PEER_PRIMARY_ADDR: ::c_int = 0x00000006; +pub const SCTP_PRIMARY_ADDR: ::c_int = 0x00000007; +pub const SCTP_ADAPTATION_LAYER: ::c_int = 0x00000008; +pub const SCTP_ADAPTION_LAYER: ::c_int = 0x00000008; +pub const SCTP_DISABLE_FRAGMENTS: ::c_int = 0x00000009; +pub const SCTP_PEER_ADDR_PARAMS: ::c_int = 0x0000000a; +pub const SCTP_DEFAULT_SEND_PARAM: ::c_int = 0x0000000b; +pub const SCTP_EVENTS: ::c_int = 0x0000000c; +pub const SCTP_I_WANT_MAPPED_V4_ADDR: ::c_int = 0x0000000d; +pub const SCTP_MAXSEG: ::c_int = 0x0000000e; +pub const SCTP_DELAYED_SACK: ::c_int = 0x0000000f; +pub const SCTP_FRAGMENT_INTERLEAVE: ::c_int = 0x00000010; +pub const SCTP_PARTIAL_DELIVERY_POINT: ::c_int = 0x00000011; +pub const SCTP_AUTH_CHUNK: ::c_int = 0x00000012; +pub const SCTP_AUTH_KEY: ::c_int = 0x00000013; +pub const SCTP_HMAC_IDENT: ::c_int = 0x00000014; +pub const SCTP_AUTH_ACTIVE_KEY: ::c_int = 0x00000015; +pub const SCTP_AUTH_DELETE_KEY: ::c_int = 0x00000016; +pub const SCTP_USE_EXT_RCVINFO: ::c_int = 0x00000017; +pub const SCTP_AUTO_ASCONF: ::c_int = 0x00000018; +pub const SCTP_MAXBURST: ::c_int = 0x00000019; +pub const SCTP_MAX_BURST: ::c_int = 0x00000019; +pub const SCTP_CONTEXT: ::c_int = 0x0000001a; +pub const SCTP_EXPLICIT_EOR: ::c_int = 0x00000001b; +pub const SCTP_REUSE_PORT: ::c_int = 0x00000001c; +pub const SCTP_AUTH_DEACTIVATE_KEY: ::c_int = 0x00000001d; +pub const SCTP_EVENT: ::c_int = 0x0000001e; +pub const SCTP_RECVRCVINFO: ::c_int = 0x0000001f; +pub const SCTP_RECVNXTINFO: ::c_int = 0x00000020; +pub const SCTP_DEFAULT_SNDINFO: ::c_int = 0x00000021; +pub const SCTP_DEFAULT_PRINFO: ::c_int = 0x00000022; +pub const SCTP_PEER_ADDR_THLDS: ::c_int = 0x00000023; +pub const SCTP_REMOTE_UDP_ENCAPS_PORT: ::c_int = 0x00000024; +pub const SCTP_ECN_SUPPORTED: ::c_int = 0x00000025; +pub const SCTP_AUTH_SUPPORTED: ::c_int = 0x00000027; +pub const SCTP_ASCONF_SUPPORTED: ::c_int = 0x00000028; +pub const SCTP_RECONFIG_SUPPORTED: ::c_int = 0x00000029; +pub const SCTP_NRSACK_SUPPORTED: ::c_int = 0x00000030; +pub const SCTP_PKTDROP_SUPPORTED: ::c_int = 0x00000031; +pub const SCTP_MAX_CWND: ::c_int = 0x00000032; + +pub const SCTP_STATUS: ::c_int = 0x00000100; +pub const SCTP_GET_PEER_ADDR_INFO: ::c_int = 0x00000101; +pub const SCTP_PEER_AUTH_CHUNKS: ::c_int = 0x00000102; +pub const SCTP_LOCAL_AUTH_CHUNKS: ::c_int = 0x00000103; +pub const SCTP_GET_ASSOC_NUMBER: ::c_int = 0x00000104; +pub const SCTP_GET_ASSOC_ID_LIST: ::c_int = 0x00000105; +pub const SCTP_TIMEOUTS: ::c_int = 0x00000106; +pub const SCTP_PR_STREAM_STATUS: ::c_int = 0x00000107; +pub const SCTP_PR_ASSOC_STATUS: ::c_int = 0x00000108; + +pub const SCTP_COMM_UP: ::c_int = 0x0001; +pub const SCTP_COMM_LOST: ::c_int = 0x0002; +pub const SCTP_RESTART: ::c_int = 0x0003; +pub const SCTP_SHUTDOWN_COMP: ::c_int = 0x0004; +pub const SCTP_CANT_STR_ASSOC: ::c_int = 0x0005; + +pub const SCTP_ASSOC_SUPPORTS_PR: ::c_int = 0x01; +pub const SCTP_ASSOC_SUPPORTS_AUTH: ::c_int = 0x02; +pub const SCTP_ASSOC_SUPPORTS_ASCONF: ::c_int = 0x03; +pub const SCTP_ASSOC_SUPPORTS_MULTIBUF: ::c_int = 0x04; +pub const SCTP_ASSOC_SUPPORTS_RE_CONFIG: ::c_int = 0x05; +pub const SCTP_ASSOC_SUPPORTS_INTERLEAVING: ::c_int = 0x06; +pub const SCTP_ASSOC_SUPPORTS_MAX: ::c_int = 0x06; + +pub const SCTP_ADDR_AVAILABLE: ::c_int = 0x0001; +pub const SCTP_ADDR_UNREACHABLE: ::c_int = 0x0002; +pub const SCTP_ADDR_REMOVED: ::c_int = 0x0003; +pub const SCTP_ADDR_ADDED: ::c_int = 0x0004; +pub const SCTP_ADDR_MADE_PRIM: ::c_int = 0x0005; +pub const SCTP_ADDR_CONFIRMED: ::c_int = 0x0006; + +pub const SCTP_ACTIVE: ::c_int = 0x0001; +pub const SCTP_INACTIVE: ::c_int = 0x0002; +pub const SCTP_UNCONFIRMED: ::c_int = 0x0200; + +pub const SCTP_DATA_UNSENT: ::c_int = 0x0001; +pub const SCTP_DATA_SENT: ::c_int = 0x0002; + +pub const SCTP_PARTIAL_DELIVERY_ABORTED: ::c_int = 0x0001; + +pub const SCTP_AUTH_NEW_KEY: ::c_int = 0x0001; +pub const SCTP_AUTH_NEWKEY: ::c_int = SCTP_AUTH_NEW_KEY; +pub const SCTP_AUTH_NO_AUTH: ::c_int = 0x0002; +pub const SCTP_AUTH_FREE_KEY: ::c_int = 0x0003; + +pub const SCTP_STREAM_RESET_INCOMING_SSN: ::c_int = 0x0001; +pub const SCTP_STREAM_RESET_OUTGOING_SSN: ::c_int = 0x0002; +pub const SCTP_STREAM_RESET_DENIED: ::c_int = 0x0004; +pub const SCTP_STREAM_RESET_FAILED: ::c_int = 0x0008; + +pub const SCTP_ASSOC_RESET_DENIED: ::c_int = 0x0004; +pub const SCTP_ASSOC_RESET_FAILED: ::c_int = 0x0008; + +pub const SCTP_STREAM_CHANGE_DENIED: ::c_int = 0x0004; +pub const SCTP_STREAM_CHANGE_FAILED: ::c_int = 0x0008; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -3926,6 +4780,39 @@ safe_f! { pub {const} fn WIFSIGNALED(status: ::c_int) -> bool { (status & 0o177) != 0o177 && (status & 0o177) != 0 && status != 0x13 } + + pub {const} fn INVALID_SINFO_FLAG(x: ::c_int) -> bool { + (x) & 0xfffffff0 & !(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED | + SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR | SCTP_SACK_IMMEDIATELY) != 0 + } + + pub {const} fn PR_SCTP_POLICY(x: ::c_int) -> ::c_int { + x & 0x0f + } + + pub {const} fn PR_SCTP_ENABLED(x: ::c_int) -> bool { + PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE && PR_SCTP_POLICY(x) != SCTP_PR_SCTP_ALL + } + + pub {const} fn PR_SCTP_TTL_ENABLED(x: ::c_int) -> bool { + PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL + } + + pub {const} fn PR_SCTP_BUF_ENABLED(x: ::c_int) -> bool { + PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF + } + + pub {const} fn PR_SCTP_RTX_ENABLED(x: ::c_int) -> bool { + PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX + } + + pub {const} fn PR_SCTP_INVALID_POLICY(x: ::c_int) -> bool { + PR_SCTP_POLICY(x) > SCTP_PR_SCTP_MAX + } + + pub {const} fn PR_SCTP_VALID_POLICY(x: ::c_int) -> bool { + PR_SCTP_POLICY(x) <= SCTP_PR_SCTP_MAX + } } cfg_if! { @@ -4381,6 +5268,14 @@ extern "C" { pub fn getpagesizes(pagesize: *mut ::size_t, nelem: ::c_int) -> ::c_int; pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int; + pub fn clock_nanosleep( + clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec, + ) -> ::c_int; + + pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; pub fn shm_create_largepage( path: *const ::c_char, @@ -4397,6 +5292,17 @@ extern "C" { pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int; pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int; + pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn fdatasync(fd: ::c_int) -> ::c_int; + + pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; + pub fn setproctitle_fast(fmt: *const ::c_char, ...); + pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn timingsafe_memcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; + pub fn _umtx_op( obj: *mut ::c_void, op: ::c_int, @@ -4404,6 +5310,57 @@ extern "C" { uaddr: *mut ::c_void, uaddr2: *mut ::c_void, ) -> ::c_int; + + pub fn sctp_peeloff(s: ::c_int, id: ::sctp_assoc_t) -> ::c_int; + pub fn sctp_bindx(s: ::c_int, addrs: *mut ::sockaddr, num: ::c_int, tpe: ::c_int) -> ::c_int; + pub fn sctp_connectx( + s: ::c_int, + addrs: *const ::sockaddr, + addrcnt: ::c_int, + id: *mut ::sctp_assoc_t, + ) -> ::c_int; + pub fn sctp_getaddrlen(family: ::sa_family_t) -> ::c_int; + pub fn sctp_getpaddrs( + s: ::c_int, + asocid: ::sctp_assoc_t, + addrs: *mut *mut ::sockaddr, + ) -> ::c_int; + pub fn sctp_freepaddrs(addrs: *mut ::sockaddr); + pub fn sctp_getladdrs( + s: ::c_int, + asocid: ::sctp_assoc_t, + addrs: *mut *mut ::sockaddr, + ) -> ::c_int; + pub fn sctp_freeladdrs(addrs: *mut ::sockaddr); + pub fn sctp_opt_info( + s: ::c_int, + id: ::sctp_assoc_t, + opt: ::c_int, + arg: *mut ::c_void, + size: *mut ::socklen_t, + ) -> ::c_int; + pub fn sctp_sendv( + sd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + addrs: *mut ::sockaddr, + addrcnt: ::c_int, + info: *mut ::c_void, + infolen: ::socklen_t, + infotype: ::c_uint, + flags: ::c_int, + ) -> ::ssize_t; + pub fn sctp_recvv( + sd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + from: *mut ::sockaddr, + fromlen: *mut ::socklen_t, + info: *mut ::c_void, + infolen: *mut ::socklen_t, + infotype: *mut ::c_uint, + flags: *mut ::c_int, + ) -> ::ssize_t; } #[link(name = "memstat")] @@ -4496,6 +5453,17 @@ extern "C" { pub fn flopenat(fd: ::c_int, path: *const ::c_char, flags: ::c_int, ...) -> ::c_int; pub fn getlocalbase() -> *const ::c_char; + + pub fn pidfile_open( + path: *const ::c_char, + mode: ::mode_t, + pidptr: *mut ::pid_t, + ) -> *mut ::pidfh; + pub fn pidfile_write(path: *mut ::pidfh) -> ::c_int; + pub fn pidfile_close(path: *mut ::pidfh) -> ::c_int; + pub fn pidfile_remove(path: *mut ::pidfh) -> ::c_int; + pub fn pidfile_fileno(path: *const ::pidfh) -> ::c_int; + // FIXME: pidfile_signal in due time (both manpage present and updated image snapshot) } #[link(name = "procstat")] diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 9aefb36e4e..6a0f383bc0 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -824,12 +824,15 @@ pub const CLOCK_VIRTUAL: ::clockid_t = 1; pub const CLOCK_PROF: ::clockid_t = 2; pub const CLOCK_MONOTONIC: ::clockid_t = 4; pub const CLOCK_UPTIME: ::clockid_t = 5; +pub const CLOCK_BOOTTIME: ::clockid_t = CLOCK_UPTIME; pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7; pub const CLOCK_UPTIME_FAST: ::clockid_t = 8; pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9; pub const CLOCK_REALTIME_FAST: ::clockid_t = 10; +pub const CLOCK_REALTIME_COARSE: ::clockid_t = CLOCK_REALTIME_FAST; pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11; pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12; +pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = CLOCK_MONOTONIC_FAST; pub const CLOCK_SECOND: ::clockid_t = 13; pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14; pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 4ac722c4c3..87132e2587 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -709,6 +709,49 @@ s! { #[cfg(libc_union)] pub ifc_ifcu: __c_anonymous_ifc_ifcu, } + + pub struct tcp_info { + pub tcpi_state: u8, + pub __tcpi_ca_state: u8, + pub __tcpi_retransmits: u8, + pub __tcpi_probes: u8, + pub __tcpi_backoff: u8, + pub tcpi_options: u8, + pub tcp_snd_wscale: u8, + pub tcp_rcv_wscale: u8, + pub tcpi_rto: u32, + pub __tcpi_ato: u32, + pub tcpi_snd_mss: u32, + pub tcpi_rcv_mss: u32, + pub __tcpi_unacked: u32, + pub __tcpi_sacked: u32, + pub __tcpi_lost: u32, + pub __tcpi_retrans: u32, + pub __tcpi_fackets: u32, + pub __tcpi_last_data_sent: u32, + pub __tcpi_last_ack_sent: u32, + pub tcpi_last_data_recv: u32, + pub __tcpi_last_ack_recv: u32, + pub __tcpi_pmtu: u32, + pub __tcpi_rcv_ssthresh: u32, + pub tcpi_rtt: u32, + pub tcpi_rttvar: u32, + pub tcpi_snd_ssthresh: u32, + pub tcpi_snd_cwnd: u32, + pub __tcpi_advmss: u32, + pub __tcpi_reordering: u32, + pub __tcpi_rcv_rtt: u32, + pub tcpi_rcv_space: u32, + pub tcpi_snd_wnd: u32, + pub tcpi_snd_bwnd: u32, + pub tcpi_snd_nxt: u32, + pub tcpi_rcv_nxt: u32, + pub tcpi_toe_tid: u32, + pub tcpi_snd_rexmitpack: u32, + pub tcpi_rcv_ooopack: u32, + pub tcpi_snd_zerowin: u32, + pub __tcpi_pad: [u32; 26], + } } s_no_extra_traits! { diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index a20a1cf688..f46ea941b9 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -590,6 +590,13 @@ pub const PR_PAC_APDAKEY: ::c_ulong = 1 << 2; pub const PR_PAC_APDBKEY: ::c_ulong = 1 << 3; pub const PR_PAC_APGAKEY: ::c_ulong = 1 << 4; +pub const PR_SME_SET_VL: ::c_int = 63; +pub const PR_SME_GET_VL: ::c_int = 64; +pub const PR_SME_VL_LEN_MAX: ::c_int = 0xffff; + +pub const PR_SME_SET_VL_INHERIT: ::c_ulong = 1 << 17; +pub const PR_SME_SET_VL_ONE_EXEC: ::c_ulong = 1 << 18; + // Syscall table pub const SYS_io_setup: ::c_long = 0; pub const SYS_io_destroy: ::c_long = 1; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index b8b6dedeb7..21396751d0 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -37,7 +37,8 @@ s! { pub stx_dev_major: u32, pub stx_dev_minor: u32, pub stx_mnt_id: u64, - __statx_pad2: u64, + pub stx_dio_mem_align: u32, + pub stx_dio_offset_align: u32, __statx_pad3: [u64; 12], } @@ -1022,6 +1023,7 @@ pub const STATX_BLOCKS: ::c_uint = 0x0400; pub const STATX_BASIC_STATS: ::c_uint = 0x07ff; pub const STATX_BTIME: ::c_uint = 0x0800; pub const STATX_MNT_ID: ::c_uint = 0x1000; +pub const STATX_DIOALIGN: ::c_uint = 0x2000; pub const STATX_ALL: ::c_uint = 0x0fff; pub const STATX__RESERVED: ::c_int = 0x80000000; pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 3481dcc044..be12190b45 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -48,6 +48,9 @@ pub type name_t = u64; pub type iconv_t = *mut ::c_void; +// linux/sctp.h +pub type sctp_assoc_t = ::__s32; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} @@ -625,6 +628,63 @@ s! { pub flag: *mut ::c_int, pub val: ::c_int, } + + // linux/sctp.h + + pub struct sctp_initmsg { + pub sinit_num_ostreams: ::__u16, + pub sinit_max_instreams: ::__u16, + pub sinit_max_attempts: ::__u16, + pub sinit_max_init_timeo: ::__u16, + } + + pub struct sctp_sndrcvinfo { + pub sinfo_stream: ::__u16, + pub sinfo_ssn: ::__u16, + pub sinfo_flags: ::__u16, + pub sinfo_ppid: ::__u32, + pub sinfo_context: ::__u32, + pub sinfo_timetolive: ::__u32, + pub sinfo_tsn: ::__u32, + pub sinfo_cumtsn: ::__u32, + pub sinfo_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_sndinfo { + pub snd_sid: ::__u16, + pub snd_flags: ::__u16, + pub snd_ppid: ::__u32, + pub snd_context: ::__u32, + pub snd_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_rcvinfo { + pub rcv_sid: ::__u16, + pub rcv_ssn: ::__u16, + pub rcv_flags: ::__u16, + pub rcv_ppid: ::__u32, + pub rcv_tsn: ::__u32, + pub rcv_cumtsn: ::__u32, + pub rcv_context: ::__u32, + pub rcv_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_nxtinfo { + pub nxt_sid: ::__u16, + pub nxt_flags: ::__u16, + pub nxt_ppid: ::__u32, + pub nxt_length: ::__u32, + pub nxt_assoc_id: ::sctp_assoc_t, + } + + pub struct sctp_prinfo { + pub pr_policy: ::__u16, + pub pr_value: ::__u32, + } + + pub struct sctp_authinfo { + pub auth_keynumber: ::__u16, + } } s_no_extra_traits! { @@ -1853,6 +1913,7 @@ pub const IPC_STAT: ::c_int = 2; pub const IPC_INFO: ::c_int = 3; pub const MSG_STAT: ::c_int = 11; pub const MSG_INFO: ::c_int = 12; +pub const MSG_NOTIFICATION: ::c_int = 0x8000; pub const MSG_NOERROR: ::c_int = 0o10000; pub const MSG_EXCEPT: ::c_int = 0o20000; @@ -3456,6 +3517,27 @@ pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +pub const FUTEX_BITSET_MATCH_ANY: ::c_int = 0xffffffff; + +pub const FUTEX_OP_SET: ::c_int = 0; +pub const FUTEX_OP_ADD: ::c_int = 1; +pub const FUTEX_OP_OR: ::c_int = 2; +pub const FUTEX_OP_ANDN: ::c_int = 3; +pub const FUTEX_OP_XOR: ::c_int = 4; + +pub const FUTEX_OP_OPARG_SHIFT: ::c_int = 8; + +pub const FUTEX_OP_CMP_EQ: ::c_int = 0; +pub const FUTEX_OP_CMP_NE: ::c_int = 1; +pub const FUTEX_OP_CMP_LT: ::c_int = 2; +pub const FUTEX_OP_CMP_LE: ::c_int = 3; +pub const FUTEX_OP_CMP_GT: ::c_int = 4; +pub const FUTEX_OP_CMP_GE: ::c_int = 5; + +pub fn FUTEX_OP(op: ::c_int, oparg: ::c_int, cmp: ::c_int, cmparg: ::c_int) -> ::c_int { + ((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff) +} + // linux/reboot.h pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; @@ -3630,6 +3712,82 @@ pub const J1939_EE_INFO_RX_ABORT: ::c_int = 4; pub const J1939_FILTER_MAX: ::c_int = 512; +// linux/sctp.h +pub const SCTP_FUTURE_ASSOC: ::c_int = 0; +pub const SCTP_CURRENT_ASSOC: ::c_int = 1; +pub const SCTP_ALL_ASSOC: ::c_int = 2; +pub const SCTP_RTOINFO: ::c_int = 0; +pub const SCTP_ASSOCINFO: ::c_int = 1; +pub const SCTP_INITMSG: ::c_int = 2; +pub const SCTP_NODELAY: ::c_int = 3; +pub const SCTP_AUTOCLOSE: ::c_int = 4; +pub const SCTP_SET_PEER_PRIMARY_ADDR: ::c_int = 5; +pub const SCTP_PRIMARY_ADDR: ::c_int = 6; +pub const SCTP_ADAPTATION_LAYER: ::c_int = 7; +pub const SCTP_DISABLE_FRAGMENTS: ::c_int = 8; +pub const SCTP_PEER_ADDR_PARAMS: ::c_int = 9; +pub const SCTP_DEFAULT_SEND_PARAM: ::c_int = 10; +pub const SCTP_EVENTS: ::c_int = 11; +pub const SCTP_I_WANT_MAPPED_V4_ADDR: ::c_int = 12; +pub const SCTP_MAXSEG: ::c_int = 13; +pub const SCTP_STATUS: ::c_int = 14; +pub const SCTP_GET_PEER_ADDR_INFO: ::c_int = 15; +pub const SCTP_DELAYED_ACK_TIME: ::c_int = 16; +pub const SCTP_DELAYED_ACK: ::c_int = SCTP_DELAYED_ACK_TIME; +pub const SCTP_DELAYED_SACK: ::c_int = SCTP_DELAYED_ACK_TIME; +pub const SCTP_CONTEXT: ::c_int = 17; +pub const SCTP_FRAGMENT_INTERLEAVE: ::c_int = 18; +pub const SCTP_PARTIAL_DELIVERY_POINT: ::c_int = 19; +pub const SCTP_MAX_BURST: ::c_int = 20; +pub const SCTP_AUTH_CHUNK: ::c_int = 21; +pub const SCTP_HMAC_IDENT: ::c_int = 22; +pub const SCTP_AUTH_KEY: ::c_int = 23; +pub const SCTP_AUTH_ACTIVE_KEY: ::c_int = 24; +pub const SCTP_AUTH_DELETE_KEY: ::c_int = 25; +pub const SCTP_PEER_AUTH_CHUNKS: ::c_int = 26; +pub const SCTP_LOCAL_AUTH_CHUNKS: ::c_int = 27; +pub const SCTP_GET_ASSOC_NUMBER: ::c_int = 28; +pub const SCTP_GET_ASSOC_ID_LIST: ::c_int = 29; +pub const SCTP_AUTO_ASCONF: ::c_int = 30; +pub const SCTP_PEER_ADDR_THLDS: ::c_int = 31; +pub const SCTP_RECVRCVINFO: ::c_int = 32; +pub const SCTP_RECVNXTINFO: ::c_int = 33; +pub const SCTP_DEFAULT_SNDINFO: ::c_int = 34; +pub const SCTP_AUTH_DEACTIVATE_KEY: ::c_int = 35; +pub const SCTP_REUSE_PORT: ::c_int = 36; +pub const SCTP_PEER_ADDR_THLDS_V2: ::c_int = 37; +pub const SCTP_PR_SCTP_NONE: ::c_int = 0x0000; +pub const SCTP_PR_SCTP_TTL: ::c_int = 0x0010; +pub const SCTP_PR_SCTP_RTX: ::c_int = 0x0020; +pub const SCTP_PR_SCTP_PRIO: ::c_int = 0x0030; +pub const SCTP_PR_SCTP_MAX: ::c_int = SCTP_PR_SCTP_PRIO; +pub const SCTP_PR_SCTP_MASK: ::c_int = 0x0030; +pub const SCTP_ENABLE_RESET_STREAM_REQ: ::c_int = 0x01; +pub const SCTP_ENABLE_RESET_ASSOC_REQ: ::c_int = 0x02; +pub const SCTP_ENABLE_CHANGE_ASSOC_REQ: ::c_int = 0x04; +pub const SCTP_ENABLE_STRRESET_MASK: ::c_int = 0x07; +pub const SCTP_STREAM_RESET_INCOMING: ::c_int = 0x01; +pub const SCTP_STREAM_RESET_OUTGOING: ::c_int = 0x02; + +pub const SCTP_INIT: ::c_int = 0; +pub const SCTP_SNDRCV: ::c_int = 1; +pub const SCTP_SNDINFO: ::c_int = 2; +pub const SCTP_RCVINFO: ::c_int = 3; +pub const SCTP_NXTINFO: ::c_int = 4; +pub const SCTP_PRINFO: ::c_int = 5; +pub const SCTP_AUTHINFO: ::c_int = 6; +pub const SCTP_DSTADDRV4: ::c_int = 7; +pub const SCTP_DSTADDRV6: ::c_int = 8; + +pub const SCTP_UNORDERED: ::c_int = 1 << 0; +pub const SCTP_ADDR_OVER: ::c_int = 1 << 1; +pub const SCTP_ABORT: ::c_int = 1 << 2; +pub const SCTP_SACK_IMMEDIATELY: ::c_int = 1 << 3; +pub const SCTP_SENDALL: ::c_int = 1 << 6; +pub const SCTP_PR_SCTP_ALL: ::c_int = 1 << 7; +pub const SCTP_NOTIFICATION: ::c_int = MSG_NOTIFICATION; +pub const SCTP_EOF: ::c_int = ::MSG_FIN; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) @@ -3705,6 +3863,20 @@ f! { set1.bits == set2.bits } + pub fn SCTP_PR_INDEX(policy: ::c_int) -> ::c_int { + policy >> 4 - 1 + } + + pub fn SCTP_PR_POLICY(policy: ::c_int) -> ::c_int { + policy & SCTP_PR_SCTP_MASK + } + + pub fn SCTP_PR_SET_POLICY(flags: &mut ::c_int, policy: ::c_int) -> () { + *flags &= !SCTP_PR_SCTP_MASK; + *flags |= policy; + () + } + pub fn major(dev: ::dev_t) -> ::c_uint { let mut major = 0; major |= (dev & 0x00000000000fff00) >> 8; @@ -3771,6 +3943,18 @@ safe_f! { dev |= (minor & 0xffffff00) << 12; dev } + + pub {const} fn SCTP_PR_TTL_ENABLED(policy: ::c_int) -> bool { + policy == SCTP_PR_SCTP_TTL + } + + pub {const} fn SCTP_PR_RTX_ENABLED(policy: ::c_int) -> bool { + policy == SCTP_PR_SCTP_RTX + } + + pub {const} fn SCTP_PR_PRIO_ENABLED(policy: ::c_int) -> bool { + policy == SCTP_PR_SCTP_PRIO + } } cfg_if! { diff --git a/src/unix/linux_like/linux/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs index a5cb2bbe47..56bfcc5d35 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs @@ -219,27 +219,34 @@ pub const CIBAUD: ::tcflag_t = 0o002003600000; pub const TAB1: ::tcflag_t = 0x00000800; pub const TAB2: ::tcflag_t = 0x00001000; pub const TAB3: ::tcflag_t = 0x00001800; +pub const TABDLY: ::tcflag_t = 0o0014000; pub const CR1: ::tcflag_t = 0x00000200; pub const CR2: ::tcflag_t = 0x00000400; pub const CR3: ::tcflag_t = 0x00000600; pub const FF1: ::tcflag_t = 0x00008000; pub const BS1: ::tcflag_t = 0x00002000; +pub const BSDLY: ::tcflag_t = 0o0020000; pub const VT1: ::tcflag_t = 0x00004000; pub const VWERASE: usize = 14; +pub const XTABS: ::tcflag_t = 0o0014000; pub const VREPRINT: usize = 12; pub const VSUSP: usize = 10; +pub const VSWTC: usize = 7; +pub const VTDLY: ::c_int = 0o0040000; pub const VSTART: usize = 8; pub const VSTOP: usize = 9; pub const VDISCARD: usize = 13; pub const VTIME: usize = 5; pub const IXON: ::tcflag_t = 0x00000400; pub const IXOFF: ::tcflag_t = 0x00001000; +pub const OLCUC: ::tcflag_t = 0o0000002; pub const ONLCR: ::tcflag_t = 0x4; pub const CSIZE: ::tcflag_t = 0x00000030; pub const CS6: ::tcflag_t = 0x00000010; pub const CS7: ::tcflag_t = 0x00000020; pub const CS8: ::tcflag_t = 0x00000030; pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CRDLY: ::c_int = 0o0003000; pub const CREAD: ::tcflag_t = 0x00000080; pub const PARENB: ::tcflag_t = 0x00000100; pub const PARODD: ::tcflag_t = 0x00000200; @@ -256,6 +263,8 @@ pub const ICANON: ::tcflag_t = 0x00000002; pub const PENDIN: ::tcflag_t = 0x00004000; pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const MAP_HUGETLB: ::c_int = 0x80000; + pub const B0: ::speed_t = 0o000000; pub const B50: ::speed_t = 0o000001; pub const B75: ::speed_t = 0o000002; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 45a1dee554..20d0006bd4 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1006,6 +1006,7 @@ cfg_if! { pub const TCP_CM_INQ: ::c_int = TCP_INQ; // NOTE: Some CI images doesn't have this option yet. // pub const TCP_TX_DELAY: ::c_int = 37; + pub const TCP_MD5SIG_MAXKEYLEN: usize = 80; } } @@ -1783,6 +1784,8 @@ extern "C" { pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; pub fn uname(buf: *mut ::utsname) -> ::c_int; + + pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; } cfg_if! { diff --git a/src/xous.rs b/src/xous.rs new file mode 100644 index 0000000000..e6c0c2573d --- /dev/null +++ b/src/xous.rs @@ -0,0 +1,49 @@ +//! Xous C type definitions + +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; + +pub type size_t = usize; +pub type ptrdiff_t = isize; +pub type intptr_t = isize; +pub type uintptr_t = usize; +pub type ssize_t = isize; + +pub type off_t = i64; +pub type c_char = u8; +pub type c_long = i64; +pub type c_ulong = u64; +pub type wchar_t = u32; + +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + +cfg_if! { + if #[cfg(libc_core_cvoid)] { + pub use ::ffi::c_void; + } else { + // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help + // enable more optimization opportunities around it recognizing things + // like malloc/free. + #[repr(u8)] + #[allow(missing_copy_implementations)] + #[allow(missing_debug_implementations)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} |