| 2776 | } |
| 2777 | |
| 2778 | int setitimer(int type UNUSED, struct itimerval *in, struct itimerval *out) |
| 2779 | { |
| 2780 | static const struct timeval zero; |
| 2781 | static int atexit_done; |
| 2782 | |
| 2783 | if (out) { |
| 2784 | errno = EINVAL; |
| 2785 | return error("setitimer param 3 != NULL not implemented"); |
| 2786 | } |
| 2787 | if (!is_timeval_eq(&in->it_interval, &zero) && |
| 2788 | !is_timeval_eq(&in->it_interval, &in->it_value)) { |
| 2789 | errno = EINVAL; |
| 2790 | return error("setitimer: it_interval must be zero or eq it_value"); |
| 2791 | } |
| 2792 | |
| 2793 | if (timer_thread) |
| 2794 | stop_timer_thread(); |
| 2795 | |
| 2796 | if (is_timeval_eq(&in->it_value, &zero) && |
| 2797 | is_timeval_eq(&in->it_interval, &zero)) |
| 2798 | return 0; |
| 2799 | |
| 2800 | timer_interval = in->it_value.tv_sec * 1000 + in->it_value.tv_usec / 1000; |
| 2801 | one_shot = is_timeval_eq(&in->it_interval, &zero); |
| 2802 | if (!atexit_done) { |
| 2803 | atexit(stop_timer_thread); |
| 2804 | atexit_done = 1; |
| 2805 | } |
| 2806 | return start_timer_thread(); |
| 2807 | } |
| 2808 | |
| 2809 | int sigaction(int sig, struct sigaction *in, struct sigaction *out) |
| 2810 | { |
no test coverage detected