spawn_int.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (C) 2000, 2008-2023 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. This file is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as
  5. published by the Free Software Foundation; either version 2.1 of the
  6. License, or (at your option) any later version.
  7. This file is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  13. #include <sys/types.h>
  14. /* Data structure to contain the action information. */
  15. struct __spawn_action
  16. {
  17. enum
  18. {
  19. spawn_do_close,
  20. spawn_do_dup2,
  21. spawn_do_open,
  22. spawn_do_chdir,
  23. spawn_do_fchdir
  24. } tag;
  25. union
  26. {
  27. struct
  28. {
  29. int fd;
  30. } close_action;
  31. struct
  32. {
  33. int fd;
  34. int newfd;
  35. } dup2_action;
  36. struct
  37. {
  38. int fd;
  39. char *path;
  40. int oflag;
  41. mode_t mode;
  42. } open_action;
  43. struct
  44. {
  45. char *path;
  46. } chdir_action;
  47. struct
  48. {
  49. int fd;
  50. } fchdir_action;
  51. } action;
  52. };
  53. #if !_LIBC
  54. # define __posix_spawn_file_actions_realloc gl_posix_spawn_file_actions_realloc
  55. #endif
  56. extern int __posix_spawn_file_actions_realloc (posix_spawn_file_actions_t *
  57. file_actions);
  58. #if !_LIBC
  59. # define __spawni gl_posix_spawn_internal
  60. #endif
  61. extern int __spawni (pid_t *pid, const char *path,
  62. const posix_spawn_file_actions_t *file_actions,
  63. const posix_spawnattr_t *attrp, const char *const argv[],
  64. const char *const envp[], int use_path);