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

Function kern_specialfd

freebsd/kern/sys_generic.c:864–894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864int
865kern_specialfd(struct thread *td, int type, void *arg)
866{
867 struct file *fp;
868 struct specialfd_eventfd *ae;
869 int error, fd, fflags;
870
871 fflags = 0;
872 error = falloc_noinstall(td, &fp);
873 if (error != 0)
874 return (error);
875
876 switch (type) {
877 case SPECIALFD_EVENTFD:
878 ae = arg;
879 if ((ae->flags & EFD_CLOEXEC) != 0)
880 fflags |= O_CLOEXEC;
881 error = eventfd_create_file(td, fp, ae->initval, ae->flags);
882 break;
883 default:
884 error = EINVAL;
885 break;
886 }
887
888 if (error == 0)
889 error = finstall(td, fp, &fd, fflags, NULL);
890 fdrop(fp, td);
891 if (error == 0)
892 td->td_retval[0] = fd;
893 return (error);
894}
895
896int
897sys___specialfd(struct thread *td, struct __specialfd_args *args)

Callers 1

sys___specialfdFunction · 0.85

Calls 2

finstallFunction · 0.85
eventfd_create_fileFunction · 0.70

Tested by

no test coverage detected