-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Bas Wassink <im*********@gmail.com> writes:
I was wondering what the standard (C89) states what the minimum
value of FOPEN_MAX should be?
[C99, §7.19.3#15] "The value of FOPEN_MAX shall be at least eight,
including the three standard text streams."
K&R just state that FOPEN_MAX is implementation-defined and when
googling for an answer I found that GNU's libc defines FOPEN_MAX to
be at least 8, including stdin, stdout and stderr. Does GNU's
definition reflect the standard, or is it their implementation of
the standard?
Both.
[Using GNU libc 2.3.5]
$ rgrep FOPEN_MAX /usr/include
/usr/include/bits/stdio_lim.h:#if defined __need_FOPEN_MAX || defined _STDIO_H
/usr/include/bits/stdio_lim.h:# undef FOPEN_MAX
/usr/include/bits/stdio_lim.h:# define FOPEN_MAX 16
/usr/include/stdio.h: FOPEN_MAX Minimum number of files that can be open at once.
So the *minimum* is 16 with my version. The actual maximum depends on
the system configuration. On a typical GNU/Linux system this will be
unlimited, but may be limited using RLIMIT_NOFILE; see getrlimit(2)
and setrlimit(2) (but this is standardised by POSIX/SUS, not C).
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux?
http://gimp-print.sourceforge.net/
Debian GNU/Linux
http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iD8DBQFDGyaWVcFcaSW/uEgRAmTrAJ4n2rZoXGbuSgYp7t+qZ3dWEihXxQCg7IQ4
C+rylg27sgPjeeYedwuXme0=
=iu90
-----END PGP SIGNATURE-----