Index: stable/11/sys/compat/linux/linux_time.c =================================================================== --- stable/11/sys/compat/linux/linux_time.c (revision 317636) +++ stable/11/sys/compat/linux/linux_time.c (revision 317637) @@ -1,604 +1,618 @@ /* $NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Emmanuel Dreyfus. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #if 0 __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp $"); #endif #include "opt_compat.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef COMPAT_LINUX32 #include #include #else #include #include #endif #include #include /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /** * DTrace probes in this module. */ LIN_SDT_PROBE_DEFINE2(time, native_to_linux_timespec, entry, "struct l_timespec *", "struct timespec *"); LIN_SDT_PROBE_DEFINE0(time, native_to_linux_timespec, return); LIN_SDT_PROBE_DEFINE2(time, linux_to_native_timespec, entry, "struct timespec *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_timespec, return, "int"); LIN_SDT_PROBE_DEFINE2(time, linux_to_native_clockid, entry, "clockid_t *", "clockid_t"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unsupported_clockid, "clockid_t"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unknown_clockid, "clockid_t"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, return, "int"); LIN_SDT_PROBE_DEFINE2(time, linux_clock_gettime, entry, "clockid_t", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, gettime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, return, "int"); LIN_SDT_PROBE_DEFINE2(time, linux_clock_settime, entry, "clockid_t", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, return, "int"); LIN_SDT_PROBE_DEFINE2(time, linux_clock_getres, entry, "clockid_t", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, return, "int"); LIN_SDT_PROBE_DEFINE2(time, linux_nanosleep, entry, "const struct l_timespec *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, return, "int"); LIN_SDT_PROBE_DEFINE4(time, linux_clock_nanosleep, entry, "clockid_t", "int", "struct l_timespec *", "struct l_timespec *"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, return, "int"); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) { LIN_SDT_PROBE2(time, native_to_linux_timespec, entry, ltp, ntp); #ifdef COMPAT_LINUX32 if (ntp->tv_sec > INT_MAX || ntp->tv_sec < INT_MIN) return (EOVERFLOW); #endif ltp->tv_sec = ntp->tv_sec; ltp->tv_nsec = ntp->tv_nsec; LIN_SDT_PROBE0(time, native_to_linux_timespec, return); return (0); } int linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) { LIN_SDT_PROBE2(time, linux_to_native_timespec, entry, ntp, ltp); if (ltp->tv_sec < 0 || ltp->tv_nsec < 0 || ltp->tv_nsec > 999999999) { LIN_SDT_PROBE1(time, linux_to_native_timespec, return, EINVAL); return (EINVAL); } ntp->tv_sec = ltp->tv_sec; ntp->tv_nsec = ltp->tv_nsec; LIN_SDT_PROBE1(time, linux_to_native_timespec, return, 0); return (0); } int native_to_linux_itimerspec(struct l_itimerspec *ltp, struct itimerspec *ntp) { int error; error = native_to_linux_timespec(<p->it_interval, &ntp->it_interval); if (error == 0) error = native_to_linux_timespec(<p->it_value, &ntp->it_interval); return (error); } int linux_to_native_itimerspec(struct itimerspec *ntp, struct l_itimerspec *ltp) { int error; error = linux_to_native_timespec(&ntp->it_interval, <p->it_interval); if (error == 0) error = linux_to_native_timespec(&ntp->it_value, <p->it_value); return (error); } int linux_to_native_clockid(clockid_t *n, clockid_t l) { LIN_SDT_PROBE2(time, linux_to_native_clockid, entry, n, l); if (l < 0) { /* cpu-clock */ if ((l & LINUX_CLOCKFD_MASK) == LINUX_CLOCKFD) return (EINVAL); if (LINUX_CPUCLOCK_WHICH(l) >= LINUX_CPUCLOCK_MAX) return (EINVAL); if (LINUX_CPUCLOCK_PERTHREAD(l)) *n = CLOCK_THREAD_CPUTIME_ID; else *n = CLOCK_PROCESS_CPUTIME_ID; return (0); } switch (l) { case LINUX_CLOCK_REALTIME: *n = CLOCK_REALTIME; break; case LINUX_CLOCK_MONOTONIC: *n = CLOCK_MONOTONIC; break; case LINUX_CLOCK_REALTIME_COARSE: *n = CLOCK_REALTIME_FAST; break; case LINUX_CLOCK_MONOTONIC_COARSE: *n = CLOCK_MONOTONIC_FAST; break; case LINUX_CLOCK_BOOTTIME: *n = CLOCK_UPTIME; break; case LINUX_CLOCK_MONOTONIC_RAW: case LINUX_CLOCK_REALTIME_ALARM: case LINUX_CLOCK_BOOTTIME_ALARM: case LINUX_CLOCK_SGI_CYCLE: case LINUX_CLOCK_TAI: LIN_SDT_PROBE1(time, linux_to_native_clockid, unsupported_clockid, l); LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL); return (EINVAL); default: LIN_SDT_PROBE1(time, linux_to_native_clockid, unknown_clockid, l); LIN_SDT_PROBE1(time, linux_to_native_clockid, return, EINVAL); return (EINVAL); } LIN_SDT_PROBE1(time, linux_to_native_clockid, return, 0); return (0); } int +linux_to_native_timerflags(int *nflags, int flags) +{ + + if (flags & ~LINUX_TIMER_ABSTIME) + return (EINVAL); + *nflags = 0; + if (flags & LINUX_TIMER_ABSTIME) + *nflags |= TIMER_ABSTIME; + return (0); +} + +int linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) { struct l_timespec lts; struct timespec tp; struct rusage ru; struct thread *targettd; struct proc *p; int error, clockwhich; clockid_t nwhich = 0; /* XXX: GCC */ pid_t pid; lwpid_t tid; LIN_SDT_PROBE2(time, linux_clock_gettime, entry, args->which, args->tp); error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_gettime, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); return (error); } switch (nwhich) { case CLOCK_PROCESS_CPUTIME_ID: clockwhich = LINUX_CPUCLOCK_WHICH(args->which); pid = LINUX_CPUCLOCK_ID(args->which); if (pid == 0) { p = td->td_proc; PROC_LOCK(p); } else { error = pget(pid, PGET_CANSEE, &p); if (error != 0) return (EINVAL); } switch (clockwhich) { case LINUX_CPUCLOCK_PROF: PROC_STATLOCK(p); calcru(p, &ru.ru_utime, &ru.ru_stime); PROC_STATUNLOCK(p); PROC_UNLOCK(p); timevaladd(&ru.ru_utime, &ru.ru_stime); TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); break; case LINUX_CPUCLOCK_VIRT: PROC_STATLOCK(p); calcru(p, &ru.ru_utime, &ru.ru_stime); PROC_STATUNLOCK(p); PROC_UNLOCK(p); TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); break; case LINUX_CPUCLOCK_SCHED: PROC_UNLOCK(p); error = kern_clock_getcpuclockid2(td, pid, CPUCLOCK_WHICH_PID, &nwhich); if (error != 0) return (EINVAL); error = kern_clock_gettime(td, nwhich, &tp); break; default: PROC_UNLOCK(p); return (EINVAL); } break; case CLOCK_THREAD_CPUTIME_ID: clockwhich = LINUX_CPUCLOCK_WHICH(args->which); p = td->td_proc; tid = LINUX_CPUCLOCK_ID(args->which); if (tid == 0) { targettd = td; PROC_LOCK(p); } else { targettd = tdfind(tid, p->p_pid); if (targettd == NULL) return (EINVAL); } switch (clockwhich) { case LINUX_CPUCLOCK_PROF: PROC_STATLOCK(p); thread_lock(targettd); rufetchtd(targettd, &ru); thread_unlock(targettd); PROC_STATUNLOCK(p); PROC_UNLOCK(p); timevaladd(&ru.ru_utime, &ru.ru_stime); TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); break; case LINUX_CPUCLOCK_VIRT: PROC_STATLOCK(p); thread_lock(targettd); rufetchtd(targettd, &ru); thread_unlock(targettd); PROC_STATUNLOCK(p); PROC_UNLOCK(p); TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); break; case LINUX_CPUCLOCK_SCHED: error = kern_clock_getcpuclockid2(td, tid, CPUCLOCK_WHICH_TID, &nwhich); PROC_UNLOCK(p); if (error != 0) return (EINVAL); error = kern_clock_gettime(td, nwhich, &tp); break; default: PROC_UNLOCK(p); return (EINVAL); } break; default: error = kern_clock_gettime(td, nwhich, &tp); break; } if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_gettime, gettime_error, error); LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); return (error); } error = native_to_linux_timespec(<s, &tp); if (error != 0) return (error); error = copyout(<s, args->tp, sizeof lts); if (error != 0) LIN_SDT_PROBE1(time, linux_clock_gettime, copyout_error, error); LIN_SDT_PROBE1(time, linux_clock_gettime, return, error); return (error); } int linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) { struct timespec ts; struct l_timespec lts; int error; clockid_t nwhich = 0; /* XXX: GCC */ LIN_SDT_PROBE2(time, linux_clock_settime, entry, args->which, args->tp); error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_settime, return, error); return (error); } error = copyin(args->tp, <s, sizeof lts); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error); LIN_SDT_PROBE1(time, linux_clock_settime, return, error); return (error); } error = linux_to_native_timespec(&ts, <s); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_settime, return, error); return (error); } error = kern_clock_settime(td, nwhich, &ts); if (error != 0) LIN_SDT_PROBE1(time, linux_clock_settime, settime_error, error); LIN_SDT_PROBE1(time, linux_clock_settime, return, error); return (error); } int linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) { struct proc *p; struct timespec ts; struct l_timespec lts; int error, clockwhich; clockid_t nwhich = 0; /* XXX: GCC */ pid_t pid; lwpid_t tid; LIN_SDT_PROBE2(time, linux_clock_getres, entry, args->which, args->tp); error = linux_to_native_clockid(&nwhich, args->which); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_getres, return, error); return (error); } /* * Check user supplied clock id in case of per-process * or thread-specific cpu-time clock. */ switch (nwhich) { case CLOCK_THREAD_CPUTIME_ID: tid = LINUX_CPUCLOCK_ID(args->which); if (tid != 0) { p = td->td_proc; if (tdfind(tid, p->p_pid) == NULL) return (ESRCH); PROC_UNLOCK(p); } break; case CLOCK_PROCESS_CPUTIME_ID: pid = LINUX_CPUCLOCK_ID(args->which); if (pid != 0) { error = pget(pid, PGET_CANSEE, &p); if (error != 0) return (EINVAL); PROC_UNLOCK(p); } break; } if (args->tp == NULL) { LIN_SDT_PROBE0(time, linux_clock_getres, nullcall); LIN_SDT_PROBE1(time, linux_clock_getres, return, 0); return (0); } switch (nwhich) { case CLOCK_THREAD_CPUTIME_ID: case CLOCK_PROCESS_CPUTIME_ID: clockwhich = LINUX_CPUCLOCK_WHICH(args->which); switch (clockwhich) { case LINUX_CPUCLOCK_PROF: nwhich = CLOCK_PROF; break; case LINUX_CPUCLOCK_VIRT: nwhich = CLOCK_VIRTUAL; break; case LINUX_CPUCLOCK_SCHED: break; default: return (EINVAL); } break; default: break; } error = kern_clock_getres(td, nwhich, &ts); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_getres, getres_error, error); LIN_SDT_PROBE1(time, linux_clock_getres, return, error); return (error); } error = native_to_linux_timespec(<s, &ts); if (error != 0) return (error); error = copyout(<s, args->tp, sizeof lts); if (error != 0) LIN_SDT_PROBE1(time, linux_clock_getres, copyout_error, error); LIN_SDT_PROBE1(time, linux_clock_getres, return, error); return (error); } int linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args) { struct timespec *rmtp; struct l_timespec lrqts, lrmts; struct timespec rqts, rmts; int error, error2; LIN_SDT_PROBE2(time, linux_nanosleep, entry, args->rqtp, args->rmtp); error = copyin(args->rqtp, &lrqts, sizeof lrqts); if (error != 0) { LIN_SDT_PROBE1(time, linux_nanosleep, copyin_error, error); LIN_SDT_PROBE1(time, linux_nanosleep, return, error); return (error); } if (args->rmtp != NULL) rmtp = &rmts; else rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); if (error != 0) { LIN_SDT_PROBE1(time, linux_nanosleep, conversion_error, error); LIN_SDT_PROBE1(time, linux_nanosleep, return, error); return (error); } error = kern_nanosleep(td, &rqts, rmtp); if (error == EINTR && args->rmtp != NULL) { error2 = native_to_linux_timespec(&lrmts, rmtp); if (error2 != 0) return (error2); error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts)); if (error2 != 0) { LIN_SDT_PROBE1(time, linux_nanosleep, copyout_error, error2); LIN_SDT_PROBE1(time, linux_nanosleep, return, error2); return (error2); } } LIN_SDT_PROBE1(time, linux_nanosleep, return, error); return (error); } int linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args) { struct timespec *rmtp; struct l_timespec lrqts, lrmts; struct timespec rqts, rmts; - int error, error2; + int error, error2, flags; + clockid_t clockid; LIN_SDT_PROBE4(time, linux_clock_nanosleep, entry, args->which, args->flags, args->rqtp, args->rmtp); - if (args->flags != 0) { - /* XXX deal with TIMER_ABSTIME */ + error = linux_to_native_timerflags(&flags, args->flags); + if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_flags, args->flags); - LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, EINVAL); - return (EINVAL); /* XXX deal with TIMER_ABSTIME */ + LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); + return (error); } - if (args->which != LINUX_CLOCK_REALTIME) { + error = linux_to_native_clockid(&clockid, args->which); + if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid, args->which); - LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, EINVAL); - return (EINVAL); + LIN_SDT_PROBE1(time, linux_clock_settime, return, error); + return (error); } error = copyin(args->rqtp, &lrqts, sizeof(lrqts)); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error, error); LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); return (error); } if (args->rmtp != NULL) rmtp = &rmts; else rmtp = NULL; error = linux_to_native_timespec(&rqts, &lrqts); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, conversion_error, error); LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); return (error); } - error = kern_nanosleep(td, &rqts, rmtp); - if (error == EINTR && args->rmtp != NULL) { - /* XXX. Not for TIMER_ABSTIME */ + error = kern_clock_nanosleep(td, clockid, flags, &rqts, rmtp); + if (error == EINTR && (flags & TIMER_ABSTIME) == 0 && + args->rmtp != NULL) { error2 = native_to_linux_timespec(&lrmts, rmtp); if (error2 != 0) return (error2); error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts)); if (error2 != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyout_error, error2); LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error2); return (error2); } } LIN_SDT_PROBE1(time, linux_clock_nanosleep, return, error); return (error); } Index: stable/11/sys/compat/linux/linux_timer.h =================================================================== --- stable/11/sys/compat/linux/linux_timer.h (revision 317636) +++ stable/11/sys/compat/linux/linux_timer.h (revision 317637) @@ -1,124 +1,126 @@ /*- * Copyright (c) 2014 Bjoern A. Zeeb * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-11-C-0249 * ("MRC2"), as part of the DARPA MRC research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LINUX_TIMER_H #define _LINUX_TIMER_H #ifndef __LINUX_ARCH_SIGEV_PREAMBLE_SIZE #define __LINUX_ARCH_SIGEV_PREAMBLE_SIZE \ (sizeof(l_int) * 2 + sizeof(l_sigval_t)) #endif #define LINUX_SIGEV_MAX_SIZE 64 #define LINUX_SIGEV_PAD_SIZE \ ((LINUX_SIGEV_MAX_SIZE - __LINUX_ARCH_SIGEV_PREAMBLE_SIZE) / \ sizeof(l_int)) #define LINUX_CLOCK_REALTIME 0 #define LINUX_CLOCK_MONOTONIC 1 #define LINUX_CLOCK_PROCESS_CPUTIME_ID 2 #define LINUX_CLOCK_THREAD_CPUTIME_ID 3 #define LINUX_CLOCK_MONOTONIC_RAW 4 #define LINUX_CLOCK_REALTIME_COARSE 5 #define LINUX_CLOCK_MONOTONIC_COARSE 6 #define LINUX_CLOCK_BOOTTIME 7 #define LINUX_CLOCK_REALTIME_ALARM 8 #define LINUX_CLOCK_BOOTTIME_ALARM 9 #define LINUX_CLOCK_SGI_CYCLE 10 #define LINUX_CLOCK_TAI 11 #define LINUX_CPUCLOCK_PERTHREAD_MASK 4 #define LINUX_CPUCLOCK_MASK 3 #define LINUX_CPUCLOCK_WHICH(clock) \ ((clock) & (clockid_t) LINUX_CPUCLOCK_MASK) #define LINUX_CPUCLOCK_PROF 0 #define LINUX_CPUCLOCK_VIRT 1 #define LINUX_CPUCLOCK_SCHED 2 #define LINUX_CPUCLOCK_MAX 3 #define LINUX_CLOCKFD LINUX_CPUCLOCK_MAX #define LINUX_CLOCKFD_MASK \ (LINUX_CPUCLOCK_PERTHREAD_MASK|LINUX_CPUCLOCK_MASK) #define LINUX_CPUCLOCK_ID(clock) ((pid_t) ~((clock) >> 3)) #define LINUX_CPUCLOCK_PERTHREAD(clock) \ (((clock) & (clockid_t) LINUX_CPUCLOCK_PERTHREAD_MASK) != 0) +#define LINUX_TIMER_ABSTIME 0x01 #define L_SIGEV_SIGNAL 0 #define L_SIGEV_NONE 1 #define L_SIGEV_THREAD 2 #define L_SIGEV_THREAD_ID 4 #define TS_CP(src,dst,fld) do { \ CP((src).fld,(dst).fld,tv_sec); \ CP((src).fld,(dst).fld,tv_nsec); \ } while (0) #define ITS_CP(src, dst) do { \ TS_CP((src), (dst), it_interval); \ TS_CP((src), (dst), it_value); \ } while (0) struct l_sigevent { l_sigval_t sigev_value; l_int sigev_signo; l_int sigev_notify; union { l_int _pad[LINUX_SIGEV_PAD_SIZE]; l_int _tid; struct { l_uintptr_t _function; l_uintptr_t _attribute; } _l_sigev_thread; } _l_sigev_un; } #if defined(__amd64__) && defined(COMPAT_LINUX32) __packed #endif ; struct l_itimerspec { struct l_timespec it_interval; struct l_timespec it_value; }; int native_to_linux_timespec(struct l_timespec *, struct timespec *); int linux_to_native_timespec(struct timespec *, struct l_timespec *); int linux_to_native_clockid(clockid_t *, clockid_t); int native_to_linux_itimerspec(struct l_itimerspec *, struct itimerspec *); int linux_to_native_itimerspec(struct itimerspec *, struct l_itimerspec *); +int linux_to_native_timerflags(int *, int); #endif /* _LINUX_TIMER_H */ Index: stable/11 =================================================================== --- stable/11 (revision 317636) +++ stable/11 (revision 317637) Property changes on: stable/11 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r316426