|
|
1.1 root 1: /*
2: * System call module
3: */
4:
5: #include <fcntl.h>
6:
7: char sys_fd[1];
8:
9: char *
10: sys_open(argv)
11: char *argv[];
12: {
13: int fd;
14:
15: if ((fd = open(argv[0], O_RDWR)) < 0) {
16: error(-1, argv[0]);
17: return 0;
18: }
19: return sys_fd + fd;
20: }
21:
22: sys_close(fd)
23: char *fd;
24: {
25: close(fd - sys_fd);
26: return 0;
27: }
28:
29: sys_read(fd, buf, n)
30: char *fd, *buf;
31: {
32: return read(fd - sys_fd, buf, n);
33: }
34:
35: sys_write(fd, buf, n)
36: char *fd, *buf;
37: {
38: return write(fd - sys_fd, buf, n);
39: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.