Rewrote the resource.h header and added comments about missing functions

and functionality.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4774 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-09-21 15:51:03 +00:00
parent 853d2f32a6
commit 051f882824

View File

@ -1,50 +1,69 @@
#ifndef _SYS_RESOURCE_H
#define _SYS_RESOURCE_H
/*
** Copyright 2002, Jeff Hamilton. All rights reserved.
** Distributed under the terms of the NewOS License.
** Distributed under the terms of the OpenBeOS License.
*/
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long rlim_t;
struct rlimit {
rlim_t rlim_cur; // Current soft limit
rlim_t rlim_max; // System hard limit
};
#define RLIMIT_CORE 0
#define RLIMIT_CPU 1
#define RLIMIT_DATA 2
#define RLIMIT_FSIZE 3
#define RLIMIT_NOFILE 4
#define RLIMIT_STACK 5
#define RLIMIT_AS 6
#define RLIMIT_VMEM 7
#define RLIM_INFINITY (0xffffffffUL)
int getrlimit(int resource, struct rlimit * rlp);
int setrlimit(int resource, const struct rlimit * rlp);
#include <sys/time.h>
/* getrlimit()/setrlimit() definitions */
typedef unsigned long rlim_t;
struct rlimit {
rlim_t rlim_cur; /* current soft limit */
rlim_t rlim_max; /* hard limit */
};
// ToDo: the only supported mode is RLIMIT_NOFILE right now
#define RLIMIT_CORE 0 /* size of the core file */
#define RLIMIT_CPU 1 /* CPU time per team */
#define RLIMIT_DATA 2 /* data segment size */
#define RLIMIT_FSIZE 3 /* file size */
#define RLIMIT_NOFILE 4 /* number of open files */
#define RLIMIT_STACK 5 /* stack size */
#define RLIMIT_AS 6 /* address space size */
#define RLIM_INFINITY (0xffffffffUL)
#define RLIM_SAVED_MAX RLIM_INFINITY
#define RLIM_SAVED_CUR RLIM_INFINITY
/* getrusage() definitions */
struct rusage {
struct timeval ru_utime; // user time used
struct timeval ru_stime; // system time used
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
};
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN -1
int getrusage(int processes, struct rusage *rusage);
/* getpriority()/setpriority() definitions */
#define PRIO_PROCESS 0
#define PRIO_PGRP 1
#define PRIO_USER 2
#ifdef __cplusplus
} /* extern "C" */
extern "C" {
#endif
extern int getrusage(int processes, struct rusage *rusage);
extern int getrlimit(int resource, struct rlimit * rlp);
extern int setrlimit(int resource, const struct rlimit * rlp);
// ToDo: The following POSIX calls are missing (in BeOS as well):
//int getpriority(int which, id_t who);
//int setpriority(int which, id_t who, int priority);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_RESOURCE_H */