mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibCore: Make Core::System::pipe2() available on Lagom
Note that this drops the flags on the floor if not on linux or serenity.
This commit is contained in:
parent
b303b8cf4e
commit
ee46cee31f
2 changed files with 14 additions and 9 deletions
|
@ -45,14 +45,6 @@ ErrorOr<void> unveil(StringView path, StringView permissions)
|
|||
HANDLE_SYSCALL_RETURN_VALUE("unveil"sv, rc, {});
|
||||
}
|
||||
|
||||
ErrorOr<Array<int, 2>> pipe2(int flags)
|
||||
{
|
||||
Array<int, 2> fds;
|
||||
if (::pipe2(fds.data(), flags) < 0)
|
||||
return Error::from_syscall("pipe2"sv, -errno);
|
||||
return fds;
|
||||
}
|
||||
|
||||
ErrorOr<void> sendfd(int sockfd, int fd)
|
||||
{
|
||||
if (::sendfd(sockfd, fd) < 0)
|
||||
|
@ -709,4 +701,17 @@ ErrorOr<void> socketpair(int domain, int type, int protocol, int sv[2])
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<Array<int, 2>> pipe2([[maybe_unused]] int flags)
|
||||
{
|
||||
Array<int, 2> fds;
|
||||
#if defined(__unix__)
|
||||
if (::pipe2(fds.data(), flags) < 0)
|
||||
return Error::from_syscall("pipe2"sv, -errno);
|
||||
#else
|
||||
if (::pipe(fds.data()) < 0)
|
||||
return Error::from_syscall("pipe2"sv, -errno);
|
||||
#endif
|
||||
return fds;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace Core::System {
|
|||
#ifdef __serenity__
|
||||
ErrorOr<void> pledge(StringView promises, StringView execpromises = {});
|
||||
ErrorOr<void> unveil(StringView path, StringView permissions);
|
||||
ErrorOr<Array<int, 2>> pipe2(int flags);
|
||||
ErrorOr<void> sendfd(int sockfd, int fd);
|
||||
ErrorOr<int> recvfd(int sockfd, int options);
|
||||
ErrorOr<void> ptrace_peekbuf(pid_t tid, void const* tracee_addr, Bytes destination_buf);
|
||||
|
@ -85,6 +84,7 @@ ErrorOr<int> mkstemp(Span<char> pattern);
|
|||
ErrorOr<void> fchmod(int fd, mode_t mode);
|
||||
ErrorOr<void> rename(StringView old_path, StringView new_path);
|
||||
ErrorOr<void> utime(StringView path, Optional<struct utimbuf>);
|
||||
ErrorOr<Array<int, 2>> pipe2(int flags);
|
||||
|
||||
ErrorOr<int> socket(int domain, int type, int protocol);
|
||||
ErrorOr<void> bind(int sockfd, struct sockaddr const*, socklen_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue