summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/ioctl.cpp
blob: 8267e5e8d05645318787b32788d73fa59037aa4b (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
/*
 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <syscall.h>

extern "C" {

int ioctl(int fd, unsigned request, ...)
{
    va_list ap;
    va_start(ap, request);
    FlatPtr arg = va_arg(ap, FlatPtr);
    int rc = syscall(SC_ioctl, fd, request, arg);
    va_end(ap);
    __RETURN_WITH_ERRNO(rc, rc, -1);
}
}