resource.h (1558B)
1 /* -*-comment-start: "//";comment-end:""-*- 2 * GNU Mes --- Maxwell Equations of Software 3 * Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 4 * 5 * This file is part of GNU Mes. 6 * 7 * GNU Mes is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or (at 10 * your option) any later version. 11 * 12 * GNU Mes is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #ifndef __MES_SYS_RESOURCE_H 21 #define __MES_SYS_RESOURCE_H 1 22 23 #if SYSTEM_LIBC 24 #undef __MES_SYS_RESOURCE_H 25 #include_next <sys/resource.h> 26 27 #else // ! SYSTEM_LIBC 28 29 #include <sys/time.h> 30 31 struct rusage 32 { 33 struct timeval ru_utime; 34 struct timeval ru_stime; 35 long ru_maxrss; 36 long ru_ixrss; 37 long ru_idrss; 38 long ru_isrss; 39 long ru_minflt; 40 long ru_majflt; 41 long ru_nswap; 42 long ru_inblock; 43 long ru_oublock; 44 long ru_msgsnd; 45 long ru_msgrcv; 46 long ru_nsignals; 47 long ru_nvcsw; 48 long ru_nivcsw; 49 }; 50 51 #define RUSAGE_SELF 0 52 #define RUSAGE_CHILDREN -1 53 #define RLIMIT_NOFILE 1024 54 #define OPEN_MAX RLIMIT_NOFILE 55 56 int getrusage (int processes, struct rusage *rusage); 57 58 #endif // ! SYSTEM_LIBC 59 60 #endif // __MES_SYS_RESOURCE_H