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

Function mqfs_search

freebsd/kern/uipc_mqueue.c:823–839  ·  view source on GitHub ↗

* Search a directory entry */

Source from the content-addressed store, hash-verified

821 * Search a directory entry
822 */
823static struct mqfs_node *
824mqfs_search(struct mqfs_node *pd, const char *name, int len, struct ucred *cred)
825{
826 struct mqfs_node *pn;
827 const void *pr_root;
828
829 sx_assert(&pd->mn_info->mi_lock, SX_LOCKED);
830 pr_root = cred->cr_prison->pr_root;
831 LIST_FOREACH(pn, &pd->mn_children, mn_sibling) {
832 /* Only match names within the same prison root directory */
833 if ((pn->mn_pr_root == NULL || pn->mn_pr_root == pr_root) &&
834 strncmp(pn->mn_name, name, len) == 0 &&
835 pn->mn_name[len] == '\0')
836 return (pn);
837 }
838 return (NULL);
839}
840
841/*
842 * Look up a file or directory.

Callers 3

mqfs_lookupxFunction · 0.85
kern_kmq_openFunction · 0.85
sys_kmq_unlinkFunction · 0.85

Calls 1

strncmpFunction · 0.85

Tested by

no test coverage detected