Merge from vendor branch LESS:
[dragonfly.git] / contrib / bind-9.3 / lib / isc / include / isc / resource.h
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 2000, 2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and 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.4.206.1 2004/03/06 08:14:47 marka Exp $ */
19
20 #ifndef ISC_RESOURCE_H
21 #define ISC_RESOURCE_H 1
22
23 #include <isc/lang.h>
24 #include <isc/types.h>
25
26 #define ISC_RESOURCE_UNLIMITED ((isc_resourcevalue_t)ISC_UINT64_MAX)
27
28 ISC_LANG_BEGINDECLS
29
30 isc_result_t
31 isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value);
32 /*
33  * Set the maximum limit for a system resource.
34  *
35  * Notes:
36  *      If 'value' exceeds the maximum possible on the operating system,
37  *      it is silently limited to that maximum -- or to "infinity", if
38  *      the operating system has that concept.  ISC_RESOURCE_UNLIMITED
39  *      can be used to explicitly ask for the maximum.
40  *
41  * Requires:
42  *      'resource' is a valid member of the isc_resource_t enumeration.
43  *
44  * Returns:
45  *      ISC_R_SUCCESS   Success.
46  *      ISC_R_NOTIMPLEMENTED    'resource' is not a type known by the OS.
47  *      ISC_R_NOPERM    The calling process did not have adequate permission
48  *                      to change the resource limit.
49  */
50
51 isc_result_t
52 isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value);
53 /*
54  * Get the maximum limit for a system resource.
55  *
56  * Notes:
57  *      'value' is set to the maximum limit.
58  *
59  *      ISC_RESOURCE_UNLIMITED is the maximum value of isc_resourcevalue_t.
60  *
61  *      On many (all?) Unix systems, RLIM_INFINITY is a valid value that is
62  *      significantly less than ISC_RESOURCE_UNLIMITED, but which in practice
63  *      behaves the same.
64  *
65  *      The current ISC libdns configuration file parser assigns a value
66  *      of ISC_UINT32_MAX for a size_spec of "unlimited" and ISC_UNIT32_MAX - 1
67  *      for "default", the latter of which is supposed to represent "the
68  *      limit that was in force when the server started".  Since these are
69  *      valid values in the middle of the range of isc_resourcevalue_t,
70  *      there is the possibility for confusion over what exactly those
71  *      particular values are supposed to represent in a particular context --
72  *      discrete integral values or generalized concepts.
73  *
74  * Requires:
75  *      'resource' is a valid member of the isc_resource_t enumeration.
76  *
77  * Returns:
78  *      ISC_R_SUCCESS           Success.
79  *      ISC_R_NOTIMPLEMENTED    'resource' is not a type known by the OS.
80  */
81
82 ISC_LANG_ENDDECLS
83
84 #endif /* ISC_RESOURCE_H */
85