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

Function kern_mkfifoat

freebsd/kern/vfs_syscalls.c:1415–1467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1413}
1414
1415int
1416kern_mkfifoat(struct thread *td, int fd, const char *path,
1417 enum uio_seg pathseg, int mode)
1418{
1419 struct mount *mp;
1420 struct vattr vattr;
1421 struct nameidata nd;
1422 int error;
1423
1424 AUDIT_ARG_MODE(mode);
1425restart:
1426 bwillwrite();
1427 NDINIT_ATRIGHTS(&nd, CREATE, LOCKPARENT | SAVENAME | AUDITVNODE1 |
1428 NOCACHE, pathseg, path, fd, &cap_mkfifoat_rights,
1429 td);
1430 if ((error = namei(&nd)) != 0)
1431 return (error);
1432 if (nd.ni_vp != NULL) {
1433 NDFREE(&nd, NDF_ONLY_PNBUF);
1434 if (nd.ni_vp == nd.ni_dvp)
1435 vrele(nd.ni_dvp);
1436 else
1437 vput(nd.ni_dvp);
1438 vrele(nd.ni_vp);
1439 return (EEXIST);
1440 }
1441 if (vn_start_write(nd.ni_dvp, &mp, V_NOWAIT) != 0) {
1442 NDFREE(&nd, NDF_ONLY_PNBUF);
1443 vput(nd.ni_dvp);
1444 if ((error = vn_start_write(NULL, &mp, V_XSLEEP | PCATCH)) != 0)
1445 return (error);
1446 goto restart;
1447 }
1448 VATTR_NULL(&vattr);
1449 vattr.va_type = VFIFO;
1450 vattr.va_mode = (mode & ALLPERMS) & ~td->td_proc->p_pd->pd_cmask;
1451#ifdef MAC
1452 error = mac_vnode_check_create(td->td_ucred, nd.ni_dvp, &nd.ni_cnd,
1453 &vattr);
1454 if (error != 0)
1455 goto out;
1456#endif
1457 error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
1458#ifdef MAC
1459out:
1460#endif
1461 VOP_VPUT_PAIR(nd.ni_dvp, error == 0 ? &nd.ni_vp : NULL, true);
1462 vn_finished_write(mp);
1463 NDFREE(&nd, NDF_ONLY_PNBUF);
1464 if (error == ERELOOKUP)
1465 goto restart;
1466 return (error);
1467}
1468
1469/*
1470 * Make a hard file link.

Callers 3

kern_mknodatFunction · 0.85
sys_mkfifoFunction · 0.85
sys_mkfifoatFunction · 0.85

Calls 8

nameiFunction · 0.85
NDFREEFunction · 0.85
vputFunction · 0.85
vn_start_writeFunction · 0.85
mac_vnode_check_createFunction · 0.85
vn_finished_writeFunction · 0.85
bwillwriteFunction · 0.70
vreleFunction · 0.70

Tested by

no test coverage detected