summaryrefslogtreecommitdiff
path: root/lib/libc/devctl/posix_devctl.c
blob: c60b984e5b5ea6ecc31d9311afd4df54a4b0877e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <devctl.h>
#include <errno.h>
#include <stddef.h>
#include <sys/cdefs.h>
#include <syscall.h>

int posix_devctl(int fildes, int dcmd, void *restrict dev_data_ptr, size_t __unused nbyte, int *restrict dev_info_ptr)
{
	int r = syscall(ioctl, fildes, dcmd, dev_data_ptr);

	if (__predict_false(r < 0))
		return errno;

	*dev_info_ptr = r;

	return 0;
}