xref: /freebsd/lib/libc/gen/dirfd.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
10bb2aabfSGleb Kurtsou /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3d915a14eSPedro 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 
290bb2aabfSGleb Kurtsou #include "namespace.h"
300bb2aabfSGleb Kurtsou #include <sys/param.h>
310bb2aabfSGleb Kurtsou 
320bb2aabfSGleb Kurtsou #include <dirent.h>
330bb2aabfSGleb Kurtsou #include "un-namespace.h"
340bb2aabfSGleb Kurtsou 
350bb2aabfSGleb Kurtsou #include "gen-private.h"
360bb2aabfSGleb Kurtsou 
370bb2aabfSGleb Kurtsou int
dirfd(DIR * dirp)380bb2aabfSGleb Kurtsou dirfd(DIR *dirp)
390bb2aabfSGleb Kurtsou {
400bb2aabfSGleb Kurtsou 
410bb2aabfSGleb Kurtsou 	return (_dirfd(dirp));
420bb2aabfSGleb Kurtsou }
43