| 1280 | } |
| 1281 | |
| 1282 | U32 KProcess::readlinkInDirectory(BString currentDirectory, BString path, U32 buffer, U32 bufSize) { |
| 1283 | // :TODO: move these to the virtual filesystem |
| 1284 | std::shared_ptr<FsNode> node = Fs::getNodeFromLocalPath(currentDirectory, path, false); |
| 1285 | if (!node || !node->isLink()) |
| 1286 | return -K_EINVAL; |
| 1287 | U32 len = (U32)node->getLink().length(); |
| 1288 | if (len>bufSize) |
| 1289 | len = bufSize; |
| 1290 | memory->memcpy(buffer, node->getLink().c_str(), len); |
| 1291 | return len; |
| 1292 | } |
| 1293 | |
| 1294 | U32 KProcess::readlinkat(FD dirfd, BString path, U32 buf, U32 bufsiz) { |
| 1295 | BString currentDirectory; |