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

Function sys_kmq_unlink

freebsd/kern/uipc_mqueue.c:2140–2166  ·  view source on GitHub ↗

* Syscall to unlink a message queue. */

Source from the content-addressed store, hash-verified

2138 * Syscall to unlink a message queue.
2139 */
2140int
2141sys_kmq_unlink(struct thread *td, struct kmq_unlink_args *uap)
2142{
2143 char path[MQFS_NAMELEN+1];
2144 struct mqfs_node *pn;
2145 int error, len;
2146
2147 error = copyinstr(uap->path, path, MQFS_NAMELEN + 1, NULL);
2148 if (error)
2149 return (error);
2150
2151 len = strlen(path);
2152 if (len < 2 || path[0] != '/' || strchr(path + 1, '/') != NULL)
2153 return (EINVAL);
2154 if (strcmp(path, "/.") == 0 || strcmp(path, "/..") == 0)
2155 return (EINVAL);
2156 AUDIT_ARG_UPATH1_CANON(path);
2157
2158 sx_xlock(&mqfs_data.mi_lock);
2159 pn = mqfs_search(mqfs_data.mi_root, path + 1, len - 1, td->td_ucred);
2160 if (pn != NULL)
2161 error = do_unlink(pn, td->td_ucred);
2162 else
2163 error = ENOENT;
2164 sx_xunlock(&mqfs_data.mi_lock);
2165 return (error);
2166}
2167
2168typedef int (*_fgetf)(struct thread *, int, cap_rights_t *, struct file **);
2169

Callers 1

linux_mq_unlinkFunction · 0.85

Calls 5

strchrFunction · 0.85
strcmpFunction · 0.85
mqfs_searchFunction · 0.85
do_unlinkFunction · 0.85
copyinstrFunction · 0.50

Tested by

no test coverage detected