1177911Sdfr/*-
2177911Sdfr * Copyright (c) 2008 Isilon Inc http://www.isilon.com/
3177911Sdfr * Authors: Doug Rabson <dfr@rabson.org>
4177911Sdfr * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
5177911Sdfr *
6281714Skib * Copyright (c) 2014-2015 The FreeBSD Foundation.
7281714Skib * All rights reserved.
8281714Skib *
9281714Skib * Portions of this software were developed by Konstantin Belousov
10281714Skib * under sponsorship from the FreeBSD Foundation.
11281714Skib *
12177911Sdfr * Redistribution and use in source and binary forms, with or without
13177911Sdfr * modification, are permitted provided that the following conditions
14177911Sdfr * are met:
15177911Sdfr * 1. Redistributions of source code must retain the above copyright
16177911Sdfr *    notice, this list of conditions and the following disclaimer.
17177911Sdfr * 2. Redistributions in binary form must reproduce the above copyright
18177911Sdfr *    notice, this list of conditions and the following disclaimer in the
19177911Sdfr *    documentation and/or other materials provided with the distribution.
20177911Sdfr *
21177911Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22177911Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23177911Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24177911Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25177911Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26177911Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27177911Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28177911Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29177911Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30177911Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31177911Sdfr * SUCH DAMAGE.
32177911Sdfr */
33177911Sdfr
34177911Sdfr#include <sys/cdefs.h>
35177911Sdfr__FBSDID("$FreeBSD$");
36177911Sdfr
37177911Sdfr#include <fcntl.h>
38177911Sdfr#include <stdarg.h>
39177911Sdfr#include <sys/types.h>
40177911Sdfr#include <sys/syscall.h>
41177911Sdfr#include "libc_private.h"
42177911Sdfr
43276630Skib#pragma weak fcntl
44276630Skibint
45276630Skibfcntl(int fd, int cmd, ...)
46276630Skib{
47276630Skib	va_list args;
48276630Skib	long arg;
49179358Sdfr
50276630Skib	va_start(args, cmd);
51276630Skib	arg = va_arg(args, long);
52276630Skib	va_end(args);
53276630Skib
54276630Skib	return (((int (*)(int, int, ...))
55276630Skib	    __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg));
56276630Skib}
57