mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-13 11:42:38 +03:00
LibCore: Add Core::System::getcwd() wrapper
This commit is contained in:
parent
1c950773fb
commit
a62669ebcf
Notes:
sideshowbarker
2024-07-17 22:12:33 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/a62669ebcfb Pull-request: https://github.com/SerenityOS/serenity/pull/11401
@ -301,6 +301,17 @@ ErrorOr<String> gethostname()
|
||||
return String(&hostname[0]);
|
||||
}
|
||||
|
||||
ErrorOr<String> getcwd()
|
||||
{
|
||||
auto* cwd = ::getcwd(nullptr, 0);
|
||||
if (!cwd)
|
||||
return Error::from_syscall("getcwd"sv, -errno);
|
||||
|
||||
String string_cwd(cwd);
|
||||
free(cwd);
|
||||
return string_cwd;
|
||||
}
|
||||
|
||||
ErrorOr<void> ioctl(int fd, unsigned request, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -53,6 +53,7 @@ ErrorOr<int> dup(int source_fd);
|
||||
ErrorOr<int> dup2(int source_fd, int destination_fd);
|
||||
ErrorOr<String> ptsname(int fd);
|
||||
ErrorOr<String> gethostname();
|
||||
ErrorOr<String> getcwd();
|
||||
ErrorOr<void> ioctl(int fd, unsigned request, ...);
|
||||
ErrorOr<struct termios> tcgetattr(int fd);
|
||||
ErrorOr<void> tcsetattr(int fd, int optional_actions, struct termios const&);
|
||||
|
Loading…
Reference in New Issue
Block a user