《操作系统》的实验代码。
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

68 linhas
2.3 KiB

há 12 anos
  1. #ifndef __LIBS_UNISTD_H__
  2. #define __LIBS_UNISTD_H__
  3. #define T_SYSCALL 0x80
  4. /* syscall number */
  5. #define SYS_exit 1
  6. #define SYS_fork 2
  7. #define SYS_wait 3
  8. #define SYS_exec 4
  9. #define SYS_clone 5
  10. #define SYS_yield 10
  11. #define SYS_sleep 11
  12. #define SYS_kill 12
  13. #define SYS_gettime 17
  14. #define SYS_getpid 18
  15. #define SYS_mmap 20
  16. #define SYS_munmap 21
  17. #define SYS_shmem 22
  18. #define SYS_putc 30
  19. #define SYS_pgdir 31
  20. #define SYS_open 100
  21. #define SYS_close 101
  22. #define SYS_read 102
  23. #define SYS_write 103
  24. #define SYS_seek 104
  25. #define SYS_fstat 110
  26. #define SYS_fsync 111
  27. #define SYS_getcwd 121
  28. #define SYS_getdirentry 128
  29. #define SYS_dup 130
  30. /* OLNY FOR LAB6 */
  31. #define SYS_lab6_set_priority 255
  32. /* SYS_fork flags */
  33. #define CLONE_VM 0x00000100 // set if VM shared between processes
  34. #define CLONE_THREAD 0x00000200 // thread group
  35. #define CLONE_FS 0x00000800 // set if shared between processes
  36. /* VFS flags */
  37. // flags for open: choose one of these
  38. #define O_RDONLY 0 // open for reading only
  39. #define O_WRONLY 1 // open for writing only
  40. #define O_RDWR 2 // open for reading and writing
  41. // then or in any of these:
  42. #define O_CREAT 0x00000004 // create file if it does not exist
  43. #define O_EXCL 0x00000008 // error if O_CREAT and the file exists
  44. #define O_TRUNC 0x00000010 // truncate file upon open
  45. #define O_APPEND 0x00000020 // append on each write
  46. // additonal related definition
  47. #define O_ACCMODE 3 // mask for O_RDONLY / O_WRONLY / O_RDWR
  48. #define NO_FD -0x9527 // invalid fd
  49. /* lseek codes */
  50. #define LSEEK_SET 0 // seek relative to beginning of file
  51. #define LSEEK_CUR 1 // seek relative to current position in file
  52. #define LSEEK_END 2 // seek relative to end of file
  53. #define FS_MAX_DNAME_LEN 31
  54. #define FS_MAX_FNAME_LEN 255
  55. #define FS_MAX_FPATH_LEN 4095
  56. #define EXEC_MAX_ARG_NUM 32
  57. #define EXEC_MAX_ARG_LEN 4095
  58. #endif /* !__LIBS_UNISTD_H__ */