mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amol <amol@teneoris.com>
To: linux-kernel@vger.kernel.org
Subject: timer_create not working in 2.6.5
Date: Sat, 28 Aug 2004 12:48:57 +0530	[thread overview]
Message-ID: <1093677537.3479.84.camel@amol.teneoris.com> (raw)

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);
}



                 reply	other threads:[~2004-08-28  7:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1093677537.3479.84.camel@amol.teneoris.com \
    --to=amol@teneoris.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome