Make this header a little bit more XSI-compliant:

- Define type rlim_t and struct timeval.  This makes autoconf
  happier.  (PR: 62388)
- Add RLIMIT_AS, which is an alias for our RLIMIT_VMEM.
- structs orlimit and loadavg, as well as macros CP*, should
  only appear if __BSD_VISIBLE.
- Use underscored versions of int32_t and fixpt_t in case
  <sys/types.h> is not included.
- Document areas of non-conformance.
This commit is contained in:
David Schultz 2004-06-13 22:07:58 +00:00
parent 1db12dbd19
commit e01682bb68
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130435

View File

@ -33,6 +33,10 @@
#ifndef _SYS_RESOURCE_H_
#define _SYS_RESOURCE_H_
#include <sys/cdefs.h>
#include <sys/_timeval.h>
#include <sys/_types.h>
/*
* Process priority specifications to get/setpriority.
*/
@ -85,10 +89,12 @@ struct rusage {
#define RLIMIT_NOFILE 8 /* number of open files */
#define RLIMIT_SBSIZE 9 /* maximum size of all socket buffers */
#define RLIMIT_VMEM 10 /* virtual process size (inclusive of mmap) */
#define RLIMIT_AS RLIMIT_VMEM /* standard name for RLIMIT_VMEM */
#define RLIM_NLIMITS 11 /* number of resource limits */
#define RLIM_INFINITY ((rlim_t)(((u_quad_t)1 << 63) - 1))
/* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */
/*
@ -111,20 +117,26 @@ static char *rlimit_ident[] = {
};
#endif
struct orlimit {
int32_t rlim_cur; /* current (soft) limit */
int32_t rlim_max; /* maximum value for rlim_cur */
};
#ifndef _RLIM_T_DECLARED
typedef __rlim_t rlim_t;
#define _RLIM_T_DECLARED
#endif
struct rlimit {
rlim_t rlim_cur; /* current (soft) limit */
rlim_t rlim_max; /* maximum value for rlim_cur */
};
/* Load average structure. */
#if __BSD_VISIBLE
struct orlimit {
__int32_t rlim_cur; /* current (soft) limit */
__int32_t rlim_max; /* maximum value for rlim_cur */
};
struct loadavg {
fixpt_t ldavg[3];
long fscale;
__fixpt_t ldavg[3];
long fscale;
};
#define CP_USER 0
@ -134,6 +146,8 @@ struct loadavg {
#define CP_IDLE 4
#define CPUSTATES 5
#endif /* __BSD_VISIBLE */
#ifdef _KERNEL
extern struct loadavg averunnable;
extern long cp_time[CPUSTATES];
@ -141,9 +155,9 @@ extern long cp_time[CPUSTATES];
int kern_setrlimit(struct thread *, u_int, struct rlimit *);
#else
#include <sys/cdefs.h>
__BEGIN_DECLS
/* XXX 2nd arg to [gs]etpriority() should be an id_t */
int getpriority(int, int);
int getrlimit(int, struct rlimit *);
int getrusage(int, struct rusage *);