mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:27:45 +00:00
LibCore: Add ioctl() syscall wrapper
This commit is contained in:
parent
9815ad556a
commit
90aa1abfed
2 changed files with 13 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <LibSystem/syscall.h>
|
#include <LibSystem/syscall.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -229,4 +230,15 @@ ErrorOr<String> gethostname()
|
||||||
return String(&hostname[0]);
|
return String(&hostname[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorOr<void> ioctl(int fd, unsigned request, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, request);
|
||||||
|
FlatPtr arg = va_arg(ap, FlatPtr);
|
||||||
|
va_end(ap);
|
||||||
|
if (::ioctl(fd, request, arg) < 0)
|
||||||
|
return Error::from_syscall("ioctl"sv, -errno);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,5 +36,6 @@ ErrorOr<int> dup(int source_fd);
|
||||||
ErrorOr<int> dup2(int source_fd, int destination_fd);
|
ErrorOr<int> dup2(int source_fd, int destination_fd);
|
||||||
ErrorOr<String> ptsname(int fd);
|
ErrorOr<String> ptsname(int fd);
|
||||||
ErrorOr<String> gethostname();
|
ErrorOr<String> gethostname();
|
||||||
|
ErrorOr<void> ioctl(int fd, unsigned request, ...);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue