Kaydet (Commit) 607b33a1 authored tarafından Guido van Rossum's avatar Guido van Rossum

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.
üst 54dec59b
...@@ -36,17 +36,15 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -36,17 +36,15 @@ PERFORMANCE OF THIS SOFTWARE.
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
/* don't know why this isn't defined in a header file */ /* On some systems, these aren't in any header file.
#ifndef getrusage On others they are, with inconsistent prototypes.
int getrusage(int who, struct rusage *rusage); We declare the (default) return type, to shut up gcc -Wall;
#endif but we can't declare the prototype, to avoid errors
when the header files declare it different.
#ifndef getpagesize Worse, on some Linuxes, getpagesize() returns a size_t... */
#ifdef linux #ifndef linux
extern size_t getpagesize(void); int getrusage();
#else int getpagesize();
int getpagesize(void);
#endif
#endif #endif
#define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001) #define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment