MCPcopy Create free account
hub / github.com/F-Stack/f-stack / eventfd_create_file

Function eventfd_create_file

freebsd/kern/sys_eventfd.c:110–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108};
109
110int
111eventfd_create_file(struct thread *td, struct file *fp, uint32_t initval,
112 int flags)
113{
114 struct eventfd *efd;
115 int fflags;
116
117 AUDIT_ARG_FFLAGS(flags);
118 AUDIT_ARG_VALUE(initval);
119
120 efd = malloc(sizeof(*efd), M_EVENTFD, M_WAITOK | M_ZERO);
121 efd->efd_flags = flags;
122 efd->efd_count = initval;
123 mtx_init(&efd->efd_lock, "eventfd", NULL, MTX_DEF);
124 knlist_init_mtx(&efd->efd_sel.si_note, &efd->efd_lock);
125
126 fflags = FREAD | FWRITE;
127 if ((flags & EFD_NONBLOCK) != 0)
128 fflags |= FNONBLOCK;
129 finit(fp, fflags, DTYPE_EVENTFD, efd, &eventfdops);
130
131 return (0);
132}
133
134static int
135eventfd_close(struct file *fp, struct thread *td)

Callers 1

kern_specialfdFunction · 0.70

Calls 4

mallocFunction · 0.85
mtx_initFunction · 0.85
knlist_init_mtxFunction · 0.85
finitFunction · 0.85

Tested by

no test coverage detected