1
0

syscall 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .TH SYSCALL 1
  2. .SH NAME
  3. syscall \- test a system call
  4. .SH SYNOPSIS
  5. .B syscall
  6. [
  7. .B -osx
  8. ]
  9. .I entry
  10. [
  11. .I arg ...
  12. ]
  13. .SH DESCRIPTION
  14. .I Syscall
  15. invokes the system call
  16. .I entry
  17. with the given arguments.
  18. (Some functions, such as
  19. .I write
  20. and
  21. .IR read (2),
  22. although not strictly system calls, are valid
  23. .IR entries .)
  24. It prints the return value and the error string, if there was an error.
  25. An argument is either an integer constant as in C (its value is passed),
  26. a string (its address is passed),
  27. or the literal
  28. .B buf
  29. (a pointer to a 1MB buffer is passed).
  30. .PP
  31. If
  32. .B -o
  33. is given, the contents of the 1MB buffer are printed as a zero-terminated string
  34. after the system call is done.
  35. The
  36. .B -x
  37. and
  38. .B -s
  39. options are similar, but
  40. .B -x
  41. formats the data as hexadecimal bytes, while
  42. .B -s
  43. interprets the data as a
  44. .IR stat (5)
  45. message and formats it similar to the style of
  46. .B ls
  47. .B -lqm
  48. (see
  49. .IR ls (1)),
  50. with extra detail about the modify and access times.
  51. .SH EXAMPLES
  52. Write a string to standard output:
  53. .IP
  54. .EX
  55. syscall write 1 hello 5
  56. .EE
  57. .PP
  58. Print information about the file connected to standard input:
  59. .IP
  60. .EX
  61. syscall -s fstat 0 buf 1024
  62. .EE
  63. .SH SOURCE
  64. .B /sys/src/cmd/syscall
  65. .SH "SEE ALSO"
  66. Section 2 of this manual.
  67. .SH DIAGNOSTICS
  68. If
  69. .I entry
  70. is not known to
  71. .IR syscall ,
  72. the exit status is
  73. .LR unknown .
  74. If the system call succeeds, the exit status is null;
  75. otherwise the exit status is the string that
  76. .IR errstr (2)
  77. returns.