Various small IS, TTY, isofs fixes
IS: - do not use p_getfrom_e for a process that is sending - register with TTY only function keys that are used - various header and formatting fixes - proper shutdown code TTY: - restore proper Ctrl+F1 dump contents isofs: - don't even try to call sys_exit()
This commit is contained in:
parent
f814fe41be
commit
56d485c1d6
10 changed files with 92 additions and 29 deletions
|
@ -14,7 +14,7 @@ d = ..
|
|||
# programs, flags, etc.
|
||||
MAKE = exec make
|
||||
CC = exec cc
|
||||
CPPFLAGS = -I$i
|
||||
CPPFLAGS = -I../../kernel/arch/$(ARCH)/include -I$i
|
||||
CFLAGS = $(CPPFLAGS)
|
||||
LDFLAGS = -i
|
||||
LIBS = -lsys -ltimers
|
||||
|
|
|
@ -14,10 +14,15 @@
|
|||
#include <termios.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <archtypes.h>
|
||||
#include <minix/callnr.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/keymap.h>
|
||||
#include "tty.h"
|
||||
#include "../../kernel/const.h"
|
||||
#include "../../kernel/config.h"
|
||||
#include "../../kernel/type.h"
|
||||
#include "../../kernel/proc.h"
|
||||
|
||||
u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
|
||||
#include "keymaps/us-std.src"
|
||||
|
@ -1186,17 +1191,33 @@ int scode; /* scan code for a function key */
|
|||
*===========================================================================*/
|
||||
PRIVATE void show_key_mappings()
|
||||
{
|
||||
int i;
|
||||
int i,s;
|
||||
struct proc proc;
|
||||
|
||||
printf("\n");
|
||||
printf("System information. Known function key mappings to request debug dumps:\n");
|
||||
printf("-------------------------------------------------------------------------\n");
|
||||
for (i=0; i<12; i++) {
|
||||
|
||||
printf(" %sF%d: ", i+1<10? " ":"", i+1);
|
||||
printf("%-14.14s", "<none>");
|
||||
if (fkey_obs[i].proc_nr != NONE) {
|
||||
if ((s = sys_getproc(&proc, fkey_obs[i].proc_nr))!=OK)
|
||||
printf("%-14.14s", "<unknown>");
|
||||
else
|
||||
printf("%-14.14s", proc.p_name);
|
||||
} else {
|
||||
printf("%-14.14s", "<none>");
|
||||
}
|
||||
|
||||
printf(" %sShift-F%d: ", i+1<10? " ":"", i+1);
|
||||
printf("%-14.14s", "<none>");
|
||||
if (sfkey_obs[i].proc_nr != NONE) {
|
||||
if ((s = sys_getproc(&proc, sfkey_obs[i].proc_nr))!=OK)
|
||||
printf("%-14.14s", "<unknown>");
|
||||
else
|
||||
printf("%-14.14s", proc.p_name);
|
||||
} else {
|
||||
printf("%-14.14s", "<none>");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
* corresponding dump procedure is called.
|
||||
*
|
||||
* The entry points into this file are
|
||||
* handle_fkey: handle a function key pressed notification
|
||||
* map_unmap_fkeys: register or unregister function key maps with TTY
|
||||
* do_fkey_pressed: handle a function key pressed notification
|
||||
*/
|
||||
|
||||
#include "inc.h"
|
||||
|
@ -40,6 +41,31 @@ struct hook_entry {
|
|||
*/
|
||||
#define NHOOKS (sizeof(hooks)/sizeof(hooks[0]))
|
||||
|
||||
/*===========================================================================*
|
||||
* map_unmap_keys *
|
||||
*===========================================================================*/
|
||||
PUBLIC void map_unmap_fkeys(map)
|
||||
int map;
|
||||
{
|
||||
int fkeys, sfkeys;
|
||||
int h, s;
|
||||
|
||||
fkeys = sfkeys = 0;
|
||||
|
||||
for (h = 0; h < NHOOKS; h++) {
|
||||
if (hooks[h].key >= F1 && hooks[h].key <= F12)
|
||||
bit_set(fkeys, hooks[h].key - F1 + 1);
|
||||
else if (hooks[h].key >= SF1 && hooks[h].key <= SF12)
|
||||
bit_set(sfkeys, hooks[h].key - SF1 + 1);
|
||||
}
|
||||
|
||||
if (map) s = fkey_map(&fkeys, &sfkeys);
|
||||
else s = fkey_unmap(&fkeys, &sfkeys);
|
||||
|
||||
if (s != OK)
|
||||
report("IS", "warning, fkey_ctl failed:", s);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* handle_fkey *
|
||||
*===========================================================================*/
|
||||
|
|
|
@ -35,13 +35,13 @@ PUBLIC void fproc_dmp()
|
|||
fp = &fproc[i];
|
||||
if (fp->fp_pid <= 0) continue;
|
||||
if (++n > 22) break;
|
||||
printf("%3d %4d %2d/%d 0x%05x %2d (%d) %2d (%d) %3d %3d %3d ",
|
||||
printf("%3d %4d %2d/%d 0x%05x %2d (%2d) %2d (%2d) %3d %3d %3d ",
|
||||
i, fp->fp_pid,
|
||||
((fp->fp_tty>>MAJOR)&BYTE), ((fp->fp_tty>>MINOR)&BYTE),
|
||||
fp->fp_umask,
|
||||
fp->fp_realuid, fp->fp_effuid, fp->fp_realgid, fp->fp_effgid,
|
||||
fp->fp_sesldr,
|
||||
fp->fp_blocked_on, fp->fp_revived
|
||||
fp->fp_blocked_on, !!fp->fp_revived
|
||||
);
|
||||
if (fp->fp_blocked_on == FP_BLOCKED_ON_OTHER)
|
||||
printf("%4d\n", fp->fp_task);
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
#define PRINTRTS(rp) { \
|
||||
char *procname = ""; \
|
||||
printf(" %s", p_rts_flags_str(rp->p_rts_flags)); \
|
||||
if (rp->p_rts_flags & (SENDING|RECEIVING)) { \
|
||||
if (rp->p_rts_flags & SENDING) \
|
||||
procname = proc_name(_ENDPOINT_P(rp->p_sendto_e)); \
|
||||
else if (rp->p_rts_flags & RECEIVING) \
|
||||
procname = proc_name(_ENDPOINT_P(rp->p_getfrom_e)); \
|
||||
} \
|
||||
printf(" %-7.7s", procname); \
|
||||
}
|
||||
|
||||
|
@ -312,7 +313,7 @@ PUBLIC void privileges_dmp()
|
|||
return;
|
||||
}
|
||||
|
||||
printf("\n--nr-id-name---- -flags- -traps- grants -ipc_to-- -ipc_sr-- -system calls--\n");
|
||||
printf("\n--nr-id-name---- -flags- -traps- grants -ipc_to-- -system calls--\n");
|
||||
|
||||
PROCLOOP(rp, oldrp)
|
||||
r = -1;
|
||||
|
@ -372,7 +373,7 @@ PUBLIC void proctab_dmp()
|
|||
return;
|
||||
}
|
||||
|
||||
printf("\n-nr-----gen---endpoint-name--- -prior-quant- -user----sys--rts flags\n");
|
||||
printf("\n-nr-----gen---endpoint-name--- -prior-quant- -user----sys-rtsflags-from/to-\n");
|
||||
|
||||
PROCLOOP(rp, oldrp)
|
||||
text = rp->p_memmap[T].mem_phys;
|
||||
|
@ -380,7 +381,7 @@ PUBLIC void proctab_dmp()
|
|||
size = rp->p_memmap[T].mem_len
|
||||
+ ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - data);
|
||||
printf(" %5d %10d ", _ENDPOINT_G(rp->p_endpoint), rp->p_endpoint);
|
||||
printf("%-8.8s %02u/%02u %02d/%02u %6lu %6lu",
|
||||
printf("%-8.8s %02u/%02u %02d/%02u %6lu %6lu ",
|
||||
rp->p_name,
|
||||
rp->p_priority, rp->p_max_priority,
|
||||
rp->p_ticks_left, rp->p_quantum_size,
|
||||
|
|
|
@ -82,15 +82,15 @@ PUBLIC void sigaction_dmp()
|
|||
getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc);
|
||||
getuptime(&uptime);
|
||||
|
||||
printf("-process- -nr- --ignore- --catch- --block- -tomess-- -pending-- -alarm---\n");
|
||||
printf("-process- -nr- --ignore- --catch- --block- -tomess- -pending- -alarm---\n");
|
||||
for (i=prev_i; i<NR_PROCS; i++) {
|
||||
mp = &mproc[i];
|
||||
if (mp->mp_pid == 0 && i != PM_PROC_NR) continue;
|
||||
if (++n > 22) break;
|
||||
printf("%8.8s %3d ", mp->mp_name, i);
|
||||
printf(" 0x%06x 0x%06x 0x%06x 0x%06x ",
|
||||
printf(" %08x %08x %08x %08x ",
|
||||
mp->mp_ignore, mp->mp_catch, mp->mp_sigmask, mp->mp_sig2mess);
|
||||
printf("0x%06x ", mp->mp_sigpending);
|
||||
printf("%08x ", mp->mp_sigpending);
|
||||
if (mp->mp_flags & ALARM_ON) printf("%8u", mp->mp_timer.tmr_exp_time-uptime);
|
||||
else printf(" -");
|
||||
printf("\n");
|
||||
|
|
|
@ -28,7 +28,7 @@ PUBLIC void rproc_dmp()
|
|||
getsysinfo(RS_PROC_NR, SI_PROC_TAB, rproc);
|
||||
|
||||
printf("Reincarnation Server (RS) system process table dump\n");
|
||||
printf("-----proc---pid-flag--dev- -T---checked----alive-starts-backoff-label command-\n");
|
||||
printf("-endpoint-flag--dev- -T---checked----alive-starts-backoff-label command-\n");
|
||||
for (i=prev_i; i<NR_SYS_PROCS; i++) {
|
||||
rp = &rproc[i];
|
||||
if (! rp->r_flags & RS_IN_USE) continue;
|
||||
|
|
|
@ -20,6 +20,7 @@ extern int errno; /* error number set by system library */
|
|||
|
||||
/* Declare some local functions. */
|
||||
FORWARD _PROTOTYPE(void init_server, (int argc, char **argv) );
|
||||
FORWARD _PROTOTYPE(void sig_handler, (void) );
|
||||
FORWARD _PROTOTYPE(void get_work, (void) );
|
||||
FORWARD _PROTOTYPE(void reply, (int whom, int result) );
|
||||
|
||||
|
@ -54,8 +55,8 @@ PUBLIC int main(int argc, char **argv)
|
|||
}
|
||||
continue;
|
||||
case PM_PROC_NR:
|
||||
result = EDONTREPLY;
|
||||
break;
|
||||
sig_handler();
|
||||
continue;
|
||||
case TTY_PROC_NR:
|
||||
result = do_fkey_pressed(&m_in);
|
||||
break;
|
||||
|
@ -84,8 +85,6 @@ PUBLIC int main(int argc, char **argv)
|
|||
PRIVATE void init_server(int argc, char **argv)
|
||||
{
|
||||
/* Initialize the information service. */
|
||||
int fkeys, sfkeys;
|
||||
int i, s;
|
||||
struct sigaction sigact;
|
||||
|
||||
/* Install signal handler. Ask PM to transform signal into message. */
|
||||
|
@ -95,12 +94,27 @@ PRIVATE void init_server(int argc, char **argv)
|
|||
if (sigaction(SIGTERM, &sigact, NULL) < 0)
|
||||
report("IS","warning, sigaction() failed", errno);
|
||||
|
||||
/* Set key mappings. IS takes all of F1-F12 and Shift+F1-F10. */
|
||||
fkeys = sfkeys = 0;
|
||||
for (i=1; i<=12; i++) bit_set(fkeys, i);
|
||||
for (i=1; i<=10; i++) bit_set(sfkeys, i);
|
||||
if ((s=fkey_map(&fkeys, &sfkeys)) != OK)
|
||||
report("IS", "warning, fkey_map failed:", s);
|
||||
/* Set key mappings. */
|
||||
map_unmap_fkeys(TRUE /*map*/);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* sig_handler *
|
||||
*===========================================================================*/
|
||||
PRIVATE void sig_handler()
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
/* Try to obtain signal set from PM. */
|
||||
if (getsigset(&sigset) != 0) return;
|
||||
|
||||
/* Only check for termination signal. */
|
||||
if (!sigismember(&sigset, SIGTERM)) return;
|
||||
|
||||
/* Shutting down. Unset key mappings, and quit. */
|
||||
map_unmap_fkeys(FALSE /*map*/);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/* Function prototypes. */
|
||||
|
||||
/* main.c */
|
||||
_PROTOTYPE( int main, (int argc, char **argv) );
|
||||
_PROTOTYPE( int main, (int argc, char **argv) );
|
||||
|
||||
/* dmp.c */
|
||||
_PROTOTYPE( void map_unmap_fkeys, (int map) );
|
||||
_PROTOTYPE( int do_fkey_pressed, (message *m) );
|
||||
_PROTOTYPE( void mapping_dmp, (void) );
|
||||
_PROTOTYPE( void vm_dmp, (void) );
|
||||
_PROTOTYPE( void vm_dmp, (void) );
|
||||
|
||||
/* dmp_kernel.c */
|
||||
_PROTOTYPE( void proctab_dmp, (void) );
|
||||
|
|
|
@ -33,5 +33,5 @@ int num; /* number to go with it */
|
|||
|
||||
printf("FS panic (%s): %s ", who, mess);
|
||||
if (num != NO_NUM) printf("%d",num);
|
||||
sys_exit(SELF);
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue