summaryrefslogtreecommitdiff
path: root/Base/usr/share/man/man1/syscall.md
blob: d3bc9e56700e04427138c62a47ec0d78391760e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
## Name

syscall - test a system call

## Synopsis

```**sh
$ syscall [-o] [-l] [-h] <syscall-name> <args...> [buf==BUFSIZ buffer]
```

## Description

The `syscall` utility can be used to invoke a system call with the given arguments.

## Options

* `-o`: Output the contents of the buffer argument specified as buf to stdout.
* `-l`: Print a space separated list of all the Serenity system calls and exit. Note that not all the system calls can be invoked using this tool.
* `-h`: Print a help message and exit.

## Examples

Write a string to standard output:

```sh
$ syscall write 1 hello 5
```

Read a string from the standard input into a buffer and output the buffer contents to stdout:

```sh
$ syscall -o read 0 buf 3
```

Get the pid of the current running process:

```sh
$ syscall getpid
```

Sleep for 3 seconds:

```sh
$ syscall sleep 3
```

Create a directory:

```sh
$ syscall mkdir my-dir 0755
```

Exit the program with status 2:

```sh
$ syscall exit 2
```

## History

This is a direct port of a utility with the same name originated from the Plan 9 operating system.