File tree 3 files changed +42
-0
lines changed
src/unix/linux_like/linux
3 files changed +42
-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,19 @@ missing! {
73
73
pub enum fpos64_t { } // FIXME: fill this out with a struct
74
74
}
75
75
76
+ cfg_if ! {
77
+ if #[ cfg( not( target_env = "musl" ) ) ] {
78
+ e! {
79
+ #[ repr( i32 ) ]
80
+ pub enum __itimer_which_t {
81
+ ITIMER_REAL = 0 ,
82
+ ITIMER_VIRTUAL = 1 ,
83
+ ITIMER_PROF = 2 ,
84
+ }
85
+ }
86
+ }
87
+ }
88
+
76
89
e ! {
77
90
pub enum tpacket_versions {
78
91
TPACKET_V1 ,
@@ -6129,6 +6142,29 @@ extern "C" {
6129
6142
pub fn ioctl ( fd : :: c_int , request : :: Ioctl , ...) -> :: c_int ;
6130
6143
}
6131
6144
6145
+
6146
+ cfg_if ! {
6147
+ if #[ cfg( target_env = "musl" ) ] {
6148
+ extern "C" {
6149
+ pub fn getitimer( which: :: c_int, value: * mut :: itimerval) -> :: c_int;
6150
+ pub fn setitimer(
6151
+ which: :: c_int,
6152
+ new: * const :: itimerval,
6153
+ old: * mut :: itimerval,
6154
+ ) -> :: c_int;
6155
+ }
6156
+ } else {
6157
+ extern "C" {
6158
+ pub fn getitimer( which: :: __itimer_which_t, value: * mut :: itimerval) -> :: c_int;
6159
+ pub fn setitimer(
6160
+ which: :: __itimer_which_t,
6161
+ new: * const :: itimerval,
6162
+ old: * mut :: itimerval,
6163
+ ) -> :: c_int;
6164
+ }
6165
+ }
6166
+ }
6167
+
6132
6168
// LFS64 extensions
6133
6169
//
6134
6170
// * 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