[Patches] Problem with _SC_AIO_LIST_MAX in posixmodule.c on Linux
Guido van Rossum
guido@python.org
Fri, 25 Feb 2000 12:00:17 -0500
On my Linux box (uname -a: Linux loony.cnri.reston.va.us 2.0.34 #1 Fri
May 8 16:05:57 EDT 1998 i586 unknown) I am unable to compile
posixmodule.c, because somehow the _SC_AIO_LIST_MAX symbol, while
defined, appears to have no value.
I get the following errors:
gcc -g -O2 -I../../Modules/../Include -I.. -DHAVE_CONFIG_H -c ../../Modules/posixmodule.c
../../Modules/posixmodule.c:3789: `_SC_AIO_LIST_MAX' undeclared here (not in a function)
../../Modules/posixmodule.c:3789: initializer element for `posix_constants_sysconf[10].value' is not constant
This seems a bug in the confname.h header file, which contains:
enum
{
...
_SC_SHARED_MEMORY_OBJECTS,
#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS
_SC_AIO_LISTIO_MAX,
#define _SC_AIO_LIST_MAX _SC_AIO_LIST_MAX
_SC_AIO_MAX,
#define _SC_AIO_MAX _SC_AIO_MAX
...
};
Note that the general pattern is
X,
#define X X
but here the enum value uses LISTIO_MAX while the #define uses
LIST_MAX.
Can anybody here suggest a better fix than this patch?
Index: posixmodule.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.123
diff -c -r2.123 posixmodule.c
*** posixmodule.c 2000/01/31 18:41:26 2.123
--- posixmodule.c 2000/02/25 16:50:02
***************
*** 3785,3791 ****
#ifdef _SC_AIO_LISTIO_MAX
{"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX},
#endif
! #ifdef _SC_AIO_LIST_MAX
{"SC_AIO_LIST_MAX", _SC_AIO_LIST_MAX},
#endif
#ifdef _SC_AIO_MAX
--- 3785,3791 ----
#ifdef _SC_AIO_LISTIO_MAX
{"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX},
#endif
! #if defined(_SC_AIO_LIST_MAX) && !defined(linux)
{"SC_AIO_LIST_MAX", _SC_AIO_LIST_MAX},
#endif
#ifdef _SC_AIO_MAX
--Guido van Rossum (home page: http://www.python.org/~guido/)