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