File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
src/unix/linux_like/linux Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -3648,6 +3648,9 @@ fn test_linux(target: &str) {
3648
3648
// in the `linux_elf.rs` file.
3649
3649
"Elf64_Phdr" | "Elf32_Phdr" => true ,
3650
3650
3651
+ // musl doesn't define these; instead, it uses a raw int for getitimer/setitimer
3652
+ "__itimer_which" | "__itimer_which_t" if musl => true ,
3653
+
3651
3654
// On Linux, the type of `ut_tv` field of `struct utmpx`
3652
3655
// can be an anonymous struct, so an extra struct,
3653
3656
// which is absent in glibc, has to be defined.
Original file line number Diff line number Diff line change @@ -3475,6 +3475,8 @@ __c_anonymous_sockaddr_can_j1939
3475
3475
__c_anonymous_sockaddr_can_tp
3476
3476
__errno_location
3477
3477
__exit_status
3478
+ __itimer_which
3479
+ __itimer_which_t
3478
3480
__s16
3479
3481
__s32
3480
3482
__u16
@@ -3591,6 +3593,7 @@ getgrnam_r
3591
3593
getgrouplist
3592
3594
gethostid
3593
3595
getifaddrs
3596
+ getitimer
3594
3597
getline
3595
3598
getmntent
3596
3599
getnameinfo
@@ -3892,6 +3895,7 @@ setfsuid
3892
3895
setgrent
3893
3896
setgroups
3894
3897
sethostname
3898
+ setitimer
3895
3899
setmntent
3896
3900
setns
3897
3901
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( not( target_env = "musl" ) ) ] {
78
+ pub type __itimer_which_t = :: __itimer_which;
79
+
80
+ e! {
81
+ #[ repr( i32 ) ]
82
+ pub enum __itimer_which {
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