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