Mail Archives: cygwin/2001/01/26/17:33:14
--------------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
> > <sys/syslimits.h> */
> > /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 <sys/syslimits.h> */
-#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
-#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--
- Raw text -