Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fogobogo/wakeup
Browse files Browse the repository at this point in the history
Conflicts:
	wakeup.c
  • Loading branch information
fogobogo committed Dec 7, 2011
2 parents 03fd3e4 + 85e6637 commit d048aa5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions wakeup.c
Expand Up @@ -97,6 +97,8 @@ do_suspend(const char *command)
return 1; return 1;
} }


fprintf(stdout, "tick.\n");

return 0; return 0;
} }


Expand All @@ -108,6 +110,7 @@ parse_options(int argc, char **argv)
{ "at", no_argument, NULL, 'a' }, { "at", no_argument, NULL, 'a' },
{ "command", required_argument, NULL, 'c' }, { "command", required_argument, NULL, 'c' },
{ "event", required_argument, NULL, 'e' }, { "event", required_argument, NULL, 'e' },
{ "execute", required_argument, NULL, 'e' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
}; };
Expand Down Expand Up @@ -277,6 +280,8 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
struct timespec_t ts; struct timespec_t ts;
struct sigevent sigev;
union sigval sival;


if(argc <= 1) { if(argc <= 1) {
fprintf(stderr, "error: no timespec specified (use -h for help)\n"); fprintf(stderr, "error: no timespec specified (use -h for help)\n");
Expand All @@ -295,6 +300,14 @@ main(int argc, char *argv[])


if(create_alarm(&ts) != 0) { if(create_alarm(&ts) != 0) {
return 3; return 3;
sival.sival_ptr = (void *)user_cmd;
/* init a signal event */
sigev.sigev_notify = SIGEV_THREAD;
sigev.sigev_notify_function = signal_function;
sigev.sigev_value = sival;

if(create_alarm(&wakeup, &ts, sigev) != 0) {
return EXIT_FAILURE;
} }


if(do_suspend(suspend_cmd ? suspend_cmd : SUSPEND_COMMAND) != 0) { if(do_suspend(suspend_cmd ? suspend_cmd : SUSPEND_COMMAND) != 0) {
Expand Down

0 comments on commit d048aa5

Please sign in to comment.