tony2001 / pinba_extension

Pinba PHP extension
http://pinba.org
GNU Lesser General Public License v2.1
83 stars 22 forks source link

cannot use on Solaris 10, timeradd() undef #10

Closed drook closed 11 years ago

drook commented 11 years ago

While it's building properly on Solaris 10, and even it's capable of sending stats, when using pinba-enabled PHP code php will complain about undefined symbol timersub().

This code fixes it:

#ifndef timersub
#define timersub(tvp, uvp, vvp)                                 \
        do                                                              \
        {                                                               \
                (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
                (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
                if ((vvp)->tv_usec < 0)                                 \
                {                                                       \
                        (vvp)->tv_sec--;                                \
                        (vvp)->tv_usec += 1000000;                      \
                }                                                       \
        } while (0)
#endif
tony2001 commented 11 years ago

Huh? What's the difference between this issue and issue #9, which is already fixed in Git?

drook commented 11 years ago

Lol. I should probably take more sleep or drink more coffee. :) I copypasted the wrong piece of code, then wrote the subject accordingly. :) This is really about another macro - timeradd():

#ifndef timeradd
#define timeradd(tvp, uvp, vvp)                                         \
        do {                                                            \
                (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;          \
                (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
                if ((vvp)->tv_usec >= 1000000) {                        \
                        (vvp)->tv_sec++;                                \
                        (vvp)->tv_usec -= 1000000;                      \
                }                                                       \
        } while (0)
#endif

Sorry for this. :)

tony2001 commented 11 years ago

Ah, ok. Solaris is WEIRD.