Run vim --clean on a Solaris machine
Observe that an E1286: Could not set timeout error occurs.
On some machines I saw E1286: Could not set timeout: Insufficient privileges.
On others I got E1286: Could not set timeout: Not owner instead.
Vim starts with no error messages.
9.0.9
Oracle Solaris 11.3 SPARC
Truss output shows: timer_create(4, 0xFFFFFFFF7FFFBE58, 0x1005C5754) Err#1 EPERM [proc_clock_highres] which indicates that the error is coming from [this line](https://github.com/vim/vim/blob/abd56da30bae4a5c6c20b9363ccae12f7b126026/src/os_unix.c#L8321). The root cause seems to be that `CLOCK_MONOTONIC` on Solaris is defined as an alias for `CLOCK_HIGHRES`: ```c sys/time_impl.h:#define CLOCK_MONOTONIC 4 /* high resolution monotonic clock */ sys/time_impl.h:#define CLOCK_HIGHRES CLOCK_MONOTONIC /* alternate name */
and the CLOCK_HIGHRES timer requires superuser privileges with timer_create:
ERRORS
The timer_create() function will fail if:
...
EPERM The specified clock ID, clock_id, is CLOCK_HIGHRES and the
{PRIV_PROC_CLOCK_HIGHRES} is not asserted in the effective
set of the calling process.
The configure script only attempts to link a program using timer_create before deciding to set HAVE_TIMER_CREATE=1, so it doesn't notice that it links successfully but fails with a runtime error unless run as a superuser.
We should fall back to using setitimer on Solaris instead (or possibly use timer_create with a different clock than CLOCK_HIGHRES). As a quick hack, this diff gets things working:
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -8248,7 +8248,7 @@ #endif // USE_XSMP #if defined(FEAT_RELTIME) || defined(PROTO) -# if defined(HAVE_TIMER_CREATE) || defined(PROTO) +# if (!defined(__sun) && defined(HAVE_TIMER_CREATE)) || defined(PROTO) /* * Implement timeout with timer_create() and timer_settime(). */ --- a/src/gui.c +++ b/src/gui.c @@ -227,7 +227,7 @@ int exit_status; pid_t pid = -1; -#if defined(FEAT_RELTIME) && defined(HAVE_TIMER_CREATE) +#if defined(FEAT_RELTIME) && (!defined(__sun) && defined(HAVE_TIMER_CREATE)) // a timer is not carried forward delete_timer(); #endif
though I suspect there's a cleaner solution.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #10647 as completed via f2ce76a.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The patch does work. Thanks for the quick fix!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This change introduces running a test program with autoconf which breaks cross-compilation...
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Considering this is an exception case I think a simple ifdef for solaris would be the better solution, alternatively a --with/--enable-timer-create that overrides the test perhaps?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Considering this is an exception case I think a simple ifdef for solaris would be the better solution, alternatively a --with/--enable-timer-create that overrides the test perhaps?
I second that.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
or do it like e.g. vim_cv_getcwd_broken
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Patch 9.0.0065 should take care of it.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()