xref: /freebsd/lib/libc/gen/dirfd.c (revision d915a14ef094c8dfc1a5aee70e135abfec01d0f1)
10bb2aabfSGleb Kurtsou /*-
2*d915a14eSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3*d915a14eSPedro F. Giffuni  *
431bfa3caSGleb Kurtsou  * Copyright (c) 2011 Gleb Kurtsou <gleb@FreeBSD.org>
531bfa3caSGleb Kurtsou  * All rights reserved.
60bb2aabfSGleb Kurtsou  *
70bb2aabfSGleb Kurtsou  * Redistribution and use in source and binary forms, with or without
80bb2aabfSGleb Kurtsou  * modification, are permitted provided that the following conditions
90bb2aabfSGleb Kurtsou  * are met:
100bb2aabfSGleb Kurtsou  * 1. Redistributions of source code must retain the above copyright
110bb2aabfSGleb Kurtsou  *    notice, this list of conditions and the following disclaimer.
120bb2aabfSGleb Kurtsou  * 2. Redistributions in binary form must reproduce the above copyright
130bb2aabfSGleb Kurtsou  *    notice, this list of conditions and the following disclaimer in the
140bb2aabfSGleb Kurtsou  *    documentation and/or other materials provided with the distribution.
150bb2aabfSGleb Kurtsou  *
1631bfa3caSGleb Kurtsou  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
170bb2aabfSGleb Kurtsou  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
180bb2aabfSGleb Kurtsou  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1931bfa3caSGleb Kurtsou  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
200bb2aabfSGleb Kurtsou  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
210bb2aabfSGleb Kurtsou  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
220bb2aabfSGleb Kurtsou  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
230bb2aabfSGleb Kurtsou  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
240bb2aabfSGleb Kurtsou  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
250bb2aabfSGleb Kurtsou  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
260bb2aabfSGleb Kurtsou  * SUCH DAMAGE.
270bb2aabfSGleb Kurtsou  *
280bb2aabfSGleb Kurtsou  * $FreeBSD$
290bb2aabfSGleb Kurtsou  */
300bb2aabfSGleb Kurtsou 
310bb2aabfSGleb Kurtsou #include <sys/cdefs.h>
320bb2aabfSGleb Kurtsou __FBSDID("$FreeBSD$");
330bb2aabfSGleb Kurtsou 
340bb2aabfSGleb Kurtsou #include "namespace.h"
350bb2aabfSGleb Kurtsou #include <sys/param.h>
360bb2aabfSGleb Kurtsou 
370bb2aabfSGleb Kurtsou #include <dirent.h>
380bb2aabfSGleb Kurtsou #include "un-namespace.h"
390bb2aabfSGleb Kurtsou 
400bb2aabfSGleb Kurtsou #include "gen-private.h"
410bb2aabfSGleb Kurtsou 
420bb2aabfSGleb Kurtsou int
430bb2aabfSGleb Kurtsou dirfd(DIR *dirp)
440bb2aabfSGleb Kurtsou {
450bb2aabfSGleb Kurtsou 
460bb2aabfSGleb Kurtsou 	return (_dirfd(dirp));
470bb2aabfSGleb Kurtsou }
48