Commit graph

64 commits

Author SHA1 Message Date
Lucas CHOLLET
b3b40ae1fa LibCore: Add wrapper for sethostname 2022-01-14 19:42:19 +02:00
Lucas CHOLLET
8153282923 LibCore: Remove usage of a hardcoded constant in gethostname() 2022-01-14 19:42:19 +02:00
Daniel Bertalan
182016d7c0 Kernel+LibC+LibCore+UE: Implement fchmodat(2)
This function is an extended version of `chmod(2)` that lets one control
whether to dereference symlinks, and specify a file descriptor to a
directory that will be used as the base for relative paths.
2022-01-12 14:54:12 +01:00
Junior Rantila
0d328f3c86 LibCore+flock: Make Core::System::waitpid more ergonomic 2022-01-11 16:04:29 +01:00
Junior Rantila
7801e38af1 LibCore: Add beep wrapper 2022-01-09 11:16:00 +03:30
Lucas CHOLLET
3fa5be655d LibCore: Add a wrapper for setsid() 2022-01-09 03:22:10 +03:30
Junior Rantila
9a38d1de07 LibCore+ImageViewer: Add unlink() wrapper, use it 2022-01-06 18:20:07 +01:00
mjz19910
eacbbca4c4 LibCore: Impliment ErrorOr wrapper for chdir 2022-01-04 10:59:42 +00:00
mjz19910
91f5fc796b LibCore: Add an ErrorOr wrapper for uname 2022-01-04 07:33:23 +00:00
Andreas Kling
431bd069f0 LibCore: Add Core::System wrappers for getspent() and getspnam() 2022-01-02 18:08:02 +01:00
Andreas Kling
7008f74214 LibCore: Add syscall wrappers for getpwuid() and getgrgid() 2022-01-02 18:08:02 +01:00
Andreas Kling
1e4117f1e1 LibCore: Add syscall wrapper for getgroups()
This wrapper does all the grunt work of figuring out how many extra GIDs
there are, and then returning them nicely wrapped in a Vector<gid_t>.
2022-01-02 18:08:02 +01:00
Andreas Kling
f95fc91e4f LibCore: Reset errno before using LibC pwd functions
We should not expect LibC functions to clear `errno` on success,
so if we want to use it for error checking after a call, we need
to clear it before the call.
2022-01-02 18:08:02 +01:00
circl
63760603f3 Kernel+LibC+LibCore: Add lchown and fchownat functions
This modifies sys$chown to allow specifying whether or not to follow
symlinks and in which directory.

This was then used to implement lchown and fchownat in LibC and LibCore.
2022-01-01 15:08:49 +01:00
Ali Mohammad Pur
8de8a7766d LibCore: Add Core::System::setpgid() 2021-12-31 02:19:45 +03:30
Ali Mohammad Pur
ee46cee31f LibCore: Make Core::System::pipe2() available on Lagom
Note that this drops the flags on the floor if not on linux or serenity.
2021-12-31 02:19:45 +03:30
tuftedocelot
ea0a002468 LibCore: Add OpenBSD headers to System and LocalSocket
Add the correct header to System.h and add OpenBSD-specific handling of
signals and socket process id
2021-12-29 03:46:56 -08:00
Kenneth Myhra
7772309169 LibCore+chown: Return ErrorOr<Optional<...>> for getgrnam and getpwnam
This patch returns an empty Optional<...> instead of an Error for
Core::System::getgrname and Core::System::getpwnam if we can't find a
matching group or user entry.

It also updates the 'chown' utility to support this new behavior.
2021-12-28 23:23:54 +01:00
Sam Atkins
289cf8d7ef LibCore: Add ErrorOr wrappers to socket syscalls
These are all pretty simple so I thought I would add them all in one go:

- socket()
- bind()
- listen()
- accept()
- accept4()
- connect()
- shutdown()
- send()
- sendmsg()
- sendto()
- recv()
- recvmsg()
- recvfrom()
- getsockopt()
- setsockopt()
- getsockname()
- getpeername()
- socketpair()
2021-12-27 22:00:01 +01:00
Andreas Kling
2bd1a62ce1 LibCore: Add syscall wrapper for ptrace() 2021-12-25 11:05:30 +01:00
Brian Gianforcaro
a62669ebcf LibCore: Add Core::System::getcwd() wrapper 2021-12-24 14:29:52 -08:00
Daniel Bertalan
8e3d1a42e3 Kernel+UE+LibC: Store address as void* in SC_m{re,}map_params
Most other syscalls pass address arguments as `void*` instead of
`uintptr_t`, so let's do that here too. Besides improving consistency,
this commit makes `strace` correctly pretty-print these arguments in
hex.
2021-12-23 23:08:10 +01:00
Andreas Kling
5911d1c880 LibCore: Fix Lagom build of Core::System::utime() 2021-12-21 01:28:59 +01:00
Andreas Kling
bd8f10db80 LibCore: Add syscall wrapper for utime() 2021-12-20 22:16:05 +01:00
Junior Rantila
4178479ee5 LibCore: Add wrapper for signal() 2021-12-19 18:26:57 -08:00
Andreas Kling
2f9e07dfdb LibCore: Use correct underlying syscall in seteuid() and setegid()
Thanks to Idan's hawk eyes for spotting this! :^)
2021-12-16 23:02:56 +01:00
Andreas Kling
ead9c36c92 LibCore: Add syscall wrapper for rename() 2021-12-16 22:48:17 +01:00
Andreas Kling
fb4ffe22c8 LibCore: Add syscall wrapper for fchmod() 2021-12-16 22:48:17 +01:00
Andreas Kling
aa7e8b5797 LibCore: Add syscall wrapper for mkstemp() 2021-12-16 22:48:17 +01:00
Andreas Kling
2637a64130 LibCore: Add syscall wrapper for fork() 2021-12-16 22:48:17 +01:00
Andreas Kling
01c2756e9a LibCore: Add syscall wrapper for mkdir() 2021-12-16 22:48:17 +01:00
Andreas Kling
f69bd3bd46 LibCore: Add syscall wrapper for mount() 2021-12-16 22:48:17 +01:00
Andreas Kling
ad37ca4815 LibCore: Add syscall wrapper for setgroups() 2021-12-16 22:48:17 +01:00
Andreas Kling
92e6532bf1 LibCore: Add syscall wrapper for isatty() 2021-12-16 22:48:17 +01:00
Andreas Kling
2c3699e257 LibCore: Add syscall wrappers for setuid/seteuid/setgid/setegid 2021-12-16 22:48:17 +01:00
Kenneth Myhra
11578c623c LibCore: Add waitpid() wrapper that return ErrorOr<pid_t> 2021-12-16 02:10:47 -08:00
Kenneth Myhra
123e49994d LibCore: Add posix_spawnp() wrapper that return ErrorOr<pid_t> 2021-12-16 02:10:47 -08:00
Kenneth Myhra
7b13f22f96 LibCore: Add syscall wrapper for clock_settime() 2021-12-11 15:10:42 -08:00
Kenneth Myhra
c4bd46023b LibCore: Add syscall wrapper for getgrnam() 2021-12-11 15:10:42 -08:00
Kenneth Myhra
cd5063555e LibCore: Add syscall wrapper for getpwnam() 2021-12-11 15:10:42 -08:00
Kenneth Myhra
52a451dcff LibCore: Add syscall wrapper for chown() 2021-12-11 15:10:42 -08:00
Ben Wiederhake
70e96fb917 LibCore: Implement new ptrace_peekbuf wrapper for PT_PEEKBUF syscall 2021-12-05 22:59:09 +01:00
Kenneth Myhra
0d76d15f9d LibCore: Add syscall wrapper for chmod() 2021-12-04 15:05:46 -08:00
Andreas Kling
1640445cb2 LibCore: Add lstat() syscall wrapper 2021-12-04 14:24:04 +01:00
Andreas Kling
612eafea2c LibCore: Add syscall wrappers for tcgetattr() and tcsetattr() 2021-11-30 23:34:40 +01:00
Andreas Kling
90aa1abfed LibCore: Add ioctl() syscall wrapper 2021-11-30 23:34:40 +01:00
Andreas Kling
83056efc1a LibCore: Add syscall wrapper for dup() 2021-11-28 23:14:19 +01:00
Andreas Kling
982ac34437 LibCore: Add syscall wrappers for sendfd() and recvfd() 2021-11-28 23:14:18 +01:00
Brian Gianforcaro
fcc00c9a27 LibCore+cat: Switch Core::System::read/write to take a Span of bytes
In the spirit of the Core::System name space having "modern" facades
for classically C functions / Kernel interfaces, it seems appropriate
that we should take Span's of data instead of raw pointer + length
arguments.
2021-11-28 08:04:57 +01:00
Kenneth Myhra
951d8a06d8 LibCore: Add syscall wrapper for gethostname() 2021-11-27 11:14:16 +01:00