From 69f439eff387a6ecb52734e400b297a3c85f2285 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Tue, 21 Sep 2021 08:35:19 +0200 Subject: New upstream version 3.1.0 --- linux/Platform.h | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 7 deletions(-) (limited to 'linux/Platform.h') diff --git a/linux/Platform.h b/linux/Platform.h index fe81448..0d6d4a9 100644 --- a/linux/Platform.h +++ b/linux/Platform.h @@ -7,16 +7,35 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" + +#include #include +#include +#include +#include #include #include "Action.h" #include "BatteryMeter.h" #include "DiskIOMeter.h" +#include "Hashtable.h" +#include "Macros.h" #include "Meter.h" +#include "NetworkIOMeter.h" #include "Process.h" #include "ProcessLocksScreen.h" +#include "RichString.h" #include "SignalsPanel.h" +#include "generic/gettime.h" +#include "generic/hostname.h" +#include "generic/uname.h" + +/* GNU/Hurd does not have PATH_MAX in limits.h */ +#ifndef PATH_MAX + #define PATH_MAX 4096 +#endif + extern const ProcessField Platform_defaultFields[]; @@ -38,7 +57,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen); int Platform_getMaxPid(void); -double Platform_setCPUValues(Meter* this, int cpu); +double Platform_setCPUValues(Meter* this, unsigned int cpu); void Platform_setMemoryValues(Meter* this); @@ -56,15 +75,57 @@ char* Platform_getInodeFilename(pid_t pid, ino_t inode); FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid); -void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred); +void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred); bool Platform_getDiskIO(DiskIOData* data); -bool Platform_getNetworkIO(unsigned long int* bytesReceived, - unsigned long int* packetsReceived, - unsigned long int* bytesTransmitted, - unsigned long int* packetsTransmitted); +bool Platform_getNetworkIO(NetworkIOData* data); + +void Platform_getBattery(double* percent, ACPresence* isOnAC); + +static inline void Platform_getHostname(char* buffer, size_t size) { + Generic_hostname(buffer, size); +} + +static inline void Platform_getRelease(char** string) { + *string = Generic_uname(); +} + +#ifdef HAVE_LIBCAP + #define PLATFORM_LONG_OPTIONS \ + {"drop-capabilities", optional_argument, 0, 160}, +#else + #define PLATFORM_LONG_OPTIONS +#endif + +void Platform_longOptionsUsage(const char* name); + +bool Platform_getLongOption(int opt, int argc, char** argv); + +static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) { + Generic_gettime_realtime(tv, msec); +} + +static inline void Platform_gettime_monotonic(uint64_t* msec) { + Generic_gettime_monotonic(msec); +} + +static inline Hashtable* Platform_dynamicMeters(void) { return NULL; } + +static inline void Platform_dynamicMetersDone(ATTR_UNUSED Hashtable* table) { } + +static inline void Platform_dynamicMeterInit(ATTR_UNUSED Meter* meter) { } + +static inline void Platform_dynamicMeterUpdateValues(ATTR_UNUSED Meter* meter) { } + +static inline void Platform_dynamicMeterDisplay(ATTR_UNUSED const Meter* meter, ATTR_UNUSED RichString* out) { } + +static inline Hashtable* Platform_dynamicColumns(void) { return NULL; } + +static inline void Platform_dynamicColumnsDone(ATTR_UNUSED Hashtable* table) { } + +static inline const char* Platform_dynamicColumnInit(ATTR_UNUSED unsigned int key) { return NULL; } -void Platform_getBattery(double *percent, ACPresence *isOnAC); +static inline bool Platform_dynamicColumnWriteField(ATTR_UNUSED const Process* proc, ATTR_UNUSED RichString* str, ATTR_UNUSED unsigned int key) { return false; } #endif -- cgit v1.2.3