~ubuntu-branches/ubuntu/vivid/gzip/vivid

« back to all changes in this revision

Viewing changes to lib/close-hook.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-10-19 11:42:42 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20111019114242-d8wiiu8kbvdtgmgj
Tags: 1.4-1ubuntu1
* Merge with Debian testing.  Remaining Ubuntu changes:
  - debian/{control,rules}: Remove the Win32 build and mingw64
    build-dependency, since mingw is in universe, and will remain so for
    the forseeable future.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, 2010 Free Software Foundation, Inc.
 
5
 
 
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.
 
10
 
 
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
   Lesser General Public License for more details.
 
15
 
 
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/>.  */
 
18
 
 
19
 
 
20
#ifndef CLOSE_HOOK_H
 
21
#define CLOSE_HOOK_H
 
22
 
 
23
#ifdef __cplusplus
 
24
extern "C" {
 
25
#endif
 
26
 
 
27
 
 
28
/* Currently, this entire code is only needed for the handling of sockets
 
29
   on native Windows platforms.  */
 
30
#if WINDOWS_SOCKETS
 
31
 
 
32
 
 
33
/* An element of the list of close hooks.
 
34
   The fields of this structure are considered private.  */
 
35
struct close_hook
 
36
{
 
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);
 
43
};
 
44
 
 
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);
 
49
 
 
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);
 
53
 
 
54
/* Execute all close hooks.
 
55
   Return 0 or -1, like close() would do.  */
 
56
extern int execute_all_close_hooks (int fd);
 
57
 
 
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);
 
62
 
 
63
/* Removes a function from the list of close hooks.  */
 
64
extern void unregister_close_hook (struct close_hook *link);
 
65
 
 
66
 
 
67
#endif
 
68
 
 
69
 
 
70
#ifdef __cplusplus
 
71
}
 
72
#endif
 
73
 
 
74
#endif /* CLOSE_HOOK_H */