view sbr/closefds.c @ 12:441a2190cfae

Lion fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 21 Apr 2012 13:10:49 +0900
parents bce86c4163a3
children
line wrap: on
line source

/* closefds.c - close-up fd:s */
#ifndef	lint
static char ident[] = "@(#)$Id: closefds.c,v 1.1.1.1 2005/04/18 14:46:06 kono Exp $";
#endif	/* lint */

#include "../h/mh.h"
#ifndef	BSD42
#include <stdio.h>
#endif	/* not BSD42 */


void	closefds (i)
register int	i;
{
#if !defined(BSD42) && !defined(linux) && defined(_NFILE)
    int     nbits = _NFILE;
#else	/* BSD42 || linux */
    int     nbits = getdtablesize ();
#endif	/* BSD42 || linux */

    for (; i < nbits; i++)
#ifdef	OVERHEAD
	if (i != fd_def && i != fd_ctx)
#endif	/* OVERHEAD */
	    (void) close (i);
}