aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/posix/generic/sys-utsname.cpp
blob: 3176574cd79b91cae0ccd8528d31b85701d6ce49 (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

#include <string.h>
#include <sys/utsname.h>
#include <errno.h>

#include <bits/ensure.h>
#include <mlibc/debug.hpp>
#include <internal-config.h>
#include <mlibc/posix-sysdeps.hpp>

int uname(struct utsname *p) {
	if (p == NULL) {
		errno = EFAULT;
		return -1;
	}

	MLIBC_CHECK_OR_ENOSYS(mlibc::sys_uname, -1);
	if(int e = mlibc::sys_uname(p); e) {
		errno = e;
		return -1;
	}
	return 0;
}