Re: [gentoo-user] nanosleep broken on ~amd64?

2009-05-04 Thread Mike Kazantsev
On Sun, 03 May 2009 14:14:38 -0700
walt  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


signature.asc
Description: PGP signature


Re: [gentoo-user] nanosleep broken on ~amd64?

2009-05-03 Thread Paul Hartman
On Sun, May 3, 2009 at 5:48 PM, 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.

Also 119 here. I use NO_HZ option.

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



Re: [gentoo-user] nanosleep broken on ~amd64?

2009-05-03 Thread Arttu V.

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.



Re: [gentoo-user] nanosleep broken on ~amd64?

2009-05-03 Thread Peter Alfredsen
On Sun, 03 May 2009 14:14:38 -0700
walt  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



[gentoo-user] nanosleep broken on ~amd64?

2009-05-03 Thread walt

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 
#include 
#include 
#include 
#include 
#include 
#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 = 9;
  alarm (1);
  if (nanosleep (&ts_sleep, &ts_remaining) == -1 && errno == EINTR
  && TYPE_MAXIMUM (time_t) - 10 < ts_remaining.tv_sec)
return 0;
  return 119;
}