Mailinglist Archive: opensuse-bugs (8114 mails)

< Previous Next >
[Bug 247269] New: clock_nanosleep return code incorrect when linking with libpthread.so
  • From: bugzilla_noreply@xxxxxxxxxx
  • Date: Wed, 21 Feb 2007 02:30:36 -0700 (MST)
  • Message-id: <bug-247269-21960@xxxxxxxxxxxxxxxxxxxxxxxxx/>
https://bugzilla.novell.com/show_bug.cgi?id=247269

Summary: clock_nanosleep return code incorrect when linking with
libpthread.so
Product: openSUSE 10.2
Version: Final
Platform: i686
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Basesystem
AssignedTo: bnc-team-screening@xxxxxxxxxxxxxxxxxxxxxx
ReportedBy: bart.vanassche@xxxxxxxxx
QAContact: qa@xxxxxxx


Compile the program included below with the command listed at the end, and run
it. An assertion failure will be reported, while the program should terminate
without complaining.

#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sys/time.h>
#include <signal.h>


static void SignalHandler(const int iSignal)
{
char msg[256];
snprintf(msg, sizeof(msg), "Got signal %d\n", iSignal);
write(STDOUT_FILENO, msg, strlen(msg));
}

int main(int /*argc*/, char** )
{
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = &SignalHandler;
sigemptyset(&sa.sa_mask);
sigaction(SIGALRM, &sa, 0);
}

itimerval itv;
memset(&itv, 0, sizeof(itv));
itv.it_value.tv_usec = 100 * 1000;
setitimer(ITIMER_REAL, &itv, 0);
const timespec tsDelay = { 10, 0 };
timespec tsRemain;
const int result = clock_nanosleep(CLOCK_MONOTONIC, 0, &tsDelay, &tsRemain);
assert(result < 0 && errno == EINTR);

return 0;
}

// Local variables:
// compile-command: "g++ -Wall -Werror -Wextra -o clock_nanosleep
clock_nanosleep.cpp -lpthread -lrt"
// End:


--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

< Previous Next >