Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#29853 - [rxvt-unicode] Link with librt
Attached to Project:
Community Packages
Opened by Jason William Walton (jasonww) - Saturday, 12 May 2012, 06:41 GMT
Last edited by Sébastien Luttringer (seblu) - Friday, 29 June 2012, 20:26 GMT
Opened by Jason William Walton (jasonww) - Saturday, 12 May 2012, 06:41 GMT
Last edited by Sébastien Luttringer (seblu) - Friday, 29 June 2012, 20:26 GMT
|
DetailsPKGBUILD should look like this:
... LDFLAGS+=" -lrt" ... LIBEV_M4_AVOID_LIBRT=0 ./configure... ... Rationale: On x86_64, clock_gettime is implemented in the VDSO, avoiding context switches. Without these flags, the copy of libev shipped with rxvt uses syscall(2) directly. |
This task depends upon
Closed by Sébastien Luttringer (seblu)
Friday, 29 June 2012, 20:26 GMT
Reason for closing: No response
Friday, 29 June 2012, 20:26 GMT
Reason for closing: No response
/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */
/* which makes programs even slower. might work on other unices, too. */
Your proposed change doesn't actually cause the binaries to be linked against librt either.
This doesn't happen on my installation for various reasons, I should've noticed :) Anyway, that comment in libev doesn't seem to make any sense whatsoever these days.
There are multiple solutions to beat the configure check, with
LIBEV_M4_AVOID_LIBRT=0 LIBS="-lrt" being the most simple.
checking for clock_gettime... yes
$ LIBS='-lrt' ./configure|grep clock
checking for clock_gettime... yes
$ ./configure|grep clock
checking for clock_gettime... no
checking for clock_gettime syscall... yes
I doesn't see the usage of LIBEV_M4_AVOID_LIBRT=0 and quickly looking the code:
$ grep LIBEV_M4_AVOID_LIBRT configure
LIBEV_M4_AVOID_LIBRT=1
if test -z "$LIBEV_M4_AVOID_LIBRT" && test -z "$ac_have_clock_syscall"; then
if test -z "$LIBEV_M4_AVOID_LIBRT"; then
$ grep -C 1 LIBEV_M4_AVOID_LIBRT=1 configure
LIBEV_M4_AVOID_LIBRT=1
If VDSO is enabled in glibc, there is no difference between clock_gettime syscall and a classic function call. I doesn't see why each application need to be changed.
If you use the generic syscall interface you can't use them, plain and simple.
When you call clock_gettime function in you c code, you call a glibc wrapper.
This wrapper potentially use a soft interrupt (int 0x80) / sysenter / vsyscall / vdso / custom cpu instruction (modern cpu) to get the answer. The magic is here!
Look inside clock_gettime implementation in glibc[1], you can see the complexity of this "syscall".
You can read [2], where they explain relation between glibc / syscall / sysenter
<quote>
Thus, the C library can use the fastest type of system call by jumping to a fixed address in the vsyscall page.
</quote>
You can also read [3], where relation between vdso, vsyscall and glibc are discuced on lwn.
<quote>
Contemporary applications should not be doing that most of the time, except for one little problem: glibc still uses the vsyscall version of time(). That has been fixed in the glibc repository, but the fix may not find its way out to users for a while; meanwhile, time() calls will be a little slower than they were before.
</quote>
So, i short, using vdso, is glibc stuff not rxvt-unicode one.
[1] http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/clock_gettime.c.
[2] http://www.win.tue.nl/~aeb/linux/lk/lk-4.html
[3] http://lwn.net/Articles/446528/
@falconindy: Sure I can. Not doing hundreds or even thousands (Think urxvtd and doing actual work.) of unnecessary syscalls per second vs linking against librt is a complete nobrainer.
Jason, did you understand what i would says about glibc wrappers and use of vdso/vsyscall inside?
I made a small test with test.c (attached). I attached strace -T output and no call to clock_gettime is done.
$ strace -f -p 3147 -e 'clock_gettime'
Process 3147 attached
clock_gettime(CLOCK_MONOTONIC, {1132905, 521487010}) = 0
clock_gettime(CLOCK_MONOTONIC, {1132905, 521513668}) = 0
clock_gettime(CLOCK_MONOTONIC, {1132910, 513344909}) = 0
$ ldd =urxvt|grep librt
librt.so.1 => /lib/librt.so.1 (0x00007f53eb60f000)
configure test if clock_gettime is working without linking with -lrt. So glibc wrapper is not found and rxvt-unicode define his own wrapper around syscall (2).
Jason, as Dave said, it could be interesting to have upstream point of view about their comment around pthread.