1/*
2 * Copyright 2002-2007, Axel D��rfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#include <unistd.h>
8#include <syscalls.h>
9#include <stdarg.h>
10#include <errno.h>
11
12#include <errno_private.h>
13#include <syscall_utils.h>
14
15
16int
17__ioctl(int fd, ulong cmd, struct ioctl_args args)
18{
19	RETURN_AND_SET_ERRNO(_kern_ioctl(fd, cmd, args.argument, args.size));
20}
21
22
23#undef ioctl
24int
25ioctl(int fd, ulong cmd, ...)
26{
27	va_list args;
28	void* argument;
29	size_t size;
30	int status;
31
32	va_start(args, cmd);
33	argument = va_arg(args, void*);
34	size = va_arg(args, size_t);
35	va_end(args);
36
37	status = _kern_ioctl(fd, cmd, argument, size);
38
39	RETURN_AND_SET_ERRNO(status);
40}
41