2
0

spawn.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef _SPAWN_H
  2. #define _SPAWN_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #define __NEED_mode_t
  8. #define __NEED_pid_t
  9. #define __NEED_sigset_t
  10. #include <bits/alltypes.h>
  11. struct sched_param;
  12. #define POSIX_SPAWN_RESETIDS 1
  13. #define POSIX_SPAWN_SETPGROUP 2
  14. #define POSIX_SPAWN_SETSIGDEF 4
  15. #define POSIX_SPAWN_SETSIGMASK 8
  16. #define POSIX_SPAWN_SETSCHEDPARAM 16
  17. #define POSIX_SPAWN_SETSCHEDULER 32
  18. #define POSIX_SPAWN_USEVFORK 64
  19. #define POSIX_SPAWN_SETSID 128
  20. typedef struct {
  21. int __flags;
  22. pid_t __pgrp;
  23. sigset_t __def, __mask;
  24. int __prio, __pol;
  25. void *__fn;
  26. char __pad[64-sizeof(void *)];
  27. } posix_spawnattr_t;
  28. typedef struct {
  29. int __pad0[2];
  30. void *__actions;
  31. int __pad[16];
  32. } posix_spawn_file_actions_t;
  33. int posix_spawn(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
  34. const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
  35. int posix_spawnp(pid_t *__restrict, const char *__restrict, const posix_spawn_file_actions_t *,
  36. const posix_spawnattr_t *__restrict, char *const *__restrict, char *const *__restrict);
  37. int posix_spawnattr_init(posix_spawnattr_t *);
  38. int posix_spawnattr_destroy(posix_spawnattr_t *);
  39. int posix_spawnattr_setflags(posix_spawnattr_t *, short);
  40. int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict, short *__restrict);
  41. int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
  42. int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict, pid_t *__restrict);
  43. int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
  44. int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
  45. int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict, const sigset_t *__restrict);
  46. int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict, sigset_t *__restrict);
  47. int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict, const struct sched_param *__restrict);
  48. int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict, struct sched_param *__restrict);
  49. int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
  50. int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict, int *__restrict);
  51. int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
  52. int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
  53. int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict, int, const char *__restrict, int, mode_t);
  54. int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
  55. int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
  56. #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
  57. int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *__restrict, const char *__restrict);
  58. int posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *, int);
  59. #endif
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif