lkml.org 
[lkml]   [2004]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Subjecttimer_create not working in 2.6.5
From
Date
Hi,
My system has fedora-core-2. I tried to run this small program to
create a posix time but it seems it is giving me wrong timer-id.. some
garbage number. Finally program segfaults in timer_settime( not included
here)

Any clues ?
Please CC me
Amol

--------------

#include <time.h>
#include <signal.h>
#include <unistd.h>

void timer_handler(int signo, siginfo_t *info, void *context)
{
printf("got signal..\n");
}

int main(){
struct timespec ts, tm, sleep;
sigset_t mask;
siginfo_t info;
struct sigevent sigev;
struct sigaction sa;
struct itimerspec ival;
timer_t tid;

sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);

sa.sa_flags = SA_SIGINFO;
sigemptyset(&sa.sa_mask);
sa.sa_sigaction = timer_handler;

if (sigaction(SIGRTMIN, &sa, NULL) == -1) {
perror("sigaction failed");
return -1;
}

sigev.sigev_notify = SIGEV_SIGNAL;
sigev.sigev_signo = SIGRTMIN;
sigev.sigev_value.sival_int = 1;

if (timer_create(CLOCK_MONOTONIC, &sigev, &tid) == -1){
perror("timer_create");
return -1;
}
printf("timer-id = %d\n", tid);
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.027 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site