linux.nim 929 B

12345678910111213141516171819202122232425262728293031
  1. {.deadCodeElim: on.} # dce option deprecated
  2. import posix
  3. const
  4. CSIGNAL* = 0x000000FF
  5. CLONE_VM* = 0x00000100
  6. CLONE_FS* = 0x00000200
  7. CLONE_FILES* = 0x00000400
  8. CLONE_SIGHAND* = 0x00000800
  9. CLONE_PTRACE* = 0x00002000
  10. CLONE_VFORK* = 0x00004000
  11. CLONE_PARENT* = 0x00008000
  12. CLONE_THREAD* = 0x00010000
  13. CLONE_NEWNS* = 0x00020000
  14. CLONE_SYSVSEM* = 0x00040000
  15. CLONE_SETTLS* = 0x00080000
  16. CLONE_PARENT_SETTID* = 0x00100000
  17. CLONE_CHILD_CLEARTID* = 0x00200000
  18. CLONE_DETACHED* = 0x00400000
  19. CLONE_UNTRACED* = 0x00800000
  20. CLONE_CHILD_SETTID* = 0x01000000
  21. CLONE_STOPPED* = 0x02000000
  22. # fn should be of type proc (a2: pointer): void {.cdecl.}
  23. proc clone*(fn: pointer; child_stack: pointer; flags: cint;
  24. arg: pointer; ptid: ptr Pid; tls: pointer;
  25. ctid: ptr Pid): cint {.importc, header: "<sched.h>".}
  26. proc pipe2*(a: array[0..1, cint], flags: cint): cint {.importc, header: "<unistd.h>".}