Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getitimer()/setitimer() are missing on Linux #1347

Open
frol opened this issue May 16, 2019 · 0 comments · May be fixed by #3847
Open

getitimer()/setitimer() are missing on Linux #1347

frol opened this issue May 16, 2019 · 0 comments · May be fixed by #3847
Labels
C-API-request Category: API request E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-linux

Comments

@frol
Copy link

frol commented May 16, 2019

#include <sys/time.h>

int getitimer(int which, struct itimerval *value);
int setitimer(int which, const struct itimerval *restrict value, struct itimerval *restrict ovalue);

man

This is a minimal demo:

let tval = nix::libc::itimerval {
    it_interval: nix::libc::timeval {
        tv_sec: 0,
        tv_usec: 0,
    },
    it_value: nix::libc::timeval {
        tv_sec: 1,
        tv_usec: 0,
    },
};
if unsafe { setitimer(nix::libc::ITIMER_REAL, &tval as *const _, std::ptr::null_mut()) } == -1 {
    panic!("setitimer");
}

let tval2 = nix::libc::itimerval {
    it_interval: nix::libc::timeval {
        tv_sec: 0,
        tv_usec: 0,
    },
    it_value: nix::libc::timeval {
        tv_sec: 0,
        tv_usec: 0,
    },
};
if unsafe { getitimer(nix::libc::ITIMER_REAL, &mut tval as *mut _) } == -1 {
    panic!("getitimer");
}

I have found these two commits: e976c37, bc48202 -- getitimer and setitimer we introduced and dropped for netbsd target. Those definitions seem to work fine for me on Linux.

@JohnTitor JohnTitor added C-API-request Category: API request O-linux labels Oct 15, 2020
@nathaniel-bennett nathaniel-bennett linked a pull request Aug 17, 2024 that will close this issue
@tgross35 tgross35 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed help wanted labels Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-linux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants