1 | /* |
---|
2 | * ---------------------------------------------------------------------- |
---|
3 | * RpWinResource.h |
---|
4 | * |
---|
5 | * This file provides the neccessary structures and function prototypes |
---|
6 | * for the Windows ports for Rappture of the following |
---|
7 | * resource management functions typically found on a Unix platform: |
---|
8 | * |
---|
9 | * setrlimit(), getrlimit(), getrusage(), gettimeofday() |
---|
10 | * |
---|
11 | * None of the ports are exactly perfect, but they are close enough |
---|
12 | * for Rappture's use. |
---|
13 | * ====================================================================== |
---|
14 | * AUTHOR: Nicholas J. Kisseberth, Purdue University |
---|
15 | * Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
16 | * |
---|
17 | * See the file "license.terms" for information on usage and |
---|
18 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
19 | * ====================================================================== |
---|
20 | */ |
---|
21 | |
---|
22 | #include <windows.h> |
---|
23 | |
---|
24 | #define OPEN_MAX 512 /* Windows Hard Limit on open files */ |
---|
25 | #define RLIMIT_CPU 0 /* CPU time in seconds */ |
---|
26 | #define RLIMIT_FSIZE 1 /* Maximum filesize */ |
---|
27 | #define RLIMIT_DATA 2 /* max data size */ |
---|
28 | #define RLIMIT_STACK 3 /* max stack size */ |
---|
29 | #define RLIMIT_CORE 4 /* max core file size */ |
---|
30 | #define RLIMIT_NOFILE 5 /* max number of open files */ |
---|
31 | #define RLIMIT_AS 6 /* address space (virt. memory) limit */ |
---|
32 | #define RLIM_INFINITY (0xffffffffUL) |
---|
33 | |
---|
34 | typedef unsigned long rlim_t; |
---|
35 | |
---|
36 | struct rlimit { |
---|
37 | rlim_t rlim_cur; |
---|
38 | rlim_t rlim_max; |
---|
39 | }; |
---|
40 | |
---|
41 | #define RUSAGE_SELF 0 /* calling process */ |
---|
42 | #define RUSAGE_CHILDREN -1 /* terminated child processes */ |
---|
43 | |
---|
44 | struct rusage { |
---|
45 | struct timeval ru_utime; /* user time used */ |
---|
46 | struct timeval ru_stime; /* system time used */ |
---|
47 | long ru_maxrss; /* max resident set size */ |
---|
48 | long ru_ixrss; /* integral shared text memory size */ |
---|
49 | long ru_idrss; /* integral unshared data size */ |
---|
50 | long ru_isrss; /* integral unshared stack size */ |
---|
51 | long ru_minflt; /* page reclaims */ |
---|
52 | long ru_majflt; /* page faults */ |
---|
53 | long ru_nswap; /* swaps */ |
---|
54 | }; |
---|
55 | |
---|
56 | HANDLE rpWinGetCurrentJob(); |
---|
57 | int getrusage(int intwho, struct rusage *rusage_in); |
---|
58 | int getrlimit(int resource, struct rlimit *rlp); |
---|
59 | int setrlimit(int resource, const struct rlimit *rlp); |
---|
60 | int gettimeofday(struct timeval *tv, void *tz); |
---|