| 2398 | } |
| 2399 | |
| 2400 | U32 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 | |
| 2429 | U32 KProcess::faccessat(U32 dirfd, BString path, U32 mode, U32 flags) { |
| 2430 | BString dir; |
no test coverage detected