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

Function sys_ksem_unlink

freebsd/kern/uipc_sem.c:656–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

654};
655#endif
656int
657sys_ksem_unlink(struct thread *td, struct ksem_unlink_args *uap)
658{
659 char *path;
660 const char *pr_path;
661 size_t pr_pathlen;
662 Fnv32_t fnv;
663 int error;
664
665 path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
666 pr_path = td->td_ucred->cr_prison->pr_path;
667 pr_pathlen = strcmp(pr_path, "/") == 0 ? 0
668 : strlcpy(path, pr_path, MAXPATHLEN);
669 error = copyinstr(uap->name, path + pr_pathlen, MAXPATHLEN - pr_pathlen,
670 NULL);
671 if (error) {
672 free(path, M_TEMP);
673 return (error);
674 }
675
676 AUDIT_ARG_UPATH1_CANON(path);
677 fnv = fnv_32_str(path, FNV1_32_INIT);
678 sx_xlock(&ksem_dict_lock);
679 error = ksem_remove(path, fnv, td->td_ucred);
680 sx_xunlock(&ksem_dict_lock);
681 free(path, M_TEMP);
682
683 return (error);
684}
685
686#ifndef _SYS_SYSPROTO_H_
687struct ksem_close_args {

Callers

nothing calls this directly

Calls 7

mallocFunction · 0.85
strcmpFunction · 0.85
fnv_32_strFunction · 0.85
ksem_removeFunction · 0.85
freeFunction · 0.70
strlcpyFunction · 0.50
copyinstrFunction · 0.50

Tested by

no test coverage detected