if (ks->ks_waiters != 0) { mtx_unlock(&sem_lock); error = EBUSY; goto err; } ks->ks_flags |= KS_DEAD; mtx_unlock(&sem_lock); error = kern_close(td, uap->id); err: fdrop(fp, td); return (error); } static struct syscall_helper_data ksem_syscalls[] = { SYSCALL_INIT_HELPER(ksem_init), SYSCALL_INIT_HELPER(ksem_open), SYSCALL_INIT_HELPER(ksem_unlink), SYSCALL_INIT_HELPER(ksem_close), SYSCALL_INIT_HELPER(ksem_post), SYSCALL_INIT_HELPER(ksem_wait), SYSCALL_INIT_HELPER(ksem_timedwait), SYSCALL_INIT_HELPER(ksem_trywait), SYSCALL_INIT_HELPER(ksem_getvalue), SYSCALL_INIT_HELPER(ksem_destroy), SYSCALL_INIT_LAST }; #ifdef COMPAT_FREEBSD32 #include <compat/freebsd32/freebsd32.h> #include <compat/freebsd32/freebsd32_proto.h>
#include <sys/ktrace.h> #endif #ifdef COMPAT_FREEBSD32 #include <compat/freebsd32/freebsd32_util.h> #endif #include <net/vnet.h> #include <security/audit/audit.h> #include <security/mac/mac_framework.h> #include <netinet/sctp.h> #include <netinet/sctp_peeloff.h> static struct syscall_helper_data sctp_syscalls[] = { SYSCALL_INIT_HELPER(sctp_peeloff), SYSCALL_INIT_HELPER(sctp_generic_sendmsg), SYSCALL_INIT_HELPER(sctp_generic_sendmsg_iov), SYSCALL_INIT_HELPER(sctp_generic_recvmsg), SYSCALL_INIT_LAST }; static void sctp_syscalls_init(void *unused __unused) { int error; error = syscall_helper_register(sctp_syscalls, SY_THR_STATIC); KASSERT((error == 0), ("%s: syscall_helper_register failed for sctp syscalls", __func__)); #ifdef COMPAT_FREEBSD32
/* 0..(MSGSEG-1) -> index of next segment */ }; #define MSG_LOCKED 01000 /* Is this msqid_ds locked? */ static int nfree_msgmaps; /* # of free map entries */ static short free_msgmaps; /* head of linked list of free map entries */ static struct msg *free_msghdrs;/* list of free msg headers */ static char *msgpool; /* MSGMAX byte long msg buffer pool */ static struct msgmap *msgmaps; /* MSGSEG msgmap structures */ static struct msg *msghdrs; /* MSGTQL msg headers */ static struct msqid_kernel *msqids; /* MSGMNI msqid_kernel struct's */ static struct mtx msq_mtx; /* global mutex for message queues. */ static struct syscall_helper_data msg_syscalls[] = { SYSCALL_INIT_HELPER(msgctl), SYSCALL_INIT_HELPER(msgget), SYSCALL_INIT_HELPER(msgsnd), SYSCALL_INIT_HELPER(msgrcv), #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) SYSCALL_INIT_HELPER(msgsys), SYSCALL_INIT_HELPER_COMPAT(freebsd7_msgctl), #endif SYSCALL_INIT_LAST }; #ifdef COMPAT_FREEBSD32 #include <compat/freebsd32/freebsd32.h> #include <compat/freebsd32/freebsd32_ipc.h> #include <compat/freebsd32/freebsd32_proto.h>
#include <sys/sysctl.h> #include <sys/priv.h> #include <sys/proc.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/module.h> #include <sys/sysent.h> #include <sys/syscall.h> #include <sys/sysproto.h> #include <security/audit/audit.h> #include <nfs/nfssvc.h> static struct syscall_helper_data nfssvc_syscalls[] = { SYSCALL_INIT_HELPER(nfssvc), SYSCALL_INIT_LAST }; /* * This tiny module simply handles the nfssvc() system call. The other * nfs modules that use the system call register themselves by setting * the nfsd_call_xxx function pointers non-NULL. */ int (*nfsd_call_nfsserver)(struct thread *, struct nfssvc_args *) = NULL; int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *) = NULL; int (*nfsd_call_nfscl)(struct thread *, struct nfssvc_args *) = NULL; int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *) = NULL; /*