libmon.7 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. .\" $Id$
  2. .TH LIBMON 7 "$Revision$"
  3. .ad
  4. .SH NAME
  5. libmon \- library of system call routines with EM calling sequence
  6. .SH DESCRIPTION
  7. The modules in this library contain the UNIX system calls with EM calling sequence.
  8. This library is written in EM assembly language and can be used
  9. for interpreted programs, and \fIa.out\fP programs.
  10. If these routines are used in Pascal programs, then the calling sequence
  11. requires some attention.
  12. Some hints may be useful:
  13. .IP -
  14. The c-option {$c+} allows declaration of zero-terminated string
  15. constants in Pascal like "/etc/passwd".
  16. Moreover, the identifier \fIstring\fP is then defined as type identifier for
  17. a pointer to these zero-terminated strings.
  18. .IP -
  19. The d-option {$d+} allows the use of double precision integers (longs).
  20. The lseek system call, for instance, needs a long argument and returns a long result.
  21. .IP -
  22. If the system call requires a pointer as argument use a \fIvar\fP parameter.
  23. For instance declare times as:
  24. .br
  25. procedure times(var t:timesbuf); extern;
  26. .br
  27. Note that a \fIstring\fP is already a pointer.
  28. .IP -
  29. When defining types, use packed records if two bytes must be allocated
  30. in a single word, as in
  31. .br
  32. device = packed record
  33. .br
  34. minor,major:0..255;
  35. .br
  36. end;
  37. .IP -
  38. If a collection of bits is needed, then define an enumerated type and
  39. a set of this enumerated type. The create mode of a file, for example,
  40. can be declared as:
  41. .br
  42. modebits = (XHIM,WHIM,RHIM,
  43. .br
  44. XYOU,WYOU,RYOU,
  45. .br
  46. XME, WME, RME,
  47. .br
  48. TEXT,SGID,SUID,... );
  49. .br
  50. creatmode = set of XHIM..SUID;
  51. .IP -
  52. There are special system call routines \fIuread\fP and \fIuwrite\fP
  53. in libpc(7),
  54. because the names \fIread\fP and \fIwrite\fP
  55. are blocked by similar functions in Pascal.
  56. .PP
  57. The system call \fIsignal\fP exists, but uses \fIsigtrp\fP.
  58. This EM system call has the
  59. following calling sequence:
  60. .br
  61. function sigtrp(signo,trapno:integer):integer;
  62. .br
  63. The action values of \fIsignal\fP, odd for \fIignore\fP and zero
  64. for \fIget back to default\fP,
  65. may interfere with the EM procedure identification in some
  66. implementations.
  67. In most interpreters procedures in EM are numbered consecutively from zero up.
  68. The first argument of \fIsigtrp\fP is the signal number \fIsigno\fP
  69. as for \fIsignal\fP.
  70. The second argument is an integer \fItrapno\fP,
  71. indicating the action to be performed
  72. when the signal is issued:
  73. .IP -2 8
  74. Reset the action for signal \fIsigno\fP to the default.
  75. .IP -3
  76. Ignore signal \fIsigno\fP.
  77. .IP "0-252"
  78. Perform an EM instruction TRP with error code \fItrapno\fP,
  79. whenever the signal \fIsigno\fP is issued.
  80. Note that the error codes 0-127 are reserved for EM machine errors
  81. and language runtime system errors.
  82. .PP
  83. The routine \fIsigtrp\fP returns the old \fItrapno\fP or -1 if an erroneous
  84. signal number is specified.
  85. Only the signal numbers 1, 2, 3, 13, 14, 15 and 16 may be used as argument
  86. for \fIsigtrp\fP.
  87. .SH FILES
  88. .IP ~em/lib/*/tail_mon
  89. .PD
  90. .SH "SEE ALSO"
  91. em(1), ack(1), *(2), libpc(7)
  92. .SH DIAGNOSTICS
  93. All routines put the UNIX error code in the global variable \fIerrno\fP.
  94. Errno is not cleared by successful system calls, so it always gives
  95. the error of the last failed call.
  96. One exception: ptrace clears errno when successful.
  97. .SH AUTHOR
  98. Ed Keizer, Vrije Universiteit
  99. .SH BUGS
  100. There should be additional routines giving a fatal error when they fail.
  101. It would be pleasant to have routines,
  102. which print a nice message and stop execution for unexpected errors.