/******************************************* * Look the parameters in the CAEN Mail_box * * * *******************************************/ #include #define SLEEP_MAX 5 /* number of cycles in which a chan. is put to sleep */ #define SECONDS #define MINUTES * 60 char *caller; int sem_127mod_id; int sem_227mod_id; sighand(signal) register int signal; { sem_unl_del(sem_127mod_id, "sy127mod", caller); sem_unl(sem_227mod_id, "sy227mod", caller); } main(argc, argv) int argc; char *argv[]; { char line[10]; if (argc < 2){ printf("stop_tubi_sitter : to stop to process that takes care of LST \n"); printf(" DON'T simply 'kill' the process otherwise \n"); printf(" other monitor processes could be blocked \n"); printf(" because of unreleased semaphores\n\n"); printf(" usage: stop_tubi_sitter process_ID\n"); printf(" ( the process_ID is the ID assigned by OS9\n"); printf(" to the process 'tubi_sitter' and can be \n"); printf(" looked using the command 'procs -e' )\n"); exit(0); } strcpy(line, "kill "); strncat(line, argv[1], 5); intercept(sighand); sem_127mod_id = sem_link_cr("SY127mod", argv[0]); sem_227mod_id = sem_link_cr("SY227mod", argv[0]); sem_wait(sem_127mod_id, argv[0]); sem_wait(sem_227mod_id, argv[0]); system(line); sem_free(sem_127mod_id, argv[0]); sem_free(sem_227mod_id, argv[0]); sem_unl_del(sem_127mod_id, "SY127mod", caller); sem_unl_del(sem_227mod_id, "SY127mod", caller); }