xref: /haiku/src/system/libroot/posix/unistd/ioctl.c (revision 21258e2674226d6aa732321b6f8494841895af5f)
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 
16 int
17 ioctl(int fd, ulong cmd, ...)
18 {
19 	va_list args;
20 	void* argument;
21 	size_t size;
22 	int status;
23 
24 	va_start(args, cmd);
25 	argument = va_arg(args, void*);
26 	size = va_arg(args, size_t);
27 	va_end(args);
28 
29 	status = _kern_ioctl(fd, cmd, argument, size);
30 
31 	RETURN_AND_SET_ERRNO(status);
32 }
33