* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / elksemu / minix.c
blob86a966f0de4062504dfa5bda078392b115dd5498
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <unistd.h>
5 #include <fcntl.h>
6 #include <sys/stat.h>
7 #include <sys/vm86.h>
8 #include <sys/times.h>
9 #include <utime.h>
10 #include <termios.h>
11 #include <time.h>
12 #include <signal.h>
13 #include <errno.h>
14 #include <sys/types.h>
15 #include <sys/resource.h>
16 #include <sys/wait.h>
17 #include <sys/ioctl.h>
18 #include <dirent.h>
19 #include "elks.h"
21 #ifdef DEBUG
22 #define dbprintf(x) db_printf x
23 #else
24 #define dbprintf(x)
25 #endif
27 static char * minix_names[] = {
28 "0", "EXIT", "FORK", "READ", "WRITE", "OPEN", "CLOSE", "WAIT",
29 "CREAT", "LINK", "UNLINK", "WAITPID", "CHDIR", "TIME", "MKNOD",
30 "CHMOD", "CHOWN", "BRK", "STAT", "LSEEK", "GETPID", "MOUNT",
31 "UMOUNT", "SETUID", "GETUID", "STIME", "PTRACE", "ALARM", "FSTAT",
32 "PAUSE", "UTIME", "31", "32", "ACCESS", "34", "35", "SYNC", "KILL",
33 "RENAME", "MKDIR", "RMDIR", "DUP", "PIPE", "TIMES", "44", "45",
34 "SETGID", "GETGID", "SIGNAL", "49", "50", "51", "52", "53", "IOCTL",
35 "FCNTL", "56", "57", "58", "EXEC", "UMASK", "CHROOT", "SETSID",
36 "GETPGRP", "KSIG", "UNPAUSE", "66", "REVIVE", "TASK_REPLY", "69",
37 "70", "SIGACTION", "SIGSUSPEND", "SIGPENDING", "SIGPROCMASK",
38 "SIGRETURN", "REBOOT", "77"
42 void
43 minix_syscall()
45 static char *nm[4] = {"?", "send", "receive", "sendrec"};
46 char tsks[10], syss[10];
48 int sr = (unsigned short) elks_cpu.regs.ecx;
49 int tsk = (unsigned short) elks_cpu.regs.eax;
50 int sys = ELKS_PEEK(short, (unsigned short) elks_cpu.regs.ebx + 2);
52 if (sr < 0 || sr > 3) sr = 0;
53 switch(tsk)
55 case 0: strcpy(tsks, "MM"); break;
56 case 1: strcpy(tsks, "FS"); break;
57 default: sprintf(tsks, "task(%d)", tsk);
59 if( sys > 0 && sys < 77 )
60 strcpy(syss, minix_names[sys]);
61 else
62 sprintf(syss, "%d", sys);
64 fprintf(stderr, "Minix syscall %s(%s,&{%d,%s,...})\n", nm[sr], tsks, getpid(), syss);
65 exit(99);