pidfile.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef TINC_PIDFILE_H
  2. #define TINC_PIDFILE_H
  3. /*
  4. pidfile.h - interact with pidfiles
  5. Copyright (c) 1995 Martin Schulze <Martin.Schulze@Linux.DE>
  6. This file is part of the sysklogd package, a kernel and system log daemon.
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc.,
  17. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. */
  19. #ifndef HAVE_MINGW
  20. /* read_pid
  21. *
  22. * Reads the specified pidfile and returns the read pid.
  23. * 0 is returned if either there's no pidfile, it's empty
  24. * or no pid can be read.
  25. */
  26. extern pid_t read_pid(const char *pidfile);
  27. /* check_pid
  28. *
  29. * Reads the pid using read_pid and looks up the pid in the process
  30. * table (using /proc) to determine if the process already exists. If
  31. * so 1 is returned, otherwise 0.
  32. */
  33. extern pid_t check_pid(const char *pidfile);
  34. /* write_pid
  35. *
  36. * Writes the pid to the specified file. If that fails 0 is
  37. * returned, otherwise the pid.
  38. */
  39. extern pid_t write_pid(const char *pidfile);
  40. /* remove_pid
  41. *
  42. * Remove the the specified file. The result from unlink(2)
  43. * is returned
  44. */
  45. extern int remove_pid(const char *pidfile);
  46. #endif
  47. #endif