Thu Jan 18 00:32:43 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / hurd / hurd / resource.h
blob042df050081a6a707ee45b232cceae656df20c5d
1 /* Resource limits for the Hurd.
2 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
20 #ifndef _HURD_RESOURCE_H
21 #define _HURD_RESOURCE_H
23 #include <sys/types.h>
24 #include <sys/resource.h>
25 #include <errno.h>
26 #include <hurd/process.h>
28 /* This array contains the current resource limits for the process. */
29 extern struct rlimit _hurd_rlimits[RLIM_NLIMITS];
30 extern struct mutex _hurd_rlimit_lock; /* Locks _hurd_rlimits. */
33 /* Helper function for getpriority and setpriority. Maps FN over all the
34 processes specified by WHICH and WHO. PI is non-null if a
35 proc_getprocinfo was already done; FN may use *PI arbitrarily, it is
36 reset on the next call; PI_FLAGS is passed to proc_getprocinfo. Returns
37 FN's result the first time it returns nonzero. If FN never returns
38 nonzero, this returns zero. */
39 extern error_t _hurd_priority_which_map (enum __priority_which which, int who,
40 error_t (*fn) (pid_t pid,
41 struct procinfo *pi),
42 int pi_flags);
44 /* Convert between Mach priority values and the priority
45 values used by getpriority, setpriority, and nice. */
46 #define MACH_PRIORITY_TO_NICE(prio) (2 * ((prio) - 12))
47 #define NICE_TO_MACH_PRIORITY(nice) (12 + ((nice) / 2))
52 #endif