|
Packit |
6c4009 |
/* Bit values & structures for resource limits. Linux version.
|
|
Packit |
6c4009 |
Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _SYS_RESOURCE_H
|
|
Packit |
6c4009 |
# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <bits/types.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Transmute defines to enumerations. The macro re-definitions are
|
|
Packit |
6c4009 |
necessary because some programs want to test for operating system
|
|
Packit |
6c4009 |
features with #ifdef RUSAGE_SELF. In ISO C the reflexive
|
|
Packit |
6c4009 |
definition is a no-op. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Kinds of resource limit. */
|
|
Packit |
6c4009 |
enum __rlimit_resource
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* Per-process CPU limit, in seconds. */
|
|
Packit |
6c4009 |
RLIMIT_CPU = 0,
|
|
Packit |
6c4009 |
#define RLIMIT_CPU RLIMIT_CPU
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Largest file that can be created, in bytes. */
|
|
Packit |
6c4009 |
RLIMIT_FSIZE = 1,
|
|
Packit |
6c4009 |
#define RLIMIT_FSIZE RLIMIT_FSIZE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum size of data segment, in bytes. */
|
|
Packit |
6c4009 |
RLIMIT_DATA = 2,
|
|
Packit |
6c4009 |
#define RLIMIT_DATA RLIMIT_DATA
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum size of stack segment, in bytes. */
|
|
Packit |
6c4009 |
RLIMIT_STACK = 3,
|
|
Packit |
6c4009 |
#define RLIMIT_STACK RLIMIT_STACK
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Largest core file that can be created, in bytes. */
|
|
Packit |
6c4009 |
RLIMIT_CORE = 4,
|
|
Packit |
6c4009 |
#define RLIMIT_CORE RLIMIT_CORE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Largest resident set size, in bytes.
|
|
Packit |
6c4009 |
This affects swapping; processes that are exceeding their
|
|
Packit |
6c4009 |
resident set size will be more likely to have physical memory
|
|
Packit |
6c4009 |
taken from them. */
|
|
Packit |
6c4009 |
__RLIMIT_RSS = 5,
|
|
Packit |
6c4009 |
#define RLIMIT_RSS __RLIMIT_RSS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Number of open files. */
|
|
Packit |
6c4009 |
RLIMIT_NOFILE = 7,
|
|
Packit |
6c4009 |
__RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */
|
|
Packit |
6c4009 |
#define RLIMIT_NOFILE RLIMIT_NOFILE
|
|
Packit |
6c4009 |
#define RLIMIT_OFILE __RLIMIT_OFILE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Address space limit. */
|
|
Packit |
6c4009 |
RLIMIT_AS = 9,
|
|
Packit |
6c4009 |
#define RLIMIT_AS RLIMIT_AS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Number of processes. */
|
|
Packit |
6c4009 |
__RLIMIT_NPROC = 6,
|
|
Packit |
6c4009 |
#define RLIMIT_NPROC __RLIMIT_NPROC
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Locked-in-memory address space. */
|
|
Packit |
6c4009 |
__RLIMIT_MEMLOCK = 8,
|
|
Packit |
6c4009 |
#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum number of file locks. */
|
|
Packit |
6c4009 |
__RLIMIT_LOCKS = 10,
|
|
Packit |
6c4009 |
#define RLIMIT_LOCKS __RLIMIT_LOCKS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum number of pending signals. */
|
|
Packit |
6c4009 |
__RLIMIT_SIGPENDING = 11,
|
|
Packit |
6c4009 |
#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum bytes in POSIX message queues. */
|
|
Packit |
6c4009 |
__RLIMIT_MSGQUEUE = 12,
|
|
Packit |
6c4009 |
#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum nice priority allowed to raise to.
|
|
Packit |
6c4009 |
Nice levels 19 .. -20 correspond to 0 .. 39
|
|
Packit |
6c4009 |
values of this resource limit. */
|
|
Packit |
6c4009 |
__RLIMIT_NICE = 13,
|
|
Packit |
6c4009 |
#define RLIMIT_NICE __RLIMIT_NICE
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum realtime priority allowed for non-priviledged
|
|
Packit |
6c4009 |
processes. */
|
|
Packit |
6c4009 |
__RLIMIT_RTPRIO = 14,
|
|
Packit |
6c4009 |
#define RLIMIT_RTPRIO __RLIMIT_RTPRIO
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Maximum CPU time in µs that a process scheduled under a real-time
|
|
Packit |
6c4009 |
scheduling policy may consume without making a blocking system
|
|
Packit |
6c4009 |
call before being forcibly descheduled. */
|
|
Packit |
6c4009 |
__RLIMIT_RTTIME = 15,
|
|
Packit |
6c4009 |
#define RLIMIT_RTTIME __RLIMIT_RTTIME
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__RLIMIT_NLIMITS = 16,
|
|
Packit |
6c4009 |
__RLIM_NLIMITS = __RLIMIT_NLIMITS
|
|
Packit |
6c4009 |
#define RLIMIT_NLIMITS __RLIMIT_NLIMITS
|
|
Packit |
6c4009 |
#define RLIM_NLIMITS __RLIM_NLIMITS
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Value to indicate that there is no limit. */
|
|
Packit |
6c4009 |
#ifndef __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
# define RLIM_INFINITY ((__rlim_t) -1)
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# define RLIM_INFINITY 0xffffffffffffffffuLL
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __USE_LARGEFILE64
|
|
Packit |
6c4009 |
# define RLIM64_INFINITY 0xffffffffffffffffuLL
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* We can represent all limits. */
|
|
Packit |
6c4009 |
#define RLIM_SAVED_MAX RLIM_INFINITY
|
|
Packit |
6c4009 |
#define RLIM_SAVED_CUR RLIM_INFINITY
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Type for resource quantity measurement. */
|
|
Packit |
6c4009 |
#ifndef __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
typedef __rlim_t rlim_t;
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
typedef __rlim64_t rlim_t;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#ifdef __USE_LARGEFILE64
|
|
Packit |
6c4009 |
typedef __rlim64_t rlim64_t;
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
struct rlimit
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* The current (soft) limit. */
|
|
Packit |
6c4009 |
rlim_t rlim_cur;
|
|
Packit |
6c4009 |
/* The hard limit. */
|
|
Packit |
6c4009 |
rlim_t rlim_max;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __USE_LARGEFILE64
|
|
Packit |
6c4009 |
struct rlimit64
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* The current (soft) limit. */
|
|
Packit |
6c4009 |
rlim64_t rlim_cur;
|
|
Packit |
6c4009 |
/* The hard limit. */
|
|
Packit |
6c4009 |
rlim64_t rlim_max;
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Whose usage statistics do you want? */
|
|
Packit |
6c4009 |
enum __rusage_who
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
/* The calling process. */
|
|
Packit |
6c4009 |
RUSAGE_SELF = 0,
|
|
Packit |
6c4009 |
#define RUSAGE_SELF RUSAGE_SELF
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* All of its terminated child processes. */
|
|
Packit |
6c4009 |
RUSAGE_CHILDREN = -1
|
|
Packit |
6c4009 |
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __USE_GNU
|
|
Packit |
6c4009 |
,
|
|
Packit |
6c4009 |
/* The calling thread. */
|
|
Packit |
6c4009 |
RUSAGE_THREAD = 1
|
|
Packit |
6c4009 |
# define RUSAGE_THREAD RUSAGE_THREAD
|
|
Packit |
6c4009 |
/* Name for the same functionality on Solaris. */
|
|
Packit |
6c4009 |
# define RUSAGE_LWP RUSAGE_THREAD
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <bits/types/struct_timeval.h>
|
|
Packit |
6c4009 |
#include <bits/types/struct_rusage.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Priority limits. */
|
|
Packit |
6c4009 |
#define PRIO_MIN -20 /* Minimum priority a process can have. */
|
|
Packit |
6c4009 |
#define PRIO_MAX 20 /* Maximum priority a process can have. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* The type of the WHICH argument to `getpriority' and `setpriority',
|
|
Packit |
6c4009 |
indicating what flavor of entity the WHO argument specifies. */
|
|
Packit |
6c4009 |
enum __priority_which
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
PRIO_PROCESS = 0, /* WHO is a process ID. */
|
|
Packit |
6c4009 |
#define PRIO_PROCESS PRIO_PROCESS
|
|
Packit |
6c4009 |
PRIO_PGRP = 1, /* WHO is a process group ID. */
|
|
Packit |
6c4009 |
#define PRIO_PGRP PRIO_PGRP
|
|
Packit |
6c4009 |
PRIO_USER = 2 /* WHO is a user ID. */
|
|
Packit |
6c4009 |
#define PRIO_USER PRIO_USER
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__BEGIN_DECLS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __USE_GNU
|
|
Packit |
6c4009 |
/* Modify and return resource limits of a process atomically. */
|
|
Packit |
6c4009 |
# ifndef __USE_FILE_OFFSET64
|
|
Packit |
6c4009 |
extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
|
|
Packit |
6c4009 |
const struct rlimit *__new_limit,
|
|
Packit |
6c4009 |
struct rlimit *__old_limit) __THROW;
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# ifdef __REDIRECT_NTH
|
|
Packit |
6c4009 |
extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
|
|
Packit |
6c4009 |
enum __rlimit_resource __resource,
|
|
Packit |
6c4009 |
const struct rlimit *__new_limit,
|
|
Packit |
6c4009 |
struct rlimit *__old_limit), prlimit64);
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define prlimit prlimit64
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# ifdef __USE_LARGEFILE64
|
|
Packit |
6c4009 |
extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
|
|
Packit |
6c4009 |
const struct rlimit64 *__new_limit,
|
|
Packit |
6c4009 |
struct rlimit64 *__old_limit) __THROW;
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__END_DECLS
|