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

Function shm_remove

freebsd/kern/uipc_shm.c:999–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

997}
998
999static int
1000shm_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
1030int
1031kern_shm_open2(struct thread *td, const char *userpath, int flags, mode_t mode,

Callers 2

sys_shm_unlinkFunction · 0.70
sys_shm_renameFunction · 0.70

Calls 5

strcmpFunction · 0.85
shm_accessFunction · 0.85
shm_dropFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected