1 #ifndef _CONF_LINUX_H 2 #define _CONF_LINUX_H 3 4 #include <stdint.h> 5 #include <stdio.h> 6 #include <grp.h> 7 8 /* uclibc snprintf is redefined between stdio.h and string.h */ 9 #include <features.h> 10 #ifdef __UCLIBC_MAJOR__ 11 #undef __USE_BSD 12 #endif 13 14 #include "queue.h" 15 #include "sylimits.h" 16 17 #define SYMON_USER "symon" 18 #define SEM_ARGS (S_IWUSR|S_IRUSR|IPC_CREAT|IPC_EXCL) 19 #define SA_LEN(x) (((x)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) 20 #define SS_LEN(x) (((x)->ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)) 21 #define strlcpy(x,y,z) snprintf((x),(z),"%s", (y)) 22 23 union semun { 24 int val; 25 }; 26 27 #ifdef LONG_LONG_MAX 28 #define QUAD_MAX LONG_LONG_MAX 29 #endif 30 #ifndef QUAD_MAX 31 #define QUAD_MAX (0x7fffffffffffffffLL) 32 #endif 33 34 #define CPUSTATES 8 35 #define CP_USER 0 36 #define CP_NICE 1 37 #define CP_SYS 2 38 #define CP_IDLE 3 39 #define CP_IOWAIT 4 40 #define CP_HARDIRQ 5 41 #define CP_SOFTIRQ 6 42 #define CP_STEAL 7 43 44 #define MAX_PATH_LEN 1024 45 46 #define DISK_PATHS { "%s", "/dev/%s", "/dev/disk/by-id/%s", "/dev/disk/by-id/%s-part1", "/dev/disk/by-label/%s", "/dev/disk/by-uuid/%s", "/dev/disk/by-path/%s", "/dev/disk/by-path/%s-part1", "/dev/mapper/%s", NULL } 47 48 #define DISK_BLOCK_LEN 512 49 50 #define SENSOR_FAN 0 51 #define SENSOR_IN 1 52 #define SENSOR_TEMP 2 53 54 union stream_parg { 55 struct { 56 int64_t time[CPUSTATES]; 57 int64_t old[CPUSTATES]; 58 int64_t diff[CPUSTATES]; 59 int64_t states[CPUSTATES]; 60 char name[6]; 61 } cp; 62 struct { 63 int64_t time[CPUSTATES]; 64 int64_t old[CPUSTATES]; 65 int64_t diff[CPUSTATES]; 66 int64_t states[CPUSTATES]; 67 char name[6]; 68 } cpw; 69 struct { 70 char mountpath[MAX_PATH_LEN]; 71 } df; 72 struct { 73 int type; 74 char path[MAX_PATH_LEN]; 75 } sn; 76 int smart; 77 char ifname[MAX_PATH_LEN]; 78 char flukso[MAX_PATH_LEN]; 79 char io[MAX_PATH_LEN]; 80 }; 81 82 #endif 83