home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / isc / resource.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  3.4 KB  |  101 lines

  1. /*
  2.  * Copyright (C) 2004, 2005, 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.5.18.2.52.2 2008/07/23 23:48:17 tbox Exp $ */
  19.  
  20. #ifndef ISC_RESOURCE_H
  21. #define ISC_RESOURCE_H 1
  22.  
  23. /*! \file */
  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_curlimit(isc_resource_t resource, isc_resourcevalue_t *value);
  86. /*
  87.  * Get the current limit on a resource.
  88.  *
  89.  * Requires:
  90.  *    'resource' is a valid member of the isc_resource_t enumeration.
  91.  *
  92.  * Returns:
  93.  *    ISC_R_SUCCESS        Success.
  94.  *    ISC_R_NOTIMPLEMENTED    'resource' is not a type known by the OS.
  95.  */
  96.  
  97. ISC_LANG_ENDDECLS
  98.  
  99. #endif /* ISC_RESOURCE_H */
  100.  
  101.