Skip to content

Commit 51248a5

Browse files
kleisauketgross35
authored andcommitted
emscripten: Remove Linux-specific implementations
See: emscripten-core/emscripten@655ad88. (backport <rust-lang#3962>) (cherry picked from commit 0df7c93)
1 parent 7e5427f commit 51248a5

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
@@ -2834,31 +2834,21 @@ fn test_emscripten(target: &str) {
28342834
"stdio.h",
28352835
"stdlib.h",
28362836
"string.h",
2837-
"sys/epoll.h",
2838-
"sys/eventfd.h",
28392837
"sys/file.h",
28402838
"sys/ioctl.h",
28412839
"sys/ipc.h",
28422840
"sys/mman.h",
28432841
"sys/mount.h",
28442842
"sys/msg.h",
2845-
"sys/personality.h",
2846-
"sys/prctl.h",
2847-
"sys/ptrace.h",
2848-
"sys/quota.h",
2849-
"sys/reboot.h",
28502843
"sys/resource.h",
28512844
"sys/sem.h",
28522845
"sys/shm.h",
2853-
"sys/signalfd.h",
28542846
"sys/socket.h",
28552847
"sys/stat.h",
28562848
"sys/statvfs.h",
2857-
"sys/swap.h",
28582849
"sys/syscall.h",
28592850
"sys/sysinfo.h",
28602851
"sys/time.h",
2861-
"sys/timerfd.h",
28622852
"sys/times.h",
28632853
"sys/types.h",
28642854
"sys/uio.h",
@@ -2884,8 +2874,6 @@ fn test_emscripten(target: &str) {
28842874
// Just pass all these through, no need for a "struct" prefix
28852875
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
28862876

2887-
"os_unfair_lock" => "struct os_unfair_lock_s".to_string(),
2888-
28892877
// LFS64 types have been removed in Emscripten 3.1.44+
28902878
// https://github.com/emscripten-core/emscripten/pull/19812
28912879
"off64_t" => "off_t".to_string(),
@@ -2922,6 +2910,10 @@ fn test_emscripten(target: &str) {
29222910
// FIXME: is this necessary?
29232911
"sighandler_t" => true,
29242912

2913+
// No epoll support
2914+
// https://github.com/emscripten-core/emscripten/issues/5033
2915+
ty if ty.starts_with("epoll") => true,
2916+
29252917
// FIXME: The size has been changed due to musl's time64
29262918
"time_t" => true,
29272919

@@ -2948,6 +2940,11 @@ fn test_emscripten(target: &str) {
29482940
// FIXME: The size has been changed when upgraded to musl 1.2.2
29492941
"pthread_mutex_t" => true,
29502942

2943+
// No epoll support
2944+
// https://github.com/emscripten-core/emscripten/issues/5033
2945+
ty if ty.starts_with("epoll") => true,
2946+
ty if ty.starts_with("signalfd") => true,
2947+
29512948
// FIXME: Lowered from 16 to 8 bytes in
29522949
// llvm/llvm-project@d1a96e9
29532950
"max_align_t" => true,
@@ -2984,10 +2981,30 @@ fn test_emscripten(target: &str) {
29842981
// FIXME: emscripten uses different constants to constructs these
29852982
n if n.contains("__SIZEOF_PTHREAD") => true,
29862983

2984+
// No epoll support
2985+
// https://github.com/emscripten-core/emscripten/issues/5033
2986+
n if n.starts_with("EPOLL") => true,
2987+
2988+
// No ptrace.h
2989+
// https://github.com/emscripten-core/emscripten/pull/17704
2990+
n if n.starts_with("PTRACE_") => true,
2991+
2992+
// No quota.h
2993+
// https://github.com/emscripten-core/emscripten/pull/17704
2994+
n if n.starts_with("QIF_") => true,
2995+
"USRQUOTA" | "GRPQUOTA" | "Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC"
2996+
| "Q_QUOTAON" | "Q_QUOTAOFF" | "Q_GETQUOTA" | "Q_SETQUOTA" => true,
2997+
29872998
// FIXME: `SYS_gettid` was removed in
29882999
// emscripten-core/emscripten@6d6474e
29893000
"SYS_gettid" => true,
29903001

3002+
// No personality.h
3003+
// https://github.com/emscripten-core/emscripten/pull/17704
3004+
"ADDR_NO_RANDOMIZE" | "MMAP_PAGE_ZERO" | "ADDR_COMPAT_LAYOUT" | "READ_IMPLIES_EXEC"
3005+
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
3006+
| "ADDR_LIMIT_3GB" => true,
3007+
29913008
// FIXME: These values have been changed
29923009
| "POSIX_MADV_DONTNEED" // to 4
29933010
| "RLIMIT_NLIMITS" // to 16
@@ -3028,17 +3045,6 @@ fn test_emscripten(target: &str) {
30283045
// musl names this __dummy1 but it's still there
30293046
// FIXME: is this necessary?
30303047
(struct_ == "glob_t" && field == "gl_flags") ||
3031-
// musl seems to define this as an *anonymous* bitfield
3032-
// FIXME: is this necessary?
3033-
(struct_ == "statvfs" && field == "__f_unused") ||
3034-
// sigev_notify_thread_id is actually part of a sigev_un union
3035-
(struct_ == "sigevent" && field == "sigev_notify_thread_id") ||
3036-
// signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet.
3037-
(struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" ||
3038-
field == "_pad2" ||
3039-
field == "ssi_syscall" ||
3040-
field == "ssi_call_addr" ||
3041-
field == "ssi_arch")) ||
30423048
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
30433049
// while other fields become reserved.
30443050
(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,
@@ -852,23 +840,10 @@ pub const SHM_UNLOCK: ::c_int = 12;
852840
pub const SHM_HUGETLB: ::c_int = 0o4000;
853841
pub const SHM_NORESERVE: ::c_int = 0o10000;
854842

855-
pub const QFMT_VFS_OLD: ::c_int = 1;
856-
pub const QFMT_VFS_V0: ::c_int = 2;
857-
858-
pub const EFD_SEMAPHORE: ::c_int = 0x1;
859-
860843
pub const LOG_NFACILITIES: ::c_int = 24;
861844

862845
pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
863846

864-
pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
865-
pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
866-
pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
867-
pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
868-
pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
869-
pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
870-
pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
871-
872847
pub const AI_PASSIVE: ::c_int = 0x0001;
873848
pub const AI_CANONNAME: ::c_int = 0x0002;
874849
pub const AI_NUMERICHOST: ::c_int = 0x0004;
@@ -903,127 +878,6 @@ pub const EAI_SYSTEM: ::c_int = -11;
903878
pub const MREMAP_MAYMOVE: ::c_int = 1;
904879
pub const MREMAP_FIXED: ::c_int = 2;
905880

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

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

1043892
pub const O_TRUNC: ::c_int = 512;
@@ -1186,10 +1035,6 @@ pub const SA_RESETHAND: ::c_int = 0x80000000;
11861035
pub const SA_RESTART: ::c_int = 0x10000000;
11871036
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
11881037

1189-
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
1190-
1191-
pub const EFD_CLOEXEC: ::c_int = 0x80000;
1192-
11931038
pub const BUFSIZ: ::c_uint = 1024;
11941039
pub const TMP_MAX: ::c_uint = 10000;
11951040
pub const FOPEN_MAX: ::c_uint = 1000;
@@ -1224,43 +1069,6 @@ pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
12241069

12251070
pub const CPU_SETSIZE: ::c_int = 128;
12261071

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

0 commit comments

Comments
 (0)