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

Function do_unlink

freebsd/kern/uipc_mqueue.c:1025–1052  ·  view source on GitHub ↗

* Remove an entry */

Source from the content-addressed store, hash-verified

1023 * Remove an entry
1024 */
1025static
1026int do_unlink(struct mqfs_node *pn, struct ucred *ucred)
1027{
1028 struct mqfs_node *parent;
1029 struct mqfs_vdata *vd;
1030 int error = 0;
1031
1032 sx_assert(&pn->mn_info->mi_lock, SX_LOCKED);
1033
1034 if (ucred->cr_uid != pn->mn_uid &&
1035 (error = priv_check_cred(ucred, PRIV_MQ_ADMIN)) != 0)
1036 error = EACCES;
1037 else if (!pn->mn_deleted) {
1038 parent = pn->mn_parent;
1039 pn->mn_parent = NULL;
1040 pn->mn_deleted = 1;
1041 LIST_REMOVE(pn, mn_sibling);
1042 LIST_FOREACH(vd, &pn->mn_vnodes, mv_link) {
1043 cache_purge(vd->mv_vnode);
1044 vhold(vd->mv_vnode);
1045 taskqueue_enqueue(taskqueue_thread, &vd->mv_task);
1046 }
1047 mqnode_release(pn);
1048 mqnode_release(parent);
1049 } else
1050 error = ENOENT;
1051 return (error);
1052}
1053
1054#if 0
1055struct vop_remove_args {

Callers 3

mqfs_removeFunction · 0.85
mqfs_prison_removeFunction · 0.85
sys_kmq_unlinkFunction · 0.85

Calls 5

cache_purgeFunction · 0.85
vholdFunction · 0.85
taskqueue_enqueueFunction · 0.85
mqnode_releaseFunction · 0.85
priv_check_credFunction · 0.70

Tested by

no test coverage detected