klibc-bot for Ben Hutchings
2023-Feb-12 22:48 UTC
[klibc] [klibc:master] resource: Avoid using <linux/resource.h>
Commit-ID: 79ee6b096470c6627f9e921668d6745d2418c951 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=79ee6b096470c6627f9e921668d6745d2418c951 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Sat, 14 Jan 2023 03:15:20 +0100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sun, 12 Feb 2023 18:53:53 +0100 [klibc] resource: Avoid using <linux/resource.h> Our <sys/resource.h> includes <linux/resource.h>, which includes <linux/time.h>, which conflicts with 64-bit time definitions. Copy the definitions we actually need instead of including <linux/resource.h>. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/sys/resource.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/usr/include/sys/resource.h b/usr/include/sys/resource.h index 5d8bd525..94ed28a5 100644 --- a/usr/include/sys/resource.h +++ b/usr/include/sys/resource.h @@ -6,8 +6,39 @@ #define _SYS_RESOURCE_H #include <klibc/extern.h> -#include <sys/types.h> /* MUST be included before linux/resource.h */ -#include <linux/resource.h> +#include <sys/types.h> +#include <sys/time.h> + +#define RUSAGE_SELF 0 +#define RUSAGE_CHILDREN (-1) +#define RUSAGE_BOTH (-2) +#define RUSAGE_THREAD 1 + +struct rusage { + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ + __kernel_long_t ru_maxrss; /* maximum resident set size */ + __kernel_long_t ru_ixrss; /* integral shared memory size */ + __kernel_long_t ru_idrss; /* integral unshared data size */ + __kernel_long_t ru_isrss; /* integral unshared stack size */ + __kernel_long_t ru_minflt; /* page reclaims */ + __kernel_long_t ru_majflt; /* page faults */ + __kernel_long_t ru_nswap; /* swaps */ + __kernel_long_t ru_inblock; /* block input operations */ + __kernel_long_t ru_oublock; /* block output operations */ + __kernel_long_t ru_msgsnd; /* messages sent */ + __kernel_long_t ru_msgrcv; /* messages received */ + __kernel_long_t ru_nsignals; /* signals received */ + __kernel_long_t ru_nvcsw; /* voluntary context switches */ + __kernel_long_t ru_nivcsw; /* involuntary " */ +}; + +#define PRIO_MIN (-20) +#define PRIO_MAX 20 + +#define PRIO_PROCESS 0 +#define PRIO_PGRP 1 +#define PRIO_USER 2 __extern int getpriority(int, int); __extern int setpriority(int, int, int);