BIND - Update BIND to 9.5.2
[dragonfly.git] / contrib / bind-9.5.2 / lib / isc / include / isc / resource.h
1 /*
2  * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2000, 2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: resource.h,v 1.11.128.2 2008/08/01 23:46:30 tbox Exp $ */
19
20 #ifndef ISC_RESOURCE_H
21 #define ISC_RESOURCE_H 1
22
23 /*! \file isc/resource.h */
24
25 #include <isc/lang.h>
26 #include <isc/types.h>
27
28 #define ISC_RESOURCE_UNLIMITED ((isc_resourcevalue_t)ISC_UINT64_MAX)
29
30 ISC_LANG_BEGINDECLS
31
32 isc_result_t
33 isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value);
34 /*%<
35  * Set the maximum limit for a system resource.
36  *
37  * Notes:
38  *\li   If 'value' exceeds the maximum possible on the operating system,
39  *      it is silently limited to that maximum -- or to "infinity", if
40  *      the operating system has that concept.  #ISC_RESOURCE_UNLIMITED
41  *      can be used to explicitly ask for the maximum.
42  *
43  * Requires:
44  *\li   'resource' is a valid member of the isc_resource_t enumeration.
45  *
46  * Returns:
47  *\li   #ISC_R_SUCCESS  Success.
48  *\li   #ISC_R_NOTIMPLEMENTED   'resource' is not a type known by the OS.
49  *\li   #ISC_R_NOPERM   The calling process did not have adequate permission
50  *                      to change the resource limit.
51  */
52
53 isc_result_t
54 isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value);
55 /*%<
56  * Get the maximum limit for a system resource.
57  *
58  * Notes:
59  *\li   'value' is set to the maximum limit.
60  *
61  *\li   #ISC_RESOURCE_UNLIMITED is the maximum value of isc_resourcevalue_t.
62  *
63  *\li   On many (all?) Unix systems, RLIM_INFINITY is a valid value that is
64  *      significantly less than #ISC_RESOURCE_UNLIMITED, but which in practice
65  *      behaves the same.
66  *
67  *\li   The current ISC libdns configuration file parser assigns a value
68  *      of ISC_UINT32_MAX for a size_spec of "unlimited" and ISC_UNIT32_MAX - 1
69  *      for "default", the latter of which is supposed to represent "the
70  *      limit that was in force when the server started".  Since these are
71  *      valid values in the middle of the range of isc_resourcevalue_t,
72  *      there is the possibility for confusion over what exactly those
73  *      particular values are supposed to represent in a particular context --
74  *      discrete integral values or generalized concepts.
75  *
76  * Requires:
77  *\li   'resource' is a valid member of the isc_resource_t enumeration.
78  *
79  * Returns:
80  *\li   #ISC_R_SUCCESS          Success.
81  *\li   #ISC_R_NOTIMPLEMENTED   'resource' is not a type known by the OS.
82  */
83
84 isc_result_t
85 isc_resource_getcurlimit(isc_resource_t resource, isc_resourcevalue_t *value);
86 /*%<
87  * Same as isc_resource_getlimit(), but returns the current (soft) limit.
88  *
89  * Returns:
90  *\li   #ISC_R_SUCCESS          Success.
91  *\li   #ISC_R_NOTIMPLEMENTED   'resource' is not a type known by the OS.
92  */
93
94 ISC_LANG_ENDDECLS
95
96 #endif /* ISC_RESOURCE_H */
97