]> granicus.if.org Git - python/commitdiff
Different strategy regarding whether to declare getrusage() and
authorGuido van Rossum <guido@python.org>
Sun, 17 Aug 1997 16:24:30 +0000 (16:24 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 17 Aug 1997 16:24:30 +0000 (16:24 +0000)
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.

Modules/resource.c

index cc81337efe403d33f1b267c13364cf20d07c75f3..428c32c03f8cbe75ef486f7f175a99374d7ead35 100644 (file)
@@ -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)