mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-29 05:12:41 +00:00
pid objects: outsource sub object evaluation
This commit is contained in:
parent
057855442c
commit
5b686294f3
160
src/conky.c
160
src/conky.c
@ -796,283 +796,123 @@ void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
OBJ(pid_chroot) {
|
OBJ(pid_chroot) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_chroot(obj, p, p_max_size);
|
print_pid_chroot(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_cmdline) {
|
OBJ(pid_cmdline) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_cmdline(obj, p, p_max_size);
|
print_pid_cmdline(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_cwd) {
|
OBJ(pid_cwd) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_cwd(obj, p, p_max_size);
|
print_pid_cwd(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_environ) {
|
OBJ(pid_environ) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_environ(obj, p, p_max_size);
|
print_pid_environ(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_environ_list) {
|
OBJ(pid_environ_list) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_environ_list(obj, p, p_max_size);
|
print_pid_environ_list(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_exe) {
|
OBJ(pid_exe) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_exe(obj, p, p_max_size);
|
print_pid_exe(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_nice) {
|
OBJ(pid_nice) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_nice(obj, p, p_max_size);
|
print_pid_nice(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_openfiles) {
|
OBJ(pid_openfiles) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_openfiles(obj, p, p_max_size);
|
print_pid_openfiles(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_parent) {
|
OBJ(pid_parent) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_parent(obj, p, p_max_size);
|
print_pid_parent(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_priority) {
|
OBJ(pid_priority) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_priority(obj, p, p_max_size);
|
print_pid_priority(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_state) {
|
OBJ(pid_state) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_state(obj, p, p_max_size);
|
print_pid_state(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_state_short) {
|
OBJ(pid_state_short) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_state_short(obj, p, p_max_size);
|
print_pid_state_short(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_stderr) {
|
OBJ(pid_stderr) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_stderr(obj, p, p_max_size);
|
print_pid_stderr(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_stdin) {
|
OBJ(pid_stdin) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_stdin(obj, p, p_max_size);
|
print_pid_stdin(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_stdout) {
|
OBJ(pid_stdout) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_stdout(obj, p, p_max_size);
|
print_pid_stdout(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_threads) {
|
OBJ(pid_threads) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_threads(obj, p, p_max_size);
|
print_pid_threads(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_thread_list) {
|
OBJ(pid_thread_list) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_thread_list(obj, p, p_max_size);
|
print_pid_thread_list(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_time_kernelmode) {
|
OBJ(pid_time_kernelmode) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_time_kernelmode(obj, p, p_max_size);
|
print_pid_time_kernelmode(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_time_usermode) {
|
OBJ(pid_time_usermode) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_time_usermode(obj, p, p_max_size);
|
print_pid_time_usermode(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_time) {
|
OBJ(pid_time) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_time(obj, p, p_max_size);
|
print_pid_time(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_uid) {
|
OBJ(pid_uid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_uid(obj, p, p_max_size);
|
print_pid_uid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_euid) {
|
OBJ(pid_euid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_euid(obj, p, p_max_size);
|
print_pid_euid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_suid) {
|
OBJ(pid_suid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_suid(obj, p, p_max_size);
|
print_pid_suid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_fsuid) {
|
OBJ(pid_fsuid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_fsuid(obj, p, p_max_size);
|
print_pid_fsuid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_gid) {
|
OBJ(pid_gid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_gid(obj, p, p_max_size);
|
print_pid_gid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_egid) {
|
OBJ(pid_egid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_egid(obj, p, p_max_size);
|
print_pid_egid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_sgid) {
|
OBJ(pid_sgid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_sgid(obj, p, p_max_size);
|
print_pid_sgid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_fsgid) {
|
OBJ(pid_fsgid) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_fsgid(obj, p, p_max_size);
|
print_pid_fsgid(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_read) {
|
OBJ(pid_read) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_read(obj, p, p_max_size);
|
print_pid_read(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmpeak) {
|
OBJ(pid_vmpeak) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmpeak(obj, p, p_max_size);
|
print_pid_vmpeak(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmsize) {
|
OBJ(pid_vmsize) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmsize(obj, p, p_max_size);
|
print_pid_vmsize(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmlck) {
|
OBJ(pid_vmlck) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmlck(obj, p, p_max_size);
|
print_pid_vmlck(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmhwm) {
|
OBJ(pid_vmhwm) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmhwm(obj, p, p_max_size);
|
print_pid_vmhwm(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmrss) {
|
OBJ(pid_vmrss) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmrss(obj, p, p_max_size);
|
print_pid_vmrss(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmdata) {
|
OBJ(pid_vmdata) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmdata(obj, p, p_max_size);
|
print_pid_vmdata(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmstk) {
|
OBJ(pid_vmstk) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmstk(obj, p, p_max_size);
|
print_pid_vmstk(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmexe) {
|
OBJ(pid_vmexe) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmexe(obj, p, p_max_size);
|
print_pid_vmexe(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmlib) {
|
OBJ(pid_vmlib) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmlib(obj, p, p_max_size);
|
print_pid_vmlib(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_vmpte) {
|
OBJ(pid_vmpte) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_vmpte(obj, p, p_max_size);
|
print_pid_vmpte(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(pid_write) {
|
OBJ(pid_write) {
|
||||||
char buf[max_user_text];
|
|
||||||
|
|
||||||
generate_text_internal(buf, max_user_text, *obj->sub, cur);
|
|
||||||
obj->data.s = buf;
|
|
||||||
print_pid_write(obj, p, p_max_size);
|
print_pid_write(obj, p, p_max_size);
|
||||||
}
|
}
|
||||||
OBJ(text) {
|
OBJ(text) {
|
||||||
|
126
src/core.c
126
src/core.c
@ -859,131 +859,89 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
scan_cmdline_to_pid_arg(obj, arg, free_at_crash);
|
scan_cmdline_to_pid_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_cmdline_to_pid;
|
obj->callbacks.print = &print_cmdline_to_pid;
|
||||||
END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument")
|
END OBJ_ARG(pid_chroot, 0, "pid_chroot needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_cmdline, 0, "pid_cmdline needs a pid as argument")
|
END OBJ_ARG(pid_cmdline, 0, "pid_cmdline needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_cwd, 0, "pid_cwd needs a pid as argument")
|
END OBJ_ARG(pid_cwd, 0, "pid_cwd needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_environ, 0, "pid_environ needs arguments")
|
END OBJ_ARG(pid_environ, 0, "pid_environ needs arguments")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_environ_list, 0, "pid_environ_list needs a pid as argument")
|
END OBJ_ARG(pid_environ_list, 0, "pid_environ_list needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_exe, 0, "pid_exe needs a pid as argument")
|
END OBJ_ARG(pid_exe, 0, "pid_exe needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_nice, 0, "pid_nice needs a pid as argument")
|
END OBJ_ARG(pid_nice, 0, "pid_nice needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_openfiles, 0, "pid_openfiles needs a pid as argument")
|
END OBJ_ARG(pid_openfiles, 0, "pid_openfiles needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_parent, 0, "pid_parent needs a pid as argument")
|
END OBJ_ARG(pid_parent, 0, "pid_parent needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_priority, 0, "pid_priority needs a pid as argument")
|
END OBJ_ARG(pid_priority, 0, "pid_priority needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_state, 0, "pid_state needs a pid as argument")
|
END OBJ_ARG(pid_state, 0, "pid_state needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_state_short, 0, "pid_state_short needs a pid as argument")
|
END OBJ_ARG(pid_state_short, 0, "pid_state_short needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_stderr, 0, "pid_stderr needs a pid as argument")
|
END OBJ_ARG(pid_stderr, 0, "pid_stderr needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_stdin, 0, "pid_stdin needs a pid as argument")
|
END OBJ_ARG(pid_stdin, 0, "pid_stdin needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_stdout, 0, "pid_stdout needs a pid as argument")
|
END OBJ_ARG(pid_stdout, 0, "pid_stdout needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_threads, 0, "pid_threads needs a pid as argument")
|
END OBJ_ARG(pid_threads, 0, "pid_threads needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_thread_list, 0, "pid_thread_list needs a pid as argument")
|
END OBJ_ARG(pid_thread_list, 0, "pid_thread_list needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_time_kernelmode, 0, "pid_time_kernelmode needs a pid as argument")
|
END OBJ_ARG(pid_time_kernelmode, 0, "pid_time_kernelmode needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_time_usermode, 0, "pid_time_usermode needs a pid as argument")
|
END OBJ_ARG(pid_time_usermode, 0, "pid_time_usermode needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_time, 0, "pid_time needs a pid as argument")
|
END OBJ_ARG(pid_time, 0, "pid_time needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_uid, 0, "pid_uid needs a pid as argument")
|
END OBJ_ARG(pid_uid, 0, "pid_uid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_euid, 0, "pid_euid needs a pid as argument")
|
END OBJ_ARG(pid_euid, 0, "pid_euid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_suid, 0, "pid_suid needs a pid as argument")
|
END OBJ_ARG(pid_suid, 0, "pid_suid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_fsuid, 0, "pid_fsuid needs a pid as argument")
|
END OBJ_ARG(pid_fsuid, 0, "pid_fsuid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_gid, 0, "pid_gid needs a pid as argument")
|
END OBJ_ARG(pid_gid, 0, "pid_gid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_egid, 0, "pid_egid needs a pid as argument")
|
END OBJ_ARG(pid_egid, 0, "pid_egid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_sgid, 0, "pid_sgid needs a pid as argument")
|
END OBJ_ARG(pid_sgid, 0, "pid_sgid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_fsgid, 0, "pid_fsgid needs a pid as argument")
|
END OBJ_ARG(pid_fsgid, 0, "pid_fsgid needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(gid_name, 0, "gid_name needs a gid as argument")
|
END OBJ_ARG(gid_name, 0, "gid_name needs a gid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(uid_name, 0, "uid_name needs a uid as argument")
|
END OBJ_ARG(uid_name, 0, "uid_name needs a uid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_read, 0, "pid_read needs a pid as argument")
|
END OBJ_ARG(pid_read, 0, "pid_read needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmpeak, 0, "pid_vmpeak needs a pid as argument")
|
END OBJ_ARG(pid_vmpeak, 0, "pid_vmpeak needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmsize, 0, "pid_vmsize needs a pid as argument")
|
END OBJ_ARG(pid_vmsize, 0, "pid_vmsize needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmlck, 0, "pid_vmlck needs a pid as argument")
|
END OBJ_ARG(pid_vmlck, 0, "pid_vmlck needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmhwm, 0, "pid_vmhwm needs a pid as argument")
|
END OBJ_ARG(pid_vmhwm, 0, "pid_vmhwm needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmrss, 0, "pid_vmrss needs a pid as argument")
|
END OBJ_ARG(pid_vmrss, 0, "pid_vmrss needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmdata, 0, "pid_vmdata needs a pid as argument")
|
END OBJ_ARG(pid_vmdata, 0, "pid_vmdata needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmstk, 0, "pid_vmstk needs a pid as argument")
|
END OBJ_ARG(pid_vmstk, 0, "pid_vmstk needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmexe, 0, "pid_vmexe needs a pid as argument")
|
END OBJ_ARG(pid_vmexe, 0, "pid_vmexe needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmlib, 0, "pid_vmlib needs a pid as argument")
|
END OBJ_ARG(pid_vmlib, 0, "pid_vmlib needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_vmpte, 0, "pid_vmpte needs a pid as argument")
|
END OBJ_ARG(pid_vmpte, 0, "pid_vmpte needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ_ARG(pid_write, 0, "pid_write needs a pid as argument")
|
END OBJ_ARG(pid_write, 0, "pid_write needs a pid as argument")
|
||||||
obj->sub = malloc(sizeof(struct text_object));
|
extract_object_args_to_sub(obj, arg);
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
|
||||||
END OBJ(processes, &update_total_processes)
|
END OBJ(processes, &update_total_processes)
|
||||||
obj->callbacks.print = &print_processes;
|
obj->callbacks.print = &print_processes;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
|
194
src/proc.c
194
src/proc.c
@ -28,8 +28,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <logging.h>
|
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
|
#include "core.h"
|
||||||
|
#include "logging.h"
|
||||||
#include "proc.h"
|
#include "proc.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -102,10 +103,19 @@ int inlist(struct ll_string* front, char* string) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void extract_object_args_to_sub(struct text_object *obj, const char *args)
|
||||||
|
{
|
||||||
|
obj->sub = malloc(sizeof(struct text_object));
|
||||||
|
memset(obj->sub, 0, sizeof(struct text_object));
|
||||||
|
extract_variable_text_internal(obj->sub, args);
|
||||||
|
}
|
||||||
|
|
||||||
void print_pid_chroot(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_chroot(struct text_object *obj, char *p, int p_max_size) {
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char buf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/root", obj->data.s);
|
generate_text_internal(buf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/root", buf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,9 +124,12 @@ void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char* buf;
|
char* buf;
|
||||||
int i, bytes_read;
|
int i, bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/cmdline", obj->data.s);
|
|
||||||
|
if(*(objbuf) != 0) {
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/cmdline", objbuf);
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
for(i = 0; i < bytes_read-1; i++) {
|
for(i = 0; i < bytes_read-1; i++) {
|
||||||
@ -137,9 +150,10 @@ void print_pid_cwd(struct text_object *obj, char *p, int p_max_size)
|
|||||||
char buf[p_max_size];
|
char buf[p_max_size];
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/cwd", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/cwd", objbuf);
|
||||||
bytes_read = readlink(pathbuf, buf, p_max_size);
|
bytes_read = readlink(pathbuf, buf, p_max_size);
|
||||||
if(bytes_read != -1) {
|
if(bytes_read != -1) {
|
||||||
buf[bytes_read] = 0;
|
buf[bytes_read] = 0;
|
||||||
@ -154,10 +168,11 @@ void print_pid_environ(struct text_object *obj, char *p, int p_max_size)
|
|||||||
int i, total_read;
|
int i, total_read;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
char *buf, *var=strdup(obj->data.s);;
|
char *buf, *var=strdup(obj->data.s);;
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
if(sscanf(obj->data.s, "%d %s", &pid, var) == 2) {
|
if(sscanf(objbuf, "%d %s", &pid, var) == 2) {
|
||||||
for(i = 0; var[i] != 0; i++) {
|
for(i = 0; var[i] != 0; i++) {
|
||||||
var[i] = toupper(var[i]);
|
var[i] = toupper(var[i]);
|
||||||
}
|
}
|
||||||
@ -186,8 +201,10 @@ void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size)
|
|||||||
int bytes_read, total_read;
|
int bytes_read, total_read;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/environ", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/environ", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &total_read, 1);
|
buf = readfile(pathbuf, &total_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
@ -206,8 +223,10 @@ void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size)
|
|||||||
|
|
||||||
void print_pid_exe(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_exe(struct text_object *obj, char *p, int p_max_size) {
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/exe", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/exe", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,10 +235,12 @@ void print_pid_nice(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
int bytes_read;
|
int bytes_read;
|
||||||
long int nice_value;
|
long int nice_value;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
if(*(obj->data.s) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", obj->data.s);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*d %*d %*d %ld", &nice_value);
|
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*d %*d %*d %ld", &nice_value);
|
||||||
@ -238,12 +259,15 @@ void print_pid_openfiles(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
int length, totallength = 0;
|
int length, totallength = 0;
|
||||||
struct ll_string* files_front = NULL;
|
struct ll_string* files_front = NULL;
|
||||||
struct ll_string* files_back = NULL;
|
struct ll_string* files_back = NULL;
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
dir = opendir(obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
|
dir = opendir(objbuf);
|
||||||
if(dir != NULL) {
|
if(dir != NULL) {
|
||||||
while ((entry = readdir(dir))) {
|
while ((entry = readdir(dir))) {
|
||||||
if(entry->d_name[0] != '.') {
|
if(entry->d_name[0] != '.') {
|
||||||
snprintf(buf, p_max_size, "%s/%s", obj->data.s, entry->d_name);
|
snprintf(buf, p_max_size, "%s/%s", objbuf, entry->d_name);
|
||||||
length = readlink(buf, buf, p_max_size);
|
length = readlink(buf, buf, p_max_size);
|
||||||
buf[length] = 0;
|
buf[length] = 0;
|
||||||
if(inlist(files_front, buf) == 0) {
|
if(inlist(files_front, buf) == 0) {
|
||||||
@ -270,8 +294,10 @@ void print_pid_parent(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
@ -295,10 +321,12 @@ void print_pid_priority(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
int bytes_read;
|
int bytes_read;
|
||||||
long int priority;
|
long int priority;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
if(*(objbuf) != 0) {
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", obj->data.s);
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*d %*d %ld", &priority);
|
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*d %*d %ld", &priority);
|
||||||
@ -316,8 +344,10 @@ void print_pid_state(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
@ -340,8 +370,11 @@ void print_pid_state_short(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *buf = NULL;
|
char *begin, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
@ -357,27 +390,40 @@ void print_pid_state_short(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
|
|
||||||
void print_pid_stderr(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_stderr(struct text_object *obj, char *p, int p_max_size) {
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/fd/2", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/fd/2", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_stdin(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_stdin(struct text_object *obj, char *p, int p_max_size) {
|
||||||
|
char objbuf[max_user_text];
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/fd/0", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/fd/0", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_stdout(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_stdout(struct text_object *obj, char *p, int p_max_size) {
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/fd/1", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/fd/1", objbuf);
|
||||||
pid_readlink(pathbuf, p, p_max_size);
|
pid_readlink(pathbuf, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash) {
|
void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void* free_at_crash) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
/* FIXME */
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
|
||||||
if(strlen(arg) > 0) {
|
if(strlen(arg) > 0) {
|
||||||
obj->data.s = strdup(arg);
|
obj->data.s = strdup(arg);
|
||||||
@ -432,8 +478,10 @@ void print_pid_threads(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
@ -457,8 +505,10 @@ void print_pid_thread_list(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
int totallength = 0;
|
int totallength = 0;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/task", obj->data.s);
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/task", objbuf);
|
||||||
|
|
||||||
dir = opendir(pathbuf);
|
dir = opendir(pathbuf);
|
||||||
if(dir != NULL) {
|
if(dir != NULL) {
|
||||||
@ -480,9 +530,12 @@ void print_pid_time_kernelmode(struct text_object *obj, char *p, int p_max_size)
|
|||||||
int bytes_read;
|
int bytes_read;
|
||||||
unsigned long int umtime;
|
unsigned long int umtime;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", obj->data.s);
|
|
||||||
|
if(*(objbuf) != 0) {
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu", &umtime);
|
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu", &umtime);
|
||||||
@ -499,9 +552,12 @@ void print_pid_time_usermode(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
int bytes_read;
|
int bytes_read;
|
||||||
unsigned long int kmtime;
|
unsigned long int kmtime;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", obj->data.s);
|
|
||||||
|
if(*(objbuf) != 0) {
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %lu", &kmtime);
|
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %lu", &kmtime);
|
||||||
@ -518,9 +574,12 @@ void print_pid_time(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
int bytes_read;
|
int bytes_read;
|
||||||
unsigned long int umtime, kmtime;
|
unsigned long int umtime, kmtime;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
if(*(obj->data.s) != 0) {
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/stat", obj->data.s);
|
|
||||||
|
if(*(objbuf) != 0) {
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/stat", objbuf);
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu", &umtime, &kmtime);
|
sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu", &umtime, &kmtime);
|
||||||
@ -538,8 +597,11 @@ void print_pid_uid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, UID_ENTRY);
|
begin = strstr(buf, UID_ENTRY);
|
||||||
@ -562,8 +624,11 @@ void print_pid_euid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, UID_ENTRY);
|
begin = strstr(buf, UID_ENTRY);
|
||||||
@ -587,8 +652,11 @@ void print_pid_suid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, UID_ENTRY);
|
begin = strstr(buf, UID_ENTRY);
|
||||||
@ -613,8 +681,11 @@ void print_pid_fsuid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, UID_ENTRY);
|
begin = strstr(buf, UID_ENTRY);
|
||||||
@ -641,8 +712,11 @@ void print_pid_gid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, GID_ENTRY);
|
begin = strstr(buf, GID_ENTRY);
|
||||||
@ -665,8 +739,11 @@ void print_pid_egid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, GID_ENTRY);
|
begin = strstr(buf, GID_ENTRY);
|
||||||
@ -690,8 +767,11 @@ void print_pid_sgid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, GID_ENTRY);
|
begin = strstr(buf, GID_ENTRY);
|
||||||
@ -716,8 +796,11 @@ void print_pid_fsgid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, GID_ENTRY);
|
begin = strstr(buf, GID_ENTRY);
|
||||||
@ -738,12 +821,15 @@ void print_pid_fsgid(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void internal_print_pid_vm(char* pid, char *p, int p_max_size, const char* entry, const char* errorstring) {
|
void internal_print_pid_vm(struct text_object *obj, char *p, int p_max_size, const char* entry, const char* errorstring) {
|
||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/status", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/status", pid);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, entry);
|
begin = strstr(buf, entry);
|
||||||
@ -765,43 +851,43 @@ void internal_print_pid_vm(char* pid, char *p, int p_max_size, const char* entry
|
|||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmpeak(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmpeak(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmPeak:\t", "Can't find the process peak virtual memory size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmPeak:\t", "Can't find the process peak virtual memory size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmsize(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmsize(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmSize:\t", "Can't find the process virtual memory size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmSize:\t", "Can't find the process virtual memory size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmlck(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmlck(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmLck:\t", "Can't find the process locked memory size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmLck:\t", "Can't find the process locked memory size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmhwm(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmhwm(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmHWM:\t", "Can't find the process peak resident set size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmHWM:\t", "Can't find the process peak resident set size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmrss(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmrss(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmHWM:\t", "Can't find the process resident set size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmHWM:\t", "Can't find the process resident set size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmdata(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmdata(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmData:\t", "Can't find the process data segment size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmData:\t", "Can't find the process data segment size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmstk(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmstk(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmData:\t", "Can't find the process stack segment size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmData:\t", "Can't find the process stack segment size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmexe(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmexe(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmData:\t", "Can't find the process text segment size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmData:\t", "Can't find the process text segment size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmlib(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmlib(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmLib:\t", "Can't find the process shared library code size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmLib:\t", "Can't find the process shared library code size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_pid_vmpte(struct text_object *obj, char *p, int p_max_size) {
|
void print_pid_vmpte(struct text_object *obj, char *p, int p_max_size) {
|
||||||
internal_print_pid_vm(obj->data.s, p, p_max_size, "VmPTE:\t", "Can't find the process page table entries size in '%s'");
|
internal_print_pid_vm(obj, p, p_max_size, "VmPTE:\t", "Can't find the process page table entries size in '%s'");
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READ_ENTRY "read_bytes: "
|
#define READ_ENTRY "read_bytes: "
|
||||||
@ -810,8 +896,11 @@ void print_pid_read(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/io", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/io", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, READ_ENTRY);
|
begin = strstr(buf, READ_ENTRY);
|
||||||
@ -834,8 +923,11 @@ void print_pid_write(struct text_object *obj, char *p, int p_max_size) {
|
|||||||
char *begin, *end, *buf = NULL;
|
char *begin, *end, *buf = NULL;
|
||||||
int bytes_read;
|
int bytes_read;
|
||||||
char pathbuf[64];
|
char pathbuf[64];
|
||||||
|
char objbuf[max_user_text];
|
||||||
|
|
||||||
|
generate_text_internal(objbuf, max_user_text, *obj->sub, &info);
|
||||||
|
snprintf(pathbuf, 64, PROCDIR "/%s/io", objbuf);
|
||||||
|
|
||||||
snprintf(pathbuf, 64, PROCDIR "/%s/io", obj->data.s);
|
|
||||||
buf = readfile(pathbuf, &bytes_read, 1);
|
buf = readfile(pathbuf, &bytes_read, 1);
|
||||||
if(buf != NULL) {
|
if(buf != NULL) {
|
||||||
begin = strstr(buf, WRITE_ENTRY);
|
begin = strstr(buf, WRITE_ENTRY);
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
#define READERR "Can't read '%s'"
|
#define READERR "Can't read '%s'"
|
||||||
#define READSIZE 128
|
#define READSIZE 128
|
||||||
|
|
||||||
|
/* XXX: this should go global */
|
||||||
|
void extract_object_args_to_sub(struct text_object *, const char *);
|
||||||
|
|
||||||
void print_pid_chroot(struct text_object *obj, char *p, int p_max_size);
|
void print_pid_chroot(struct text_object *obj, char *p, int p_max_size);
|
||||||
void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size);
|
void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size);
|
||||||
void print_pid_cwd(struct text_object *obj, char *p, int p_max_size);
|
void print_pid_cwd(struct text_object *obj, char *p, int p_max_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user