[BZ #5186]
[glibc.git] / resolv / gai_misc.h
blob94005de02c1846f13c25dc5230407802fca9d5b3
1 /* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #ifndef _GAI_MISC_H
21 #define _GAI_MISC_H 1
23 #include <netdb.h>
24 #include <signal.h>
27 /* Used to synchronize. */
28 struct waitlist
30 struct waitlist *next;
32 #ifndef DONT_NEED_GAI_MISC_COND
33 pthread_cond_t *cond;
34 #endif
35 volatile int *counterp;
36 /* The next field is used in asynchronous `lio_listio' operations. */
37 struct sigevent *sigevp;
38 /* XXX See requestlist, it's used to work around the broken signal
39 handling in Linux. */
40 pid_t caller_pid;
44 /* Used to queue requests.. */
45 struct requestlist
47 int running;
49 struct requestlist *next;
51 /* Pointer to the actual data. */
52 struct gaicb *gaicbp;
54 /* List of waiting processes. */
55 struct waitlist *waiting;
58 /* To customize the implementation one can use the following struct.
59 This implementation follows the one in Irix. */
60 struct gaiinit
62 int gai_threads; /* Maximal number of threads. */
63 int gai_num; /* Number of expected simultanious requests. */
64 int gai_locks; /* Not used. */
65 int gai_usedba; /* Not used. */
66 int gai_debug; /* Not used. */
67 int gai_numusers; /* Not used. */
68 int gai_idle_time; /* Number of seconds before idle thread
69 terminates. */
70 int gai_reserved;
74 /* Lock for global I/O list of requests. */
75 extern pthread_mutex_t __gai_requests_mutex;
78 /* Enqueue request. */
79 extern struct requestlist *__gai_enqueue_request (struct gaicb *gaicbp)
80 internal_function;
82 /* Find request on wait list. */
83 extern struct requestlist *__gai_find_request (const struct gaicb *gaicbp)
84 internal_function;
86 /* Remove request from waitlist. */
87 extern int __gai_remove_request (struct gaicb *gaicbp)
88 internal_function;
90 /* Notify initiator of request and tell this everybody listening. */
91 extern void __gai_notify (struct requestlist *req)
92 internal_function;
94 /* Notify initiator of request. */
95 extern int __gai_notify_only (struct sigevent *sigev, pid_t caller_pid)
96 internal_function;
98 /* Send the signal. */
99 extern int __gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
100 internal_function;
102 #endif /* gai_misc.h */