Deleted Added
full compact
getdtablesize.c (55682) getdtablesize.c (90926)
1/*
1/*
2 * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska H�gskolan
2 * Copyright (c) 1995-2001 Kungliga Tekniska H�gskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifdef HAVE_CONFIG_H
35#include <config.h>
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifdef HAVE_CONFIG_H
35#include <config.h>
36RCSID("$Id: getdtablesize.c,v 1.10 1999/12/02 16:58:46 joda Exp $");
36RCSID("$Id: getdtablesize.c,v 1.11 2001/06/20 00:00:38 joda Exp $");
37#endif
38
39#include "roken.h"
40
41#ifdef HAVE_SYS_TYPES_H
42#include <sys/types.h>
43#endif
44#ifdef TIME_WITH_SYS_TIME

--- 32 unchanged lines hidden (view full) ---

77#else /* !definded(HAVE_GETRLIMIT) */
78#if defined(HAVE_SYSCTL) && defined(CTL_KERN) && defined(KERN_MAXFILES)
79 int mib[2];
80 size_t len;
81
82 mib[0] = CTL_KERN;
83 mib[1] = KERN_MAXFILES;
84 len = sizeof(files);
37#endif
38
39#include "roken.h"
40
41#ifdef HAVE_SYS_TYPES_H
42#include <sys/types.h>
43#endif
44#ifdef TIME_WITH_SYS_TIME

--- 32 unchanged lines hidden (view full) ---

77#else /* !definded(HAVE_GETRLIMIT) */
78#if defined(HAVE_SYSCTL) && defined(CTL_KERN) && defined(KERN_MAXFILES)
79 int mib[2];
80 size_t len;
81
82 mib[0] = CTL_KERN;
83 mib[1] = KERN_MAXFILES;
84 len = sizeof(files);
85 sysctl(&mib, 2, &files, sizeof(nfil), NULL, 0);
85 sysctl(&mib, 2, &files, sizeof(files), NULL, 0);
86#endif /* defined(HAVE_SYSCTL) */
87#endif /* !definded(HAVE_GETRLIMIT) */
88#endif /* !defined(HAVE_SYSCONF) */
89
90#ifdef OPEN_MAX
91 if (files < 0)
92 files = OPEN_MAX;
93#endif
94
95#ifdef NOFILE
96 if (files < 0)
97 files = NOFILE;
98#endif
99
100 return files;
101}
86#endif /* defined(HAVE_SYSCTL) */
87#endif /* !definded(HAVE_GETRLIMIT) */
88#endif /* !defined(HAVE_SYSCONF) */
89
90#ifdef OPEN_MAX
91 if (files < 0)
92 files = OPEN_MAX;
93#endif
94
95#ifdef NOFILE
96 if (files < 0)
97 files = NOFILE;
98#endif
99
100 return files;
101}