Back to index

glibc  2.9
resource.h
Go to the documentation of this file.
00001 /* Resource limits for the Hurd.
00002    Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _HURD_RESOURCE_H
00021 #define _HURD_RESOURCE_H
00022 
00023 #include <sys/types.h>
00024 #include <sys/resource.h>
00025 #include <errno.h>
00026 #include <hurd/process.h>
00027 
00028 /* This array contains the current resource limits for the process.  */
00029 extern struct rlimit _hurd_rlimits[RLIM_NLIMITS];
00030 extern struct mutex _hurd_rlimit_lock; /* Locks _hurd_rlimits.  */
00031 
00032 
00033 /* Helper function for getpriority and setpriority.  Maps FN over all the
00034    processes specified by WHICH and WHO.  PI is non-null if a
00035    proc_getprocinfo was already done; FN may use *PI arbitrarily, it is
00036    reset on the next call; PI_FLAGS is passed to proc_getprocinfo.  Returns
00037    FN's result the first time it returns nonzero.  If FN never returns
00038    nonzero, this returns zero.  */
00039 extern error_t _hurd_priority_which_map (enum __priority_which which, int who,
00040                                     error_t (*fn) (pid_t pid,
00041                                                  struct procinfo *pi),
00042                                     int pi_flags);
00043 
00044 /* Convert between Mach priority values and the priority
00045    values used by getpriority, setpriority, and nice.  */
00046 #define MACH_PRIORITY_TO_NICE(prio) (2 * ((prio) - 12))
00047 #define NICE_TO_MACH_PRIORITY(nice) (12 + ((nice) / 2))
00048 
00049 
00050 
00051 
00052 #endif