aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/glibc/generic/sys-io.cpp
blob: fbd907067f8e9a2f7cbb8c722d4ca6de346d36b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <errno.h>
#include <sys/io.h>

#include <bits/ensure.h>
#include <mlibc/glibc-sysdeps.hpp>

int ioperm(unsigned long int from, unsigned long int num, int turn_on) {
	auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_ioperm, -1);

	if(int e = sysdep(from, num, turn_on); e) {
		errno = e;
		return -1;
	}
	return 0;
}

int iopl(int level) {
	auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_iopl, -1);

	if(int e = sysdep(level); e) {
		errno = e;
		return -1;
	}
	return 0;
}