I see tons of unknown clock_gettime() error: -1 imessage in the log.

I think, it is related to the following check (i'm not a c guru) in
/programs/pluto/defs.c

monotime_t mononow(void)
{
        monotime_t m;

#ifdef _POSIX_MONOTONIC_CLOCK
        struct timespec t;
        int r = clock_gettime(
#   ifdef CLOCK_BOOTTIME
                CLOCK_BOOTTIME  /* best */
#   else
                CLOCK_MONOTONIC /* second best */
#   endif
                , &t);

        switch (r) {
        case 0:
                /* OK */
                m.mono_secs =  t.tv_sec;
                return m;
        case EINVAL:
                libreswan_log("Invalid clock method for clock_gettime() -
possibly compiled with mismatched kernel and glibc-headers ");
                break;
        case EPERM:
                libreswan_log("No permission for clock_gettime()");
                break;
        case EFAULT:
                libreswan_log("Invalid address space return by
clock_gettime()");
                break;
        default:
                libreswan_log("unknown clock_gettime() error: %d", r);
                break;
        }
#   endif
        return mononow_fallback();
}

Strace below:

pid 11467] clock_gettime(CLOCK_MONOTONIC, {1297, 310762308}) = 0
[pid 11467] gettimeofday({1487233895, 599484}, NULL) = 0
[pid 11467] epoll_wait(7, {}, 32, 31)   = 0
[pid 11467] clock_gettime(CLOCK_MONOTONIC, {1297, 350370525}) = 0
[pid 11467] gettimeofday({1487233895, 639071}, NULL) = 0
???---->>>[pid 11467] clock_gettime(0x7 /* CLOCK_??? */, 0x7fff6917e6c0) =
-1 EINVAL (Invalid argument)
[pid 11467] gettimeofday({1487233895, 639209}, NULL) = 0
[pid 11467] write(3, "Feb 16 09:31:35: unknown clock_g"..., 51) = 51
[pid 11467] gettimeofday({1487233895, 639338}, NULL) = 0
[pid 11467] clock_gettime(0x7 /* CLOCK_??? */, 0x7fff6917e650) = -1 EINVAL
(Invalid argument)
[pid 11467] gettimeofday({1487233895, 639418}, NULL) = 0
[pid 11467] write(3, "Feb 16 09:31:35: unknown clock_g"..., 51) = 51
[pid 11467] gettimeofday({1487233895, 639504}, NULL) = 0


When i replace the entire check, with a fixed CLOCK_MONOTONIC (i have a
2.6.32.70 kernel so CLOCK_BOOTIME not exist) i dont see more "-1" messages
in the log or strace.

monotime_t mononow(void)
{
        monotime_t m;

        struct timespec t;
        int r = clock_gettime(CLOCK_MONOTONIC, &t);

        switch (r) {
        case 0:
                /* OK */
                m.mono_secs =  t.tv_sec;
                return m;
        case EINVAL:
                libreswan_log("Invalid clock method for clock_gettime() -
possibly compiled with mismatched kernel and glibc-headers ");
                break;
        case EPERM:
                libreswan_log("No permission for clock_gettime()");
                break;
        case EFAULT:
                libreswan_log("Invalid address space return by
clock_gettime()");
                break;
        default:
                libreswan_log("unknown clock_gettime() error: %d", r);
                break;
        }
        return mononow_fallback();
}

Thx
Godot
_______________________________________________
Swan mailing list
Swan@lists.libreswan.org
https://lists.libreswan.org/mailman/listinfo/swan

Reply via email to