spawn_ext.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // Copyright 2026 Aarav Ravindra Kharade
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. /* POSIX spawn extensions. Linux version.
  17. Copyright (C) 2023-2026 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, see
  29. <https://www.gnu.org/licenses/>. */
  30. #ifndef _SPAWN_H
  31. # error "Never include <bits/spawn-ext.h> directly; use <spawn.h> instead."
  32. #endif
  33. __BEGIN_DECLS
  34. #ifdef __USE_MISC
  35. /* Get the cgroupsv2 the attribute structure. */
  36. extern int posix_spawnattr_getcgroup_np (const posix_spawnattr_t *
  37. __restrict __attr,
  38. int *__restrict __cgroup)
  39. __THROW __nonnull ((1, 2));
  40. /* Sore the cgroupsv2 the attribute structure. */
  41. extern int posix_spawnattr_setcgroup_np (posix_spawnattr_t *__attr,
  42. int __cgroup)
  43. __THROW __nonnull ((1));
  44. /* Spawn a new process executing PATH with the attributes describes in *ATTRP.
  45. Before running the process perform the actions described in FACTS. Return
  46. a PID file descriptor in PIDFD if process creation was successful and the
  47. argument is non-null.
  48. This function is a possible cancellation point and therefore not
  49. marked with __THROW. */
  50. extern int pidfd_spawn (int *__restrict __pidfd,
  51. const char *__restrict __path,
  52. const posix_spawn_file_actions_t *__restrict __facts,
  53. const posix_spawnattr_t *__restrict __attrp,
  54. char *const __argv[__restrict_arr],
  55. char *const __envp[__restrict_arr])
  56. __nonnull ((2, 5));
  57. /* Similar to `pidfd_spawn' but search for FILE in the PATH.
  58. This function is a possible cancellation point and therefore not
  59. marked with __THROW. */
  60. extern int pidfd_spawnp (int *__restrict __pidfd,
  61. const char *__restrict __file,
  62. const posix_spawn_file_actions_t *__restrict __facts,
  63. const posix_spawnattr_t *__restrict __attrp,
  64. char *const __argv[__restrict_arr],
  65. char *const __envp[__restrict_arr])
  66. __nonnull ((1, 2, 5));
  67. #endif /* __USE_MISC */
  68. __END_DECLS