| 654 | }; |
| 655 | #endif |
| 656 | int |
| 657 | sys_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_ |
| 687 | struct ksem_close_args { |
nothing calls this directly
no test coverage detected