1*1bcc0142Skamil /* $NetBSD: closefrom.c,v 1.4 2018/01/17 01:24:29 kamil Exp $ */
256c1b441Sitojun
356c1b441Sitojun /*
456c1b441Sitojun * Copyright (C) 2004 WIDE Project.
556c1b441Sitojun * All rights reserved.
656c1b441Sitojun *
756c1b441Sitojun * Redistribution and use in source and binary forms, with or without
856c1b441Sitojun * modification, are permitted provided that the following conditions
956c1b441Sitojun * are met:
1056c1b441Sitojun * 1. Redistributions of source code must retain the above copyright
1156c1b441Sitojun * notice, this list of conditions and the following disclaimer.
1256c1b441Sitojun * 2. Redistributions in binary form must reproduce the above copyright
1356c1b441Sitojun * notice, this list of conditions and the following disclaimer in the
1456c1b441Sitojun * documentation and/or other materials provided with the distribution.
1556c1b441Sitojun * 3. Neither the name of the project nor the names of its contributors
1656c1b441Sitojun * may be used to endorse or promote products derived from this software
1756c1b441Sitojun * without specific prior written permission.
1856c1b441Sitojun *
1956c1b441Sitojun * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
2056c1b441Sitojun * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2156c1b441Sitojun * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2256c1b441Sitojun * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
2356c1b441Sitojun * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2456c1b441Sitojun * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2556c1b441Sitojun * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2656c1b441Sitojun * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2756c1b441Sitojun * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2856c1b441Sitojun * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2956c1b441Sitojun * SUCH DAMAGE.
3056c1b441Sitojun */
3156c1b441Sitojun
3256c1b441Sitojun #include <sys/cdefs.h>
3356c1b441Sitojun #if defined(LIBC_SCCS) && !defined(lint)
34*1bcc0142Skamil __RCSID("$NetBSD: closefrom.c,v 1.4 2018/01/17 01:24:29 kamil Exp $");
3556c1b441Sitojun #endif /* LIBC_SCCS and not lint */
3656c1b441Sitojun
3756c1b441Sitojun #include <fcntl.h>
3856c1b441Sitojun #include <unistd.h>
3956c1b441Sitojun
4056c1b441Sitojun int
closefrom(int fd)4156c1b441Sitojun closefrom(int fd)
4256c1b441Sitojun {
4356c1b441Sitojun
44eaa9fc4cSatatat return (fcntl(fd, F_CLOSEM));
4556c1b441Sitojun }
46