public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user]  nanosleep broken on ~amd64?
@ 2009-05-03 21:14 walt
  2009-05-03 22:33 ` Peter Alfredsen
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: walt @ 2009-05-03 21:14 UTC (permalink / raw
  To: gentoo-user

By accident I noticed that the configure script for one of the gentoo
packages (I think maybe it was coreutils but I can't remember) gives
different results on ~x86 and ~amd64.

The script uses a "test for working nanosleep" that I've included below.

Could someone else compile the test and confirm that it returns 119 on
~amd64 instead of 0?

Here are the steps if you don't already know them:
1. Copy and paste the c code below into a new file named conftest.c
2. # gcc conftest.c
3. # ./a.out  (don't forget that leading dot)
4. # echo $? (this should print either 0 or 119)

I get 119 on ~amd64, which implies the test for nanosleep fails.

Thanks!


Here are the contents of conftest.c:

         #include <errno.h>
         #include <limits.h>
         #include <signal.h>
         #include <sys/time.h>
         #include <time.h>
         #include <unistd.h>
         #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
         #define TYPE_MAXIMUM(t) ((t) (! TYPE_SIGNED (t) ? (t) -1 : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))

         static void
         check_for_SIGALRM (int sig)
         {
           if (sig != SIGALRM)
             _exit (1);
         }

         int
         main ()
         {
           static struct timespec ts_sleep;
           static struct timespec ts_remaining;
           static struct sigaction act;
           if (! nanosleep)
             return 1;
           act.sa_handler = check_for_SIGALRM;
           sigemptyset (&act.sa_mask);
           sigaction (SIGALRM, &act, NULL);
           ts_sleep.tv_sec = 0;
           ts_sleep.tv_nsec = 1;
           alarm (1);
           if (nanosleep (&ts_sleep, NULL) != 0)
             return 1;
           ts_sleep.tv_sec = TYPE_MAXIMUM (time_t);
           ts_sleep.tv_nsec = 999999999;
           alarm (1);
           if (nanosleep (&ts_sleep, &ts_remaining) == -1 && errno == EINTR
               && TYPE_MAXIMUM (time_t) - 10 < ts_remaining.tv_sec)
             return 0;
           return 119;
         }




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user]  nanosleep broken on ~amd64?
  2009-05-03 21:14 [gentoo-user] nanosleep broken on ~amd64? walt
@ 2009-05-03 22:33 ` Peter Alfredsen
  2009-05-03 22:48 ` Arttu V.
  2009-05-04 13:14 ` Mike Kazantsev
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Alfredsen @ 2009-05-03 22:33 UTC (permalink / raw
  To: gentoo-user

On Sun, 03 May 2009 14:14:38 -0700
walt <w41ter@gmail.com> wrote:

> By accident I noticed that the configure script for one of the gentoo
> packages (I think maybe it was coreutils but I can't remember) gives
> different results on ~x86 and ~amd64.
> 
> The script uses a "test for working nanosleep" that I've included
> below.
> 
> Could someone else compile the test and confirm that it returns 119 on
> ~amd64 instead of 0?

~amd64, returns 119

/loki_val



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user]  nanosleep broken on ~amd64?
  2009-05-03 21:14 [gentoo-user] nanosleep broken on ~amd64? walt
  2009-05-03 22:33 ` Peter Alfredsen
@ 2009-05-03 22:48 ` Arttu V.
  2009-05-04  1:55   ` [gentoo-user] " Nikos Chantziaras
  2009-05-04  4:59   ` [gentoo-user] " Paul Hartman
  2009-05-04 13:14 ` Mike Kazantsev
  2 siblings, 2 replies; 7+ messages in thread
From: Arttu V. @ 2009-05-03 22:48 UTC (permalink / raw
  To: gentoo-user

walt wrote:
> Could someone else compile the test and confirm that it returns 119 on
> ~amd64 instead of 0?

It returns 119 on an semi-ancient Athlon64 3200+ box here as well.

Could kernel HZ-settings affect the outcome? This box has CONFIG_HZ=250, 
but tomorrow I can try on another amd64 which runs a 1000HZ kernel IIRC.

-- 
Arttu V.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-user]  Re: nanosleep broken on ~amd64?
  2009-05-03 22:48 ` Arttu V.
@ 2009-05-04  1:55   ` Nikos Chantziaras
  2009-05-04 14:43     ` Nikos Chantziaras
  2009-05-04  4:59   ` [gentoo-user] " Paul Hartman
  1 sibling, 1 reply; 7+ messages in thread
From: Nikos Chantziaras @ 2009-05-04  1:55 UTC (permalink / raw
  To: gentoo-user

Arttu V. wrote:
> walt wrote:
>> Could someone else compile the test and confirm that it returns 119 on
>> ~amd64 instead of 0?
> 
> It returns 119 on an semi-ancient Athlon64 3200+ box here as well.
> 
> Could kernel HZ-settings affect the outcome? This box has CONFIG_HZ=250, 
> but tomorrow I can try on another amd64 which runs a 1000HZ kernel IIRC.

119 here on AMD64 with a not-so-ancient Core 2 Duo and a kernel timer of 
1000Hz (gentoo-sources-2.6.28-r5).




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user] nanosleep broken on ~amd64?
  2009-05-03 22:48 ` Arttu V.
  2009-05-04  1:55   ` [gentoo-user] " Nikos Chantziaras
@ 2009-05-04  4:59   ` Paul Hartman
  1 sibling, 0 replies; 7+ messages in thread
From: Paul Hartman @ 2009-05-04  4:59 UTC (permalink / raw
  To: gentoo-user

On Sun, May 3, 2009 at 5:48 PM, Arttu V. <arttuv69@gmail.com> wrote:
> walt wrote:
>>
>> Could someone else compile the test and confirm that it returns 119 on
>> ~amd64 instead of 0?
>
> It returns 119 on an semi-ancient Athlon64 3200+ box here as well.
>
> Could kernel HZ-settings affect the outcome? This box has CONFIG_HZ=250, but
> tomorrow I can try on another amd64 which runs a 1000HZ kernel IIRC.

Also 119 here. I use NO_HZ option.

Also, ksystraycmd from KDE4 has segfault in nanosleep every time,
forever. Maybe it's related?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-user]  nanosleep broken on ~amd64?
  2009-05-03 21:14 [gentoo-user] nanosleep broken on ~amd64? walt
  2009-05-03 22:33 ` Peter Alfredsen
  2009-05-03 22:48 ` Arttu V.
@ 2009-05-04 13:14 ` Mike Kazantsev
  2 siblings, 0 replies; 7+ messages in thread
From: Mike Kazantsev @ 2009-05-04 13:14 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

On Sun, 03 May 2009 14:14:38 -0700
walt <w41ter@gmail.com> wrote:

> Could someone else compile the test and confirm that it returns 119 on
> ~amd64 instead of 0?

119, x86_64 Intel(R) Xeon(R) CPU L5420 @ 2.50GHz GenuineIntel

-- 
Mike Kazantsev // fraggod.net

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-user]  Re: nanosleep broken on ~amd64?
  2009-05-04  1:55   ` [gentoo-user] " Nikos Chantziaras
@ 2009-05-04 14:43     ` Nikos Chantziaras
  0 siblings, 0 replies; 7+ messages in thread
From: Nikos Chantziaras @ 2009-05-04 14:43 UTC (permalink / raw
  To: gentoo-user

Nikos Chantziaras wrote:
> Arttu V. wrote:
>> walt wrote:
>>> Could someone else compile the test and confirm that it returns 119 on
>>> ~amd64 instead of 0?
>>
>> It returns 119 on an semi-ancient Athlon64 3200+ box here as well.
>>
>> Could kernel HZ-settings affect the outcome? This box has 
>> CONFIG_HZ=250, but tomorrow I can try on another amd64 which runs a 
>> 1000HZ kernel IIRC.
> 
> 119 here on AMD64 with a not-so-ancient Core 2 Duo and a kernel timer of 
> 1000Hz (gentoo-sources-2.6.28-r5).

OK, compiling with "gcc -m32 nanotest.c" (-m32 compiles it as 32-bit on 
multilib Gentoo) returns 0.  Maybe a bug in glibc?




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-04 14:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-03 21:14 [gentoo-user] nanosleep broken on ~amd64? walt
2009-05-03 22:33 ` Peter Alfredsen
2009-05-03 22:48 ` Arttu V.
2009-05-04  1:55   ` [gentoo-user] " Nikos Chantziaras
2009-05-04 14:43     ` Nikos Chantziaras
2009-05-04  4:59   ` [gentoo-user] " Paul Hartman
2009-05-04 13:14 ` Mike Kazantsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox