| 1294 | |
| 1295 | * mykill.c |
| 1296 | {{{ |
| 1297 | #!c#include <sys/types.h> |
| 1298 | #include <signal.h> |
| 1299 | #include <stdlib.h> |
| 1300 | |
| 1301 | int main(int argc, char **argv) { |
| 1302 | |
| 1303 | kill(atoi(argv[1]), 9); |
| 1304 | return 0; |
| 1305 | |
| 1306 | } |
| 1307 | }}} |
| 1308 | |
| 1309 | * mykill-raw1.c |
| 1310 | {{{ |
| 1311 | #!c |
| 1312 | #include <stdio.h> |
| 1313 | #include <stdlib.h> |
| 1314 | #include <ansi.h> |
| 1315 | #include <lib.h> |
| 1316 | #include <minix/ipc.h> |
| 1317 | |
| 1318 | int main(int argc, char **argv) { |
| 1319 | message m; |
| 1320 | |
| 1321 | printf("PID: %s SIG: %s\n", argv[1], argv[2]); |
| 1322 | |
| 1323 | m.m1_i1 = atoi(argv[1]); |
| 1324 | m.m1_i2 = atoi(argv[2]); |
| 1325 | |
| 1326 | printf("PID: %d SIG: %d\n", m.m1_i1, m.m1_i2); |
| 1327 | |
| 1328 | return(_syscall(MM, KILL, &m)); |
| 1329 | } |
| 1330 | }}} |
| 1331 | |
| 1332 | * mykill-raw2.c |
| 1333 | {{{ |
| 1334 | #!c |
| 1335 | #include <stdio.h> |
| 1336 | #include <stdlib.h> |
| 1337 | #include <ansi.h> |
| 1338 | #include <lib.h> |
| 1339 | #include <minix/ipc.h> |
| 1340 | |
| 1341 | int main(int argc, char **argv) { |
| 1342 | message m; |
| 1343 | int status; |
| 1344 | |
| 1345 | printf("PID: %s SIG: %s\n", argv[1], argv[2]); |
| 1346 | |
| 1347 | m.m1_i1 = atoi(argv[1]); |
| 1348 | m.m1_i2 = atoi(argv[2]); |
| 1349 | |
| 1350 | printf("PID: %d SIG: %d\n", m.m1_i1, m.m1_i2); |
| 1351 | |
| 1352 | |
| 1353 | m.m_type = KILL; |
| 1354 | status = _sendrec(MM, &m); |
| 1355 | if (status != 0) { |
| 1356 | /* 'sendrec' itself failed. */ |
| 1357 | /* XXX - strerror doesn't know all the codes */ |
| 1358 | m.m_type = status; |
| 1359 | } |
| 1360 | if (m.m_type < 0) { |
| 1361 | errno = -m.m_type; |
| 1362 | return(-1); |
| 1363 | } |
| 1364 | |
| 1365 | return(0); |
| 1366 | } |
| 1367 | |
| 1368 | }}} |