Skip to content

Commit 0df7c93

Browse files
kleisauketgross35
authored andcommitted
emscripten: Remove Linux-specific implementations
See: emscripten-core/emscripten@655ad88.
1 parent 6670ab2 commit 0df7c93

File tree

2 files changed

+29
-215
lines changed

2 files changed

+29
-215
lines changed

libc-test/build.rs

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,31 +2779,21 @@ fn test_emscripten(target: &str) {
27792779
"stdio.h",
27802780
"stdlib.h",
27812781
"string.h",
2782-
"sys/epoll.h",
2783-
"sys/eventfd.h",
27842782
"sys/file.h",
27852783
"sys/ioctl.h",
27862784
"sys/ipc.h",
27872785
"sys/mman.h",
27882786
"sys/mount.h",
27892787
"sys/msg.h",
2790-
"sys/personality.h",
2791-
"sys/prctl.h",
2792-
"sys/ptrace.h",
2793-
"sys/quota.h",
2794-
"sys/reboot.h",
27952788
"sys/resource.h",
27962789
"sys/sem.h",
27972790
"sys/shm.h",
2798-
"sys/signalfd.h",
27992791
"sys/socket.h",
28002792
"sys/stat.h",
28012793
"sys/statvfs.h",
2802-
"sys/swap.h",
28032794
"sys/syscall.h",
28042795
"sys/sysinfo.h",
28052796
"sys/time.h",
2806-
"sys/timerfd.h",
28072797
"sys/times.h",
28082798
"sys/types.h",
28092799
"sys/uio.h",
@@ -2829,8 +2819,6 @@ fn test_emscripten(target: &str) {
28292819
// Just pass all these through, no need for a "struct" prefix
28302820
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
28312821

2832-
"os_unfair_lock" => "struct os_unfair_lock_s".to_string(),
2833-
28342822
// LFS64 types have been removed in Emscripten 3.1.44+
28352823
// https://github.com/emscripten-core/emscripten/pull/19812
28362824
"off64_t" => "off_t".to_string(),
@@ -2867,6 +2855,10 @@ fn test_emscripten(target: &str) {
28672855
// FIXME: is this necessary?
28682856
"sighandler_t" => true,
28692857

2858+
// No epoll support
2859+
// https://github.com/emscripten-core/emscripten/issues/5033
2860+
ty if ty.starts_with("epoll") => true,
2861+
28702862
// FIXME: The size has been changed due to musl's time64
28712863
"time_t" => true,
28722864

@@ -2893,6 +2885,11 @@ fn test_emscripten(target: &str) {
28932885
// FIXME: The size has been changed when upgraded to musl 1.2.2
28942886
"pthread_mutex_t" => true,
28952887

2888+
// No epoll support
2889+
// https://github.com/emscripten-core/emscripten/issues/5033
2890+
ty if ty.starts_with("epoll") => true,
2891+
ty if ty.starts_with("signalfd") => true,
2892+
28962893
// FIXME: Lowered from 16 to 8 bytes in
28972894
// llvm/llvm-project@d1a96e9
28982895
"max_align_t" => true,
@@ -2929,10 +2926,30 @@ fn test_emscripten(target: &str) {
29292926
// FIXME: emscripten uses different constants to constructs these
29302927
n if n.contains("__SIZEOF_PTHREAD") => true,
29312928

2929+
// No epoll support
2930+
// https://github.com/emscripten-core/emscripten/issues/5033
2931+
n if n.starts_with("EPOLL") => true,
2932+
2933+
// No ptrace.h
2934+
// https://github.com/emscripten-core/emscripten/pull/17704
2935+
n if n.starts_with("PTRACE_") => true,
2936+
2937+
// No quota.h
2938+
// https://github.com/emscripten-core/emscripten/pull/17704
2939+
n if n.starts_with("QIF_") => true,
2940+
"USRQUOTA" | "GRPQUOTA" | "Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC"
2941+
| "Q_QUOTAON" | "Q_QUOTAOFF" | "Q_GETQUOTA" | "Q_SETQUOTA" => true,
2942+
29322943
// FIXME: `SYS_gettid` was removed in
29332944
// emscripten-core/emscripten@6d6474e
29342945
"SYS_gettid" => true,
29352946

2947+
// No personality.h
2948+
// https://github.com/emscripten-core/emscripten/pull/17704
2949+
"ADDR_NO_RANDOMIZE" | "MMAP_PAGE_ZERO" | "ADDR_COMPAT_LAYOUT" | "READ_IMPLIES_EXEC"
2950+
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
2951+
| "ADDR_LIMIT_3GB" => true,
2952+
29362953
// FIXME: These values have been changed
29372954
| "POSIX_MADV_DONTNEED" // to 4
29382955
| "RLIMIT_NLIMITS" // to 16
@@ -2973,17 +2990,6 @@ fn test_emscripten(target: &str) {
29732990
// musl names this __dummy1 but it's still there
29742991
// FIXME: is this necessary?
29752992
(struct_ == "glob_t" && field == "gl_flags") ||
2976-
// musl seems to define this as an *anonymous* bitfield
2977-
// FIXME: is this necessary?
2978-
(struct_ == "statvfs" && field == "__f_unused") ||
2979-
// sigev_notify_thread_id is actually part of a sigev_un union
2980-
(struct_ == "sigevent" && field == "sigev_notify_thread_id") ||
2981-
// signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet.
2982-
(struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" ||
2983-
field == "_pad2" ||
2984-
field == "ssi_syscall" ||
2985-
field == "ssi_call_addr" ||
2986-
field == "ssi_arch")) ||
29872993
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
29882994
// while other fields become reserved.
29892995
(struct_ == "sched_param" && [

src/unix/linux_like/emscripten/mod.rs

Lines changed: 0 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,6 @@ s! {
103103
__f_spare: [::c_int; 6],
104104
}
105105

106-
pub struct dqblk {
107-
pub dqb_bhardlimit: u64,
108-
pub dqb_bsoftlimit: u64,
109-
pub dqb_curspace: u64,
110-
pub dqb_ihardlimit: u64,
111-
pub dqb_isoftlimit: u64,
112-
pub dqb_curinodes: u64,
113-
pub dqb_btime: u64,
114-
pub dqb_itime: u64,
115-
pub dqb_valid: u32,
116-
}
117-
118106
pub struct signalfd_siginfo {
119107
pub ssi_signo: u32,
120108
pub ssi_errno: i32,
@@ -850,23 +838,10 @@ pub const SHM_UNLOCK: ::c_int = 12;
850838
pub const SHM_HUGETLB: ::c_int = 0o4000;
851839
pub const SHM_NORESERVE: ::c_int = 0o10000;
852840

853-
pub const QFMT_VFS_OLD: ::c_int = 1;
854-
pub const QFMT_VFS_V0: ::c_int = 2;
855-
856-
pub const EFD_SEMAPHORE: ::c_int = 0x1;
857-
858841
pub const LOG_NFACILITIES: ::c_int = 24;
859842

860843
pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
861844

862-
pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
863-
pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
864-
pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
865-
pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
866-
pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
867-
pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
868-
pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
869-
870845
pub const AI_PASSIVE: ::c_int = 0x0001;
871846
pub const AI_CANONNAME: ::c_int = 0x0002;
872847
pub const AI_NUMERICHOST: ::c_int = 0x0004;
@@ -901,127 +876,6 @@ pub const EAI_SYSTEM: ::c_int = -11;
901876
pub const MREMAP_MAYMOVE: ::c_int = 1;
902877
pub const MREMAP_FIXED: ::c_int = 2;
903878

904-
pub const PR_SET_PDEATHSIG: ::c_int = 1;
905-
pub const PR_GET_PDEATHSIG: ::c_int = 2;
906-
907-
pub const PR_GET_DUMPABLE: ::c_int = 3;
908-
pub const PR_SET_DUMPABLE: ::c_int = 4;
909-
910-
pub const PR_GET_UNALIGN: ::c_int = 5;
911-
pub const PR_SET_UNALIGN: ::c_int = 6;
912-
pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
913-
pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
914-
915-
pub const PR_GET_KEEPCAPS: ::c_int = 7;
916-
pub const PR_SET_KEEPCAPS: ::c_int = 8;
917-
918-
pub const PR_GET_FPEMU: ::c_int = 9;
919-
pub const PR_SET_FPEMU: ::c_int = 10;
920-
pub const PR_FPEMU_NOPRINT: ::c_int = 1;
921-
pub const PR_FPEMU_SIGFPE: ::c_int = 2;
922-
923-
pub const PR_GET_FPEXC: ::c_int = 11;
924-
pub const PR_SET_FPEXC: ::c_int = 12;
925-
pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
926-
pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
927-
pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
928-
pub const PR_FP_EXC_UND: ::c_int = 0x040000;
929-
pub const PR_FP_EXC_RES: ::c_int = 0x080000;
930-
pub const PR_FP_EXC_INV: ::c_int = 0x100000;
931-
pub const PR_FP_EXC_DISABLED: ::c_int = 0;
932-
pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
933-
pub const PR_FP_EXC_ASYNC: ::c_int = 2;
934-
pub const PR_FP_EXC_PRECISE: ::c_int = 3;
935-
936-
pub const PR_GET_TIMING: ::c_int = 13;
937-
pub const PR_SET_TIMING: ::c_int = 14;
938-
pub const PR_TIMING_STATISTICAL: ::c_int = 0;
939-
pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
940-
941-
pub const PR_SET_NAME: ::c_int = 15;
942-
pub const PR_GET_NAME: ::c_int = 16;
943-
944-
pub const PR_GET_ENDIAN: ::c_int = 19;
945-
pub const PR_SET_ENDIAN: ::c_int = 20;
946-
pub const PR_ENDIAN_BIG: ::c_int = 0;
947-
pub const PR_ENDIAN_LITTLE: ::c_int = 1;
948-
pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
949-
950-
pub const PR_GET_SECCOMP: ::c_int = 21;
951-
pub const PR_SET_SECCOMP: ::c_int = 22;
952-
953-
pub const PR_CAPBSET_READ: ::c_int = 23;
954-
pub const PR_CAPBSET_DROP: ::c_int = 24;
955-
956-
pub const PR_GET_TSC: ::c_int = 25;
957-
pub const PR_SET_TSC: ::c_int = 26;
958-
pub const PR_TSC_ENABLE: ::c_int = 1;
959-
pub const PR_TSC_SIGSEGV: ::c_int = 2;
960-
961-
pub const PR_GET_SECUREBITS: ::c_int = 27;
962-
pub const PR_SET_SECUREBITS: ::c_int = 28;
963-
964-
pub const PR_SET_TIMERSLACK: ::c_int = 29;
965-
pub const PR_GET_TIMERSLACK: ::c_int = 30;
966-
967-
pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
968-
pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
969-
970-
pub const PR_MCE_KILL: ::c_int = 33;
971-
pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
972-
pub const PR_MCE_KILL_SET: ::c_int = 1;
973-
974-
pub const PR_MCE_KILL_LATE: ::c_int = 0;
975-
pub const PR_MCE_KILL_EARLY: ::c_int = 1;
976-
pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
977-
978-
pub const PR_MCE_KILL_GET: ::c_int = 34;
979-
980-
pub const PR_SET_MM: ::c_int = 35;
981-
pub const PR_SET_MM_START_CODE: ::c_int = 1;
982-
pub const PR_SET_MM_END_CODE: ::c_int = 2;
983-
pub const PR_SET_MM_START_DATA: ::c_int = 3;
984-
pub const PR_SET_MM_END_DATA: ::c_int = 4;
985-
pub const PR_SET_MM_START_STACK: ::c_int = 5;
986-
pub const PR_SET_MM_START_BRK: ::c_int = 6;
987-
pub const PR_SET_MM_BRK: ::c_int = 7;
988-
pub const PR_SET_MM_ARG_START: ::c_int = 8;
989-
pub const PR_SET_MM_ARG_END: ::c_int = 9;
990-
pub const PR_SET_MM_ENV_START: ::c_int = 10;
991-
pub const PR_SET_MM_ENV_END: ::c_int = 11;
992-
pub const PR_SET_MM_AUXV: ::c_int = 12;
993-
pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
994-
pub const PR_SET_MM_MAP: ::c_int = 14;
995-
pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
996-
997-
pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
998-
pub const PR_SET_PTRACER_ANY: ::c_ulong = 0xffffffffffffffff;
999-
1000-
pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
1001-
pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
1002-
1003-
pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
1004-
pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
1005-
1006-
pub const PR_GET_TID_ADDRESS: ::c_int = 40;
1007-
1008-
pub const PR_SET_THP_DISABLE: ::c_int = 41;
1009-
pub const PR_GET_THP_DISABLE: ::c_int = 42;
1010-
1011-
pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
1012-
pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
1013-
1014-
pub const PR_SET_FP_MODE: ::c_int = 45;
1015-
pub const PR_GET_FP_MODE: ::c_int = 46;
1016-
pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
1017-
pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
1018-
1019-
pub const PR_CAP_AMBIENT: ::c_int = 47;
1020-
pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
1021-
pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
1022-
pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
1023-
pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
1024-
1025879
pub const ITIMER_REAL: ::c_int = 0;
1026880
pub const ITIMER_VIRTUAL: ::c_int = 1;
1027881
pub const ITIMER_PROF: ::c_int = 2;
@@ -1031,11 +885,6 @@ pub const _POSIX_VDISABLE: ::cc_t = 0;
1031885
pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
1032886
pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
1033887

1034-
// On Linux, libc doesn't define this constant, libattr does instead.
1035-
// We still define it for Linux as it's defined by libc on other platforms,
1036-
// and it's mentioned in the man pages for getxattr and setxattr.
1037-
pub const SFD_CLOEXEC: ::c_int = 0x080000;
1038-
1039888
pub const NCCS: usize = 32;
1040889

1041890
pub const O_TRUNC: ::c_int = 512;
@@ -1184,10 +1033,6 @@ pub const SA_RESETHAND: ::c_int = 0x80000000;
11841033
pub const SA_RESTART: ::c_int = 0x10000000;
11851034
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
11861035

1187-
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
1188-
1189-
pub const EFD_CLOEXEC: ::c_int = 0x80000;
1190-
11911036
pub const BUFSIZ: ::c_uint = 1024;
11921037
pub const TMP_MAX: ::c_uint = 10000;
11931038
pub const FOPEN_MAX: ::c_uint = 1000;
@@ -1222,43 +1067,6 @@ pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
12221067

12231068
pub const CPU_SETSIZE: ::c_int = 128;
12241069

1225-
pub const QFMT_VFS_V1: ::c_int = 4;
1226-
1227-
pub const PTRACE_TRACEME: ::c_int = 0;
1228-
pub const PTRACE_PEEKTEXT: ::c_int = 1;
1229-
pub const PTRACE_PEEKDATA: ::c_int = 2;
1230-
pub const PTRACE_PEEKUSER: ::c_int = 3;
1231-
pub const PTRACE_POKETEXT: ::c_int = 4;
1232-
pub const PTRACE_POKEDATA: ::c_int = 5;
1233-
pub const PTRACE_POKEUSER: ::c_int = 6;
1234-
pub const PTRACE_CONT: ::c_int = 7;
1235-
pub const PTRACE_KILL: ::c_int = 8;
1236-
pub const PTRACE_SINGLESTEP: ::c_int = 9;
1237-
pub const PTRACE_ATTACH: ::c_int = 16;
1238-
pub const PTRACE_DETACH: ::c_int = 17;
1239-
pub const PTRACE_SYSCALL: ::c_int = 24;
1240-
pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
1241-
pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
1242-
pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
1243-
pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
1244-
pub const PTRACE_GETREGSET: ::c_int = 0x4204;
1245-
pub const PTRACE_SETREGSET: ::c_int = 0x4205;
1246-
pub const PTRACE_SEIZE: ::c_int = 0x4206;
1247-
pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
1248-
pub const PTRACE_LISTEN: ::c_int = 0x4208;
1249-
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
1250-
1251-
pub const PTRACE_GETFPREGS: ::c_uint = 14;
1252-
pub const PTRACE_SETFPREGS: ::c_uint = 15;
1253-
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
1254-
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
1255-
pub const PTRACE_GETREGS: ::c_uint = 12;
1256-
pub const PTRACE_SETREGS: ::c_uint = 13;
1257-
1258-
pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
1259-
1260-
pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
1261-
12621070
pub const TCSANOW: ::c_int = 0;
12631071
pub const TCSADRAIN: ::c_int = 1;
12641072
pub const TCSAFLUSH: ::c_int = 2;

0 commit comments

Comments
 (0)