From afe57f9ee90651f139b43bd34f61e00f79b63b87 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Tue, 20 Oct 1998 20:08:49 +0000 Subject: [PATCH] Use a 2-element-array of type `u_int64_t' for all signal masks instead of 1998-10-20 Martin Baulig * include/glibtop/proc_signal.h: Use a 2-element-array of type `u_int64_t' for all signal masks instead of just scalar numbers. This avoids problems on systems with more than 64 signals. If there is any operating system out there with even more than 128 signals, we can simply increase the number of array elements here. [NOTE for people porting libgtop: Please use all 64 bits of the `u_int64_t' and not just 32 - the signal number (as it is used in calls to kill () ...) should be a bit-index into this field; if a process ignores for instance signal 64, it has the 0-bit of sigcatch[1] set, if it ignores 63, this is the 63-bit of sigcatch[0] and so on ... The mapping between signal numbers and their names is done via the glibtop_sys_siglist [] field which should be declared in sysdeps/@sysdeps_dir@/siglist.c - see linux for an example. ] * features.def: It's now safe to put things like `loadavg[3]' here - the awk skripts should correctly threat this as an array. --- ChangeLog | 27 +++++++++++++++++++++++++++ features.def | 4 ++-- include/glibtop/procsignal.h | 8 ++++---- sysdeps/freebsd/procsignal.c | 8 ++++---- sysdeps/guile/ChangeLog | 6 ++++++ sysdeps/guile/guile.awk | 12 +++++++++++- sysdeps/kernel/procsignal.c | 8 ++++---- sysdeps/linux/procsignal.c | 8 ++++---- sysdeps/osf1/procsignal.c | 8 ++++---- sysdeps/sun4/procsignal.c | 8 ++++---- 10 files changed, 70 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index b48e692d..7d44ff13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +1998-10-20 Martin Baulig + + * include/glibtop/proc_signal.h: Use a 2-element-array of + type `u_int64_t' for all signal masks instead of just + scalar numbers. This avoids problems on systems with more + than 64 signals. + + If there is any operating system out there with even more than + 128 signals, we can simply increase the number of array elements + here. + + [NOTE for people porting libgtop: + + Please use all 64 bits of the `u_int64_t' and not just 32 - the + signal number (as it is used in calls to kill () ...) should be + a bit-index into this field; if a process ignores for instance + signal 64, it has the 0-bit of sigcatch[1] set, if it ignores 63, + this is the 63-bit of sigcatch[0] and so on ... + + The mapping between signal numbers and their names is done via the + glibtop_sys_siglist [] field which should be declared in + sysdeps/@sysdeps_dir@/siglist.c - see linux for an example. + ] + + * features.def: It's now safe to put things like `loadavg[3]' + here - the awk skripts should correctly threat this as an array. + 1998-10-12 Martin Baulig * configure.in (GNOME_COMPILE_WARNINGS): Let the user enable diff --git a/features.def b/features.def index da2ac6cd..4150e912 100644 --- a/features.def +++ b/features.def @@ -2,7 +2,7 @@ void|cpu|ulong(total,user,nice,sys,idle,frequency) void|mem|ulong(total,used,free,shared,buffer,cached,user,locked) void|swap|ulong(total,used,free,pagein,pageout) void|uptime|double(uptime,idletime) -void|loadavg|double(loadavg[0],loadavg[1],loadavg[2]):ulong(nr_running,nr_tasks,last_pid) +void|loadavg|double(loadavg[3]):ulong(nr_running,nr_tasks,last_pid) void|shm_limits|ulong(shmmax,shmmin,shmmni,shmseg,shmall) void|msg_limits|ulong(msgpool,msgmap,msgmax,msgmnb,msgmni,msgssz,msgtql) void|sem_limits|ulong(semmap,semmni,semmns,semmnu,semmsl,semopm,semume,semusz,semvmx,semaem) @@ -11,7 +11,7 @@ void|proc_state|str(cmd):char(state):ulong(uid,gid)|pid_t(pid) void|proc_uid|long(uid,euid,gid,egid,pid,ppid,pgrp,session,tty,tpgid,priority,nice)|pid_t(pid) void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid) void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency)|pid_t(pid) -void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t(pid) +void|proc_signal|ulong(signal[2],blocked[2],sigignore[2],sigcatch[2])|pid_t(pid) void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid) void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid) glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid) diff --git a/include/glibtop/procsignal.h b/include/glibtop/procsignal.h index e9616ed6..d42b1a05 100644 --- a/include/glibtop/procsignal.h +++ b/include/glibtop/procsignal.h @@ -41,10 +41,10 @@ typedef struct _glibtop_proc_signal glibtop_proc_signal; struct _glibtop_proc_signal { u_int64_t flags, - signal, /* mask of pending signals */ - blocked, /* mask of blocked signals */ - sigignore, /* mask of ignored signals */ - sigcatch; /* mask of caught signals */ + signal [2], /* mask of pending signals */ + blocked [2], /* mask of blocked signals */ + sigignore [2], /* mask of ignored signals */ + sigcatch [2]; /* mask of caught signals */ }; #define glibtop_get_proc_signal(p1, p2) glibtop_get_proc_signal_l(glibtop_global_server, p1, p2) diff --git a/sysdeps/freebsd/procsignal.c b/sysdeps/freebsd/procsignal.c index 6f5a14ed..058b9fa0 100644 --- a/sysdeps/freebsd/procsignal.c +++ b/sysdeps/freebsd/procsignal.c @@ -63,22 +63,22 @@ glibtop_get_proc_signal_p (glibtop *server, /* signal: mask of pending signals. * pinfo [0].kp_proc.p_siglist */ - buf->signal = pinfo [0].kp_proc.p_siglist; + buf->signal [0] = pinfo [0].kp_proc.p_siglist; /* blocked: mask of blocked signals. * pinfo [0].kp_proc.p_sigmask */ - buf->blocked = pinfo [0].kp_proc.p_sigmask; + buf->blocked [0] = pinfo [0].kp_proc.p_sigmask; /* sigignore: mask of ignored signals. * pinfo [0].kp_proc.p_sigignore */ - buf->sigignore = pinfo [0].kp_proc.p_sigignore; + buf->sigignore [0] = pinfo [0].kp_proc.p_sigignore; /* sigcatch: mask of caught signals. * pinfo [0].kp_proc.p_sigcatch */ - buf->sigcatch = pinfo [0].kp_proc.p_sigcatch; + buf->sigcatch [0] = pinfo [0].kp_proc.p_sigcatch; buf->flags = _glibtop_sysdeps_proc_signal; } diff --git a/sysdeps/guile/ChangeLog b/sysdeps/guile/ChangeLog index 307ddb0f..b19992da 100644 --- a/sysdeps/guile/ChangeLog +++ b/sysdeps/guile/ChangeLog @@ -1,3 +1,9 @@ +1998-10-20 Martin Baulig + + * guile.awk: If the features.def contains something like + `fieldname[number]' we interpret this as an array and add all + members of this array. + 1998-10-12 Martin Baulig * Makefile.am: Let the `Makefile' depend upon $(BUILT_SOURCES). diff --git a/sysdeps/guile/guile.awk b/sysdeps/guile/guile.awk index 27f47c03..9ed125e0 100644 --- a/sysdeps/guile/guile.awk +++ b/sysdeps/guile/guile.awk @@ -95,7 +95,17 @@ function make_output(line) { sub(/^.*\(/, "", list); sub(/\)$/, "", list); count = split (list, fields, /,/); for (field = 1; field <= count; field++) { - output = output""convert[type]" ("feature"."fields[field]"),\n\t\t\t"; + if (fields[field] ~ /^(\w+)\[([0-9]+)\]$/) { + split(fields[field], field_parts, /\[/); + fields[field] = field_parts[1]; + sub(/\]/, "", field_parts[2]); + number = field_parts[2]; + for (nr = 0; nr < number; nr++) { + output = output""convert[type]" ("feature"."fields[field]" ["nr"]),\n\t\t\t"; + } + } else { + output = output""convert[type]" ("feature"."fields[field]"),\n\t\t\t"; + } } } output = output"SCM_UNDEFINED);\n"; diff --git a/sysdeps/kernel/procsignal.c b/sysdeps/kernel/procsignal.c index 9ff120c9..ca5ce6cb 100644 --- a/sysdeps/kernel/procsignal.c +++ b/sysdeps/kernel/procsignal.c @@ -54,8 +54,8 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, buf->flags = _glibtop_sysdeps_proc_signal; - buf->signal = tbl.proc_signal.signal; - buf->blocked = tbl.proc_signal.blocked; - buf->sigignore = tbl.proc_signal.ignored; - buf->sigcatch = tbl.proc_signal.caught; + buf->signal [0] = tbl.proc_signal.signal; + buf->blocked [0] = tbl.proc_signal.blocked; + buf->sigignore [0] = tbl.proc_signal.ignored; + buf->sigcatch [0] = tbl.proc_signal.caught; } diff --git a/sysdeps/linux/procsignal.c b/sysdeps/linux/procsignal.c index 51a167df..0d217952 100644 --- a/sysdeps/linux/procsignal.c +++ b/sysdeps/linux/procsignal.c @@ -54,10 +54,10 @@ glibtop_get_proc_signal_s (glibtop *server, glibtop_proc_signal *buf, pid_t pid) p = skip_multiple_token (p, 28); - buf->signal = strtoul (p, &p, 0); - buf->blocked = strtoul (p, &p, 0); - buf->sigignore = strtoul (p, &p, 0); - buf->sigcatch = strtoul (p, &p, 0); + buf->signal [0] = strtoul (p, &p, 0); + buf->blocked [0] = strtoul (p, &p, 0); + buf->sigignore [0] = strtoul (p, &p, 0); + buf->sigcatch [0] = strtoul (p, &p, 0); buf->flags = _glibtop_sysdeps_proc_signal; } diff --git a/sysdeps/osf1/procsignal.c b/sysdeps/osf1/procsignal.c index f10c712f..8c769afb 100644 --- a/sysdeps/osf1/procsignal.c +++ b/sysdeps/osf1/procsignal.c @@ -63,10 +63,10 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, if (ret != 1) return; - buf->signal = procinfo.pi_sig; - buf->blocked = procinfo.pi_sigmask; - buf->sigignore = procinfo.pi_sigignore; - buf->sigcatch = procinfo.pi_sigcatch; + buf->signal [0] = procinfo.pi_sig; + buf->blocked [0] = procinfo.pi_sigmask; + buf->sigignore [0] = procinfo.pi_sigignore; + buf->sigcatch [0] = procinfo.pi_sigcatch; buf->flags = _glibtop_sysdeps_proc_signal; } diff --git a/sysdeps/sun4/procsignal.c b/sysdeps/sun4/procsignal.c index 5952ceba..8de2bcfa 100644 --- a/sysdeps/sun4/procsignal.c +++ b/sysdeps/sun4/procsignal.c @@ -52,10 +52,10 @@ glibtop_get_proc_signal_p (glibtop *server, glibtop_proc_signal *buf, /* Fill in data fields. */ - buf->signal = pp->p_sig; - buf->blocked = pp->p_sigmask; - buf->sigignore = pp->p_sigignore; - buf->sigcatch = pp->p_sigcatch; + buf->signal [0] = pp->p_sig; + buf->blocked [0] = pp->p_sigmask; + buf->sigignore [0] = pp->p_sigignore; + buf->sigcatch [0] = pp->p_sigcatch; buf->flags = _glibtop_sysdeps_proc_signal; }