Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
4.0 KiB

  1. /* $OpenBSD: spawn.h,v 1.2 2012/12/05 23:19:57 deraadt Exp $ */
  2. /*-
  3. * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  16. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18. * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  19. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  21. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  23. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  24. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25. * SUCH DAMAGE.
  26. *
  27. * $FreeBSD: src/include/spawn.h,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
  28. */
  29. #ifndef _SPAWN_H_
  30. #define _SPAWN_H_
  31. #include <sys/types.h>
  32. #include <sys/signal.h>
  33. struct sched_param;
  34. typedef struct __posix_spawnattr *posix_spawnattr_t;
  35. typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t;
  36. #define POSIX_SPAWN_RESETIDS 0x01
  37. #define POSIX_SPAWN_SETPGROUP 0x02
  38. #define POSIX_SPAWN_SETSCHEDPARAM 0x04
  39. #define POSIX_SPAWN_SETSCHEDULER 0x08
  40. #define POSIX_SPAWN_SETSIGDEF 0x10
  41. #define POSIX_SPAWN_SETSIGMASK 0x20
  42. __BEGIN_DECLS
  43. /*
  44. * Spawn routines
  45. *
  46. * XXX both arrays should be __restrict, but this does not work when GCC
  47. * is invoked with -std=c99.
  48. */
  49. int posix_spawn(pid_t *__restrict, const char *__restrict,
  50. const posix_spawn_file_actions_t *, const posix_spawnattr_t *__restrict,
  51. char *const [], char *const []);
  52. int posix_spawnp(pid_t *__restrict, const char *__restrict,
  53. const posix_spawn_file_actions_t *, const posix_spawnattr_t *__restrict,
  54. char *const [], char *const []);
  55. /*
  56. * File descriptor actions
  57. */
  58. int posix_spawn_file_actions_init(posix_spawn_file_actions_t *);
  59. int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);
  60. int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *__restrict,
  61. int, const char *__restrict, int, mode_t);
  62. int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);
  63. int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);
  64. /*
  65. * Spawn attributes
  66. */
  67. int posix_spawnattr_init(posix_spawnattr_t *);
  68. int posix_spawnattr_destroy(posix_spawnattr_t *);
  69. int posix_spawnattr_getflags(const posix_spawnattr_t *__restrict,
  70. short *__restrict);
  71. int posix_spawnattr_getpgroup(const posix_spawnattr_t *__restrict,
  72. pid_t *__restrict);
  73. int posix_spawnattr_getschedparam(const posix_spawnattr_t *__restrict,
  74. struct sched_param *__restrict);
  75. int posix_spawnattr_getschedpolicy(const posix_spawnattr_t *__restrict,
  76. int *__restrict);
  77. int posix_spawnattr_getsigdefault(const posix_spawnattr_t *__restrict,
  78. sigset_t *__restrict);
  79. int posix_spawnattr_getsigmask(const posix_spawnattr_t *__restrict,
  80. sigset_t *__restrict sigmask);
  81. int posix_spawnattr_setflags(posix_spawnattr_t *, short);
  82. int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);
  83. int posix_spawnattr_setschedparam(posix_spawnattr_t *__restrict,
  84. const struct sched_param *__restrict);
  85. int posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);
  86. int posix_spawnattr_setsigdefault(posix_spawnattr_t *__restrict,
  87. const sigset_t *__restrict);
  88. int posix_spawnattr_setsigmask(posix_spawnattr_t *__restrict,
  89. const sigset_t *__restrict);
  90. __END_DECLS
  91. #endif /* !_SPAWN_H_ */