klibc-bot for Ben Hutchings
2023-Jan-14 22:03 UTC
[klibc] [klibc:time64] resource: Avoid using <linux/resource.h>
Commit-ID: d4ab7343978bbec7141f8462236ba6a47574205f Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d4ab7343978bbec7141f8462236ba6a47574205f 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: Sat, 14 Jan 2023 18:09:28 +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);
Arnd Bergmann
2023-Jan-14 22:29 UTC
[klibc] [klibc:time64] resource: Avoid using <linux/resource.h>
On Sat, Jan 14, 2023, at 23:03, klibc-bot for Ben Hutchings wrote:> Commit-ID: d4ab7343978bbec7141f8462236ba6a47574205f > Gitweb: > http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=d4ab7343978bbec7141f8462236ba6a47574205f > 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: Sat, 14 Jan 2023 18:09:28 +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>I had no idea we still had those definitions in linux/time.h, I wonder if those should be removed in the kernel, as you point out here there is no way this can actually work. What are the rules for klibc including kernel headers here, is it able to rely on the latest header version, or does it it have to work with old headers? Arnd
Seemingly Similar Threads
- [klibc:time64] resource: Avoid using <linux/resource.h>
- [klibc:time64] time: Use 64-bit time types on all architectures
- [klibc:time64] time: Use 64-bit time types on all architectures
- [klibc:time64] select: Make all select calls wrappers for pselect6()
- [klibc:time64] select: Fix handling of NULL timeout when wrapping pselect()