Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3A71FAD8.671502E1@cygnus.com> Date: Fri, 26 Jan 2001 17:31:52 -0500 From: "J. Johnston" Organization: Red Hat Inc. X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Earnie Boyd , newlib AT sources DOT redhat DOT com CC: Andrej Borsenkow , cygwin AT sources DOT redhat DOT com Subject: Re: PATH_MAX and FILENAME_MAX References: <000001c0877f$67915cf0$21c9ca95 AT mow DOT siemens DOT ru> <3A71804B DOT F2D7E82D AT yahoo DOT com> Content-Type: multipart/mixed; boundary="------------86CEAC5001CAD1839ED547EA" Note-from-DJ: This may be spam --------------86CEAC5001CAD1839ED547EA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Earnie Boyd wrote: > > Andrej Borsenkow wrote: > > > > Doing something different, this caught my eyes: > > > > $ grep PATH_MAX /usr/include/*.h > > /usr/include/limits.h:#define PATH_MAX (260 - 1 /*NUL*/) > > /usr/include/limits.h:#define _POSIX_PATH_MAX 255 > > /usr/include/stdio.h:#define FILENAME_MAX 1024 /* must be <= PATH_MAX > > */ > > /usr/include/stdio.h:#define L_tmpnam 1024 /* XXX must be == > > PATH_MAX */ > > > > So are comments misleading or FILENAME_MAX (and L_tmpnam) should be changed? > > > > The comments are correct. This is a newlib issue. I've CC'ed the > newlib list in my response. > Actually, the comments are not quite correct. Based on POSIX, the value FOPEN_MAX should be tied to STREAM_MAX, not OPEN_MAX. The value of L_tmpnam should be <= PATH_MAX, like FILENAME_MAX. As a solution, I have made a patch that adds the ability for config.h or the compiler to override the default values for FOPEN_MAX, FILENAME_MAX, and L_tmpnam. I have altered config.h for RTEMS and Cygwin to set the value of __FILENAME_MAX__ appropriately. Any comments/objections from Cygwin or RTEMS? -- Jeff J. --------------86CEAC5001CAD1839ED547EA Content-Type: text/plain; charset=us-ascii; name="stdio.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="stdio.patch" ? max.patch ? math.h.new ? stdio.patch Index: stdio.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/stdio.h,v retrieving revision 1.4 diff -u -r1.4 stdio.h --- stdio.h 2000/05/30 17:18:05 1.4 +++ stdio.h 2001/01/26 22:16:56 @@ -90,9 +90,27 @@ #define BUFSIZ 1024 #define EOF (-1) -#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ -#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ -#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ +/* FOPEN_MAX should equal STREAM_MAX */ +#ifdef __FOPEN_MAX__ +#define FOPEN_MAX __FOPEN_MAX__ +#else +#define FOPEN_MAX 20 +#endif + +/* FILENAME_MAX must be <= PATH_MAX */ +#ifdef __FILENAME_MAX__ +#define FILENAME_MAX __FILENAME_MAX__ +#else +#define FILENAME_MAX 1024 +#endif + +/* L_tmpnam must be <= PATH_MAX */ +#ifdef __L_tmpnam__ +#define L_tmpnam __L_tmpnam__ +#else +#define L_tmpnam FILENAME_MAX +#endif + #ifndef __STRICT_ANSI__ #define P_tmpdir "/tmp" #endif Index: sys/config.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v retrieving revision 1.4 diff -u -r1.4 config.h --- config.h 2000/08/01 20:51:51 1.4 +++ config.h 2001/01/26 22:16:56 @@ -127,11 +127,16 @@ #if defined(__CYGWIN32__) || defined(__CYGWIN__) +#define __FILENAME_MAX__ (260 - 1 /* NUL */) #if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB) #define __IMPORT #else #define __IMPORT __declspec(dllimport) #endif +#endif + +#if defined(__rtems__) +#define __FILENAME_MAX__ 255 #endif #ifndef __IMPORT --------------86CEAC5001CAD1839ED547EA Content-Type: text/plain; charset=us-ascii -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple --------------86CEAC5001CAD1839ED547EA--