1 /* (c) 2007,2008 Andrei Nigmatulin */ 2 3 #include <php_config.h> 4 5 /* Solaris does not have it */ 6 #ifndef INADDR_NONE 7 # define INADDR_NONE (-1) 8 #endif 9 10 11 /* If we're not using GNU C, elide __attribute__ */ 12 #ifndef __GNUC__ 13 # define __attribute__(x) /*NOTHING*/ 14 #endif 15 16 /* Missing timer* macros (for solaris) */ 17 #ifndef timerisset 18 # define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 19 #endif 20 21 #ifndef timerclear 22 # define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) 23 #endif 24 25 #ifndef timersub 26 # define timersub(tvp, uvp, vvp) \ 27 do { \ 28 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ 29 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ 30 if ((vvp)->tv_usec < 0) { \ 31 (vvp)->tv_sec--; \ 32 (vvp)->tv_usec += 1000000; \ 33 } \ 34 } while (0) 35 #endif 36 37 #ifndef timeradd 38 # define timeradd(a, b, result) \ 39 do { \ 40 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ 41 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ 42 if ((result)->tv_usec >= 1000000) \ 43 { \ 44 ++(result)->tv_sec; \ 45 (result)->tv_usec -= 1000000; \ 46 } \ 47 } while (0) 48 #endif 49 50 #ifndef timercmp 51 /* does not work for >= and <= */ 52 # define timercmp(a, b, CMP) \ 53 (((a)->tv_sec == (b)->tv_sec) ? \ 54 ((a)->tv_usec CMP (b)->tv_usec) : \ 55 ((a)->tv_sec CMP (b)->tv_sec)) 56 #endif 57 /* endof timer* macros */ 58 59 #ifndef MIN 60 # define MIN(a,b) (((a)<(b))?(a):(b)) 61 #endif 62 63 #ifndef MAX 64 # define MAX(a,b) (((a)>(b))?(a):(b)) 65 #endif 66 67 #if defined(HAVE_PTRACE) || defined(PROC_MEM_FILE) || defined(HAVE_MACH_VM_READ) 68 # define HAVE_FPM_TRACE 1 69 #else 70 # define HAVE_FPM_TRACE 0 71 #endif 72 73 #if defined(HAVE_LQ_TCP_INFO) || defined(HAVE_LQ_TCP_CONNECTION_INFO) || defined(HAVE_LQ_SO_LISTENQ) 74 # define HAVE_FPM_LQ 1 75 #else 76 # define HAVE_FPM_LQ 0 77 #endif 78