resource.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 2000, 2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /* $Id: resource.h,v 1.13 2008/07/11 23:47:09 tbox Exp $ */
00019 
00020 #ifndef ISC_RESOURCE_H
00021 #define ISC_RESOURCE_H 1
00022 
00023 /*! \file isc/resource.h */
00024 
00025 #include <isc/lang.h>
00026 #include <isc/types.h>
00027 
00028 #define ISC_RESOURCE_UNLIMITED ((isc_resourcevalue_t)ISC_UINT64_MAX)
00029 
00030 ISC_LANG_BEGINDECLS
00031 
00032 isc_result_t
00033 isc_resource_setlimit(isc_resource_t resource, isc_resourcevalue_t value);
00034 /*%<
00035  * Set the maximum limit for a system resource.
00036  *
00037  * Notes:
00038  *\li   If 'value' exceeds the maximum possible on the operating system,
00039  *      it is silently limited to that maximum -- or to "infinity", if
00040  *      the operating system has that concept.  #ISC_RESOURCE_UNLIMITED
00041  *      can be used to explicitly ask for the maximum.
00042  *
00043  * Requires:
00044  *\li   'resource' is a valid member of the isc_resource_t enumeration.
00045  *
00046  * Returns:
00047  *\li   #ISC_R_SUCCESS  Success.
00048  *\li   #ISC_R_NOTIMPLEMENTED   'resource' is not a type known by the OS.
00049  *\li   #ISC_R_NOPERM   The calling process did not have adequate permission
00050  *                      to change the resource limit.
00051  */
00052 
00053 isc_result_t
00054 isc_resource_getlimit(isc_resource_t resource, isc_resourcevalue_t *value);
00055 /*%<
00056  * Get the maximum limit for a system resource.
00057  *
00058  * Notes:
00059  *\li   'value' is set to the maximum limit.
00060  *
00061  *\li   #ISC_RESOURCE_UNLIMITED is the maximum value of isc_resourcevalue_t.
00062  *
00063  *\li   On many (all?) Unix systems, RLIM_INFINITY is a valid value that is
00064  *      significantly less than #ISC_RESOURCE_UNLIMITED, but which in practice
00065  *      behaves the same.
00066  *
00067  *\li   The current ISC libdns configuration file parser assigns a value
00068  *      of ISC_UINT32_MAX for a size_spec of "unlimited" and ISC_UNIT32_MAX - 1
00069  *      for "default", the latter of which is supposed to represent "the
00070  *      limit that was in force when the server started".  Since these are
00071  *      valid values in the middle of the range of isc_resourcevalue_t,
00072  *      there is the possibility for confusion over what exactly those
00073  *      particular values are supposed to represent in a particular context --
00074  *      discrete integral values or generalized concepts.
00075  *
00076  * Requires:
00077  *\li   'resource' is a valid member of the isc_resource_t enumeration.
00078  *
00079  * Returns:
00080  *\li   #ISC_R_SUCCESS          Success.
00081  *\li   #ISC_R_NOTIMPLEMENTED   'resource' is not a type known by the OS.
00082  */
00083 
00084 isc_result_t
00085 isc_resource_getcurlimit(isc_resource_t resource, isc_resourcevalue_t *value);
00086 /*%<
00087  * Same as isc_resource_getlimit(), but returns the current (soft) limit.
00088  *
00089  * Returns:
00090  *\li   #ISC_R_SUCCESS          Success.
00091  *\li   #ISC_R_NOTIMPLEMENTED   'resource' is not a type known by the OS.
00092  */
00093 
00094 ISC_LANG_ENDDECLS
00095 
00096 #endif /* ISC_RESOURCE_H */
00097 

Generated on Tue Apr 28 17:41:04 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha