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

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

320 case FIOASYNC:
321 return (0);
322 }
323
324 return (ENOTTY);
325}
326
327static int
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2014 Dmitry Chagin <dchagin@FreeBSD.org>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

320 case FIOASYNC:
321 return (0);
322 }
323
324 return (ENOTTY);
325}
326
327static int
328eventfd_stat(struct file *fp, struct stat *st, struct ucred *active_cred,
329 struct thread *td)
328eventfd_stat(struct file *fp, struct stat *st, struct ucred *active_cred)
330{
331 bzero((void *)st, sizeof *st);
332 st->st_mode = S_IFIFO;
333 return (0);
334}
335
336static int
337eventfd_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
338{
339 struct eventfd *efd = fp->f_data;
340
341 kif->kf_type = KF_TYPE_EVENTFD;
342 mtx_lock(&efd->efd_lock);
343 kif->kf_un.kf_eventfd.kf_eventfd_value = efd->efd_count;
344 kif->kf_un.kf_eventfd.kf_eventfd_flags = efd->efd_flags;
345 mtx_unlock(&efd->efd_lock);
346 return (0);
347}
329{
330 bzero((void *)st, sizeof *st);
331 st->st_mode = S_IFIFO;
332 return (0);
333}
334
335static int
336eventfd_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
337{
338 struct eventfd *efd = fp->f_data;
339
340 kif->kf_type = KF_TYPE_EVENTFD;
341 mtx_lock(&efd->efd_lock);
342 kif->kf_un.kf_eventfd.kf_eventfd_value = efd->efd_count;
343 kif->kf_un.kf_eventfd.kf_eventfd_flags = efd->efd_flags;
344 mtx_unlock(&efd->efd_lock);
345 return (0);
346}