sys_timerfd.c (0ecf0b26a750582b804e238e6446db55188d7fdc) sys_timerfd.c (ef9ffb8594eee294334ced627755bf5b46b48f9f)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2014 Dmitry Chagin <dchagin@FreeBSD.org>
5 * Copyright (c) 2023 Jake Freeland <jfree@FreeBSD.org>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 270 unchanged lines hidden (view full) ---

279{
280 struct timerfd *tfd = kn->kn_hook;
281
282 mtx_assert(&tfd->tfd_lock, MA_OWNED);
283 kn->kn_data = (int64_t)tfd->tfd_count;
284 return (tfd->tfd_count > 0);
285}
286
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2014 Dmitry Chagin <dchagin@FreeBSD.org>
5 * Copyright (c) 2023 Jake Freeland <jfree@FreeBSD.org>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 270 unchanged lines hidden (view full) ---

279{
280 struct timerfd *tfd = kn->kn_hook;
281
282 mtx_assert(&tfd->tfd_lock, MA_OWNED);
283 kn->kn_data = (int64_t)tfd->tfd_count;
284 return (tfd->tfd_count > 0);
285}
286
287static struct filterops timerfd_rfiltops = {
287static const struct filterops timerfd_rfiltops = {
288 .f_isfd = 1,
289 .f_detach = filt_timerfddetach,
290 .f_event = filt_timerfdread,
291};
292
293static int
294timerfd_kqfilter(struct file *fp, struct knote *kn)
295{

--- 58 unchanged lines hidden (view full) ---

354 kif->kf_type = KF_TYPE_TIMERFD;
355 kif->kf_un.kf_timerfd.kf_timerfd_clockid = tfd->tfd_clockid;
356 kif->kf_un.kf_timerfd.kf_timerfd_flags = tfd->tfd_flags;
357 kif->kf_un.kf_timerfd.kf_timerfd_addr = (uintptr_t)tfd;
358
359 return (0);
360}
361
288 .f_isfd = 1,
289 .f_detach = filt_timerfddetach,
290 .f_event = filt_timerfdread,
291};
292
293static int
294timerfd_kqfilter(struct file *fp, struct knote *kn)
295{

--- 58 unchanged lines hidden (view full) ---

354 kif->kf_type = KF_TYPE_TIMERFD;
355 kif->kf_un.kf_timerfd.kf_timerfd_clockid = tfd->tfd_clockid;
356 kif->kf_un.kf_timerfd.kf_timerfd_flags = tfd->tfd_flags;
357 kif->kf_un.kf_timerfd.kf_timerfd_addr = (uintptr_t)tfd;
358
359 return (0);
360}
361
362static struct fileops timerfdops = {
362static const struct fileops timerfdops = {
363 .fo_read = timerfd_read,
364 .fo_write = invfo_rdwr,
365 .fo_truncate = invfo_truncate,
366 .fo_ioctl = timerfd_ioctl,
367 .fo_poll = timerfd_poll,
368 .fo_kqfilter = timerfd_kqfilter,
369 .fo_stat = timerfd_stat,
370 .fo_close = timerfd_close,

--- 239 unchanged lines hidden ---
363 .fo_read = timerfd_read,
364 .fo_write = invfo_rdwr,
365 .fo_truncate = invfo_truncate,
366 .fo_ioctl = timerfd_ioctl,
367 .fo_poll = timerfd_poll,
368 .fo_kqfilter = timerfd_kqfilter,
369 .fo_stat = timerfd_stat,
370 .fo_close = timerfd_close,

--- 239 unchanged lines hidden ---