dragonfly has closefrom()
This commit is contained in:
parent
800131ef91
commit
3d14c537ad
@ -44,9 +44,9 @@
|
|||||||
* getting-the-highest-allocated-file-descriptor
|
* getting-the-highest-allocated-file-descriptor
|
||||||
*
|
*
|
||||||
* System interfaces:
|
* System interfaces:
|
||||||
* FreeBSD:
|
* FreeBSD/DragonFly:
|
||||||
* - Has a closefrom() system call as of release 7.x around Sep 2009
|
* - Have a closefrom() system call as of release 7.x around Sep 2009
|
||||||
* - Has a /dev/fd, directory which shows the current process' open
|
* - Have a /dev/fd, directory which shows the current process' open
|
||||||
* descriptors. Only descriptors 0, 1, 2 are shown except if
|
* descriptors. Only descriptors 0, 1, 2 are shown except if
|
||||||
* fdescfs is mounted which it is not by default
|
* fdescfs is mounted which it is not by default
|
||||||
*
|
*
|
||||||
@ -69,6 +69,9 @@
|
|||||||
* @return 0 for success, -1 for error.
|
* @return 0 for success, -1 for error.
|
||||||
*/
|
*/
|
||||||
#ifndef TEST_CLOSEFROM
|
#ifndef TEST_CLOSEFROM
|
||||||
|
|
||||||
|
#include "closefrom.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -77,7 +80,6 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include "closefrom.h"
|
|
||||||
|
|
||||||
/* #define DEBUG_CLOSEFROM */
|
/* #define DEBUG_CLOSEFROM */
|
||||||
#ifdef DEBUG_CLOSEFROM
|
#ifdef DEBUG_CLOSEFROM
|
||||||
@ -93,7 +95,8 @@
|
|||||||
|
|
||||||
/* closefrom() exists on Solaris, netbsd and openbsd, but someone will
|
/* closefrom() exists on Solaris, netbsd and openbsd, but someone will
|
||||||
* have to provide me the appropriate macro to test */
|
* have to provide me the appropriate macro to test */
|
||||||
#if (defined(__FreeBSD__) && __FreeBSD_version >= 702104)
|
#if ((defined(__FreeBSD__) && __FreeBSD_version >= 702104)) || \
|
||||||
|
defined(__DragonFly__)
|
||||||
/* Use closefrom() system call */
|
/* Use closefrom() system call */
|
||||||
int libclf_closefrom(int fd0)
|
int libclf_closefrom(int fd0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user