akaros/tests/notify.c
<<
>>
Prefs
   1#include <stdlib.h>
   2#include <stdio.h>
   3#include <parlib/parlib.h>
   4#include <unistd.h>
   5#include <signal.h>
   6
   7int main(int argc, char **argv)
   8{
   9        struct event_msg msg = {0};
  10        int pid, ev_type;
  11
  12        if (argc < 3) {
  13                printf("Usage: %s PID EV_NUM [Arg1 Arg2 0xArg3 Arg4]\n",
  14                       argv[0]);
  15                exit(-1);
  16        }
  17        pid = strtol(argv[1], 0, 10);
  18        ev_type = strtol(argv[2], 0, 10);
  19        msg.ev_type = ev_type;
  20
  21        if (argc >= 4)
  22                msg.ev_arg1 = strtol(argv[3], 0, 10);
  23        if (argc >= 5)
  24                msg.ev_arg2 = strtol(argv[4], 0, 10);
  25        if (argc >= 6)
  26                msg.ev_arg3 = (void*)strtoll(argv[5], 0, 16);   /* base 16 */
  27        if (argc >= 7)
  28                msg.ev_arg4 = strtoll(argv[6], 0, 10);
  29
  30        if (sys_notify(pid, ev_type, &msg)) {
  31                perror("Notify failed");
  32                exit(errno);
  33        }
  34        return 0;
  35}
  36