1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Hook for making the close() function extensible.
4 Copyright (C) 2009-2011 Free Software Foundation, Inc.
6 This program is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 3 of the License, or
9 (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 GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
28 /* Currently, this entire code is only needed for the handling of sockets
29 on native Windows platforms. */
33 /* An element of the list of close hooks.
34 The fields of this structure are considered private. */
37 /* Doubly linked list. */
38 struct close_hook *private_next;
39 struct close_hook *private_prev;
40 /* Function that treats the types of FD that it knows about and calls
41 execute_close_hooks (FD, REMAINING_LIST) as a fallback. */
42 int (*private_fn) (int fd, const struct close_hook *remaining_list);
45 /* This type of function closes FD, applying special knowledge for the FD
46 types it knows about, and calls execute_close_hooks (FD, REMAINING_LIST)
47 for the other FD types. */
48 typedef int (*close_hook_fn) (int fd, const struct close_hook *remaining_list);
50 /* Execute the close hooks in REMAINING_LIST.
51 Return 0 or -1, like close() would do. */
52 extern int execute_close_hooks (int fd, const struct close_hook *remaining_list);
54 /* Execute all close hooks.
55 Return 0 or -1, like close() would do. */
56 extern int execute_all_close_hooks (int fd);
58 /* Add a function to the list of close hooks.
59 The LINK variable points to a piece of memory which is guaranteed to be
60 accessible until the corresponding call to unregister_close_hook. */
61 extern void register_close_hook (close_hook_fn hook, struct close_hook *link);
63 /* Removes a function from the list of close hooks. */
64 extern void unregister_close_hook (struct close_hook *link);
74 #endif /* CLOSE_HOOK_H */