diff options
author | Guido van Rossum <guido@python.org> | 1997-08-17 16:24:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-17 16:24:30 (GMT) |
commit | 607b33a1fe760859d5079cbe743fdc2364d3c6e7 (patch) | |
tree | cf3d0fb8306718e1ae22c1fbd8fd5a7643eba2de /Modules/resource.c | |
parent | 54dec59b56c14fc45558df48fa92077d669caf25 (diff) | |
download | cpython-607b33a1fe760859d5079cbe743fdc2364d3c6e7.zip cpython-607b33a1fe760859d5079cbe743fdc2364d3c6e7.tar.gz cpython-607b33a1fe760859d5079cbe743fdc2364d3c6e7.tar.bz2 |
Different strategy regarding whether to declare getrusage() and
getpagesize() -- #ifdef doesn't work, Linux has conflicting decls in
its headers. Choice: only declare the return type, not the argument
prototype, and not on Linux.
Diffstat (limited to 'Modules/resource.c')
-rw-r--r-- | Modules/resource.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Modules/resource.c b/Modules/resource.c index cc81337..428c32c 100644 --- a/Modules/resource.c +++ b/Modules/resource.c @@ -36,17 +36,15 @@ PERFORMANCE OF THIS SOFTWARE. #include <string.h> #include <errno.h> -/* don't know why this isn't defined in a header file */ -#ifndef getrusage -int getrusage(int who, struct rusage *rusage); -#endif - -#ifndef getpagesize -#ifdef linux -extern size_t getpagesize(void); -#else -int getpagesize(void); -#endif +/* On some systems, these aren't in any header file. + On others they are, with inconsistent prototypes. + We declare the (default) return type, to shut up gcc -Wall; + but we can't declare the prototype, to avoid errors + when the header files declare it different. + Worse, on some Linuxes, getpagesize() returns a size_t... */ +#ifndef linux +int getrusage(); +int getpagesize(); #endif #define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001) |