home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vp21beta.zip / LRTLSRC.RAR / LINUX.PAS < prev    next >
Pascal/Delphi Source File  |  2000-08-15  |  48KB  |  1,910 lines

  1. {█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
  2. {█                                                       █}
  3. {█      Virtual Pascal for Linux                         █}
  4. {█      Linux Operating System Interface Unit            █}
  5. {█      ─────────────────────────────────────────────────█}
  6. {█      Copyright (C) 1999 Joerg Pleumann                █}
  7. {█                                                       █}
  8. {▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
  9.  
  10. (**
  11.  * This unit provides an interface to the Linux kernel.
  12.  * All constant names are the same as under Linux. Function
  13.  * names (system calls, that is) have a 'Lnx' prefix to avoid
  14.  * confusion with stuff from 'System'. Primitive types have
  15.  * been converted to Pascal types. Compound types have been
  16.  * declared with a suitable Pascal name (with usual 'T'
  17.  * prefix).
  18.  *
  19.  * To get more info on a certain function, say 'LnxWrite', do
  20.  * the following:
  21.  *
  22.  * - Read the man page in section 2 for the lowercase function
  23.  *   name without the 'Lnx' prefix. For our example, this is
  24.  *   'man 2 write'. The parameter names should be more or less
  25.  *   the same.
  26.  *
  27.  * - Grep around in /usr/src/linux :-)
  28.  *
  29.  * In system calls, the registers are used the following way:
  30.  *
  31.  * - EAX ... system call number
  32.  * - EBX ... first parameter
  33.  * - ECX ... second parameter
  34.  * - EDX ... third parameter
  35.  * - ESI ... fourth parameter
  36.  * - EDI ... fifth parameter
  37.  *
  38.  * When more than five parameters are used, EBX holds the
  39.  * address of the structure or memory block where the
  40.  * parameters are stored instead.
  41.  *
  42.  *)
  43.  
  44. {&Speed+,AlignCode+,AlignRec-,CDecl+,Delphi+}
  45. {$X+,W-,H-,R-,S-,Q-,B-,T-,Use32+}
  46.  
  47. unit Linux;
  48.  
  49. interface
  50.  
  51. var
  52.   TrmHandle: LongInt;
  53.  
  54. const
  55.   (* Error codes *)
  56.   EPERM           =   1;  (* Operation not permitted *)
  57.   ENOENT          =   2;  (* No such file or directory *)
  58.   ESRCH           =   3;  (* No such process *)
  59.   EINTR           =   4;  (* Interrupted system call *)
  60.   EIO             =   5;  (* I/O error *)
  61.   ENXIO           =   6;  (* No such device or address *)
  62.   E2BIG           =   7;  (* Arg list too long *)
  63.   ENOEXEC         =   8;  (* Exec format error *)
  64.   EBADF           =   9;  (* Bad file number *)
  65.   ECHILD          =  10;  (* No child processes *)
  66.   EAGAIN          =  11;  (* Try again *)
  67.   ENOMEM          =  12;  (* Out of memory *)
  68.   EACCES          =  13;  (* Permission denied *)
  69.   EFAULT          =  14;  (* Bad address *)
  70.   ENOTBLK         =  15;  (* Block device required *)
  71.   EBUSY           =  16;  (* Device or resource busy *)
  72.   EEXIST          =  17;  (* File exists *)
  73.   EXDEV           =  18;  (* Cross-device link *)
  74.   ENODEV          =  19;  (* No such device *)
  75.   ENOTDIR         =  20;  (* Not a directory *)
  76.   EISDIR          =  21;  (* Is a directory *)
  77.   EINVAL          =  22;  (* Invalid argument *)
  78.   ENFILE          =  23;  (* File table overflow *)
  79.   EMFILE          =  24;  (* Too many open files *)
  80.   ENOTTY          =  25;  (* Not a typewriter *)
  81.   ETXTBSY         =  26;  (* Text file busy *)
  82.   EFBIG           =  27;  (* File too large *)
  83.   ENOSPC          =  28;  (* No space left on device *)
  84.   ESPIPE          =  29;  (* Illegal seek *)
  85.   EROFS           =  30;  (* Read-only file system *)
  86.   EMLINK          =  31;  (* Too many links *)
  87.   EPIPE           =  32;  (* Broken pipe *)
  88.   EDOM            =  33;  (* Math argument out of domain of func *)
  89.   ERANGE          =  34;  (* Math result not representable *)
  90.   EDEADLK         =  35;  (* Resource deadlock would occur *)
  91.   ENAMETOOLONG    =  36;  (* File name too long *)
  92.   ENOLCK          =  37;  (* No record locks available *)
  93.   ENOSYS          =  38;  (* Function not implemented *)
  94.   ENOTEMPTY       =  39;  (* Directory not empty *)
  95.   ELOOP           =  40;  (* Too many symbolic links encountered *)
  96.   ENOMSG          =  42;  (* No message of desired type *)
  97.   EIDRM           =  43;  (* Identifier removed *)
  98.   ECHRNG          =  44;  (* Channel number out of range *)
  99.   EL2NSYNC        =  45;  (* Level 2 not synchronized *)
  100.   EL3HLT          =  46;  (* Level 3 halted *)
  101.   EL3RST          =  47;  (* Level 3 reset *)
  102.   ELNRNG          =  48;  (* Link number out of range *)
  103.   EUNATCH         =  49;  (* Protocol driver not attached *)
  104.   ENOCSI          =  50;  (* No CSI structure available *)
  105.   EL2HLT          =  51;  (* Level 2 halted *)
  106.   EBADE           =  52;  (* Invalid exchange *)
  107.   EBADR           =  53;  (* Invalid request descriptor *)
  108.   EXFULL          =  54;  (* Exchange full *)
  109.   ENOANO          =  55;  (* No anode *)
  110.   EBADRQC         =  56;  (* Invalid request code *)
  111.   EBADSLT         =  57;  (* Invalid slot *)
  112.   EBFONT          =  59;  (* Bad font file format *)
  113.   ENOSTR          =  60;  (* Device not a stream *)
  114.   ENODATA         =  61;  (* No data available *)
  115.   ETIME           =  62;  (* Timer expired *)
  116.   ENOSR           =  63;  (* Out of streams resources *)
  117.   ENONET          =  64;  (* Machine is not on the network *)
  118.   ENOPKG          =  65;  (* Package not installed *)
  119.   EREMOTE         =  66;  (* Object is remote *)
  120.   ENOLINK         =  67;  (* Link has been severed *)
  121.   EADV            =  68;  (* Advertise error *)
  122.   ESRMNT          =  69;  (* Srmount error *)
  123.   ECOMM           =  70;  (* Communication error on send *)
  124.   EPROTO          =  71;  (* Protocol error *)
  125.   EMULTIHOP       =  72;  (* Multihop attempted *)
  126.   EDOTDOT         =  73;  (* RFS specific error *)
  127.   EBADMSG         =  74;  (* Not a data message *)
  128.   EOVERFLOW       =  75;  (* Value too large for defined data type *)
  129.   ENOTUNIQ        =  76;  (* Name not unique on network *)
  130.   EBADFD          =  77;  (* File descriptor in bad state *)
  131.   EREMCHG         =  78;  (* Remote address changed *)
  132.   ELIBACC         =  79;  (* Can not access a needed shared library *)
  133.   ELIBBAD         =  80;  (* Accessing a corrupted shared library *)
  134.   ELIBSCN         =  81;  (* .lib section in a.out corrupted *)
  135.   ELIBMAX         =  82;  (* Attempting to link in too many shared libraries *)
  136.   ELIBEXEC        =  83;  (* Cannot exec a shared library directly *)
  137.   EILSEQ          =  84;  (* Illegal byte sequence *)
  138.   ERESTART        =  85;  (* Interrupted system call should be restarted *)
  139.   ESTRPIPE        =  86;  (* Streams pipe error *)
  140.   EUSERS          =  87;  (* Too many users *)
  141.   ENOTSOCK        =  88;  (* Socket operation on non-socket *)
  142.   EDESTADDRREQ    =  89;  (* Destination address required *)
  143.   EMSGSIZE        =  90;  (* Message too long *)
  144.   EPROTOTYPE      =  91;  (* Protocol wrong type for socket *)
  145.   ENOPROTOOPT     =  92;  (* Protocol not available *)
  146.   EPROTONOSUPPORT =  93;  (* Protocol not supported *)
  147.   ESOCKTNOSUPPORT =  94;  (* Socket type not supported *)
  148.   EOPNOTSUPP      =  95;  (* Operation not supported on transport endpoint *)
  149.   EPFNOSUPPORT    =  96;  (* Protocol family not supported *)
  150.   EAFNOSUPPORT    =  97;  (* Address family not supported by protocol *)
  151.   EADDRINUSE      =  98;  (* Address already in use *)
  152.   EADDRNOTAVAIL   =  99;  (* Cannot assign requested address *)
  153.   ENETDOWN        = 100;  (* Network is down *)
  154.   ENETUNREACH     = 101;  (* Network is unreachable *)
  155.   ENETRESET       = 102;  (* Network dropped connection because of reset *)
  156.   ECONNABORTED    = 103;  (* Software caused connection abort *)
  157.   ECONNRESET      = 104;  (* Connection reset by peer *)
  158.   ENOBUFS         = 105;  (* No buffer space available *)
  159.   EISCONN         = 106;  (* Transport endpoint is already connected *)
  160.   ENOTCONN        = 107;  (* Transport endpoint is not connected *)
  161.   ESHUTDOWN       = 108;  (* Cannot send after transport endpoint shutdown *)
  162.   ETOOMANYREFS    = 109;  (* Too many references: cannot splice *)
  163.   ETIMEDOUT       = 110;  (* Connection timed out *)
  164.   ECONNREFUSED    = 111;  (* Connection refused *)
  165.   EHOSTDOWN       = 112;  (* Host is down *)
  166.   EHOSTUNREACH    = 113;  (* No route to host *)
  167.   EALREADY        = 114;  (* Operation already in progress *)
  168.   EINPROGRESS     = 115;  (* Operation now in progress *)
  169.   ESTALE          = 116;  (* Stale NFS file handle *)
  170.   EUCLEAN         = 117;  (* Structure needs cleaning *)
  171.   ENOTNAM         = 118;  (* Not a XENIX named type file *)
  172.   ENAVAIL         = 119;  (* No XENIX semaphores available *)
  173.   EISNAM          = 120;  (* Is a named type file *)
  174.   EREMOTEIO       = 121;  (* Remote I/O error *)
  175.   EDQUOT          = 122;  (* Quota exceeded *)
  176.   ENOMEDIUM       = 123;  (* No medium found *)
  177.   EMEDIUMTYPE     = 124;  (* Wrong medium type *)
  178.  
  179.   EWOULDBLOCK     = EAGAIN;  (* Operation would block *)
  180.   EDEADLOCK       = EDEADLK; (* Resource deadlock would occur *)
  181.  
  182.   (* Standard file descriptors.  *)
  183.   STDIN_FILENO  = 0;       (* Standard input.  *)
  184.   STDOUT_FILENO = 1;       (* Standard output.  *)
  185.   STDERR_FILENO = 2;       (* Standard error output.  *)
  186.  
  187.   (* Values for the second argument to access.
  188.      These may be OR'd together.  *)
  189.   R_OK = 4;               (* Test for read permission.  *)
  190.   W_OK = 2;               (* Test for write permission.  *)
  191.   X_OK = 1;               (* Test for execute permission.  *)
  192.   F_OK = 0;               (* Test for existence.  *)
  193.  
  194.   (* Values for the WHENCE argument to lseek.  *)
  195.   SEEK_SET = 0;       (* Seek from beginning of file.  *)
  196.   SEEK_CUR = 1;       (* Seek from current position.  *)
  197.   SEEK_END = 2;       (* Seek from end of file.  *)
  198.  
  199.   F_ULOCK = 0;       (* Unlock a previously locked region.  *)
  200.   F_LOCK  = 1;       (* Lock a region for exclusive use.  *)
  201.   F_TLOCK = 2;       (* Test and lock a region for exclusive use.  *)
  202.   F_TEST  = 3;       (* Test a region for other processes locks.  *)
  203.  
  204.   LOCK_SH = 1;
  205.   LOCK_EX = 2;
  206.   LOCK_UN = 4;
  207.   LOCK_NB = 8;
  208.  
  209.   (* fcntl cmd options *)
  210.   F_GETFD =  1;
  211.   F_SETFD =  2;
  212.   F_GETFL =  3;
  213.   F_SETFL =  4;
  214.   F_GETLK =  5;
  215.   F_SETLK =  6;
  216.   F_SETLKW = 7;
  217.   F_GETOWN = 8;
  218.   F_SETOWN = 9;
  219.  
  220.   (* fcntl flock.l_type options *)
  221.   F_RDLCK = 0;
  222.   F_WRLCK = 1;
  223.   F_UNLCK = 2;
  224.  
  225.   (* File open modes *)
  226.   O_ACCMODE   = $00000003;
  227.   O_RDONLY    = $00000000;
  228.   O_WRONLY    = $00000001;
  229.   O_RDWR      = $00000002;
  230.   O_NDELAY    = $00000004;
  231.   O_APPEND    = $00000008;
  232.   O_TEXT      = $00000010;
  233.  
  234.   O_BINARY    = $00000100;
  235.   O_CREAT     = $00000200;
  236.   O_TRUNC     = $00000400;
  237.   O_EXCL      = $00000800;
  238.   O_NOINHERIT = $00001000;
  239.   O_SYNC      = $00002000;
  240.   O_NOCTTY    = $00004000;
  241.   O_SIZE      = $00008000;
  242.  
  243.   (* File modes *)
  244.   S_IFSOCK    = $0000C000;
  245.   S_IFLNK     = $0000A000;
  246.   S_IFREG     = $00008000;
  247.   S_IFBLK     = $00006000;
  248.   S_IFDIR     = $00004000;
  249.   S_IFCHR     = $00002000;
  250.   S_IFIFO     = $00001000;
  251.  
  252.   S_ISUID     = $00000800;
  253.   S_ISGID     = $00000400;
  254.   S_ISVTX     = $00000200;
  255.  
  256.   S_IRWXU     = $000001C0;
  257.   S_IRUSR     = $00000100;
  258.   S_IWUSR     = $00000080;
  259.   S_IXUSR     = $00000040;
  260.  
  261.   S_IRWXG     = $00000038;
  262.   S_IRGRP     = $00000020;
  263.   S_IWGRP     = $00000010;
  264.   S_IXGRP     = $00000008;
  265.  
  266.   S_IRWXO     = $00000007;
  267.   S_IROTH     = $00000004;
  268.   S_IWOTH     = $00000002;
  269.   S_IXOTH     = $00000001;
  270.  
  271.  
  272.  
  273.   (* ? *)
  274.   F_EOF       = $00000020;
  275.   F_TERMIO    = $00000040;
  276.   F_DEV       = $00000080;
  277.  
  278.   F_SOCKET    = $10000000;
  279.   F_PIPE      = $20000000;
  280.   F_WRCRPEND  = $40000000;
  281.   F_CRLF      = $80000000;
  282.  
  283. (* mmap *)
  284.  
  285.   PROT_NONE   = $00;    (* No access.  *)
  286.   PROT_READ   = $04;    (* Pages can be read.  *)
  287.   PROT_WRITE  = $02;    (* Pages can be written.  *)
  288.   PROT_EXEC   = $01;    (* Pages can be executed.  *)
  289.  
  290. (* Flags contain mapping type, sharing type and options.  *)
  291.  
  292. (* Mapping type (must choose one and only one of these).  *)
  293.   MAP_FILE    = $0001;  (* Mapped from a file or device.  *)
  294.   MAP_ANON    = $0002;  (* Allocated from anonymous virtual memory.  *)
  295.   MAP_TYPE    = $000f;  (* Mask for type field.  *)
  296.  
  297. (* Sharing types (must choose one and only one of these).  *)
  298.   MAP_COPY     =   $0020;  (* Virtual copy of region at mapping time.  *)
  299.   MAP_SHARED   =   $0010;  (* Share changes.  *)
  300.   MAP_PRIVATE  =   $0000;  (* Changes private; copy pages on write.  *)
  301.  
  302. (* Other flags.  *)
  303.   MAP_FIXED       = $0100;  (* Map address must be exactly as requested. *)
  304.   MAP_NOEXTEND    = $0200;  (* For MAP_FILE, don't change file size.  *)
  305.   MAP_HASSEMPHORE = $0400;  (* Region may contain semaphores.  *)
  306.   MAP_INHERIT     = $0800;  (* Region is retained after exec.  *)
  307.  
  308. (* Cloning flags *)
  309.  
  310.   CLONE_VM      = $0100; // Set if VM shared between processes
  311.   CLONE_FS      = $0200; // Set if FS info shared between processes
  312.   CLONE_FILES   = $0400; // Set if open files shared between processes
  313.   CLONE_SIGHAND = $0800; // Set if signal handlers shared between processes
  314.   CLONE_PID     = $1000; // Set if PID shared between processes
  315.   CLONE_PTRACE  = $2000; // Set if tracing shall continue on the child process
  316.   CLONE_VFORK   = $4000; // Set if if parent wants child to wake up on mm__release
  317.  
  318. (* Signals *)
  319.  
  320.   SIGHUP      =  1;
  321.   SIGINT      =  2;
  322.   SIGQUIT     =  3;
  323.   SIGILL      =  4;
  324.   SIGTRAP     =  5;
  325.   SIGABRT     =  6;
  326.   SIGIOT      =  6;
  327.   SIGBUS      =  7;
  328.   SIGFPE      =  8;
  329.   SIGKILL     =  9;
  330.   SIGUSR1     = 10;
  331.   SIGSEGV     = 11;
  332.   SIGUSR2     = 12;
  333.   SIGPIPE     = 13;
  334.   SIGALRM     = 14;
  335.   SIGTERM     = 15;
  336.   SIGSTKFLT   = 16;
  337.   SIGCHLD     = 17;
  338.   SIGCONT     = 18;
  339.   SIGSTOP     = 19;
  340.   SIGTSTP     = 20;
  341.   SIGTTIN     = 21;
  342.   SIGTTOU     = 22;
  343.   SIGURG      = 23;
  344.   SIGXCPU     = 24;
  345.   SIGXFSZ     = 25;
  346.   SIGVTALRM   = 26;
  347.   SIGPROF     = 27;
  348.   SIGWINCH    = 28;
  349.   SIGIO       = 29;
  350.   SIGPOLL     = 29;
  351.   SIGPWR      = 30;
  352.   SIGUNUSED   = 31;
  353.  
  354. (* Signal handler flags *)
  355.  
  356.   SA_NOCLDSTOP  = $00000001; // Turn off SIGCHLD when children stop
  357.   SA_NOCHLDWAIT = $00000002; // Not supported
  358.   SA_SIGINFO    = $00000004; // Want TSigInfo structure in signal handler
  359.   SA_RESTORER   = $04000000; // ?
  360.   SA_ONSTACK    = $08000000; // Use registered stack for signals
  361.   SA_RESTART    = $10000000; // Restarting signals
  362.   SA_INTERRUPT  = $20000000; // Ignored
  363.   SA_NODEFER    = $40000000; // Current signal is not masked in handler
  364.   SA_RESETHAND  = $80000000; // Clear handler when signal is delivered
  365.  
  366.   SA_NOMASK     = SA_NODEFER;
  367.   SA_ONESHOT    = SA_RESETHAND;
  368.  
  369.   (* Control codes for IOCtl() *)
  370.   TCGETS     = $00005401;
  371.   TCSETS     = $00005402;
  372.  
  373.   TIOCGWINSZ = $00005413;
  374.   TIOCSWINSZ = $00005414;
  375.  
  376.   TIOCLINUX  = $0000541C;
  377.  
  378.   TIOCMGET   = $00005415;
  379.   TIOCMSET   = $00005418;
  380.  
  381.   KDGKBMETA = $00004B62;
  382.   KDSKBMETA = $00004B63;
  383.  
  384.   K_METABIT   = $03;
  385.   K_ESCPREFIX = $04;
  386.  
  387.   (* Terminal control bits for c_iflag field *)
  388.  
  389.   IGNBRK   = $00000001;
  390.   BRKINT   = $00000002;
  391.   IGNPAR   = $00000004;
  392.   PARMRK   = $00000008;
  393.   INPCK    = $00000010;
  394.   ISTRIP   = $00000020;
  395.   INLCR    = $00000040;
  396.   IGNCR    = $00000080;
  397.   ICRNL    = $00000100;
  398.   IUCLC    = $00000200;
  399.   IXON     = $00000400;
  400.   IXANY    = $00000800;
  401.   IXOFF    = $00001000;
  402.   IMAXBEL  = $00002000;
  403.  
  404.   (* Terminal control bits for c_oflag field *)
  405.  
  406.   OPOST    = $00000001;
  407.   OLCUC    = $00000002;
  408.   ONLCR    = $00000004;
  409.   OCRNL    = $00000008;
  410.   ONOCR    = $00000010;
  411.   ONLRET   = $00000020;
  412.   OFILL    = $00000040;
  413.   OFDEL    = $00000080;
  414.   NLDLY    = $00000100;
  415.     NL0    = $00000000;
  416.     NL1    = $00000100;
  417.   CRDLY    = $00000600;
  418.     CR0    = $00000000;
  419.     CR1    = $00000200;
  420.     CR2    = $00000400;
  421.     CR3    = $00000600;
  422.   TABDLY   = $00001800;
  423.     TAB0   = $00000000;
  424.     TAB1   = $00000800;
  425.     TAB2   = $00001000;
  426.     TAB3   = $00001800;
  427.     XTABS  = $00001800;
  428.   BSDLY    = $00002000;
  429.     BS0    = $00000000;
  430.     BS1    = $00002000;
  431.   VTDLY    = $00004000;
  432.     VT0    = $00000000;
  433.     VT1    = $00004000;
  434.   FFDLY    = $00008000;
  435.     FF0    = $00000000;
  436.     FF1    = $00008000;
  437.  
  438.   (* Terminal control bits for c_c flag field *)
  439.  
  440.   CBAUD    = $0000100F;
  441.     B0     = $00000000;
  442.     B50    = $00000001;
  443.     B75    = $00000002;
  444.     B110   = $00000003;
  445.     B134   = $00000004;
  446.     B150   = $00000005;
  447.     B200   = $00000006;
  448.     B300   = $00000007;
  449.     B600   = $00000008;
  450.     B1200  = $00000009;
  451.     B1800  = $0000000A;
  452.     B2400  = $0000000B;
  453.     B4800  = $0000000C;
  454.     B9600  = $0000000D;
  455.     B19200 = $0000000E;
  456.     B38400 = $0000000F;
  457.   EXTA     = B19200;
  458.   EXTB     = B38400;
  459.   CSIZE    = $00000030;
  460.     CS5    = $00000000;
  461.     CS6    = $00000010;
  462.     CS7    = $00000020;
  463.     CS8    = $00000030;
  464.   CSTOPB   = $00000040;
  465.   CREAD    = $00000080;
  466.   PARENB   = $00000100;
  467.   CHUPCL   = $00000200;
  468.   CLOCAL   = $00000400;
  469.   CBAUDEX  = $00000800;
  470.     B57600  = $00008001;
  471.     B115200 = $00008002;
  472.     B230400 = $00008003;
  473.     B460800 = $00008004;
  474.     B500000 = $00008005;
  475.     B576000 = $00008006;
  476.     B921600 = $00008007;
  477.     B1000000 = $00008008;
  478.     B1152000 = $00008009;
  479.     B1500000 = $0000800A;
  480.     B2000000 = $0000800B;
  481.     B2500000 = $0000800C;
  482.     B3000000 = $0000800D;
  483.     B3500000 = $0000800E;
  484.     B4000000 = $0000800F;
  485.   CIBAUD     = $100F0000;
  486.   CMSPAR     = $40000000;
  487.   CRTSCTS    = $80000000;
  488.  
  489.   (* Terminal control bits for c_lflag field *)
  490.  
  491.   ISIG       = $00000001;
  492.   ICANON     = $00000002;
  493.   XCASE      = $00000004;
  494.   ECHO       = $00000008;
  495.   ECHOE      = $00000010;
  496.   ECHOK      = $00000020;
  497.   ECHONL     = $00000040;
  498.   NOFLSH     = $00000080;
  499.   TOSTOP     = $00000100;
  500.   ECHOCTL    = $00000200;
  501.   ECHOPRT    = $00000400;
  502.   ECHOKE     = $00000800;
  503.   FLUSHO     = $00001000;
  504.   PENDIN     = $00002000;
  505.   IEXTEN     = $00004000;
  506.  
  507.   (* Values for c_cc field *)
  508.  
  509.   VINTR    = 0;
  510.   VQUIT    = 1;
  511.   VERASE   = 2;
  512.   VKILL    = 3;
  513.   VEOF     = 4;
  514.   VTIME    = 5;
  515.   VMIN     = 6;
  516.   VSWTC    = 7;
  517.   VSTART   = 8;
  518.   VSTOP    = 9;
  519.   VSUSP    = 10;
  520.   VEOL     = 11;
  521.   VREPRINT = 12;
  522.   VDISCARD = 13;
  523.   VWERASE  = 14;
  524.   VLNEXT   = 15;
  525.   VEOL2    = 16;
  526.  
  527.   (* Flags for tcflow and TCXONC *)
  528.  
  529.   TCOOFF = 0;
  530.   TCOON  = 1;
  531.   TCIOFF = 2;
  532.   TCION  = 3;
  533.  
  534.   (* Flags for tcflush and TCFLSH *)
  535.  
  536.   TCIFLUSH  = 0;
  537.   TCOFLUSH  = 1;
  538.   TCIOFLUSH = 2;
  539.  
  540.   (* Flags for tcsetattr *)
  541.  
  542.   TCSANOW   = 0;
  543.   TCSADRAIN = 1;
  544.   TCSAFLUSH = 2;
  545.  
  546.   (* IoCtl and Keyboard *)
  547.  
  548.   KDGKBMODE = $00004B44;
  549.   KDSKBMODE = $00004B45;
  550.  
  551.   K_RAW       = 0;
  552.   K_XLATE     = 1;
  553.   K_MEDIUMRAW = 2;
  554.   K_UNICODE   = 3;
  555.  
  556.   KDGETKEYCODE = $00004B4C;
  557.   KDSETKEYCODE = $00004B4D;
  558.  
  559. type
  560.   TKdKeyCode = record
  561.     ScanCode, KeyCode: LongInt;
  562.   end;
  563.  
  564. type
  565.   PDirEnt = ^TDirEnt;
  566.   TDirEnt = record
  567.     d_Ino:    LongInt;
  568.     d_Off:    LongInt;
  569.     d_RecLen: SmallInt;
  570.     d_Name:   array[0..255] of Char;
  571.   end;
  572.  
  573.   TStat = record
  574.     st_Dev:     SmallInt;
  575.     __pad1:     SmallInt;
  576.     st_Ino:     LongInt;
  577.     st_Mode:    SmallInt;
  578.     st_Nlink:   SmallInt;
  579.     st_Uid:     SmallInt;
  580.     st_Gid:     SmallInt;
  581.     st_Rdev:    SmallInt;
  582.     __pad2:     SmallInt;
  583.     st_Size:    LongInt;
  584.     st_BlkSize: LongInt;
  585.     st_Blocks:  LongInt;
  586.     st_ATime:   LongInt;
  587.     __unused1:  LongInt;
  588.     st_MTime:   LongInt;
  589.     __unused2:  LongInt;
  590.     st_CTime:   LongInt;
  591.     __unused3:  LongInt;
  592.     __unused4:  LongInt;
  593.     __unused5:  LongInt;
  594.   end;
  595.  
  596.   TTimeVal = record
  597.     tv_Sec: LongInt;
  598.     tv_USec: LongInt;
  599.   end;
  600.  
  601.   TTimeZone = record
  602.     tz_MinutesWest: LongInt;
  603.     tz_DstTime: LongInt;
  604.   end;
  605.  
  606.   TUTimBuf = record
  607.     actime:  LongInt;
  608.     modtime: LongInt;
  609.   end;
  610.  
  611.   TStatFS = record
  612.     f_Type: LongInt;
  613.     f_BSize: LongInt;
  614.     f_Blocks: LongInt;
  615.     f_BFree: LongInt;
  616.     f_BAvail: LongInt;
  617.     f_Files: LongInt;
  618.     f_FFree: LongInt;
  619.     f_FSid: array[0..1] of LongInt;
  620.     f_NameLen: LongInt;
  621.     f_Spare: array[0..5] of LongInt;
  622.   end;
  623.  
  624.   TSigAction = record
  625.     sa_Handler: Pointer; (* procedure(Sig: LongInt); cdecl; *)
  626.     sa_Mask: LongInt;
  627.     sa_Flags: LongInt;
  628.     sa_Restorer: Pointer;
  629.   end;
  630.  
  631.   TModifyLDT = record
  632.     Index: LongInt;
  633.     Base:  Pointer;
  634.     Limit: LongInt;
  635.     Flags: LongInt;
  636.   end;
  637.  
  638.   TFpReg = record
  639.     Significand: array[0..3] of Word;
  640.     Exponent: Word;
  641.   end;
  642.  
  643.   TFpState = record
  644.     cw, sw, tag, ipoff, cssel, dataoff, datasel: LongInt;
  645.     _st: array[0..7] of TFpReg;
  646.     status: LongInt;
  647.   end;
  648.  
  649.   TSigContext = record
  650.     gs, __gsh:     Word;
  651.     fs, __fsh:     Word;
  652.     es, __esh:     Word;
  653.     ds, __dsh:     Word;
  654.     edi:           LongInt;
  655.     esi:           LongInt;
  656.     ebp:           LongInt;
  657.     esp:           LongInt;
  658.     ebx:           LongInt;
  659.     edx:           LongInt;
  660.     ecx:           LongInt;
  661.     eax:           LongInt;
  662.     trapno:        LongInt;
  663.     err:           LongInt;
  664.     eip:           LongInt;
  665.     cs, __csh:     Word;
  666.     eflags:        LongInt;
  667.     esp_at_signal: LongInt;
  668.     ss, __ssh:     Word;
  669.     fpstate:       ^TFpState;
  670.     oldmask:       LongInt;
  671.     cr2:           LongInt;
  672.   end;
  673.  
  674.   TSysInfo = record
  675.     Uptime:    LongInt;
  676.     Loads:     array[0..2] of LongInt;
  677.     TotalRam:  LongInt;
  678.     FreeRam:   LongInt;
  679.     SharedRam: LongInt;
  680.     BufferRam: LongInt;
  681.     TotalSwap: LongInt;
  682.     FreeSwap:  LongInt;
  683.     Procs:     Word;
  684.     __Unused:  array[0..21] of Char;
  685.   end;
  686.  
  687.   TTimeSpec = record
  688.     tv_Sec:  LongInt;
  689.     tv_NSec: LongInt;
  690.   end;
  691.  
  692.   TTermios = record
  693.     c_iflag: LongInt;
  694.     c_oflag: LongInt;
  695.     c_cflag: LongInt;
  696.     c_lflag: LongInt;
  697.     c_line : Byte;
  698.     c_cc:    array[0..18] of Byte;
  699.   end;
  700.  
  701.   TWinSize = record
  702.     ws_row: SmallWord;
  703.     ws_col: SmallWord;
  704.     ws_xpixel: SmallWord;
  705.     ws_ypixel: SmallWord;
  706.   end;
  707.  
  708.   TPipe = record
  709.     RdFile, WrFile: LongInt;
  710.   end;
  711.  
  712.   PFLock = ^TFLock;
  713.   TFLock = record
  714.     l_Type:   SmallInt;
  715.     l_Whence: SmallInt;
  716.     l_Start:  LongInt;
  717.     l_Len:    LongInt;
  718.     l_PID:    LongInt;
  719.   end;
  720.  
  721. (* 1 *)
  722. function LnxExit(Status: LongInt): LongInt;
  723.  
  724. (* 2 *)
  725. function LnxFork: LongInt;
  726.  
  727. (* 3 *)
  728. function LnxRead(Fd: LongInt; var Buf; Count: LongInt): LongInt;
  729.  
  730. (* 4 *)
  731. function LnxWrite(Fd: LongInt; const Buf; Count: LongInt): LongInt;
  732.  
  733. (* 5 *)
  734. function LnxOpen(PathName: PChar; Flags, Mode: LongInt): LongInt;
  735.  
  736. (* 6 *)
  737. function LnxClose(Fd: LongInt): LongInt;
  738.  
  739. (* 7 *)
  740. function LnxWaitPid(PID: LongInt; var Status: LongInt; Options: LongInt): LongInt;
  741.  
  742. (* 8 *)
  743. function LnxCreat(PathName: PChar; Mode: LongInt): LongInt;
  744.  
  745. (* 10 *)
  746. function LnxUnlink(PathName: PChar): LongInt;
  747.  
  748. (* 11 *)
  749. function LnxExecve(FileName: PChar; Args: Pointer; Env: Pointer): LongInt;
  750.  
  751. (* 12 *)
  752. function LnxChDir(Path: PChar): LongInt;
  753.  
  754. (* 13 *)
  755. function LnxTime(var Time: LongInt): LongInt;
  756.  
  757. (* 15 *)
  758. function LnxChMod(Path: PChar; Mode: LongInt): LongInt;
  759.  
  760. (* 17 *)
  761. function LnxBrk(End_Data_Segment: Pointer): LongInt;
  762.  
  763. (* 19 *)
  764. function LnxLSeek(Fd, _Offset, Whence: LongInt): LongInt;
  765.  
  766. (* 20 *)
  767. function LnxGetPid: LongInt;
  768.  
  769. (* 25 *)
  770. function LnxSTime(const Time: LongInt): LongInt;
  771.  
  772. (* 30 *)
  773. function LnxUTime(FileName: PChar; const Buf: TUTimBuf): LongInt;
  774.  
  775. (* 33 *)
  776. function LnxAccess(PathName: PChar; Mode: LongInt): LongInt;
  777.  
  778. (* 37 *)
  779. function LnxKill(PID, Sig: LongInt): LongInt;
  780.  
  781. (* 38 *)
  782. function LnxRename(const OldPath, NewPath: PChar): LongInt;
  783.  
  784. (* 39 *)
  785. function LnxMkDir(Path: PChar; Mode: LongInt): LongInt;
  786.  
  787. (* 40 *)
  788. function LnxRmDir(Path: PChar): LongInt;
  789.  
  790. (* 42 *)
  791. function LnxPipe(var Pipe: TPipe): LongInt;
  792.  
  793. (* 54 *)
  794. function LnxIOCtl(Fd, Request: LongInt; Arg: Pointer): LongInt;
  795.  
  796. (* 55 *)
  797. function LnxFCntl_3(FD: LongInt; Cmd: LongInt; Lock: PFLock): LongInt;
  798.  
  799. (* 60 *)
  800. function LnxUmask(Mask: LongInt): LongInt;
  801.  
  802. (* 67 *)
  803. function LnxSigAction(SigNum: LongInt; const Act: TSigAction; var OldAct: TSigAction): LongInt;
  804.  
  805. (* 72 *)
  806. function LnxSigSuspend(const Mask: LongInt): LongInt;
  807.  
  808. (* 73 *)
  809. function LnxSigPending(var SigSet: LongInt): LongInt;
  810.  
  811. (* 78 *)
  812. function LnxGetTimeOfDay(var TimeVal: TTimeVal; var TimeZone: TTimeZone): LongInt;
  813.  
  814. (* 79 *)
  815. function LnxSetTimeOfDay(const TimeVal: TTimeVal; const TimeZone: TTimeZone): LongInt;
  816.  
  817. (* 85 *)
  818. function LnxReadLink(Path, Buf: PChar; BufSize: LongInt): LongInt;
  819.  
  820. (* 89 *)
  821. function LnxReadDir(FD: LongInt; var Dir: TDirEnt; Count: LongInt): LongInt;
  822.  
  823. (* 90 *)
  824. function LnxMMap(Start: Pointer; Length, Prot, Flags, Fd, Offset: LongInt): Pointer;
  825.  
  826. (* 91 *)
  827. function LnxMUnmap(Start: Pointer; Length: LongInt): LongInt;
  828.  
  829. (* 93 *)
  830. function LnxFTruncate(FD, NewSize: LongInt): LongInt;
  831.  
  832. (* 99 *)
  833. function LnxStatFS(Path: PChar; var StatFS: TStatFS): LongInt;
  834.  
  835. (* 106 *)
  836. function LnxStat(FileName: PChar; var Buffer: TStat): LongInt;
  837.  
  838. (* 108 *)
  839. function LnxFStat(FD: LongInt; var Buffer: TStat): LongInt;
  840.  
  841. (* 116 *)
  842. function LnxSysInfo(var Info: TSysInfo): LongInt;
  843.  
  844. (* 118 *)
  845. function LnxFSync(Fd: Longint): Longint;
  846.  
  847. (* 120 *)
  848. function LnxClone(Child_Stack: Pointer; Flags: LongInt): LongInt;
  849.  
  850. (* 123 *)
  851. function LnxModifyLDT(Func: LongInt; var _Ptr; ByteCount: LongInt): LongInt;
  852.  
  853. (* 125 *)
  854. function LnxMProtect(Addr: Pointer; Len, Prot: LongInt): LongInt;
  855.  
  856. (* 126 *)
  857. function LnxSigProcMask(How: LongInt; const NewSet: LongInt; var OldSet: LongInt): LongInt;
  858.  
  859. (* 143 *)
  860. function LnxFlock(Fd, Operation: LongInt): LongInt;
  861.  
  862. (* 162 *)
  863. function LnxNanoSleep(const Req: TTimeSpec; var Rem: TTimeSpec): LongInt;
  864.  
  865.  
  866. {
  867.  
  868. (* Terminal stuff *)
  869.  
  870. (**
  871.  * Get Termical attributes
  872.  *)
  873. function TrmGetAttr(var Termios: TTermios): LongInt;
  874.  
  875. (**
  876.  * Set terminal attributes. Option parameter
  877.  * is currently ignored - all changes are
  878.  * immediate.
  879.  *)
  880. function TrmSetAttr(const Termios: TTermios): LongInt;
  881. // TrmSetAttr
  882.  
  883. (*
  884.  * Initialize given terminal. Returns description of
  885.  * terminal or NIL if terminal capabilities couldn't
  886.  * be found.
  887.  *)
  888. function TrmInit(TermName: PChar): PChar; // LnxGetTermInfo
  889. // TrmInitCaps
  890.  
  891. (**
  892.  * End access to terminal.
  893.  *)
  894. procedure TrmDone; // LnxFreeTermInfo
  895. // TrmDoneCaps
  896.  
  897. (**
  898.  * Get a boolean terminal capability.
  899.  * See '/usr/include/term.h' for a list
  900.  * of terminal capabilities.
  901.  *)
  902. function TrmGetBooleanCap(Index: LongInt): Boolean; // LnxGetBooleanTermCap
  903. // TrmGetBooleanCap
  904.  
  905. (**
  906.  * Get an integer terminal capability.
  907.  * See '/usr/include/term.h' for a list
  908.  * of terminal capabilities.
  909.  *)
  910. function TrmGetIntegerCap(Index: LongInt): SmallInt;
  911. // TrmGetIntegerCap
  912.  
  913. (**
  914.  * Get a string terminal capability.
  915.  * See '/usr/include/term.h' for a list
  916.  * of terminal capabilities.
  917.  *)
  918. function TrmGetStringCap(Index: LongInt): PChar;
  919. // TrmGetStringCap
  920.  
  921. (**
  922.  * Output a terminal control string.
  923.  *)
  924. procedure TrmControl(Format: PChar); // LnxSendTermControl
  925. // TrmControl
  926.  
  927. (**
  928.  * Format and output a terminal control  // LnxSendTermControlFmt
  929.  * string.
  930.  *)
  931. procedure TrmControlFmt(Format: PChar; Args: array of LongInt);
  932. // TrmControlFmt
  933.  
  934. // TrmWrite
  935. function TrmWrite(Buffer: PChar; Count: LongInt): LongInt;
  936.  
  937. // TrmRead
  938. function TrmRead(Buffer: PChar; Count: LongInt): LongInt;
  939.  
  940. }
  941.  
  942. (* others *)
  943.  
  944. procedure LnxDebug(S: ShortString);
  945.  
  946. implementation
  947.  
  948. uses
  949.   Strings, LnxRes;
  950.  
  951. {$r linux}
  952.  
  953. (* 1 *)
  954. function LnxExit(Status: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  955. asm
  956.   mov eax, 1;
  957.   mov ebx, Status;
  958.   int $80;
  959. end;
  960.  
  961. (* 2 *)
  962. function LnxFork: LongInt; {&uses ebx,ecx,edx,esi,edi}
  963. asm
  964.   mov eax, 2;
  965.   int $80;
  966. end;
  967.  
  968. (* 3 *)
  969. function LnxRead(Fd: LongInt; var Buf; Count: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  970. asm
  971.   mov eax, 3;
  972.   mov ebx, Fd;
  973.   mov ecx, Buf;
  974.   mov edx, Count;
  975.   int $80;
  976. end;
  977.  
  978. (* 4 *)
  979. function LnxWrite(Fd: LongInt; const Buf; Count: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  980. asm
  981.   mov eax, 4;
  982.   mov ebx, Fd;
  983.   mov ecx, Buf;
  984.   mov edx, Count;
  985.   int $80;
  986. end;
  987.  
  988. (* 5 *)
  989. function LnxOpen(PathName: PChar; Flags, Mode: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  990. asm
  991.   mov eax, 5;
  992.   mov ebx, PathName;
  993.   mov ecx, Flags;
  994.   mov edx, Mode;
  995.   int $80;
  996. end;
  997.  
  998. (* 6 *)
  999. function LnxClose(Fd: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1000. asm
  1001.   mov eax, 6;
  1002.   mov ebx, Fd;
  1003.   int $80;
  1004. end;
  1005.  
  1006. (* 7 *)
  1007. function LnxWaitPid(PID: LongInt; var Status: LongInt; Options: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1008. asm
  1009.   mov eax, 7;
  1010.   mov ebx, PID;
  1011.   mov ecx, Status;
  1012.   mov edx, Options;
  1013.   int $80;
  1014. end;
  1015.  
  1016. (* 8 *)
  1017. function LnxCreat(PathName: PChar; Mode: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1018. asm
  1019.   mov eax, 8;
  1020.   mov ebx, PathName;
  1021.   mov ecx, Mode;
  1022.   int $80;
  1023. end;
  1024.  
  1025. (* 10 *)
  1026. function LnxUnlink(PathName: PChar): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1027. asm
  1028.   mov eax, 10;
  1029.   mov ebx, PathName;
  1030.   int $80;
  1031. end;
  1032.  
  1033. (* 11 *)
  1034. function LnxExecve(FileName: PChar; Args: Pointer; Env: Pointer): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1035. asm
  1036.   mov eax, 11;
  1037.   mov ebx, FileName;
  1038.   mov ecx, Args;
  1039.   mov edx, Env;
  1040.   int $80;
  1041. end;
  1042.  
  1043. (* 12 *)
  1044. function LnxChDir(Path: PChar): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1045. asm
  1046.   mov eax, 12;
  1047.   mov ebx, Path;
  1048.   int $80;
  1049. end;
  1050.  
  1051. (* 13 *)
  1052. function LnxTime(var Time: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1053. asm
  1054.   mov eax, 13;
  1055.   mov ebx, Time;
  1056.   int $80;
  1057. end;
  1058.  
  1059. (* 15 *)
  1060. function LnxChMod(Path: PChar; Mode: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1061. asm
  1062.   mov eax, 15;
  1063.   mov ebx, Path;
  1064.   mov ecx, Mode;
  1065.   int $80;
  1066. end;
  1067.  
  1068. (* 17 *)
  1069. function LnxBrk(End_Data_Segment: Pointer): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1070. asm
  1071.   mov eax, 17;
  1072.   mov ebx, End_Data_Segment;
  1073.   int $80;
  1074. end;
  1075.  
  1076. (* 19 *)
  1077. function LnxLSeek(Fd, _Offset, Whence: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1078. asm
  1079.   mov eax, 19;
  1080.   mov ebx, Fd;
  1081.   mov ecx, _Offset;
  1082.   mov edx, Whence;
  1083.   int $80;
  1084. end;
  1085.  
  1086. (* 20 *)
  1087. function LnxGetPid: LongInt; {&uses ebx,ecx,edx,esi,edi}
  1088. asm
  1089.   mov eax, 20;
  1090.   int $80;
  1091. end;
  1092.  
  1093. (* 25 *)
  1094. function LnxSTime(const Time: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1095. asm
  1096.   mov eax, 25;
  1097.   mov ebx, Time;
  1098.   int $80;
  1099. end;
  1100.  
  1101. (* 30 *)
  1102. function LnxUTime(FileName: PChar; const Buf: TUTimBuf): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1103. asm
  1104.   mov eax, 30;
  1105.   mov ebx, FileName;
  1106.   mov ecx, Buf;
  1107.   int $80;
  1108. end;
  1109.  
  1110. (* 33 *)
  1111. function LnxAccess(PathName: PChar; Mode: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1112. asm
  1113.   mov eax, 33;
  1114.   mov ebx, PathName;
  1115.   mov ecx, Mode;
  1116.   int $80;
  1117. end;
  1118.  
  1119. (* 37 *)
  1120. function LnxKill(PID, Sig: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1121. asm
  1122.   mov eax, 37;
  1123.   mov ebx, PID;
  1124.   mov ecx, Sig;
  1125.   int $80;
  1126. end;
  1127.  
  1128. (* 38 *)
  1129. // Achtung: Überschreibt!
  1130. function LnxRename(const OldPath, NewPath: PChar): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1131. asm
  1132.   mov eax, 38;
  1133.   mov ebx, OldPath;
  1134.   mov ecx, NewPath;
  1135.   int $80;
  1136. end;
  1137.  
  1138. (* 39 *)
  1139. function LnxMkDir(Path: PChar; Mode: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1140. asm
  1141.   mov eax, 39;
  1142.   mov ebx, Path;
  1143.   mov ecx, Mode;
  1144.   int $80;
  1145. end;
  1146.  
  1147. (* 40 *)
  1148. function LnxRmDir(Path: PChar): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1149. asm
  1150.   mov eax, 40;
  1151.   mov ebx, Path;
  1152.   int $80;
  1153. end;
  1154.  
  1155. (* 42 *)
  1156. function LnxPipe(var Pipe: TPipe): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1157. asm
  1158.   mov eax, 42;
  1159.   mov ebx, Pipe;
  1160.   int $80;
  1161. end;
  1162.  
  1163. (* 54 *)
  1164. function LnxIoCtl(Fd, Request: LongInt; Arg: Pointer): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1165. asm
  1166.   mov eax, 54;
  1167.   mov ebx, Fd;
  1168.   mov ecx, Request;
  1169.   mov edx, Arg;
  1170.   int $80;
  1171. end;
  1172.  
  1173. (* 55 *)
  1174. function LnxFCntl_3(FD: LongInt; Cmd: LongInt; Lock: PFLock): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1175. asm
  1176.   mov eax, 55
  1177.   mov ebx, FD
  1178.   mov ecx, Cmd
  1179.   mov edx, Lock
  1180.   int $80
  1181. end;
  1182.  
  1183. (* 60 *)
  1184. function LnxUmask(Mask: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1185. asm
  1186.   mov eax, 60;
  1187.   mov ebx, Mask;
  1188.   int $80;
  1189. end;
  1190.  
  1191. (* 67 *)
  1192. function LnxSigAction(SigNum: LongInt; const Act: TSigAction; var OldAct: TSigAction): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1193. asm
  1194.   mov eax, 67;
  1195.   mov ebx, SigNum;
  1196.   mov ecx, Act;
  1197.   mov edx, OldAct;
  1198.   int $80;
  1199. end;
  1200.  
  1201. (* 72 *)
  1202. function LnxSigSuspend(const Mask: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1203. asm
  1204.   mov eax, 72;
  1205.   mov ebx, Mask;
  1206.   int $80;
  1207. end;
  1208.  
  1209. (* 73 *)
  1210. function LnxSigPending(var SigSet: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1211. asm
  1212.   mov eax, 73;
  1213.   mov ebx, SigSet;
  1214.   int $80;
  1215. end;
  1216.  
  1217. (* 78 *)
  1218. function LnxGetTimeOfDay(var TimeVal: TTimeVal; var TimeZone: TTimeZone): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1219. asm
  1220.   mov eax, 78;
  1221.   mov ebx, TimeVal;
  1222.   mov ecx, TimeZone;
  1223.   int $80;
  1224. end;
  1225.  
  1226. (* 79 *)
  1227. function LnxSetTimeOfDay(const TimeVal: TTimeVal; const TimeZone: TTimeZone): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1228. asm
  1229.   mov eax, 79;
  1230.   mov ebx, TimeVal;
  1231.   mov ecx, TimeZone;
  1232.   int $80;
  1233. end;
  1234.  
  1235. (* 85 *)
  1236. function LnxReadLink(Path, Buf: PChar; BufSize: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1237. asm
  1238.   mov eax, 85;
  1239.   mov ebx, Path;
  1240.   mov ecx, Buf;
  1241.   mov edx, BufSize;
  1242.   int $80;
  1243. end;
  1244.  
  1245. (* 89 *)
  1246. function LnxReadDir(FD: LongInt; var Dir: TDirEnt; Count: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1247. asm
  1248.   mov eax, 89;
  1249.   mov ebx, FD;
  1250.   mov ecx, Dir;
  1251.   mov edx, Count;
  1252.   int $80;
  1253. end;
  1254.  
  1255.  
  1256. (* 90 *)
  1257. function LnxMMap(Start: Pointer; Length, Prot, Flags, Fd, Offset: LongInt): Pointer; {&uses ebx,ecx,edx,esi,edi}
  1258. asm
  1259.   mov eax, 90;
  1260.   mov ebx, ebp;
  1261.   add ebx, 8;
  1262.   int $80;
  1263. end;
  1264.  
  1265. (* 91 *)
  1266. function LnxMUnmap(Start: Pointer; Length: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1267. asm
  1268.   mov eax, 91;
  1269.   mov ebx, Start;
  1270.   mov ecx, Length;
  1271.   int $80;
  1272. end;
  1273.  
  1274. (* 93 *)
  1275. function LnxFTruncate(FD, NewSize: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1276. asm
  1277.   mov eax, 93;
  1278.   mov ebx, FD;
  1279.   mov ecx, NewSize;
  1280.   int $80;
  1281. end;
  1282.  
  1283. (* 99 *)
  1284. function LnxStatFS(Path: PChar; var StatFS: TStatFS): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1285. asm
  1286.   mov eax, 99;
  1287.   mov ebx, Path;
  1288.   mov ecx, StatFS;
  1289.   int $80;
  1290. end;
  1291.  
  1292. (* 106 *)
  1293. function LnxStat(FileName: PChar; var Buffer: TStat): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1294. asm
  1295.   mov eax, 106;
  1296.   mov ebx, FileName;
  1297.   mov ecx, Buffer;
  1298.   int $80;
  1299. end;
  1300.  
  1301. (* 108 *)
  1302. function LnxFStat(FD: LongInt; var Buffer: TStat): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1303. asm
  1304.   mov eax, 108;
  1305.   mov ebx, FD;
  1306.   mov ecx, Buffer;
  1307.   int $80;
  1308. end;
  1309.  
  1310. (* 116 *)
  1311. function LnxSysInfo(var Info: TSysInfo): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1312. asm
  1313.   mov eax, 116;
  1314.   mov ebx, Info;
  1315.   int $80;
  1316. end;
  1317.  
  1318. (* 118 *)
  1319. function LnxFSync(Fd: Longint): Longint; {&uses ebx,ecx,edx,esi,edi}
  1320. asm
  1321.   mov eax, 118;
  1322.   mov ebx, Fd;
  1323.   int $80;
  1324. end;
  1325.  
  1326. (* 120 *)
  1327. function LnxClone(Child_Stack: Pointer; Flags: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1328. asm
  1329.   mov eax, 120;
  1330. //  mov ebx, Fn;
  1331.   mov ebx, Flags;
  1332.   mov ecx, Child_Stack;
  1333. //  mov edi, Args;
  1334.   int $80;
  1335. end;
  1336.  
  1337. (* 123 *)
  1338. function LnxModifyLDT(Func: LongInt; var _Ptr; ByteCount: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1339. asm
  1340.   mov eax, 123;
  1341.   mov ebx, Func;
  1342.   mov ecx, _Ptr;
  1343.   mov edx, ByteCount;
  1344.   int $80;
  1345. end;
  1346.  
  1347. (* 125 *)
  1348. function LnxMProtect(Addr: Pointer; Len, Prot: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1349. asm
  1350.   mov eax, 125;
  1351.   mov ebx, Addr;
  1352.   mov ecx, Len;
  1353.   mov edx, Prot;
  1354.   int $80;
  1355. end;
  1356.  
  1357. (* 126 *)
  1358. function LnxSigProcMask(How: LongInt; const NewSet: LongInt; var OldSet: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1359. asm
  1360.   mov eax, 126;
  1361.   mov ebx, How;
  1362.   mov ecx, NewSet;
  1363.   mov edx, OldSet;
  1364.   int $80;
  1365. end;
  1366.  
  1367. (* 143 *)
  1368. function LnxFlock(Fd, Operation: LongInt): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1369. asm
  1370.   mov eax, 143;
  1371.   mov ebx, Fd;
  1372.   mov ecx, Operation;
  1373.   int $80;
  1374. end;
  1375.  
  1376. (* 162 *)
  1377. function LnxNanoSleep(const Req: TTimeSpec; var Rem: TTimeSpec): LongInt; {&uses ebx,ecx,edx,esi,edi}
  1378. asm
  1379.   mov eax, 162;
  1380.   mov ebx, Req;
  1381.   mov ecx, Rem;
  1382.   int $80;
  1383. end;
  1384.  
  1385. (* Terminal stuff *)
  1386.  
  1387. type
  1388.   TTermInfo = record
  1389.     Buffer:     PChar;   // Compiled terminal information read from file
  1390.     OffNames:   LongInt; // Offset of terminal names section
  1391.     NumNames:   LongInt; // Number of bytes in terminal names section
  1392.     OffFlags:   LongInt; // Offset of ordinal caps section
  1393.     NumFlags:   LongInt; // Number of ordinal caps available
  1394.     OffNumbers: LongInt; // Offset of integer caps section
  1395.     NumNumbers: LongInt; // Number of integer caps available
  1396.     OffStrings: LongInt; // Offset of string caps section
  1397.     NumStrings: LongInt; // Number of string caps available
  1398.     OffValues:  LongInt; // Offset of string values section
  1399.   end;
  1400.  
  1401. var
  1402.   TermInfo: TTermInfo;
  1403.  
  1404. function TrmGetAttr(var Termios: TTermios): LongInt;
  1405. begin
  1406.   Result := LnxIOCtl(TrmHandle, TCGETS, @Termios);
  1407. end;
  1408.  
  1409. function TrmSetAttr(const Termios: TTermios): LongInt;
  1410. begin
  1411.   Result := LnxIOCtl(TrmHandle, TCSETS, @Termios);
  1412. end;
  1413.  
  1414. function TrmInit(TermName: PChar): PChar;
  1415. var
  1416.   FileName: array[0..1023] of Char;
  1417.   P: PChar;
  1418.   Handle, Actual: LongInt;
  1419. begin
  1420.   Result := nil;
  1421.  
  1422.   P := StrECopy(FileName, '/usr/lib/terminfo/');
  1423.   P[0] := TermName[0];
  1424.   P[1] := '/';
  1425.   StrLCopy(P + 2, TermName, SizeOf(FileName) - LongInt(P - FileName) - 3);
  1426.  
  1427.   Handle := LnxOpen(FileName, O_RDONLY, 0);
  1428.   if Handle < 0 then Exit;
  1429.  
  1430.   with TermInfo do
  1431.   begin
  1432.     GetMem(Buffer, 4096);
  1433.     Actual := LnxRead(Handle, Buffer^, 4096);
  1434.     LnxClose(Handle);
  1435.  
  1436.     if Actual < 0 then Exit;
  1437.  
  1438.     ReAllocMem(Buffer, Actual);
  1439.  
  1440.     NumNames   := Ord(Buffer[2]) + Ord(Buffer[3]) shl 8;
  1441.     NumFlags   := Ord(Buffer[4]) + Ord(Buffer[5]) shl 8;
  1442.     NumNumbers := Ord(Buffer[6]) + Ord(Buffer[7]) shl 8;
  1443.     NumStrings := Ord(Buffer[8]) + Ord(Buffer[9]) shl 8;
  1444.  
  1445.     OffNames   := 12;
  1446.     OffFlags   := OffNames + NumNames;
  1447.     OffNumbers := OffFlags + NumFlags;
  1448.  
  1449.     if Odd(OffNumbers) then Inc(OffNumbers);
  1450.  
  1451.     OffStrings := OffNumbers + NumNumbers * 2;
  1452.     OffValues  := OffStrings + NumStrings * 2;
  1453.  
  1454.     Result := StrScan(Buffer + OffNames, ' ');
  1455.     if Result = nil then
  1456.       Result := ''
  1457.     else
  1458.       Inc(Result);
  1459.   end;
  1460.  
  1461.   TrmHandle := LnxOpen('/dev/tty', O_RDWR, 0);
  1462. end;
  1463.  
  1464. procedure TrmDone;
  1465. begin
  1466.   if TrmHandle > 0 then LnxClose(TrmHandle);
  1467.  
  1468.   FreeMem(TermInfo.Buffer);
  1469. end;
  1470.  
  1471. function TrmGetBooleanCap(Index: LongInt): Boolean;
  1472. begin
  1473.   with TermInfo do
  1474.   begin
  1475.     if Index >= NumFlags then
  1476.       Result := False
  1477.     else
  1478.       Result := Buffer[OffFlags + Index] <> #0;
  1479.   end;
  1480. end;
  1481.  
  1482. function TrmGetIntegerCap(Index: LongInt): SmallInt;
  1483. type
  1484.   PSmallInt = ^SmallInt;
  1485. begin
  1486.   with TermInfo do
  1487.   begin
  1488.     if Index >= NumNumbers then
  1489.       Result := -1
  1490.     else
  1491.       Result := PSmallInt(@Buffer[OffNumbers + Index * 2])^;
  1492.   end;
  1493. end;
  1494.  
  1495. function TrmGetStringCap(Index: LongInt): PChar;
  1496. type
  1497.   PSmallInt = ^SmallInt;
  1498. var
  1499.   Offset: SmallInt;
  1500. begin
  1501.   with TermInfo do
  1502.   begin
  1503.     if Index >= NumStrings then
  1504.       Result := ''
  1505.     else
  1506.     begin
  1507.       Offset := PSmallInt(@Buffer[OffStrings + Index * 2])^;
  1508.       if Offset = -1 then
  1509.         Result := ''
  1510.       else
  1511.         Result := @Buffer[OffValues + Offset];
  1512.     end;
  1513.   end;
  1514. end;
  1515.  
  1516. procedure TrmControl(Format: PChar);
  1517. begin
  1518.   LnxWrite(STDOUT_FILENO, Format^, StrLen(Format));
  1519. end;
  1520.  
  1521. procedure TrmControlFmt(Format: PChar; Args: array of LongInt);
  1522. var
  1523.   BufferPtr, FormatPtr: PChar;
  1524.  
  1525.   Stack: array[0..15] of LongInt;
  1526.   StackPtr: LongInt;
  1527.  
  1528.   Digits, Value: LongInt;
  1529.  
  1530.   Condition: Boolean;
  1531.  
  1532.   Buffer: array[0..1023] of Char;
  1533.  
  1534.   procedure Push(I: LongInt);
  1535.   begin
  1536.     Inc(StackPtr);
  1537.     Stack[StackPtr] := I;
  1538.   end;
  1539.  
  1540.   function Pop: LongInt;
  1541.   begin
  1542.     Result := Stack[StackPtr];
  1543.     Dec(StackPtr);
  1544.   end;
  1545.  
  1546.   function GetInt: LongInt;
  1547.   begin
  1548.     Result := 0;
  1549.     while FormatPtr^ in ['0'..'9'] do
  1550.     begin
  1551.       Result := Result * 10 + Ord(FormatPtr^) - Ord('0');
  1552.       Inc(FormatPtr);
  1553.     end;
  1554.   end;
  1555.  
  1556.   procedure PutChar(C: Char);
  1557.   begin
  1558.     if C > ' ' then Write(C) else Write('#', Ord(C));
  1559.  
  1560.     BufferPtr^ := C;
  1561.     Inc(BufferPtr);
  1562.   end;
  1563.  
  1564.   procedure PutHex(I, Digits: LongInt);
  1565.   const
  1566.     Hex: PChar = '0123456789abcdef';
  1567.   begin
  1568.     if (I > $FFF) or (Digits > 3) then
  1569.     begin
  1570.       PutChar(Hex[I shr 12]);
  1571.       I := I and $FFF;
  1572.     end;
  1573.  
  1574.     if (I > $FF) or (Digits > 2) then
  1575.     begin
  1576.       PutChar(Hex[I shr 8]);
  1577.       I := I and $FF;
  1578.     end;
  1579.  
  1580.     if (I > $F) or (Digits > 1) then
  1581.     begin
  1582.       PutChar(Hex[I shr 4]);
  1583.       I := I and $F;
  1584.     end;
  1585.  
  1586.     PutChar(Hex[I]);
  1587.   end;
  1588.  
  1589.   procedure PutInt(I, Digits: LongInt);
  1590.   begin
  1591.     if I < 0 then
  1592.     begin
  1593.       PutChar('-');
  1594.       I := -I;
  1595.     end;
  1596.  
  1597.     if (I > 999) or (Digits > 3) then
  1598.     begin
  1599.       PutChar(Char(48 + I div 1000));
  1600.       I := I mod 1000;
  1601.     end;
  1602.  
  1603.     if (I > 99) or (Digits > 2) then
  1604.     begin
  1605.       PutChar(Char(48 + I div 100));
  1606.       I := I mod 100;
  1607.     end;
  1608.  
  1609.     if (I > 9) or (Digits > 1) then
  1610.     begin
  1611.       PutChar(Char(48 + I div 10));
  1612.       I := I mod 10;
  1613.     end;
  1614.  
  1615.     PutChar(Char(48 + I));
  1616.   end;
  1617.  
  1618.   procedure PutStr(P: PChar);
  1619.   begin
  1620.     BufferPtr := StrECopy(BufferPtr, P);
  1621.   end;
  1622.  
  1623. begin
  1624.   StackPtr := -1;
  1625.   Condition := True;
  1626.  
  1627.   FormatPtr := Format;
  1628.   BufferPtr := Buffer;
  1629.  
  1630.   while FormatPtr^ <> #0 do
  1631.   begin
  1632.     if FormatPtr^ = '%' then
  1633.     begin
  1634.       Inc(FormatPtr);
  1635.  
  1636.       Digits := GetInt;
  1637.  
  1638.       case FormatPtr^ of
  1639.         '?':
  1640.         begin
  1641.         end;
  1642.  
  1643.         't':
  1644.         begin
  1645.           Condition := (Pop <> 0);
  1646.  
  1647.           // if condition not true, then ignore this part
  1648.           if not Condition then
  1649.           begin
  1650.             Inc(FormatPtr);
  1651.             while not ((FormatPtr[0] = '%') and (FormatPtr[1] in ['e', ';'])) do
  1652.               Inc(FormatPtr);
  1653.             Inc(FormatPtr);
  1654.           end;
  1655.         end;
  1656.  
  1657.         'e':
  1658.         begin
  1659.           // if condition already true, then ignore this part
  1660.           if Condition then
  1661.           begin
  1662.             Inc(FormatPtr);
  1663.             while not ((FormatPtr[0] = '%') and (FormatPtr[1] = ';')) do
  1664.               Inc(FormatPtr);
  1665.             Inc(FormatPtr);
  1666.           end;
  1667.         end;
  1668.  
  1669.         ';':
  1670.         begin
  1671.         end;
  1672.  
  1673.         '%':
  1674.         begin
  1675.           PutChar('%');
  1676.         end;
  1677.  
  1678.         '''':
  1679.         begin
  1680.           Inc(FormatPtr);
  1681.           Push(Ord(FormatPtr^));
  1682.           Inc(FormatPtr);
  1683.         end;
  1684.  
  1685.         '{':
  1686.         begin
  1687.           Inc(FormatPtr);
  1688.           Push(GetInt);
  1689.         end;
  1690.  
  1691.         '+': Push(Pop + Pop);
  1692.         '-': begin Value := Pop; Push(Pop - Value); end;
  1693.         '*': Push(Pop * Pop);
  1694.         '/': begin Value := Pop; Push(Pop div Value); end;
  1695.         'm': begin Value := Pop; Push(Pop mod Value); end;
  1696.  
  1697.         '&': Push(Pop and Pop);
  1698.         '|': Push(Pop or Pop);
  1699.         '^': Push(Pop xor Pop);
  1700.  
  1701.         '=': Push(Ord(Pop = Pop));
  1702.         '<': Push(Ord(Pop >= Pop));
  1703.         '>': Push(Ord(Pop <= Pop));
  1704.  
  1705.         'A': Push(Ord((Pop <> 0) and (Pop <> 0)));
  1706.         'O': Push(Ord((Pop <> 0) or (Pop <> 0)));
  1707.  
  1708.         '!': Push(Ord(Pop = 0));
  1709.         '~': Push(not Pop);
  1710.  
  1711.         'd':
  1712.         begin
  1713.           PutInt(Pop, Digits);
  1714.         end;
  1715.  
  1716.         'i':
  1717.         begin
  1718.           Inc(Args[0]);
  1719.           Inc(Args[1]);
  1720.         end;
  1721.  
  1722.         'p':
  1723.         begin
  1724.           Inc(FormatPtr);
  1725.           case FormatPtr^ of
  1726.             '1'..'9':
  1727.             begin
  1728.               Push(Args[Ord(FormatPtr^) - Ord('1')]);
  1729.             end;
  1730.           else
  1731.             WriteLn('Terminal error: Illegal parameter "', FormatPtr, '"');
  1732.             Halt(255);
  1733.           end;
  1734.         end;
  1735.  
  1736.         's':
  1737.         begin
  1738.           PutStr(PChar(Pop));
  1739.         end;
  1740.  
  1741.         'x':
  1742.         begin
  1743.           PutHex(Pop, Digits);
  1744.         end;
  1745.  
  1746.       else
  1747.         WriteLn('Terminal error: Unknown terminal control sequence "%', FormatPtr^, '"');
  1748.         Halt(255);
  1749.       end;
  1750.     end
  1751.     else PutChar(FormatPtr^);
  1752.  
  1753.     Inc(FormatPtr);
  1754.   end;
  1755.  
  1756.   BufferPtr^ := #0;
  1757.  
  1758.   TrmControl(Buffer);
  1759. end;
  1760.  
  1761. function TrmRead(Buffer: PChar; Count: LongInt): LongInt;
  1762. begin
  1763.   Result := LnxRead(TrmHandle, Buffer^, Count);
  1764. end;
  1765.  
  1766. function TrmWrite(Buffer: PChar; Count: LongInt): LongInt;
  1767. begin
  1768.   Result := LnxWrite(TrmHandle, Buffer^, Count);
  1769. end;
  1770.  
  1771. (* others *)
  1772.  
  1773. (* Output a string  - not really a system call *)
  1774. procedure LnxDebug(S: ShortString);
  1775. begin
  1776.   S := S + #10;
  1777.   LnxWrite(1, S[1], Length(S));
  1778. end;
  1779.  
  1780. end.
  1781.  
  1782.  
  1783. {
  1784.   Currently unimplemeted system calls:
  1785.  
  1786.   __NR_setup              0     (* used only by init, to get system going *)
  1787.   __NR_link               9
  1788.   __NR_mknod             14
  1789.   __NR_chown             16
  1790.   __NR_oldstat           18
  1791.   __NR_mount             21
  1792.   __NR_umount            22
  1793.   __NR_setuid            23
  1794.   __NR_getuid            24
  1795.   __NR_ptrace            26
  1796.   __NR_alarm             27
  1797.   __NR_oldfstat          28
  1798.   __NR_pause             29
  1799.   __NR_stty              31
  1800.   __NR_gtty              32
  1801.   __NR_nice              34
  1802.   __NR_ftime             35
  1803.   __NR_sync              36
  1804.   __NR_dup               41
  1805.   __NR_times             43
  1806.   __NR_prof              44
  1807.   __NR_setgid            46
  1808.   __NR_getgid            47
  1809.   __NR_signal            48
  1810.   __NR_geteuid           49
  1811.   __NR_getegid           50
  1812.   __NR_acct              51
  1813.   __NR_phys              52
  1814.   __NR_lock              53
  1815.   __NR_fcntl             55
  1816.   __NR_mpx               56
  1817.   __NR_setpgid           57
  1818.   __NR_ulimit            58
  1819.   __NR_oldolduname       59
  1820.   __NR_umask             60
  1821.   __NR_chroot            61
  1822.   __NR_ustat             62
  1823.   __NR_dup2              63
  1824.   __NR_getppid           64
  1825.   __NR_getpgrp           65
  1826.   __NR_setsid            66
  1827.   __NR_sigaction                 67
  1828.   __NR_sgetmask          68
  1829.   __NR_ssetmask          69
  1830.   __NR_setreuid          70
  1831.   __NR_setregid          71
  1832.   __NR_sethostname       74
  1833.   __NR_setrlimit                 75
  1834.   __NR_getrlimit                 76
  1835.   __NR_getrusage                 77
  1836.   __NR_getgroups                 80
  1837.   __NR_setgroups                 81
  1838.   __NR_select            82
  1839.   __NR_symlink           83
  1840.   __NR_oldlstat          84
  1841.   __NR_uselib            86
  1842.   __NR_swapon            87
  1843.   __NR_reboot            88
  1844.   __NR_truncate          92
  1845.   __NR_fchmod            94
  1846.   __NR_fchown            95
  1847.   __NR_getpriority       96
  1848.   __NR_setpriority       97
  1849.   __NR_profil            98
  1850.   __NR_fstatfs          100
  1851.   __NR_ioperm           101
  1852.   __NR_socketcall               102
  1853.   __NR_syslog           103
  1854.   __NR_setitimer                104
  1855.   __NR_getitimer                105
  1856.   __NR_lstat            107
  1857.   __NR_olduname         109
  1858.   __NR_iopl             110
  1859.   __NR_vhangup          111
  1860.   __NR_idle             112
  1861.   __NR_vm86             113
  1862.   __NR_wait4            114
  1863.   __NR_swapoff          115
  1864.   __NR_ipc              117
  1865.   __NR_sigreturn                119
  1866.   __NR_setdomainname    121
  1867.   __NR_uname            122
  1868.   __NR_adjtimex         124
  1869.   __NR_create_module    127
  1870.   __NR_init_module      128
  1871.   __NR_delete_module    129
  1872.   __NR_get_kernel_syms  130
  1873.   __NR_quotactl         131
  1874.   __NR_getpgid          132
  1875.   __NR_fchdir           133
  1876.   __NR_bdflush          134
  1877.   __NR_sysfs            135
  1878.   __NR_personality      136
  1879.   __NR_afs_syscall      137 (* Syscall for Andrew File System *)
  1880.   __NR_setfsuid         138
  1881.   __NR_setfsgid         139
  1882.   __NR__llseek          140
  1883.   __NR_getdents         141
  1884.   __NR__newselect               142
  1885.   __NR_msync            144
  1886.   __NR_readv            145
  1887.   __NR_writev           146
  1888.   __NR_getsid           147
  1889.   __NR_fdatasync                148
  1890.   __NR__sysctl          149
  1891.   __NR_mlock            150
  1892.   __NR_munlock          151
  1893.   __NR_mlockall         152
  1894.   __NR_munlockall               153
  1895.   __NR_sched_setparam           154
  1896.   __NR_sched_getparam           155
  1897.   __NR_sched_setscheduler               156
  1898.   __NR_sched_getscheduler               157
  1899.   __NR_sched_yield              158
  1900.   __NR_sched_get_priority_max   159
  1901.   __NR_sched_get_priority_min   160
  1902.   __NR_sched_rr_get_interval    161
  1903.   __NR_mremap           163
  1904.   __NR_poll             168
  1905.   __NR_getpmsg          188
  1906.   __NR_putpmsg          189
  1907.  
  1908. }
  1909.  
  1910.