home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / emxtutor.zip / emxsrcd1.zip / emx / doc / system.doc
Text File  |  1998-09-03  |  52KB  |  1,308 lines

  1. ===============================================================================
  2. system.doc        emx 0.9d     SYSTEM DEVELOPER'S GUIDE             03-Sep-1998
  3. ===============================================================================
  4.                                      Copyright (c) 1990-1998 by Eberhard Mattes
  5.  
  6. DOS calls
  7. ---------
  8.  
  9. DOS calls marked [*] are not available yet under OS/2.  A DOS call is
  10. performed by loading the function number into AH, the arguments into
  11. the relevant registers and
  12.  
  13.  - issuing INT 21H under DOS
  14.  
  15.  - calling emx_syscall (ordinal 2) exported by emx.dll.
  16.  
  17.  
  18. doscall AH=01H Read keyboard and echo
  19.         In:  --
  20.         Out: AL     character
  21.         Notes: Ctrl-C generates SIGINT
  22.  
  23. doscall AH=02H Display character
  24.         In:  DL     character
  25.         Out: --
  26.         Notes: Checks for Ctrl-C under DOS
  27.  
  28. doscall AH=03H Auxiliary input [*]
  29.         In:  --
  30.         Out: AL     character
  31.         Notes: Not tested.  You should open a file called COM1 (or
  32.                similar) to get input from a serial interface
  33.  
  34. doscall AH=04H Auxiliary output [*]
  35.         In:  DL     character
  36.         Out: --
  37.         Notes: Not tested.  You should open a file called COM1 (or
  38.                similar) to send output to a serial interface
  39.  
  40. doscall AH=05H Print character [*]
  41.         In:  DL     character
  42.         Out: --
  43.         Notes: Not tested.  You should open a file called PRN to print
  44.  
  45. doscall AH=06H Direct console I/O
  46.         In:  DL     character/function:
  47.                     00H-FEH: display character
  48.                     FFH:     read keyboard
  49.         Out: for DL=FFH:
  50.                     NZ       character available (has been read)
  51.                     ZR       no character available
  52.                     AL       character
  53.              for DL=00H-FEH:
  54.                     --
  55.         Notes: Does not check for Ctrl-C under DOS
  56.  
  57. doscall AH=07H Direct console input
  58.         In:  --
  59.         Out: AL     character
  60.         Notes: Without echo, does not check for Ctrl-C under DOS
  61.  
  62. doscall AH=08H Read keyboard
  63.         In:  --
  64.         Out: AL     character
  65.         Notes: Without echo, Ctrl-C generates SIGINT
  66.  
  67. doscall AH=09H Display string [*]
  68.         In:  EDX    pointer to $ terminated string
  69.         Out: --
  70.         Notes: The $ is not displayed.  The string length must not
  71.                exceed 65531
  72.  
  73. doscall AH=0AH __cgets()  Buffered keyboard input
  74.         In:  EDX    pointer to buffer
  75.         Out: --
  76.         Notes: BYTE PTR EDX[0] must be set to the maximum number of
  77.                                characters (including terminating CR)
  78.                BYTE PTR EDX[1] is set to the number of characters
  79.                                (excluding terminating CR)
  80.                EDX+2           start of buffer
  81.                Checks for Ctrl-C.  Editing possible.  Not reentrant
  82.                (don't use in signal handler before unwinding the
  83.                exception handlers)
  84.  
  85. doscall AH=0BH Check keyboard status
  86.         In:  --
  87.         Out: AL=FFH character(s) available
  88.              AL=00H no characters available
  89.         Notes: Checks for Ctrl-C.  Not tested
  90.  
  91. doscall AH=0DH Reset disk
  92.         Note: Ignored under OS/2
  93.  
  94. doscall AH=0EH __chdrive()  Select disk
  95.         In:  DL     drive number (0=A, 1=B, ...)
  96.  
  97. doscall AH=19H __getdrive()  Get current disk
  98.         In:  --
  99.         Out: AL     current selected drive (0=A, 1=B, ...)
  100.  
  101. doscall AH=2AH Get date
  102.         In:  --
  103.         Out: CX     year (1980-2099)
  104.              DH     month (1-12)
  105.              DL     day (1-31)
  106.              AL     day of week (0=Su, 1=Mo, 2=Tu, 3=We, 4=Th, 5=Fr, 6=Sa)
  107.  
  108. doscall AH=2BH Set date [*]
  109.         In:  CX     year (1980-2099)
  110.              DH     month (1-12)
  111.              DL     day (1-31)
  112.         Out: AL=00H ok
  113.              AL=FFH date invalid
  114.         Notes: Not tested
  115.  
  116. doscall AH=2CH Get time
  117.         In:  --
  118.         Out: CH     hour (0-23)
  119.              CL     minutes (0-59)
  120.              DH     seconds (0-59)
  121.              DL     hundredths (0-99) (may be always 00H)
  122.  
  123. doscall AH=2DH Set time [*]
  124.         In:  CH     hour (0-23)
  125.              CL     minutes (0-59)
  126.              DH     seconds (0-59)
  127.              DL     hundredths (0-99)
  128.         Out: AL=00H ok
  129.              AL=FFH time invalid
  130.         Notes: Not tested
  131.  
  132. doscall AH=2EH Set/reset verify flag [*]
  133.         In:  AL=00H turn off verify
  134.              AL=01H turn on verify
  135.         Out: --
  136.         Notes: Not tested
  137.  
  138. doscall AH=30H __os_version()  Get DOS or OS/2 version number
  139.         In:  --
  140.         Out: AL     major version number
  141.              AH     minor version number
  142.              BH     OEM serial number
  143.              BL:CX  user serial number
  144.              EAX    Bits 16..31: 6D65H ("em")
  145.  
  146. doscall AH=33H Ctrl-C check [*]
  147.         In:  AL=00H get Ctrl-C checking state
  148.              AL=01H set Ctrl-C checking state
  149.              for AL=01H:
  150.                   DL=00H turn Ctrl-C checking off
  151.                   DL=01H turn Ctrl-C checking off
  152.         Out: AL=00H-01H ok
  153.              AL=FFH     error
  154.              for AL=00H:
  155.                   DL=00H Ctrl-C checking off
  156.                   DL=01H Ctrl-C checking on
  157.         Notes: Not tested.  Use signal handling instead
  158.  
  159. doscall AH=36H Get disk free space [*]
  160.         In:  DL     drive number (0=default, 1=A:, 2=B:, ...)
  161.         Out: AX=FFFFH: invalid drive number
  162.              otherwise:
  163.              AX     sectors per cluster
  164.              BX     available clusters
  165.              CX     bytes per sector
  166.              DX     clusters per drive
  167.         Notes: Not tested
  168.  
  169. doscall AH=37H __swchar()  Get/set switch character
  170.         In:  AL=00H get switch character
  171.              AL=01H set switch character [*]
  172.              For AL=01H:
  173.                   DL new switch character
  174.         Out: AL=00H Success
  175.              DL     Switch character (for AL=00H)
  176.         Note: Under OS/2, this function returns AL=0FFH (failure)
  177.  
  178. doscall AH=38H Get/set country data [*]
  179.         In:  AL=00H current country
  180.              AL=FFH BX contains country code
  181.              AL=xx  country code (00H < xx < 0FFH)
  182.              EBX    country code (for AL=FFH)
  183.              EDX    pointer to 34-byte memory area, or -1 for "set"
  184.         Out: CY     error, EAX=error number
  185.              EBX    country code
  186.  
  187. doscall AH=39H __mkdir()  Create directory
  188.         In:  EDX    path name
  189.         Out: CY     error, EAX=error number
  190.         Notes: Path name must not be longer than 65531 bytes.  Not
  191.                tested
  192.  
  193. doscall AH=3AH __rmdir()  Remove directory
  194.         In:  EDX    path name
  195.         Out: CY     error, EAX=error number
  196.         Notes: Path name must not be longer than 65531 bytes.  Not
  197.                tested
  198.  
  199. doscall AH=3BH __chdir()  Change current directory
  200.         In:  EDX    path name
  201.         Out: CY     error, EAX=error number
  202.         Notes: Path name must not be longer than 65531 bytes.  Not
  203.                tested
  204.         Bugs:  All processes share the same current directory
  205.  
  206. doscall AH=3CH Create handle
  207.         In:  EDX    path name
  208.              CX     attributes
  209.         Out: CY     error, EAX=error number
  210.              EAX    handle
  211.         Notes: Path name must not be longer than 65531 bytes
  212.  
  213. doscall AH=3DH Open handle
  214.         In:  EDX    path name
  215.              AL     access code
  216.         Out: CY     error, EAX=error number
  217.              EAX    handle
  218.         Notes: Path name must not be longer than 65531 bytes.
  219.                Access code:
  220.                   bits 0-3      access mode:
  221.                                    0000 read
  222.                                    0001 write
  223.                                    0010 read and write
  224.                   bits 4-6      sharing mode:
  225.                                    000  compatibility (same as 100 for OS/2)
  226.                                    001  deny read and write
  227.                                    010  deny write
  228.                                    011  deny read
  229.                                    100  deny none
  230.                   bit  7        file inherited by (DOS) child processes
  231.         Bugs: files are always inherited by protected mode child processes
  232.  
  233. doscall AH=3EH __close()  Close handle
  234.         In:  EBX    handle
  235.         Out: CY     error, EAX=error number
  236.  
  237. doscall AH=3FH __read()  Read handle
  238.         In:  EBX    handle
  239.              ECX    number of bytes
  240.              EDX    buffer
  241.         Out: CY     error, EAX=error number
  242.              EAX    number of bytes read
  243.  
  244. doscall AH=40H __write()  Write handle
  245.         In:  EBX    handle
  246.              ECX    number of bytes
  247.              EDX    buffer
  248.         Out: CY     error, EAX=error number
  249.              EAX    number of bytes written
  250.         Note: The behaviour of this DOS call is undefined for ECX=0: the file
  251.               may or may not get truncated
  252.  
  253. doscall AH=41H __remove()  Delete directory entry
  254.         In:  EDX    path name
  255.         Out: CY     error, EAX=error number
  256.         Notes: Path name must not be longer than 65531 bytes
  257.  
  258. doscall AH=42H _lseek()  Move file pointer
  259.         In:  AL     origin (0=beginning of file, 1=current position, 2=end)
  260.              EBX    handle
  261.              EDX    distance
  262.         Out: CY     error, EAX=error number
  263.              EAX    new position
  264.         Notes: Seeking before beginning of file isn't an error
  265.  
  266. doscall AH=43H __chmod()  Get/set file attributes
  267.         In:  AL=00H get attributes
  268.              AL=01H set attributes
  269.              CX     attributes (for AL=01H)
  270.              EDX    path name
  271.         Out: CY     error, EAX=error number
  272.              CX     attributes (for AL=00H)
  273.         Notes: Path name must not be longer than 65531 bytes
  274.  
  275. doscall AX=4400H __ioctl1()  Get IOCTL data
  276.         In:  EBX    handle
  277.         Out: CY     error, EAX=error number
  278.              EDX    device data (bit 7 = 0: file)
  279.                       Bits 0-5: drive number (0=A, 1=B, ..., always 0 for OS/2)
  280.              EDX    device data (bit 7 = 1: device or pipe (OS/2))
  281.                       Bit 0: standard input
  282.                       Bit 1: standard output
  283.                       Bit 2: null device
  284.                       Bit 3: clock device
  285.         Notes: Other bits are reserved and currently not used by the C library
  286.  
  287. doscall AX=4401H __ioctl1()  Set IOCTL data [*]
  288.         In:  EBX    handle
  289.              EDX    device data
  290.         Out: CY     error, EAX=error number
  291.         Notes: Not tested
  292.  
  293. doscall AX=4402H Send control data to character device [*]
  294. doscall AX=4403H Receive control data from character device [*]
  295.         In:  EBX    handle
  296.              ECX    number of bytes
  297.              EDX    buffer
  298.         Out: CY     error, EAX=error number
  299.              EAX    number of bytes transferred
  300.         Notes: Not tested
  301.  
  302. doscall AX=4404H Send control data to block device [*]
  303. doscall AX=4405H Receive control data from block device [*]
  304.         In:  BL     drive number (0=default, 1=A:, 2=B:, ...)
  305.              ECX    number of bytes
  306.              EDX    buffer
  307.         Out: CY     error, EAX=error number
  308.              EAX    number of bytes transferred
  309.         Notes: Not tested
  310.  
  311. doscall AX=4406H Check input status [*]
  312. doscall AX=4407H Check output status [*]
  313.         In:  EBX    handle
  314.         Out: CY     error, EAX=error number
  315.              AL=00H not ready
  316.              AL=FFH ready
  317.         Notes: Not tested
  318.  
  319. doscall AX=4408H Is changable [*]
  320.         In:  BL     drive number (0=default, 1=A:, 2=B:, ...)
  321.         Out: CY     error, EAX=error number
  322.              AX=00H changable
  323.              AX=01H not changable
  324.         Notes: Not tested
  325.  
  326. doscall AX=4409H Is redirected block device [*]
  327.         In:  BL     drive number (0=default, 1=A:, 2=B:, ...)
  328.         Out: CY     error, EAX=error number
  329.              DX     device attributes
  330.         Notes: Not tested
  331.  
  332. doscall AX=440AH Is redirected handle [*]
  333.         In:  EBX    handle
  334.         Out: CY     error, EAX=error number
  335.              DX     IOCTL bits
  336.         Notes: Not tested
  337.  
  338. doscall AX=440BH Retry [*]
  339.         In:  BX     number of retries
  340.              CX     wait time
  341.         Out: CY     error, EAX=error number
  342.         Notes: Not tested
  343.  
  344. doscall AH=45H __dup()  Duplicate file handle
  345.         In:  EBX    file handle
  346.         Out: CY     error, EAX=error number
  347.              EAX    new handle
  348.  
  349. doscall AH=46H __dup2()  Force duplicate file handle
  350.         In:  EBX    file handle (source)
  351.              ECX    file handle (destination)
  352.         Out: CY     error, EAX=error number
  353.         Notes: doesn't work under DOS
  354.  
  355. doscall AH=47H __getcwd()  Get current directory
  356.         In:  ESI    pointer to buffer (64 bytes for DOS, more for OS/2)
  357.              DL     drive number (0=default, 1=A:, 2=B:, ...)
  358.         Out: CY     error, EAX=error number
  359.  
  360. doscall AH=4CH __exit()  End process
  361.         In:  AL return code
  362.         Out: --
  363.         Notes: Never returns
  364.  
  365. doscall AH=4EH __findfirst()  Find first file
  366.         In:  EDX    path name
  367.              ESI    pointer to buffer (should be long for OS/2)
  368.              CX     attributes
  369.         Out: CY     error, EAX=error number
  370.         Notes: Automatically sets DTA to ESI
  371.                Nested searches are not supported by emx.dll to avoid
  372.                a potential handle leak
  373.  
  374. doscall AH=4FH __findnext()  Find next file
  375.         In:  ESI    pointer to buffer (filled in by function 4EH)
  376.         Out: CY     error, EAX=error number
  377.         Notes: Automatically sets DTA to ESI
  378.  
  379. doscall AH=54H Get verify state [*]
  380.         In:  --
  381.         Out: AL=00H no verify after write
  382.              AL=01H verify after write
  383.         Notes: Not tested
  384.  
  385. doscall AH=56H __rename()  Change directory entry
  386.         In:  EDX    pointer to first path name
  387.              EDI    pointer to second path name
  388.         Out: CY     error, EAX=error number
  389.         Notes: Path names must not be longer than 32763 bytes
  390.  
  391. doscall AH=57H Get/set date/time of file
  392.         In:  AL=00H get date and time
  393.              AL=01H set date and time [*]
  394.              EBX    handle
  395.              CX     time (for AL=01H)
  396.              DX     date (for AL=01H)
  397.         Out: CY     error, EAX=error number
  398.              CX     time (for AL=00H)
  399.              DX     date (for AL=00H)
  400.         Notes: CX, bits 0..4:   seconds / 2
  401.                CX, bits 5..10:  minutes
  402.                CX, bits 11..15: hours
  403.                DX, bits 0..4:   day
  404.                DX, bits 5..9:   month
  405.                DX, bits 10..15: year - 1980
  406.  
  407. doscall AH=58H Get/set allocation strategy [*]
  408.         Note: See DOS manual
  409.  
  410. doscall AH=59H Get extended error [*]
  411.         Note: See DOS manual
  412.  
  413. doscall AH=5AH Create temporary file [*]
  414.         In:  CX     attributes
  415.              EDX    pointer to path name (followed by a byte of 0 and
  416.                     13 bytes of memory)
  417.         Out: CY     error, EAX=error number
  418.              EAX    handle
  419.         Notes: Path name must not be longer than 65531 bytes
  420.  
  421. doscall AH=5BH Create new file [*]
  422.         In:  CX     attributes
  423.              EDX    pointer to path name
  424.         Out: CY     error, EAX=error number
  425.              EAX    handle
  426.         Notes: Path name must not be longer than 65531 bytes.  Not
  427.                tested
  428.  
  429. doscall AH=5CH Lock/unlock [*]
  430.         In:  AL=00H lock
  431.              AL=01H unlock
  432.              EBX    handle
  433.              EDX    offset
  434.              EDI    length
  435.         Out: CY     error, EAX=error number
  436.  
  437. doscall AH=60H Canonicalize filename or path [*]
  438.         In:  ESI    input path name
  439.              EDI    output buffer
  440.         Out: CY     error, EAX=error number
  441.  
  442. doscall AH=66H Get/set global codepage table [*]
  443.         In:  AL=01H get global codepage table
  444.              AL=02H set global codepage table
  445.              EBX    active code page (for AL=02H)
  446.              EDX    system code page (for AL=02H)
  447.         Out: CY     error, EAX=error number
  448.              EBX    active code page (for AL=01H)
  449.              EDX    system code page (for AL=01H)
  450.  
  451. doscall AH=67H Set handle count [*]
  452.         In:  EBX    number of handles
  453.         Out: CY     error, EAX=error number
  454.  
  455. doscall AH=68H Commit file [*]
  456.         In:  EBX    handle
  457.         Out: CY     error, EAX=error number
  458.  
  459. doscall AH=6AH Commit file [*]
  460.         In:  EBX    handle
  461.         Out: CY     error, EAX=error number
  462.  
  463. doscall AH=6CH Extended open/create [*]
  464.         In:  AL=00H
  465.              BL     open mode
  466.              BH     flags
  467.              CX     attribute
  468.              DL     action
  469.              DH=00H
  470.              ESI    path name
  471.         Out: CY     error, EAX=error number
  472.              EAX    handle
  473.              ECX    status
  474.  
  475.  
  476. System calls
  477. ------------
  478.  
  479. A system call is performed by loading 7FH into AH, the function number
  480. into AL, the arguments into the relevant registers and
  481.  
  482.  - issuing INT 21H under DOS
  483.  
  484.  - calling emx_syscall (ordinal 2) exported by emx.dll.
  485.  
  486.  
  487. syscall AL=00H __sbrk()
  488.         In:  EDX    value added to current break value
  489.         Out: EAX    previous break value, -1 if error
  490.  
  491. syscall AL=01H __brk()
  492.         In:  EDX    new break value
  493.         Out: EAX=0  ok
  494.              EAX=-1 error
  495.  
  496. syscall AL=02H __ulimit()
  497.         In:  ECX=3  UL_GMEMLIM  Get greatest possible break value
  498.              ECX=81 UL_OBJREST  Get remaining bytes in current heap object
  499.              EDX    new limit (currently ignored)
  500.         Out: EAX    return value
  501.              ECX    errno, if non-zero
  502.  
  503. syscall AL=03H __vmstat()
  504.         In:  EBX    pointer to buffer (2 DWORDs)
  505.              ECX    size of buffer (bytes)
  506.         Out: --
  507.         Notes: Not tested.  At most ECX/4 DWORDs will be filled in
  508.         Buffer layout:
  509.              DWORD  number of page faults caused by this process
  510.              DWORD  total number of page faults
  511.  
  512. syscall AL=04H __umask1()
  513.         In:  EDX    file permission mask
  514.         Out: EAX    previous file permission mask
  515.         Note: This file permission mask is not used -- obsolete
  516.  
  517. syscall AL=05H __getpid()
  518.         In:  --
  519.         Out: EAX    process id
  520.  
  521. syscall AL=06H __spawnve()
  522.         In:  EDX    pointer to parameter block
  523.         Out: CY     error
  524.              EAX    error number (CY)
  525.              EAX    process id (NC, asynchronous process)
  526.              EAX    return code (NC, synchronous process)
  527.              NC     ok, EAX=process id
  528.         Parameter block:
  529.             DWORD   pointer to arguments (offset)
  530.             DWORD   pointer to environment (offset)
  531.             DWORD   pointer to file name (offset)
  532.             WORD    pointer to arguments (selector)
  533.             WORD    pointer to environment (selector)
  534.             WORD    pointer to file name (selector)
  535.             WORD    number of arguments
  536.             WORD    size of arguments
  537.             WORD    number of environment strings
  538.             WORD    size of environment
  539.             WORD    mode (lower 8 bits):
  540.                         0 P_WAIT        spawn child, wait til terminated
  541.                         1 P_NOWAIT      not implemented yet
  542.                         2 P_OVERLAY     exec child, kill current process
  543.                         3 P_DEBUG       debug child, use with ptrace()
  544.                         4 P_SESSION     run in separate session
  545.                         5 P_DETACH      detached
  546.                         6 P_PM          run as PM program
  547.                     flags (upper 8 bits):
  548.                         Bit 8-10:       0000=P_DEFAULT    0011=P_FULLSCREEN   
  549.                                         0001=P_MINIMIZE   0100=P_WINDOWED
  550.                                         0010=P_MAXIMIZE
  551.                         Bit 12:         P_BACKGROUND
  552.                         Bit 13:         P_NOCLOSE
  553.                         Bit 14:         P_NOSESSION
  554.                         Bit 15:         there's another WORD of flag bits
  555.             WORD   optional, more flag bits (continued from previous word),
  556.                    only present if bit 15 of the previous WORD is set:
  557.                         Bit 16:         P_QUOTE
  558.                         Bit 17:         P_TILDE
  559.                         Bit 18:         P_DEBUGDESC
  560.         Error codes:
  561.             EAGAIN  too many processes
  562.             ENOENT  file not found
  563.             ENOEXEC invalid program file
  564.             ENOMEM  out of memory
  565.             EINVAL  invalid argument (invalid mode)
  566.             E2BIG   arguments or environment too big
  567.         Notes: `arguments' contains all the program arguments, delimited
  568.                 by zeros and preceded by a flags byte (usually 80H), e.g.,
  569.                     DB  80H, "name", 0, 80H, "arg1", 0, 80H, "arg2", 0
  570.                 `environment' contains the environment strings, delimited
  571.                 by zeros, an additional byte of zeros at the end, e.g.,
  572.                     DB  "PATH=C:\", 0, "EMXPATH=C:\EMX\BIN", 0, 0
  573.                 The `size' variables must include all the bytes of zeros.
  574.                 This function ignores the EMXPATH and PATH environment
  575.                 variables.  Currently, DOS programs don't get the
  576.                 environment given in the parameter block -- they inherit the
  577.                 environment of emx
  578.  
  579. syscall AL=07H
  580.         Note: Used by RSX
  581.  
  582. syscall AL=08H __ptrace()
  583.         In:  EBX    request code
  584.              EDI    process id of child (or lower word=PID, upper word=TID)
  585.              EDX    address
  586.              ECX    data
  587.         Out: EAX    result.  -1 if error (or if PEEKed -1)
  588.              ECX    errno.  Zero if no error
  589.         Request codes (cf. /emx/include/sys/ptrace.h):
  590.              0  PTRACE_TRACEME   not used by emx
  591.              1  PTRACE_PEEKTEXT  return the word at text address EDX
  592.              2  PTRACE_PEEKDATA  return the word at data address EDX
  593.              3  PTRACE_PEEKUSER  return the word at user block address EDX
  594.              4  PTRACE_POKETEXT  write ECX to text address EDX
  595.              5  PTRACE_POKEDATA  write ECX to data address EDX
  596.              6  PTRACE_POKEUSER  write ECX to user block address EDX
  597.              7  PTRACE_RESUME    resume process (with signal ECX)
  598.              8  PTRACE_EXIT      terminate process
  599.              9  PTRACE_STEP      execute one instruction (with signal ECX)
  600.             10  PTRACE_SESSION   session switching
  601.             11  PTRACE_NOTIFICATION  obtain a notification (ECX bytes at EDX)
  602.             12  PTRACE_CONT      continue after notification
  603.             13  PTRACE_THAW      thaw (enable) a thread
  604.             14  PTRACE_FREEZE    freeze (disable) a thread
  605.             15  PTRACE_ATTACH    attach to a descendant
  606.             16  PTRACE_DETACH    detach from a descendant
  607.  
  608.         Addresses in the user block (cf. /emx/include/sys/user.h):
  609.             48  u_ar0: this variable points to the registers after subtracting
  610.                 0E0000000H
  611.             52  u_fpvalid: the first byte is non-zero if the floating-point
  612.                 state is valid
  613.             56  u_fpstate: floating point state, 108 bytes
  614.            164  u_fpstatus: currently always 0 (used for exceptions?)
  615.         Addresses of registers relative to u_ar0 - 0E0000000H
  616.         (cf. /emx/include/sys/reg.h):
  617.              0  GS          20 ESI         40 ECX         60 CS
  618.              4  FS          24 EBP         44 EAX         64 EFLAGS
  619.              8  ES          28 n/a         48 n/a         68 ESP
  620.             12  DS          32 EBX         52 ERRCD       72 SS
  621.             16  EDI         36 EDX         56 EIP
  622.         Notes: There is no difference between text and data addresses.
  623.                If there is no process with ID EDI or if the process
  624.                exists but isn't tracable, 3 (ESRCH) will be returned
  625.                ECX.  All other errors (address out of range, invalid
  626.                request code) return 5 (EIO) in ECX.  PTRACE_TRACEME is
  627.                not implemented, cf. spawnve().  Only the registers
  628.                EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EIP and some
  629.                bits of EFLAGS can be changed.  PTRACE_POKEUSER is
  630.                ignored for other addresses.  The floating point state
  631.                consists of 27 32-bit integers, see 387 reference
  632.                manual.
  633.  
  634. syscall AL=09H __wait()
  635.         In:  --
  636.         Out: EAX    process ID (-1 if no children)
  637.              ECX    errno (0 if no error)
  638.              EDX    termination status:
  639.                       DL=7FH, DH=signal number   process stopped
  640.                       DL=00H, DH=return code     process terminated: exit()
  641.                       DL=signal number, DH=00H   process terminated: signal
  642.                                                  (not implemented)
  643.         Notes: wait() is currently implemented for processes started
  644.                with P_DEBUG and running under control of ptrace().
  645.                Under OS/2, wait() is also implemented for all other
  646.                types of processes started under control of emx by the
  647.                process.  See AX=7F0CH for signal numbers
  648.  
  649. syscall AL=0AH Get emx version
  650.         In:  --
  651.         Out: EAX    version number
  652.                       Bits 0..7:    version letter ("a".."z")
  653.                       Bits 8..15:   minor version number ("0".."9")
  654.                       Bits 16..23:  2EH (".")
  655.                       Bits 24..31:  major version number ("0".."9")
  656.                     Example: 2.3e  -> EAX = "2.3e" = 322E3365H
  657.              EBX    environment:
  658.                       Bit 0:        VCPI
  659.                       Bit 1:        XMS
  660.                       Bit 2:        VDISK.SYS 3.3
  661.                       Bit 3:        DESQview
  662.                       Bit 4:        287
  663.                       Bit 5:        387
  664.                       Bit 6:        486      (not implemented)
  665.                       Bit 7:        DPMI 0.9 (not implemented)
  666.                       Bit 8:        DPMI 1.0 (not implemented)
  667.                       Bit 9:        OS/2
  668.                       Bit 10:       -t option given
  669.                       Bit 11:       Data executable (-ac option)
  670.                       Bit 12:       RSX
  671.              ECX    revision index
  672.              EDX    0 (reserved for future expansion)
  673.         Note: The version number returned in EAX is suitable for
  674.               comparing, but not for printing without swapping bytes.
  675.               The 387 bit is always set under OS/2.
  676.  
  677. syscall AL=0BH Available memory
  678.         In:  --
  679.         Out: EAX    number of available 4K pages of memory
  680.         Note: This function returns the amount of memory available
  681.               without resorting to swapping
  682.  
  683. syscall AL=0CH __signal()  set signal handler
  684.         In:  ECX    signal number
  685.              EDX    address of signal handler or SIG_IGN, SIG_DFL, SIG_ACK
  686.         Out: EAX=-1 error
  687.              EAX    address of previous signal handler
  688.         Signal numbers:
  689.               1     SIGHUP   hangup                         (not implemented)
  690.               2     SIGINT   interrupt (Ctrl-C)
  691.               3     SIGQUIT  quit                           (only for raise())
  692.               4     SIGILL   illegal instruction            (only for ptrace())
  693.               5     SIGTRAP  single step (debugging)        (only for ptrace())
  694.               6     SIGABRT  abort()
  695.               7     SIGEMT   EMT instruction                (not implemented)
  696.               8     SIGFPE   floating point                 (only for ptrace())
  697.               9     SIGKILL  kill                           (not implemented)
  698.              11     SIGSEGV  segmentation fault             (only for ptrace())
  699.              12     SIGSYS   invalid argument to syscall    (not implemented)
  700.              13     SIGPIPE  broken pipe
  701.              14     SIGALRM  alarm
  702.              15     SIGTERM  termination, process killed
  703.              16     SIGUSR1  user-defined signal #1
  704.              17     SIGUSR2  user-defined signal #2
  705.              18     SIGCLD   status for child process available
  706.              21     SIGBREAK break (Ctrl-Break)             (see notes)
  707.         Special signal handler values:
  708.              0      SIG_DFL  default signal handler (see notes)
  709.              1      SIG_IGN  ignore signal
  710.              4      SIG_ACK  unblock the signal (for SA_ACK)
  711.  
  712.         Notes: Both Ctrl-C and Ctrl-Break generate SIGINT.  An
  713.                application program can raise SIGBREAK.  The default
  714.                handler for SIGINT and SIGBREAK displays `Program
  715.                stopped' and exits to DOS with return code 3.  The
  716.                default handler for SIGTERM exits to DOS with return
  717.                code 3.  SIGTERM is not implemented for OS/2.  The
  718.                default handler for SIGQUIT creates a core dump file
  719.                and exits to DOS
  720.  
  721. syscall AL=0DH __kill()  send signal to a process
  722.         In:  ECX    signal number, see __signal()
  723.              EDX    process ID
  724.         Out: EAX=0  ok
  725.              EAX=-1 error
  726.              ECX    errno [0.8d]
  727.         Notes: Under DOS, this function currently does not switch
  728.                processes.  Only SIGINT and SIGBREAK can be sent to any
  729.                process.  A process can send SIGQUIT only to itself.
  730.                Almost not tested under DOS
  731.  
  732. syscall AL=0EH __raise()  raise a signal
  733.         In:  ECX    signal number, see __signal()
  734.         Out: EAX=0  ok
  735.              EAX=-1 error
  736.              ECX    errno [0.8d]
  737.  
  738. syscall AL=0FH __uflags()  set flags
  739.         In:  ECX    mask (only bits set to 1 in ECX will be changed)
  740.              EDX    new values of the bits selected by ECX
  741.         Out: EAX    old flags
  742.         Bits:
  743.              0-1    signal() semantics
  744.                            00   emx (SIG_ACK)
  745.                            01   System V
  746.                            10   BSD
  747.              2-3    __sbrk() behavior
  748.                            00   always returns contiguous memory (limits size)
  749.                            01   may return non-contiguous memory, monotonous
  750.                            10   may return non-contiguous memory, arbitrary
  751.  
  752.         NOTE: All bits are zero initially
  753.  
  754. syscall AL=10H __unwind()  unwind signal handlers
  755.         In:  --
  756.         Out: --
  757.         Note: This must be used if a signal handler decides not to
  758.               return and to use longjmp() instead.  This is required
  759.               if the signal handler restores the stack frame of
  760.               another function.
  761.  
  762. syscall AL=11H __core()  write a core image file
  763.         In:  EBX    file handle
  764.         Out: CY     failed
  765.              EAX    errno (0 if successful)
  766.  
  767. syscall AL=12H __portaccess()  Enable access to I/O ports
  768.         In:  ECX    first port number (0..3FFH)
  769.              EDX    last port number (0..3FFH)
  770.         Out: CY     failed
  771.              EAX    errno (0 if successful)
  772.         Notes: The -ai option must be used to enable _portaccess.  The
  773.                ports are enabled for *all* processes run by the
  774.                current instance of emx.  You cannot disable access to
  775.                ports after enabling access
  776.  
  777. syscall AL=13H __memaccess()  Enable access to memory
  778.         In:  EBX    first address (0..0FF000H)
  779.              ECX    last address (0FFFH..0FFFFFH)
  780.              EDX    0: read access, 1:write access
  781.         Out: CY     failed
  782.              EAX    errno if failed (CY)
  783.              EAX    pointer to start of mapped memory area (NC)
  784.         Notes: The -am option must be used to enable _memaccess.  The
  785.                first address must be page aligned, the last address +
  786.                1 must be page aligned.  For write access, the -aw
  787.                option must be used.  If the address range is entirely
  788.                in the range 0A0000H..0BFFFFH, read and write access is
  789.                also granted without -aw.  Otherwise, only read access
  790.                is granted.  The address given are physical addresses,
  791.                that is, if a memory manager remaps low memory, you
  792.                lose
  793.  
  794. syscall AL=14H __ioctl2()  Unix-like ioctl()
  795.         In:  EBX    handle
  796.              ECX    request code
  797.              EDX    argument
  798.         Out: EAX    return value
  799.              ECX    errno, if non-zero
  800.  
  801. syscall AL=15H __alarm()  Set alarm clock
  802.         In:  EDX    seconds
  803.         Out: EAX    time remaining before setting new value
  804.         Note: While in DOS, SIGALRM is blocked.  SIGALRM will be delivered
  805.               after return from DOS
  806.  
  807. syscall AL=16H Used internally for polling the keyboard
  808.         Note: Cannot be called by user program
  809.  
  810. syscall AL=17H __sleep()  Suspend process
  811.         In:  EDX    seconds
  812.         Out: EAX    number of remaining seconds if interrupted by signal
  813.  
  814. syscall AL=18H __chsize()  Change size of file
  815.         In:  EBX    file handle
  816.              EDX    file size (bytes)
  817.         Out: CY     failed
  818.              EAX    errno (0 if successful)
  819.         Note: The position of the file pointer is undefined after
  820.               calling this function.  Bytes appended are undefined
  821.  
  822. syscall AL=19H __fcntl()  Unix-like fcntl()
  823.         In:  EBX    handle
  824.              ECX    request code
  825.              EDX    argument
  826.         Out: EAX    return value
  827.              ECX    errno, if non-zero
  828.         Notes: O_NDELAY is only implemented for handle 0, if refers to
  829.                the keyboard and is not in ICANON mode.  O_GETFD and
  830.                O_SETFD are implemented partially under DOS.  O_SETFL
  831.                is implemented for termio on handle 0 only.  No other
  832.                request codes are implemented.  Parts of fcntl() are
  833.                implemented in the C library
  834.  
  835. syscall AL=1AH __pipe()  Create unnamed pipe
  836.         In:  ECX    pipe size (bytes)
  837.              EDX    pointer to storage for two handles (two DWORDs)
  838.         Out: EAX    0 (success) or -1 (failure)
  839.              ECX    errno (0 if successful)
  840.         Note: Not implemented under DOS
  841.  
  842. syscall AL=1BH __fsync()  Upate file system
  843.         In:  EBX    file handle
  844.         Out: EAX    0 (success) or -1 (failure)
  845.              ECX    errno (0 if successful)
  846.         Note: Not implemented under DOS
  847.  
  848. syscall AL=1CH __fork()  Duplicate process
  849.         In:  --
  850.         Out: EAX    process ID or 0 (in new process) or -1 (failure)
  851.              ECX    errno (0 if successful)
  852.         Note: Not implemented
  853.  
  854. syscall AL=1DH __scrsize()  Get number of rows and columns
  855.         In:  EDX    pointer to structure
  856.         Out: --     (first word set to number of columns (width), second
  857.                     word set to number of rows (height))
  858.  
  859. syscall AL=1EH __select()  Synchronous I/O multiplexing
  860.         In:  EDX    pointer to structure
  861.         Out: EAX    0 (timeout), > 0 (ready) or -1 (failure)
  862.              ECX    errno (0 if successful)
  863.  
  864. syscall AL=1FH __syserrno()  Get last error code
  865.         In:  --
  866.         Out: EAX    OS/2 or DOS error code for last syscall of this thread
  867.         Notes: Not implemented under DOS
  868.  
  869. syscall AL=20H __stat()  Get information about a path name
  870.         In:  EDX    path name
  871.              EDI    pointer to structure
  872.         Out: EAX    0 (ok), -1 (error)
  873.              ECX    errno (0 if successful)
  874.         Note: Not implemented under DOS
  875.  
  876. syscall AL=21H __fstat()  Get information about an open file
  877.         In:  EBX    file handle
  878.              EDI    pointer to structure
  879.         Out: EAX    0 (ok), -1 (error)
  880.              ECX    errno (0 if successful)
  881.         Note: Not implemented under DOS
  882.  
  883. syscall AL=23H __filesys()  Get name of file-system driver
  884.         In:  EDX    pointer to drive name
  885.              EDI    pointer to output buffer
  886.              ECX    size of output buffer
  887.         Out: EAX    0 (ok), -1 (error)
  888.              ECX    errno (0 if successful)
  889.         Note: File-system driver names include FAT, HPFS, LAN, CDFS, NFS
  890.  
  891. syscall AL=24H __utimes()  Set access and modification time of a file
  892.         In:  EDX    pointer to path name
  893.              ESI    pointer to array of structures
  894.         Out: EAX    0 (ok), -1 (error)
  895.              ECX    errno (0 if successful)
  896.         Notes: The first element of the array is the access time, the
  897.                second element is the modification time.  The
  898.                structures contain two fields:
  899.                  - the number of seconds elapsed since 00:00 01-Jan-1970
  900.                    (local time)
  901.                  - milliseconds.
  902.                The milliseconds field is ignored.
  903.  
  904. syscall AL=25H  __ftruncate()  Truncate a file
  905.         In:  EBX    file handle
  906.              EDX    file size (bytes)
  907.         Out: EAX    0 (ok), -1 (error)
  908.              ECX    errno (0 if successful)
  909.         Notes: The position of the file pointer is undefined after
  910.                calling this function.  __ftruncate() doesn't increase
  911.                the size of a file
  912.  
  913. syscall AL=26H  __clock()  Processor time
  914.         In:  ---
  915.         Out: EAX timer ticks of processor time used, low-order 32 bits
  916.              EDX high-order 32 bits
  917.         Note: Returns time elapsed, not CPU time.  There are 100 timer
  918.               ticks per second.
  919.  
  920. syscall AL=27H  __ftime()  Get current time
  921.         In:  EDX pointer to structure
  922.  
  923. syscall AL=28H __umask()  Set file permission mask
  924.         In:  EDX    file permission mask
  925.         Out: EAX    previous file permission mask
  926.  
  927. syscall AL=29H __getppid()  Get parent process ID
  928.         In:  --
  929.         Out: EAX    parent process id
  930.  
  931. syscall AL=2AH __nls_memupr()  Convert buffer to upper case
  932.         In:  EDX    pointer to buffer
  933.              ECX    size of buffer
  934.  
  935. syscall AL=2BH __open()  Open a file
  936.         In:  EDX    pointer to path name
  937.              ECX    flags (attributes, sharing mode, create)
  938.              EBX    initial size (ignored unless _SO_SIZE is set)
  939.         Out: EAX    handle (success), -1 (failure)
  940.              ECX    errno (0 if successful)
  941.         Notes: Path name must not be longer than 65531 bytes.  Bits
  942.                0..7 of ECX contain the sharing mode, bits 8..15
  943.                contain the attributes, the remaining bits contain
  944.                additional flags:
  945.  
  946.                bit 16  _SO_CREAT      Create file if it doesn't exist
  947.                bit 17  _SO_EXCL       Fail if file exists and _SO_CREAT is set
  948.                bit 18  _SO_TRUNC      Truncate file
  949.                bit 19  _SO_NOINHERIT  Children don't inherit this handle
  950.                bit 20  _SO_SYNC       Write through
  951.                bit 21  _SO_SIZE       Set inital size (EBX)
  952.  
  953. syscall AL=2CH __newthread()  Notify emx of new thread
  954.         In:  EDX    thread ID
  955.         Out: EAX    0 (success), -1 (failure)
  956.              ECX    errno (0 if successful)
  957.  
  958. syscall AL=2DH __endthread()  Notify emx of end of thread
  959.         In:  EDX    thread ID
  960.         Out: EAX    0 (success), -1 (failure)
  961.              ECX    errno (0 if successful)
  962.  
  963. syscall AL=2EH __waitpid()
  964.         In:  EDX    pid
  965.              ECX    options (WNOHANG)
  966.         Out: EAX    process ID (-1 if no children, 0 if it would block)
  967.              ECX    errno (0 if no error)
  968.              EDX    termination status, see wait()
  969.         Note: __waitpid() is not implemented under DOS
  970.  
  971. syscall AL=2FH __read_kbd()
  972.         In:  EDX    flags (bit 0: echo, bit 1: wait, bit 2:sig)
  973.         Out: EAX    character (or -1)
  974.  
  975. syscall AL=30H __sleep2()  Suspend process
  976.         In:  EDX    milliseconds
  977.         Out: EAX    0
  978.  
  979. syscall AL=31H __unwind2()  Unwind signal handlers
  980.         In:  EDX    exception handler chain
  981.         Out: --
  982.         Note: This must be used if a signal handler decides not to
  983.               return and to use longjmp() instead.  This is required
  984.               if the signal handler restores the stack frame of
  985.               another function.
  986.  
  987. syscall AL=32H __pause()  Wait for signal
  988.         In:  --
  989.         Out: --
  990.         Note: __pause() is not implemented under DOS
  991.  
  992. syscall AL=33H __execname()  Get the name of the executable file
  993.         In:  EDX    pointer to buffer
  994.              ECX    size of buffer
  995.         Out: EAX    0 (success), -1 (failure)
  996.  
  997. syscall AL=34H __initthread()  Install exception handler in new thread
  998.         In:  EDX    pointer to EXCEPTIONREGISTRATIONRECORD
  999.         Out: EAX    0 (success), -1 (failure)
  1000.  
  1001. syscall AL=35H __sigaction()  Examine or specify action for a signal
  1002.         In:  ECX    signal number
  1003.              EDX    pointer to sigaction structure (input)
  1004.              EBX    pointer to sigaction structure (output)
  1005.         Out: EAX    0 (success), -1 (failure)
  1006.              ECX    errno (0 if no error)
  1007.         Note: POSIX.1
  1008.  
  1009. syscall AL=36H __sigpending()  Query set of pending signals
  1010.         In:  EDX    pointer to sigset_t (output)
  1011.         Out: EAX    0 (success), -1 (failure)
  1012.              ECX    errno (0 if no error)
  1013.         Note: POSIX.1
  1014.  
  1015. syscall AL=37H __sigprocmask()  Examine or change the signal mask
  1016.         In:  ECX    manner in which to set the mask
  1017.              EDX    pointer to sigset_t (input)
  1018.              EBX    pointer to sigset_t (output)
  1019.         Out: EAX    0 (success), -1 (failure)
  1020.              ECX    errno (0 if no error)
  1021.         Note: POSIX.1
  1022.  
  1023. syscall AL=38H __sigsuspend()  Replace signal mask and wait for signal
  1024.         In:  EDX    pointer to sigset_t (input)
  1025.         Out: EAX    -1 (failure)
  1026.              ECX    errno (EINTR)
  1027.         Notes: POSIX.1.  Not yet implemented under DOS
  1028.  
  1029. syscall AL=39H __imphandle()  Import an OS/2 file handle
  1030.         In:  EDX    OS/2 file handle
  1031.         Out: EAX    relocated file handle (success), -1 (failure)
  1032.              ECX    errno (0 if no error)
  1033.         Note: Not implemented under DOS (ENOSYS)
  1034.  
  1035. syscall AL=3AH __fpuemu()  Interface for floating point unit emulator
  1036.         In:  ECX    Command code
  1037.              EDX    Pointer to communication area
  1038.         Out: EAX    0 (success), -1 (failure)
  1039.         Communication area:
  1040.             DWORD   Notification code
  1041.             DWORD   Process number (zero-based, not the PID!)
  1042.             DWORD   Signal number
  1043.             WORD    GS
  1044.             WORD    FS
  1045.             WORD    ES
  1046.             WORD    DS
  1047.             DWORD   EDI
  1048.             DWORD   ESI
  1049.             DWORD   EBP
  1050.             DWORD   ESP (kernel)
  1051.             DWORD   EBX
  1052.             DWORD   EDX
  1053.             DWORD   ECX
  1054.             DWORD   EAX
  1055.             DWORD   ERRCD
  1056.             DWORD   EIP
  1057.             DWORD   CS
  1058.             DWORD   EFLAGS
  1059.             DWORD   ESP
  1060.             DWORD   SS
  1061.         Commmand codes:
  1062.             0       Initialization (register as floating point emulator)
  1063.             1       Get next notification
  1064.             2       Raise signal
  1065.         Notification codes:
  1066.             0       New application process started
  1067.             1       Application process terminated (not yet fully implemented)
  1068.             2       Emulate a floating-point instruction
  1069.         Note: The client process' memory space is addressed with the
  1070.               FS register
  1071.  
  1072. syscall AL=3BH __getsockhandle()  Return the TCP/IP handle of a socket
  1073.         In:  EBX    File handle
  1074.         Out: EAX    handle (success), -1 (failure)
  1075.              ECX    errno (0 if no error)
  1076.  
  1077. syscall AL=3CH __socket()  Create a socket
  1078.         In:  ECX    Domain
  1079.              EDX    Type
  1080.              EBX    Protocol
  1081.         Out: EAX    handle (success), -1 (failure)
  1082.              ECX    errno (0 if no error)
  1083.  
  1084. syscall AL=3DH __bind()  Bind a name to a socket
  1085.         In:  EBX    File handle
  1086.              EDX    Pointer to address
  1087.              ECX    Size of address
  1088.         Out: EAX    0 (success), -1 (failure)
  1089.              ECX    errno (0 if no error)
  1090.  
  1091. syscall AL=3EH __listen()  Listen for connections on a socket
  1092.         In:  EBX    File handle
  1093.              EDX    backlog
  1094.         Out: EAX    0 (success), -1 (failure)
  1095.              ECX    errno (0 if no error)
  1096.  
  1097. syscall AL=3FH __recv()  Receive a message from a socket
  1098.         In:  EBX    File handle
  1099.              EDX    Pointer to buffer
  1100.              ECX    Size of buffer
  1101.              ESI    Flags
  1102.         Out: EAX    number of bytes (success), -1 (failure)
  1103.              ECX    errno (0 if no error)
  1104.  
  1105. syscall AL=40H __send()  Send a message to a socket
  1106.         In:  EBX    File handle
  1107.              EDX    Pointer to buffer
  1108.              ECX    Size of buffer
  1109.              ESI    Flags
  1110.         Out: EAX    number of bytes (success), -1 (failure)
  1111.              ECX    errno (0 if no error)
  1112.  
  1113. syscall AL=41H __accept()  Accept a connection on a socket
  1114.         In:  EBX    File handle
  1115.              EDX    Pointer to address
  1116.              ECX    Pointer to size of address
  1117.         Out: EAX    handle (success), -1 (failure)
  1118.              ECX    errno (0 if no error)
  1119.  
  1120. syscall AL=42H __connect()  Initiate a connection on a socket
  1121.         In:  EBX    File handle
  1122.              EDX    Pointer to address
  1123.              ECX    Size of address
  1124.         Out: EAX    0 (success), -1 (failure)
  1125.              ECX    errno (0 if no error)
  1126.  
  1127. syscall AL=43H __getsockopt()  Get options on a socket
  1128.         In:  EBX    File handle
  1129.              EDX    Level
  1130.              ECX    Option name
  1131.              ESI    Pointer to option value
  1132.              EDI    Pointer to option length
  1133.         Out: EAX    0 (success), -1 (failure)
  1134.              ECX    errno (0 if no error)
  1135.  
  1136. syscall AL=44H __setsockopt()  Set options on a socket
  1137.         In:  EBX    File handle
  1138.              EDX    Level
  1139.              ECX    Option name
  1140.              ESI    Pointer to option value
  1141.              EDI    Option length
  1142.         Out: EAX    0 (success), -1 (failure)
  1143.              ECX    errno (0 if no error)
  1144.  
  1145. syscall AL=45H __getsockname()  Get socket name
  1146.         In:  EBX    File handle
  1147.              EDX    Pointer to name
  1148.              ECX    Pointer to length
  1149.         Out: EAX    0 (success), -1 (failure)
  1150.              ECX    errno (0 if no error)
  1151.  
  1152. syscall AL=46H __getpeername()  Get name of connected peer
  1153.         In:  EBX    File handle
  1154.              EDX    Pointer to name
  1155.              ECX    Pointer to length
  1156.         Out: EAX    0 (success), -1 (failure)
  1157.              ECX    errno (0 if no error)
  1158.  
  1159. syscall AL=47H __gethostbyname()  Get network host entry by name
  1160.         In:  EDX    Pointer to name
  1161.              EBX    Pointer to result
  1162.         Out: EAX    0 (success), -1 (failure)
  1163.              ECX    errno (0 if no error)
  1164.         Note: h_errno is passed in errno
  1165.  
  1166. syscall AL=48H __gethostbyaddr()  Get network host entry by address
  1167.         In:  EDX    Pointer to address
  1168.              ECX    Length
  1169.              ESI    Type
  1170.              EBX    Pointer to result
  1171.         Out: EAX    0 (success), -1 (failure)
  1172.              ECX    errno (0 if no error)
  1173.         Note: h_errno is passed in errno
  1174.  
  1175. syscall AL=49H __getservbyname()  Get service entry by name
  1176.         In:  EDX    Pointer to name
  1177.              ECX    Pointer to protocol
  1178.              EBX    Pointer to result
  1179.         Out: EAX    0 (success), -1 (failure)
  1180.              ECX    always zero
  1181.  
  1182. syscall AL=4AH __getservbyport()  Get service entry by port
  1183.         In:  EDX    Port number
  1184.              ECX    Pointer to protocol
  1185.              EBX    Pointer to result
  1186.         Out: EAX    0 (success), -1 (failure)
  1187.              ECX    always zero
  1188.  
  1189. syscall AL=4BH __getprotobyname()  Get protocol entry by name
  1190.         In:  EDX    Pointer to name
  1191.              EBX    Pointer to result
  1192.         Out: EAX    0 (success), -1 (failure)
  1193.              ECX    always zero
  1194.  
  1195. syscall AL=4CH __getprotobynumber()  Get protocol entry by number
  1196.         In:  EDX    Number
  1197.              EBX    Pointer to result
  1198.         Out: EAX    0 (success), -1 (failure)
  1199.              ECX    always zero
  1200.  
  1201. syscall AL=4DH __getnetbyname()  Get network entry by name
  1202.         In:  EDX    Pointer to name
  1203.         Out: EAX    0 (success), -1 (failure)
  1204.              ECX    errno (0 if no error)
  1205.  
  1206. syscall AL=4EH __getnetbyaddr()  Get network entry by address
  1207.         In:  EDX    Address
  1208.         Out: EAX    0 (success), -1 (failure)
  1209.              ECX    errno (0 if no error)
  1210.  
  1211. syscall AL=4FH __gethostname()  Get host name
  1212.         In:  EDX    Pointer to name
  1213.              ECX    Length of buffer
  1214.         Out: EAX    0 (success), -1 (failure)
  1215.              ECX    errno (0 if no error)
  1216.  
  1217. syscall AL=50H __gethostid()  Get host indentifier
  1218.         In:  EBX    Pointer to result
  1219.         Out: EAX    0 (success), -1 (failure)
  1220.              ECX    errno (0 if no error)
  1221.  
  1222. syscall AL=51H __shutdown()  Shut down part of a full-duplex connection
  1223.         In:  EBX    Handle
  1224.              EDX    What to shut down
  1225.         Out: EAX    0 (success), -1 (failure)
  1226.              ECX    errno (0 if no error)
  1227.  
  1228. syscall AL=52H __recvfrom()  Receive a message from a socket
  1229.         In:  EDX    Pointer to structure (struct _recvfrom)
  1230.         Out: EAX    number of bytes (success), -1 (failure)
  1231.              ECX    errno (0 if no error)
  1232.  
  1233. syscall AL=53H __sendto()  Send a message to a socket
  1234.         In:  EDX    Pointer to structure (struct _sendto)
  1235.         Out: EAX    number of bytes (success), -1 (failure)
  1236.              ECX    errno (0 if no error)
  1237.  
  1238. syscall AL=54H __impsockhandle()  Import a socket handle of IBM TCP/IP
  1239.         In:  EDX    socket handle
  1240.              ECX    flags (reserved, must be 0)
  1241.         Out: EAX    relocated file handle (success), -1 (failure)
  1242.              ECX    errno (0 if no error)
  1243.         Note: Not implemented under DOS (ENOSYS)
  1244.  
  1245. syscall AL=55H __recvmsg() -- NOT YET IMPLEMENTED
  1246.  
  1247. syscall AL=56H __sendmsg() -- NOT YET IMPLEMENTED
  1248.  
  1249. syscall AL=57H __ttyname()
  1250.         In:  EDX    file handle
  1251.              EDI    pointer to output buffer
  1252.              ECX    size of output buffer
  1253.         Out: EAX    0 (ok), -1 (error)
  1254.              ECX    errno (0 if successful)
  1255.         Note: Not yet implemented under DOS (ENOSYS)
  1256.  
  1257. syscall AL=58H __settime()  Set system time
  1258.         In:  EDX    pointer to struct timeval
  1259.         Out: EAX    0 (ok), -1 (error)
  1260.              ECX    errno (0 if successful)
  1261.  
  1262. syscall AL=59H __profil()  Sampling profiler
  1263.         In:  EDX    pointer to struct _profil
  1264.         Out: EAX    0 (ok), -1 (error)
  1265.              ECX    errno (0 if successful)
  1266.  
  1267. syscall AL=5AH __nls_ctype()  Initialize character table (DBCS lead bytes)
  1268.         In:  EDX    pointer to array of 256 bytes
  1269.         Out: EAX    0 (ok), -1 (error)
  1270.              ECX    errno (0 if successful)
  1271.  
  1272. syscall AL=5BH __syserrno()  Set last error code
  1273.         In:  EDX    new error code
  1274.         Out: EAX    Old OS/2 or DOS error code for last syscall of this thread
  1275.         Notes: Not implemented under DOS; returns -1 if not implemented
  1276.                (does not set errno)
  1277.  
  1278.  
  1279. Selectors (DOS)
  1280. ---------------
  1281.  
  1282. 0000H   null selector
  1283. 000FH   code segment (read only)
  1284. 0017H   data segment (size changable with brk/sbrk)
  1285. 001FH   video memory (text mode)
  1286. 0027H   symbol table (only if symbols available and -S option set; read only)
  1287.  
  1288. Do not rely on the selectors given above, they may change in a future
  1289. version of emx.  Moreover, they are different when the program is run
  1290. under OS/2.  Use only the values found in the segment registers on
  1291. program entry.
  1292.  
  1293.  
  1294. Argument Passing
  1295. ----------------
  1296.  
  1297. The arguments and the environment are passed on the stack:
  1298.  
  1299.         (high end of stack)
  1300.         environment and argument strings; use envp[] and argv[] for accessing
  1301.         argv[], NULL terminated
  1302. ESP->   envp[], NULL terminated
  1303.  
  1304. Note: Under OS/2, the environment strings are not in the stack.
  1305.  
  1306.  
  1307. --------------------------- END OF SYSTEM.DOC -------------------------------
  1308.