libroot: add posix_devctl() from POSIX.1-2024
Change-Id: I2ae748b2febcdeca0256e9033119dcf9988ccc74 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8556 Reviewed-by: waddlesplash <[email protected]> Tested-by: Commit checker robot <[email protected]> Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2024 Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _DEVCTL_H_
|
||||
#define _DEVCTL_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int posix_devctl(int fd, int cmd, void* __restrict argument, size_t size, int* __restrict result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _DEVCTL_H_
|
||||
@@ -29,6 +29,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
|
||||
MergeObject <$(architecture)>posix_main.o :
|
||||
assert.cpp
|
||||
cat.cpp
|
||||
devctl.c
|
||||
dlfcn.c
|
||||
dirent.cpp
|
||||
errno.c
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2024 Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <devctl.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
int
|
||||
posix_devctl(int fd, int cmd, void* __restrict argument, size_t size, int* __restrict result)
|
||||
{
|
||||
int status = _kern_ioctl(fd, cmd, argument, size);
|
||||
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
if (result != NULL)
|
||||
*result = status;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
Reference in New Issue
Block a user