MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / unlinkat

Method unlinkat

source/kernel/kprocess.cpp:2400–2427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2398}
2399
2400U32 KProcess::unlinkat(FD dirfd, BString path, U32 flags) {
2401 BString dir;
2402 U32 result = 0;
2403
2404 if (path.charAt(0) != '/')
2405 result = getCurrentDirectoryFromDirFD(dirfd, dir);
2406
2407 if (result)
2408 return result;
2409 std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(dir, path, false);
2410 if (!node) {
2411 return -K_ENOENT;
2412 }
2413 if (flags & 0x200) { // unlinkat AT_REMOVEDIR
2414 if (!node->isDirectory()) {
2415 return -K_ENOTDIR;
2416 }
2417 if (node->removeDir() == 0)
2418 return 0;
2419 return -K_ENOTEMPTY;
2420 } else {
2421 if (!node->remove()) {
2422 kwarn_fmt("filed to remove file: errno=%d", errno);
2423 return -K_EBUSY;
2424 }
2425 return 0;
2426 }
2427}
2428
2429U32 KProcess::faccessat(U32 dirfd, BString path, U32 mode, U32 flags) {
2430 BString dir;

Callers 1

syscall_unlinkatFunction · 0.80

Calls 5

kwarn_fmtFunction · 0.85
charAtMethod · 0.80
isDirectoryMethod · 0.80
removeDirMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected