descriptors.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Monitoring file descriptor usage.
  2. Copyright (C) 2018-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef SUPPORT_DESCRIPTORS_H
  16. #define SUPPORT_DESCRIPTORS_H
  17. #include <stdio.h>
  18. /* Opaque pointer, for capturing file descriptor lists. */
  19. struct support_descriptors;
  20. /* Record the currently open file descriptors and store them in the
  21. returned list. Terminate the process if the listing operation
  22. fails. */
  23. struct support_descriptors *support_descriptors_list (void);
  24. /* Deallocate the list of descriptors. */
  25. void support_descriptors_free (struct support_descriptors *);
  26. /* Write the list of descriptors to STREAM, adding PREFIX to each
  27. line. */
  28. void support_descriptors_dump (struct support_descriptors *,
  29. const char *prefix, FILE *stream);
  30. /* Check for file descriptor leaks and other file descriptor changes:
  31. Compare the current list of descriptors with the passed list.
  32. Record a test failure if there are additional open descriptors,
  33. descriptors have been closed, or if a change in file descriptor can
  34. be detected. */
  35. void support_descriptors_check (struct support_descriptors *);
  36. #endif /* SUPPORT_DESCRIPTORS_H */