process.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Process-related tools
  2. //
  3. // Platform: ISO C++ 98/11 - POSIX
  4. // $Id$
  5. //
  6. // (c) __vic 2011
  7. #ifndef __VIC_POSIX_PROCESS_H
  8. #define __VIC_POSIX_PROCESS_H
  9. #include<__vic/defs.h>
  10. #include<sys/types.h>
  11. #if __cpp_initializer_lists
  12. #include<initializer_list>
  13. #endif
  14. namespace __vic { namespace posix {
  15. // BSD daemon() call
  16. void daemon(bool , bool = false);
  17. // true if process associated with the PID exists and not a zombie
  18. bool process_alive(pid_t );
  19. void ignore_signals(const int [], size_t );
  20. //----------------------------------------------------------------------------
  21. template<size_t Size>
  22. inline void ignore_signals(const int (&sigs)[Size])
  23. {
  24. ignore_signals(sigs, Size);
  25. }
  26. //----------------------------------------------------------------------------
  27. #if __cpp_initializer_lists
  28. inline void ignore_signals(std::initializer_list<int> sigs)
  29. {
  30. ignore_signals(sigs.begin(), sigs.size());
  31. }
  32. #endif
  33. //----------------------------------------------------------------------------
  34. }} // namespace
  35. #endif // header guard