mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-24 17:44:17 +01:00
timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME
This is a common use case when using timerfd_create to actually use it with CLOCK_BOOTTIME on linux which is CLOCK_UPTIME for us. Note that currently on freebsd CLOCK_BOOTTIME is CLOCK_UPTIME, but the semantic is supposed to be different, this has to be fixed later. Tested with the fnott notification software Reviewed by: des, imp Differential Revision: https://reviews.freebsd.org/D44253
This commit is contained in:
parent
32b8aac6f9
commit
cf742faa39
@ -26,6 +26,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/_clock_id.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/callout.h>
|
||||
@ -432,8 +433,18 @@ kern_timerfd_create(struct thread *td, int clockid, int flags)
|
||||
AUDIT_ARG_VALUE(clockid);
|
||||
AUDIT_ARG_FFLAGS(flags);
|
||||
|
||||
if (clockid != CLOCK_REALTIME && clockid != CLOCK_MONOTONIC)
|
||||
switch (clockid) {
|
||||
case CLOCK_REALTIME:
|
||||
/* FALLTHROUGH */
|
||||
case CLOCK_MONOTONIC:
|
||||
/* FALLTHROUGH */
|
||||
case CLOCK_UPTIME:
|
||||
/* FALLTHROUGH */
|
||||
case CLOCK_BOOTTIME:
|
||||
break;
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
if ((flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user