/* eventWait.c * * Call the eventWait system call implemented in the waitQ module. * Pass in the event id, which will be 1, 2, or 3. If I use any * other event Id, then the event won't be found. * * If the event is found, this task will sleep on the event until a * task issuing a signal on this event is invoked. * * Use the existing unused system calls. * eventWait is sched_setaffinity 241 * eventSig is sched_getaffinity 242 * */ /* Standard include files for syscall, see man syscall */ #include #include #include /* for printf */ #include /* for atoi */ int main(int argc, char **argv) { int i,n,eventId; if (argc != 2) { printf("Usage: ./eventWait eventIdint\n"); return -1; } printf("eventWait - calling my_syscall 241\n"); for (i = 1; i < argc; i++) { eventId = atoi(argv[i]); if (!eventId) { printf("Invalid event Id: %d\n",eventId); return -1; } printf("eventWait %d\n", eventId); n = syscall(__NR_sched_setaffinity, eventId); } printf("eventWait - returned: %d\n",n); printf("eventWait - Done.\n"); return 0; }