File tree 3 files changed +43
-0
lines changed
src/unix/linux_like/linux
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -3558,6 +3558,9 @@ fn test_linux(target: &str) {
3558
3558
// https://github.com/rust-lang/libc/issues/1359
3559
3559
"sighandler_t" => true ,
3560
3560
3561
+ // musl doesn't define these; instead, it uses a raw int for getitimer/setitimer
3562
+ "__itimer_which_t" if musl => true ,
3563
+
3561
3564
// These cannot be tested when "resolv.h" is included and are tested
3562
3565
// in the `linux_elf.rs` file.
3563
3566
"Elf64_Phdr" | "Elf32_Phdr" => true ,
Original file line number Diff line number Diff line change @@ -3475,6 +3475,7 @@ __c_anonymous_sockaddr_can_j1939
3475
3475
__c_anonymous_sockaddr_can_tp
3476
3476
__errno_location
3477
3477
__exit_status
3478
+ __itimer_which_t
3478
3479
__s16
3479
3480
__s32
3480
3481
__u16
@@ -3591,6 +3592,7 @@ getgrnam_r
3591
3592
getgrouplist
3592
3593
gethostid
3593
3594
getifaddrs
3595
+ getitimer
3594
3596
getline
3595
3597
getmntent
3596
3598
getnameinfo
@@ -3892,6 +3894,7 @@ setfsuid
3892
3894
setgrent
3893
3895
setgroups
3894
3896
sethostname
3897
+ setitimer
3895
3898
setmntent
3896
3899
setns
3897
3900
setpriority
Original file line number Diff line number Diff line change @@ -73,6 +73,21 @@ missing! {
73
73
pub enum fpos64_t { } // FIXME: fill this out with a struct
74
74
}
75
75
76
+ cfg_if ! {
77
+ if #[ cfg( target_env = "musl" ) ] {
78
+ pub type __itimer_which_t = :: c_int;
79
+ } else {
80
+ e! {
81
+ #[ repr( i32 ) ]
82
+ pub enum __itimer_which_t {
83
+ ITIMER_REAL = 0 ,
84
+ ITIMER_VIRTUAL = 1 ,
85
+ ITIMER_PROF = 2 ,
86
+ }
87
+ }
88
+ }
89
+ }
90
+
76
91
e ! {
77
92
pub enum tpacket_versions {
78
93
TPACKET_V1 ,
@@ -6129,6 +6144,28 @@ extern "C" {
6129
6144
pub fn ioctl ( fd : :: c_int , request : :: Ioctl , ...) -> :: c_int ;
6130
6145
}
6131
6146
6147
+ cfg_if ! {
6148
+ if #[ cfg( target_env = "musl" ) ] {
6149
+ extern "C" {
6150
+ pub fn getitimer( which: :: c_int, value: * mut :: itimerval) -> :: c_int;
6151
+ pub fn setitimer(
6152
+ which: :: c_int,
6153
+ new: * const :: itimerval,
6154
+ old: * mut :: itimerval,
6155
+ ) -> :: c_int;
6156
+ }
6157
+ } else {
6158
+ extern "C" {
6159
+ pub fn getitimer( which: :: __itimer_which_t, value: * mut :: itimerval) -> :: c_int;
6160
+ pub fn setitimer(
6161
+ which: :: __itimer_which_t,
6162
+ new: * const :: itimerval,
6163
+ old: * mut :: itimerval,
6164
+ ) -> :: c_int;
6165
+ }
6166
+ }
6167
+ }
6168
+
6132
6169
// LFS64 extensions
6133
6170
//
6134
6171
// * musl has 64-bit versions only so aliases the LFS64 symbols to the standard ones
You can’t perform that action at this time.
0 commit comments