| 997 | } |
| 998 | |
| 999 | static int |
| 1000 | shm_remove(char *path, Fnv32_t fnv, struct ucred *ucred) |
| 1001 | { |
| 1002 | struct shm_mapping *map; |
| 1003 | int error; |
| 1004 | |
| 1005 | LIST_FOREACH(map, SHM_HASH(fnv), sm_link) { |
| 1006 | if (map->sm_fnv != fnv) |
| 1007 | continue; |
| 1008 | if (strcmp(map->sm_path, path) == 0) { |
| 1009 | #ifdef MAC |
| 1010 | error = mac_posixshm_check_unlink(ucred, map->sm_shmfd); |
| 1011 | if (error) |
| 1012 | return (error); |
| 1013 | #endif |
| 1014 | error = shm_access(map->sm_shmfd, ucred, |
| 1015 | FREAD | FWRITE); |
| 1016 | if (error) |
| 1017 | return (error); |
| 1018 | map->sm_shmfd->shm_path = NULL; |
| 1019 | LIST_REMOVE(map, sm_link); |
| 1020 | shm_drop(map->sm_shmfd); |
| 1021 | free(map->sm_path, M_SHMFD); |
| 1022 | free(map, M_SHMFD); |
| 1023 | return (0); |
| 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | return (ENOENT); |
| 1028 | } |
| 1029 | |
| 1030 | int |
| 1031 | kern_shm_open2(struct thread *td, const char *userpath, int flags, mode_t mode, |
no test coverage detected