copy-acl: enhance Solaris ACL error handling
[gnulib.git] / lib / spawn.in.h
index 29b388b..1e8c936 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for POSIX spawn interface.
-   Copyright (C) 2000, 2003, 2004, 2008-2009 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2003-2004, 2008-2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
 #ifndef _GL_SPAWN_H
 #define _GL_SPAWN_H
 
-#include <sched.h>
-#include <signal.h>
+/* Get definitions of 'struct sched_param' and 'sigset_t'.
+   But avoid namespace pollution on glibc systems.  */
+#ifndef __GLIBC__
+# include <sched.h>
+# include <signal.h>
+#endif
+
 #include <sys/types.h>
 
 #ifndef __THROW
 # endif
 #endif
 
-/* The definition of GL_LINK_WARNING is copied here.  */
-
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
 
 /* Data structure to contain attributes for thread creation.  */
 #if @REPLACE_POSIX_SPAWN@
@@ -105,17 +110,19 @@ typedef struct
 
 
 /* Flags to be set in the `posix_spawnattr_t'.  */
-#if @REPLACE_POSIX_SPAWN@
+#if !@HAVE_POSIX_SPAWN@
+# if @REPLACE_POSIX_SPAWN@
 /* Use the values from the system, for better compatibility.  */
 /* But this implementation does not support AIX extensions.  */
-# undef POSIX_SPAWN_FORK_HANDLERS
-#else
-# define POSIX_SPAWN_RESETIDS           0x01
-# define POSIX_SPAWN_SETPGROUP          0x02
-# define POSIX_SPAWN_SETSIGDEF          0x04
-# define POSIX_SPAWN_SETSIGMASK         0x08
-# define POSIX_SPAWN_SETSCHEDPARAM      0x10
-# define POSIX_SPAWN_SETSCHEDULER       0x20
+#  undef POSIX_SPAWN_FORK_HANDLERS
+# else
+#  define POSIX_SPAWN_RESETIDS           0x01
+#  define POSIX_SPAWN_SETPGROUP          0x02
+#  define POSIX_SPAWN_SETSIGDEF          0x04
+#  define POSIX_SPAWN_SETSIGMASK         0x08
+#  define POSIX_SPAWN_SETSCHEDPARAM      0x10
+#  define POSIX_SPAWN_SETSCHEDULER       0x20
+# endif
 #endif
 /* A GNU extension.  Use the next free bit position.  */
 #define POSIX_SPAWN_USEVFORK \
@@ -156,6 +163,12 @@ extern int posix_spawn (pid_t *_Restrict_ __pid,
                         char *const envp[_Restrict_arr_])
      _GL_ARG_NONNULL ((2, 5, 6));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn
+# if HAVE_RAW_DECL_POSIX_SPAWN
+_GL_WARN_ON_USE (posix_spawn, "posix_spawn is unportable - "
+                 "use gnulib module posix_spawn for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNP@
@@ -173,6 +186,12 @@ extern int posix_spawnp (pid_t *__pid, const char *__file,
                          char *const argv[], char *const envp[])
      _GL_ARG_NONNULL ((2, 5, 6));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnp
+# if HAVE_RAW_DECL_POSIX_SPAWNP
+_GL_WARN_ON_USE (posix_spawnp, "posix_spawnp is unportable - "
+                 "use gnulib module posix_spawnp for portability");
+# endif
 #endif
 
 
@@ -185,6 +204,12 @@ extern int posix_spawnp (pid_t *__pid, const char *__file,
 extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_init
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_INIT
+_GL_WARN_ON_USE (posix_spawnattr_init, "posix_spawnattr_init is unportable - "
+                 "use gnulib module posix_spawnattr_init for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_DESTROY@
@@ -196,6 +221,12 @@ extern int posix_spawnattr_init (posix_spawnattr_t *__attr)
 extern int posix_spawnattr_destroy (posix_spawnattr_t *__attr)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_destroy
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_DESTROY
+_GL_WARN_ON_USE (posix_spawnattr_destroy, "posix_spawnattr_destroy is unportable - "
+                 "use gnulib module posix_spawnattr_destroy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT@
@@ -209,6 +240,12 @@ extern int posix_spawnattr_getsigdefault (const posix_spawnattr_t *_Restrict_ __
                                           sigset_t *_Restrict_ __sigdefault)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getsigdefault
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGDEFAULT
+_GL_WARN_ON_USE (posix_spawnattr_getsigdefault, "posix_spawnattr_getsigdefault is unportable - "
+                 "use gnulib module posix_spawnattr_getsigdefault for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT@
@@ -221,6 +258,12 @@ extern int posix_spawnattr_setsigdefault (posix_spawnattr_t *_Restrict_ __attr,
                                           const sigset_t *_Restrict_ __sigdefault)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setsigdefault
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGDEFAULT
+_GL_WARN_ON_USE (posix_spawnattr_setsigdefault, "posix_spawnattr_setsigdefault is unportable - "
+                 "use gnulib module posix_spawnattr_setsigdefault for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSIGMASK@
@@ -233,6 +276,12 @@ extern int posix_spawnattr_getsigmask (const posix_spawnattr_t *_Restrict_ __att
                                        sigset_t *_Restrict_ __sigmask)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getsigmask
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSIGMASK
+_GL_WARN_ON_USE (posix_spawnattr_getsigmask, "posix_spawnattr_getsigmask is unportable - "
+                 "use gnulib module posix_spawnattr_getsigmask for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSIGMASK@
@@ -245,6 +294,12 @@ extern int posix_spawnattr_setsigmask (posix_spawnattr_t *_Restrict_ __attr,
                                        const sigset_t *_Restrict_ __sigmask)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setsigmask
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSIGMASK
+_GL_WARN_ON_USE (posix_spawnattr_setsigmask, "posix_spawnattr_setsigmask is unportable - "
+                 "use gnulib module posix_spawnattr_setsigmask for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETFLAGS@
@@ -257,6 +312,12 @@ extern int posix_spawnattr_getflags (const posix_spawnattr_t *_Restrict_ __attr,
                                      short int *_Restrict_ __flags)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getflags
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETFLAGS
+_GL_WARN_ON_USE (posix_spawnattr_getflags, "posix_spawnattr_getflags is unportable - "
+                 "use gnulib module posix_spawnattr_getflags for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETFLAGS@
@@ -269,6 +330,12 @@ extern int posix_spawnattr_setflags (posix_spawnattr_t *__attr,
                                      short int __flags)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setflags
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETFLAGS
+_GL_WARN_ON_USE (posix_spawnattr_setflags, "posix_spawnattr_setflags is unportable - "
+                 "use gnulib module posix_spawnattr_setflags for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETPGROUP@
@@ -281,6 +348,12 @@ extern int posix_spawnattr_getpgroup (const posix_spawnattr_t *_Restrict_ __attr
                                       pid_t *_Restrict_ __pgroup)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getpgroup
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETPGROUP
+_GL_WARN_ON_USE (posix_spawnattr_getpgroup, "posix_spawnattr_getpgroup is unportable - "
+                 "use gnulib module posix_spawnattr_getpgroup for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETPGROUP@
@@ -293,6 +366,12 @@ extern int posix_spawnattr_setpgroup (posix_spawnattr_t *__attr,
                                       pid_t __pgroup)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setpgroup
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETPGROUP
+_GL_WARN_ON_USE (posix_spawnattr_setpgroup, "posix_spawnattr_setpgroup is unportable - "
+                 "use gnulib module posix_spawnattr_setpgroup for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY@
@@ -305,6 +384,12 @@ extern int posix_spawnattr_getschedpolicy (const posix_spawnattr_t *_Restrict_ _
                                            int *_Restrict_ __schedpolicy)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getschedpolicy
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPOLICY
+_GL_WARN_ON_USE (posix_spawnattr_getschedpolicy, "posix_spawnattr_getschedpolicy is unportable - "
+                 "use gnulib module posix_spawnattr_getschedpolicy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY@
@@ -317,6 +402,12 @@ extern int posix_spawnattr_setschedpolicy (posix_spawnattr_t *__attr,
                                            int __schedpolicy)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setschedpolicy
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPOLICY
+_GL_WARN_ON_USE (posix_spawnattr_setschedpolicy, "posix_spawnattr_setschedpolicy is unportable - "
+                 "use gnulib module posix_spawnattr_setschedpolicy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM@
@@ -329,6 +420,12 @@ extern int posix_spawnattr_getschedparam (const posix_spawnattr_t *_Restrict_ __
                                           struct sched_param *_Restrict_ __schedparam)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_getschedparam
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_GETSCHEDPARAM
+_GL_WARN_ON_USE (posix_spawnattr_getschedparam, "posix_spawnattr_getschedparam is unportable - "
+                 "use gnulib module posix_spawnattr_getschedparam for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM@
@@ -341,6 +438,12 @@ extern int posix_spawnattr_setschedparam (posix_spawnattr_t *_Restrict_ __attr,
                                           const struct sched_param *_Restrict_ __schedparam)
      __THROW _GL_ARG_NONNULL ((1, 2));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawnattr_setschedparam
+# if HAVE_RAW_DECL_POSIX_SPAWNATTR_SETSCHEDPARAM
+_GL_WARN_ON_USE (posix_spawnattr_setschedparam, "posix_spawnattr_setschedparam is unportable - "
+                 "use gnulib module posix_spawnattr_setschedparam for portability");
+# endif
 #endif
 
 
@@ -353,6 +456,12 @@ extern int posix_spawnattr_setschedparam (posix_spawnattr_t *_Restrict_ __attr,
 extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_actions)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_init
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_INIT
+_GL_WARN_ON_USE (posix_spawn_file_actions_init, "posix_spawn_file_actions_init is unportable - "
+                 "use gnulib module posix_spawn_file_actions_init for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY@
@@ -364,6 +473,12 @@ extern int posix_spawn_file_actions_init (posix_spawn_file_actions_t *__file_act
 extern int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *__file_actions)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_destroy
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_DESTROY
+_GL_WARN_ON_USE (posix_spawn_file_actions_destroy, "posix_spawn_file_actions_destroy is unportable - "
+                 "use gnulib module posix_spawn_file_actions_destroy for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN@
@@ -379,6 +494,12 @@ extern int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t *_Restri
                                              int __oflag, mode_t __mode)
      __THROW _GL_ARG_NONNULL ((1, 3));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_addopen
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
+_GL_WARN_ON_USE (posix_spawn_file_actions_addopen, "posix_spawn_file_actions_addopen is unportable - "
+                 "use gnulib module posix_spawn_file_actions_addopen for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE@
@@ -392,6 +513,12 @@ extern int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *__file
                                               int __fd)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_addclose
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
+_GL_WARN_ON_USE (posix_spawn_file_actions_addclose, "posix_spawn_file_actions_addclose is unportable - "
+                 "use gnulib module posix_spawn_file_actions_addclose for portability");
+# endif
 #endif
 
 #if @GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2@
@@ -405,6 +532,12 @@ extern int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *__file_
                                              int __fd, int __newfd)
      __THROW _GL_ARG_NONNULL ((1));
 # endif
+#elif defined GNULIB_POSIXCHECK
+# undef posix_spawn_file_actions_adddup2
+# if HAVE_RAW_DECL_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
+_GL_WARN_ON_USE (posix_spawn_file_actions_adddup2, "posix_spawn_file_actions_adddup2 is unportable - "
+                 "use gnulib module posix_spawn_file_actions_adddup2 for portability");
+# endif
 #endif