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

Function ksem_remove

freebsd/kern/uipc_sem.c:404–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402}
403
404static int
405ksem_remove(char *path, Fnv32_t fnv, struct ucred *ucred)
406{
407 struct ksem_mapping *map;
408 int error;
409
410 LIST_FOREACH(map, KSEM_HASH(fnv), km_link) {
411 if (map->km_fnv != fnv)
412 continue;
413 if (strcmp(map->km_path, path) == 0) {
414#ifdef MAC
415 error = mac_posixsem_check_unlink(ucred, map->km_ksem);
416 if (error)
417 return (error);
418#endif
419 error = ksem_access(map->km_ksem, ucred);
420 if (error)
421 return (error);
422 map->km_ksem->ks_path = NULL;
423 LIST_REMOVE(map, km_link);
424 ksem_drop(map->km_ksem);
425 free(map->km_path, M_KSEM);
426 free(map, M_KSEM);
427 return (0);
428 }
429 }
430
431 return (ENOENT);
432}
433
434static int
435ksem_create_copyout_semid(struct thread *td, semid_t *semidp, int fd,

Callers 1

sys_ksem_unlinkFunction · 0.85

Calls 5

strcmpFunction · 0.85
ksem_accessFunction · 0.85
ksem_dropFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected