mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-16 01:57:09 +00:00
Merge branch 'master' into lua-config
This commit is contained in:
commit
1b791ed1c8
@ -2012,7 +2012,7 @@ static void main_loop(void)
|
|||||||
#ifdef HAVE_SYS_INOTIFY_H
|
#ifdef HAVE_SYS_INOTIFY_H
|
||||||
int inotify_config_wd = -1;
|
int inotify_config_wd = -1;
|
||||||
#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event))
|
#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event))
|
||||||
#define INOTIFY_BUF_LEN (20 * (INOTIFY_EVENT_SIZE + 16))
|
#define INOTIFY_BUF_LEN (20 * (INOTIFY_EVENT_SIZE + 16)) + 1
|
||||||
char inotify_buff[INOTIFY_BUF_LEN];
|
char inotify_buff[INOTIFY_BUF_LEN];
|
||||||
#endif /* HAVE_SYS_INOTIFY_H */
|
#endif /* HAVE_SYS_INOTIFY_H */
|
||||||
|
|
||||||
@ -2420,7 +2420,8 @@ static void main_loop(void)
|
|||||||
select(inotify_fd + 1, &descriptors, NULL, NULL, &time_to_wait);
|
select(inotify_fd + 1, &descriptors, NULL, NULL, &time_to_wait);
|
||||||
if (FD_ISSET(inotify_fd, &descriptors)) {
|
if (FD_ISSET(inotify_fd, &descriptors)) {
|
||||||
/* process inotify events */
|
/* process inotify events */
|
||||||
len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN);
|
len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN - 1);
|
||||||
|
inotify_buff[len] = 0;
|
||||||
while (len > 0 && idx < len) {
|
while (len > 0 && idx < len) {
|
||||||
struct inotify_event *ev = (struct inotify_event *) &inotify_buff[idx];
|
struct inotify_event *ev = (struct inotify_event *) &inotify_buff[idx];
|
||||||
if (ev->wd == inotify_config_wd && (ev->mask & IN_MODIFY || ev->mask & IN_IGNORED)) {
|
if (ev->wd == inotify_config_wd && (ev->mask & IN_MODIFY || ev->mask & IN_IGNORED)) {
|
||||||
|
10
src/linux.cc
10
src/linux.cc
@ -2450,7 +2450,7 @@ static unsigned long long calc_cpu_total(void)
|
|||||||
KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGPROC : TMPL_SHORTPROC;
|
KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGPROC : TMPL_SHORTPROC;
|
||||||
|
|
||||||
ps = open("/proc/stat", O_RDONLY);
|
ps = open("/proc/stat", O_RDONLY);
|
||||||
rc = read(ps, line, sizeof(line));
|
rc = read(ps, line, BUFFER_LEN - 1);
|
||||||
close(ps);
|
close(ps);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -2529,7 +2529,7 @@ static void process_parse_stat(struct process *process)
|
|||||||
/* Mark process as up-to-date. */
|
/* Mark process as up-to-date. */
|
||||||
process->time_stamp = g_time;
|
process->time_stamp = g_time;
|
||||||
|
|
||||||
rc = read(ps, line, sizeof(line));
|
rc = read(ps, line, BUFFER_LEN - 1);
|
||||||
close(ps);
|
close(ps);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return;
|
return;
|
||||||
@ -2566,11 +2566,9 @@ static void process_parse_stat(struct process *process)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
endl = read(ps, line, sizeof(line));
|
endl = read(ps, line, BUFFER_LEN - 1);
|
||||||
close(ps);
|
close(ps);
|
||||||
|
|
||||||
/* null terminate the input */
|
|
||||||
line[endl] = 0;
|
|
||||||
/* account for "kdeinit: " */
|
/* account for "kdeinit: " */
|
||||||
if ((char *) line == strstr(line, "kdeinit: ")) {
|
if ((char *) line == strstr(line, "kdeinit: ")) {
|
||||||
r = ((char *) line) + 9;
|
r = ((char *) line) + 9;
|
||||||
@ -2641,7 +2639,7 @@ static void process_parse_io(struct process *process)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = read(ps, line, sizeof(line));
|
rc = read(ps, line, BUFFER_LEN - 1);
|
||||||
close(ps);
|
close(ps);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user