首页 > 其他 > 详细

2.3 确定文件描述符数

时间:2014-07-18 23:35:42      阅读:443      评论:0      收藏:0      [点我收藏+]

lib/openmax.c

#include "apue.h"
#include <errno.h>
#include <limits.h>
#ifdef	OPEN_MAX
static long	openmax = OPEN_MAX;
#else
static long	openmax = 0;
#endif
/*
 * If OPEN_MAX is indeterminate, we‘re not
 * guaranteed that this is adequate.
 */
#define	OPEN_MAX_GUESS	256
long
open_max(void)
{
	if (openmax == 0) {		/* first time through */
		errno = 0;
		if ((openmax = sysconf(_SC_OPEN_MAX)) < 0) {
			if (errno == 0)
				openmax = OPEN_MAX_GUESS;	/* it‘s indeterminate */
			else
				err_sys("sysconf error for _SC_OPEN_MAX");
		}
	}
	return(openmax);
}

2.3 确定文件描述符数,布布扣,bubuko.com

2.3 确定文件描述符数

原文:http://www.cnblogs.com/paullam/p/3849926.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!