posix.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright (c) 2016 Klemens D. Morgenstern
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_PROCESS_POSIX_HPP_
  6. #define BOOST_PROCESS_POSIX_HPP_
  7. #include <boost/process/detail/posix/fd.hpp>
  8. #include <boost/process/detail/posix/handler.hpp>
  9. #include <boost/process/detail/posix/use_vfork.hpp>
  10. #include <boost/process/detail/posix/signal.hpp>
  11. /** \file boost/process/posix.hpp
  12. *
  13. * Header which provides the posix extensions.
  14. \xmlonly
  15. <programlisting>
  16. namespace boost {
  17. namespace process {
  18. namespace posix {
  19. <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::fd">fd</globalname>;
  20. <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::sig">sig</globalname>;
  21. <emphasis>unspecified</emphasis> <globalname alt="boost::process::posix::use_vfork">use_vfork</globalname>;
  22. }
  23. }
  24. }
  25. </programlisting>
  26. * \endxmlonly
  27. * \warning Only available on posix. See the documentation of [fork](http://pubs.opengroup.org/onlinepubs/009695399/functions/fork.html),
  28. * [execve](http://pubs.opengroup.org/onlinepubs/009695399/functions/execve.html) and
  29. * [vfork](http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html).
  30. *
  31. */
  32. namespace boost { namespace process {
  33. ///Namespace containing the posix exensions.
  34. namespace posix {
  35. /** This property lets you modify file-descriptors other than the standard ones (0,1,2).
  36. *
  37. * It provides the functions `bind`, which implements [dup2](http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html)
  38. * and [close](http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html).
  39. *
  40. * Close can also be called with a range of file-descriptors to be closed.
  41. *
  42. */
  43. constexpr ::boost::process::detail::posix::fd_ fd;
  44. /** This property lets you modify the handling of `SIGCHLD` for this call. It will be reset afterwards.
  45. It can be set to default, by the expression `sig.dfl()`, set to ignore with `sig.ign()` or
  46. assigned a custom handler. A custom handler must have the type `sighandler_t`and can be assigned with the following syntax:
  47. \code{.cpp}
  48. sig = handler;
  49. sig(handler);
  50. \endcode
  51. \warning @ref spawn will automatically use `sig.ign()`, which will override if you pass a custom handler.
  52. */
  53. constexpr ::boost::process::detail::posix::sig_ sig;
  54. /** This property will replace the usage of [fork](http://pubs.opengroup.org/onlinepubs/9699919799/functions/fork.html) by [vfork](http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html).
  55. \note `vfork` is no longer an official part of the posix standard.
  56. */
  57. constexpr ::boost::process::detail::posix::use_vfork_ use_vfork;
  58. using ::boost::process::detail::posix::sighandler_t;
  59. }}}
  60. #endif /* BOOST_PROCESS_POSIX_HPP_ */