case DEV_IOCTL: r = (*dp->dr_ioctl)(dp, &mess); break;
case DEV_READ:
- case DEV_WRITE: r = do_rdwt(dp, &mess); break;
+ case DEV_WRITE: r = do_rdwt(dp, &mess); break;
case DEV_GATHER:
case DEV_SCATTER: r = do_vrdwt(dp, &mess); break;
message m;
int s;
- if (m_ptr->PROC_NR != FS_PROC_NR) return(EPERM);
+ if (m_ptr->PROC_NR != FS_PROC_NR) {
+ report("MEM", "warning, MIOCRAMSIZE called by", m_ptr->PROC_NR);
+ return(EPERM);
+ }
/* Try to allocate a piece of memory for the RAM disk. */
ramdev_size = m_ptr->POSITION;
- if (allocmem(ramdev_size, &ramdev_base) < 0) return(ENOMEM);
+ if (allocmem(ramdev_size, &ramdev_base) < 0) {
+ report("MEM", "warning, allocmem failed", errno);
+ return(ENOMEM);
+ }
dv->dv_base = cvul64(ramdev_base);
dv->dv_size = cvul64(ramdev_size);
PRIVATE message m;
PRIVATE int int_event_check; /* set to TRUE if events arrived */
+extern int errno;
+
/*===========================================================================*
* rtl8139_task *
*===========================================================================*/
re_t *rep;
long v;
- if ((v=get_proc_nr(&rl_tasknr, NULL)) != OK)
- panic("RTL8139", "Couldn't get own proc nr", v);
+ if (getprocnr(&rl_tasknr) != OK)
+ panic("RTL8139", "getprocnr failed", errno);
v= 0;
(void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL);
rep->re_name[8] += i;
rep->re_seen= FALSE;
envvar[sizeof(RL_ENVVAR)-1]= '0'+i;
-#if DEAD_CODE
- if (0 == sys_getkenv(envvar, strlen(envvar), val, sizeof(val)) &&
-#else
if (0 == get_mon_param(envvar, val, sizeof(val)) &&
-#endif
! env_prefix(envvar, "pci")) {
env_panic(envvar);
}
#define BUF_ALIGNMENT (64*1024)
-#if DEAD_CODE
- if (OK != (i=sys_kmalloc(tot_bufsize, &buf))) {
-#else
if(!(mallocbuf = malloc(BUF_ALIGNMENT + tot_bufsize))) {
-#endif
panic("RTL8139","Couldn't allocate kernel buffer",i);
}
rep->re_tx[2].ret_busy, rep->re_tx[3].ret_busy);
rep->re_need_reset= TRUE;
rep->re_got_int= TRUE;
- /* Under MINIX, we got here via a synchronous alarm call.
- * Change the message type to HARD_INT to fake an interrupt.
- * The switch in the main loop 'falls through' if it sees
- * the HARD_INT message type.
- */
-#if DEAD_CODE
- m.m_type = HARD_INT;
-#else
- check_int_events();
-#endif
+
+ check_int_events();
}
}
FORWARD _PROTOTYPE( int scan_keyboard, (void) );
FORWARD _PROTOTYPE( unsigned make_break, (int scode) );
FORWARD _PROTOTYPE( void set_leds, (void) );
+FORWARD _PROTOTYPE( void show_key_mappings, (void) );
FORWARD _PROTOTYPE( void kb_read, (struct tty *tp) );
FORWARD _PROTOTYPE( unsigned map_key, (int scode) );
} else
if (CF1 <= ch && ch <= CF12) {
switch(ch) {
+ case CF1: show_key_mappings(); break;
case CF3: toggle_scroll(); break; /* hardware <-> software */
case CF7: sigchar(&tty_table[CONSOLE], SIGQUIT); break;
case CF8: sigchar(&tty_table[CONSOLE], SIGINT); break;
int result;
/* See if this key can be observed; get the observers array and index. */
- if (SF1 == fkey) result = EINVAL; /* Shift-F1 is TTY reserved */
if (F1 <= fkey && fkey <= F12) { /* F1-F12 */
observers = fkey_obs;
index = fkey - F1;
- } else if (SF2 <= fkey && fkey <= SF12) { /* Shift F1-F12 */
+ } else if (SF1 <= fkey && fkey <= SF12) { /* Shift F1-F12 */
observers = sfkey_obs;
index = fkey - SF1;
}
unsigned fkey;
int index = -1;
int i,s;
- struct proc proc;
/* Ignore key releases. If this is a key press, get full key code. */
if (scode & KEY_RELEASE) return(FALSE); /* key release */
* Other combinations are not in use. Note that Alt+Shift+F1-F12 is yet
* defined in <minix/keymap.h>, but other modifier combinations are not.
*/
- if (SF1 == fkey) {
- 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);
- if (fkey_obs[i] != NONE) {
- if ((s=sys_getproc(&proc, fkey_obs[i]))!=OK)
- printf("sys_getproc: %d\n", s);
- printf("%-14.14s", proc.p_name);
- } else {
- printf("%-14.14s", "<none>");
- }
-
- printf(" %sShift-F%d: ", i+1<10? " ":"", i+1);
- if (i==0) {
- printf("%-14.14s", "<reserved by TTY>");
- } else if (sfkey_obs[i] != NONE) {
- if ((s=sys_getproc(&proc, sfkey_obs[i]))!=OK)
- printf("sys_getproc: %d\n", s);
- printf("%-14.14s", proc.p_name);
- } else {
- printf("%-14.14s", "<none>");
- }
- printf("\n");
- }
- printf("\n");
- printf("Press one of the registered function keys to trigger a debug dump.\n");
- printf("\n");
- }
- else if (F1 <= fkey && fkey <= F12) { /* F1-F12 */
+ if (F1 <= fkey && fkey <= F12) { /* F1-F12 */
observers = &fkey_obs[0];
index = fkey - F1;
} else if (SF2 <= fkey && fkey <= SF12) { /* Shift F2-F12 */
}
+/*==========================================================================*
+ * show_key_mappings *
+ *==========================================================================*/
+PRIVATE void show_key_mappings()
+{
+ 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);
+ if (fkey_obs[i] != NONE) {
+ if ((s=sys_getproc(&proc, fkey_obs[i]))!=OK)
+ printf("sys_getproc: %d\n", s);
+ printf("%-14.14s", proc.p_name);
+ } else {
+ printf("%-14.14s", "<none>");
+ }
+
+ printf(" %sShift-F%d: ", i+1<10? " ":"", i+1);
+ if (i==0) {
+ printf("%-14.14s", "<reserved by TTY>");
+ } else if (sfkey_obs[i] != NONE) {
+ if ((s=sys_getproc(&proc, sfkey_obs[i]))!=OK)
+ printf("sys_getproc: %d\n", s);
+ printf("%-14.14s", proc.p_name);
+ } else {
+ printf("%-14.14s", "<none>");
+ }
+ printf("\n");
+ }
+ printf("\n");
+ printf("Press one of the registered function keys to trigger a debug dump.\n");
+ printf("\n");
+}
+
+
/*==========================================================================*
* scan_keyboard *
*==========================================================================*/
/*==========================================================================*
* Minix system library. *
*==========================================================================*/
-_PROTOTYPE( int printf, (const char *fmt, ...) );
-_PROTOTYPE( void kputc, (int c) );
_PROTOTYPE( int _taskcall, (int who, int syscallnr, message *msgptr) );
_PROTOTYPE( int sys_abort, (int how, ...) );
* Mar 15, 2004 by Jorrit N. Herder
*
* Changes:
+ * May 31, 2005: added printf, kputc (relocated from syslib)
* May 31, 2005: added getuptime
* Mar 18, 2005: added tickdelay
- * Mar 15, 2005: added get_proc_nr
* Oct 01, 2004: added env_parse, env_prefix, env_panic
* Jul 13, 2004: added fkey_ctl
* Apr 28, 2004: added report, panic
#define EP_SET 3 /* var = 1:2:3 (nonblank field) */
#define EP_EGETKENV 4 /* sys_getkenv() failed ... */
-_PROTOTYPE(int get_mon_param, (char *key, char *value, int max_size) );
-_PROTOTYPE(int env_prefix, (char *env, char *prefix) );
-_PROTOTYPE(void env_panic, (char *key) );
-_PROTOTYPE(int env_parse, (char *env, char *fmt, int field, long *param,
+_PROTOTYPE( int get_mon_param, (char *key, char *value, int max_size) );
+_PROTOTYPE( int env_prefix, (char *env, char *prefix) );
+_PROTOTYPE( void env_panic, (char *key) );
+_PROTOTYPE( int env_parse, (char *env, char *fmt, int field, long *param,
long min, long max) );
#define fkey_enable(fkey) fkey_ctl(fkey, 1)
#define fkey_disable(fkey) fkey_ctl(fkey, 0)
-_PROTOTYPE(int fkey_ctl, (int fkey_code, int enable_disable) );
+_PROTOTYPE( int fkey_ctl, (int fkey_code, int enable_disable) );
-_PROTOTYPE(int get_proc_nr, (int *proc_nr, char *proc_name) );
-
-_PROTOTYPE(void report, (char *who, char *mess, int num));
-_PROTOTYPE(void panic, (char *who, char *mess, int num));
-
-_PROTOTYPE(int getuptime, (clock_t *ticks));
-_PROTOTYPE(int tickdelay, (clock_t ticks));
+_PROTOTYPE( int printf, (const char *fmt, ...));
+_PROTOTYPE( void kputc, (int c));
+_PROTOTYPE( void report, (char *who, char *mess, int num));
+_PROTOTYPE( void panic, (char *who, char *mess, int num));
+_PROTOTYPE( int getuptime, (clock_t *ticks));
+_PROTOTYPE( int tickdelay, (clock_t ticks));
#endif /* _EXTRALIB_H */
#endif /* (CHIP == M68000) */
-#if DEAD_CODE /* now in glo.h */
-/* Declare buffer space and a bit map for notification messages. */
-PRIVATE struct notification notify_buffer[NR_NOTIFY_BUFS];
-PRIVATE bitchunk_t notify_bitmap[BITMAP_CHUNKS(NR_NOTIFY_BUFS)];
-#endif
-
/*===========================================================================*
* sys_call *
*/
switch(function) {
case SENDREC: /* has FRESH_ANSWER flags */
+#if DEAD_CODE
+ { message m;
+ if (caller_ptr->p_nr == MEMORY && src_dst == FS_PROC_NR) {
+ CopyMess(caller_ptr->p_nr, caller_ptr, m_ptr, proc_addr(HARDWARE), &m);
+ kprintf("MEMORY sendrec FS, m.m_type %d", m.m_type);
+ kprintf("TTY_LINE %d", m.TTY_LINE);
+ kprintf("TTY_REQ %d\n", m.TTY_REQUEST);
+ }
+ if (caller_ptr->p_nr == FS_PROC_NR && src_dst == MEMORY) {
+ CopyMess(caller_ptr->p_nr, caller_ptr, m_ptr, proc_addr(HARDWARE), &m);
+ kprintf("FS sendrec MEMORY, m.m_type %d\n", m.m_type);
+ }
+ }
+#endif
/* fall through */
case SEND:
if (! isalive(src_dst)) {
dst_ptr = proc_addr(dst); /* pointer to destination's proc entry */
- /* Check for deadlock by 'caller_ptr' and 'dst' sending to each other.
- * This check is rare, so overhead is acceptable.
- */
+ /* Check for deadlock by 'caller_ptr' and 'dst' sending to each other. */
if (dst_ptr->p_flags & SENDING) {
next_ptr = proc_addr(dst_ptr->p_sendto);
while (TRUE) {
all: $(LIBSYS)
OBJECTS = \
- $(LIBSYS)(kmalloc.o) \
- $(LIBSYS)(kprintf.o) \
- $(LIBSYS)(kputc.o) \
$(LIBSYS)(sys_times.o) \
$(LIBSYS)(sys_getuptm.o) \
$(LIBSYS)(sys_abort.o) \
aal cr $@ *.o
rm *.o
-$(LIBSYS)(kmalloc.o): kmalloc.c
- $(CC1) kmalloc.c
-
-$(LIBSYS)(kprintf.o): kprintf.c
- $(CC1) kprintf.c
-
-$(LIBSYS)(kputc.o): kputc.c
- $(CC1) kputc.c
-
$(LIBSYS)(sys_times.o): sys_times.c
$(CC1) sys_times.c
all: $(LIBUTILS)
OBJECTS = \
+ $(LIBSYS)(kmalloc.o) \
+ $(LIBSYS)(kprintf.o) \
+ $(LIBSYS)(kputc.o) \
$(LIBUTILS)(tickdelay.o) \
$(LIBUTILS)(getuptime.o) \
$(LIBUTILS)(get_mon_prm.o) \
$(LIBUTILS)(env_panic.o) \
$(LIBUTILS)(env_prefix.o) \
$(LIBUTILS)(fkey_ctl.o) \
- $(LIBUTILS)(get_proc_nr.o) \
$(LIBUTILS)(panic.o) \
$(LIBUTILS)(report.o) \
$(LIBUTILS)(taskcall.o) \
aal cr $@ *.o
rm *.o
+$(LIBSYS)(kmalloc.o): kmalloc.c
+ $(CC1) kmalloc.c
+
+$(LIBSYS)(kprintf.o): kprintf.c
+ $(CC1) kprintf.c
+
+$(LIBSYS)(kputc.o): kputc.c
+ $(CC1) kputc.c
+
$(LIBUTILS)(getuptime.o): getuptime.c
$(CC1) getuptime.c
$(LIBUTILS)(fkey_ctl.o): fkey_ctl.c
$(CC1) fkey_ctl.c
-$(LIBUTILS)(get_proc_nr.o): get_proc_nr.c
- $(CC1) get_proc_nr.c
-
$(LIBUTILS)(panic.o): panic.c
$(CC1) panic.c
+++ /dev/null
-#include "utils.h"
-#include <minix/config.h>
-#include <timers.h>
-#include "../../kernel/const.h"
-#include "../../kernel/type.h"
-#include "../../kernel/proc.h"
-
-/*===========================================================================*
- * get_proc_nr *
- *===========================================================================*/
-PUBLIC int get_proc_nr(proc_nr, proc_name)
-int *proc_nr; /* store process number here */
-char *proc_name; /* lookup process by name */
-{
- static struct proc proc;
- message m;
- int s;
- if (proc_name != NULL) { /* lookup by name */
-
- } else { /* get own process number */
- m.m_type = SYS_GETINFO;
- m.I_REQUEST = GET_PROC;
- m.I_PROC_NR = SELF;
- m.I_KEY_LEN = SELF;
- m.I_VAL_LEN = 0;
- m.I_VAL_PTR = (char *) &proc;
- m.I_VAL_LEN = 0;
- if ((s=_taskcall(SYSTASK, SYS_GETINFO, &m)) != OK)
- return(s);
- *proc_nr = proc.p_nr;
- }
- return(OK);
-}
-
-
* to pollute the kernel message buffer with its debug dumps.
*/
-#include "syslib.h"
-#include <minix/callnr.h>
-#include <minix/minlib.h>
+#include "utils.h"
/*===========================================================================*
* kputc *
# dependencies
a= fs.h $h/config.h $s/types.h $h/const.h $h/type.h \
- $i/limits.h $i/errno.h $i/ansi.h $h/syslib.h \
+ $i/limits.h $i/errno.h $i/ansi.h $h/syslib.h $h/utils.h \
const.h type.h proto.h glo.h $s/dir.h
cache.o: $a
#include <errno.h>
#include <minix/syslib.h>
+#include <minix/utils.h>
#include "const.h"
#include "type.h"
struct super_block *sp, *dsp;
block_t b;
Dev_t image_dev;
- int r;
+ int s,r;
static char sbbuf[MIN_BLOCK_SIZE];
int block_size_image, block_size_ram, ramfs_block_size;
m_out.m_type = DEV_IOCTL;
m_out.PROC_NR = FS_PROC_NR;
m_out.DEVICE = RAM_DEV;
- m_out.REQUEST = MIOCRAMSIZE;
- m_out.POSITION = ram_size_kb*1024;
- if (sendrec(MEMORY, &m_out) != OK || m_out.REP_STATUS != OK)
- panic(__FILE__,"can't set RAM disk size", NO_NUM);
+ m_out.REQUEST = MIOCRAMSIZE; /* I/O control to use */
+ m_out.POSITION = (ram_size_kb * 1024); /* request in bytes */
+ if ((s=sendrec(MEMORY, &m_out)) != OK)
+ panic("FS","sendrec from MEM failed", s);
+ else if (m_out.REP_STATUS != OK) {
+ /* Report and continue, unless RAM disk is required as root FS. */
+ if (root_dev != DEV_RAM) {
+ report("FS","can't set RAM disk size", m_out.REP_STATUS);
+ return;
+ } else {
+ panic(__FILE__,"can't set RAM disk size", m_out.REP_STATUS);
+ }
+ }
#if ENABLE_CACHE2
if (svrctl(SYSSIGNON, (void *) NULL) == -1) pause();
/* Our new identity as a server. */
-#if DEAD_CODE
- if (get_proc_nr(&this_proc, NULL) != OK)
-#endif
if (getprocnr(&this_proc) != OK)
ip_panic(( "unable to get own process nr\n"));
#include <minix/const.h>
#include <minix/com.h>
#include <minix/syslib.h>
+#include <minix/utils.h>
#include <net/hton.h>
#include <net/gen/ether.h>
#include <net/gen/eth_hdr.h>
#include <minix/config.h>
#include <minix/type.h>
#include <minix/syslib.h>
+#include <minix/utils.h>
#include <unistd.h>
#include "inet_config.h"
/* Set own process number. */
is_proc_nr = IS_PROC_NR;
- /* Set key mappings. IS takes all of F2-F12. F1 is TTY reserved. */
+ /* Set key mappings. IS takes all of F1-F12 and Shift+F1-F6 . */
for (key=F1; key<=F12; key++) {
if ((r=fkey_enable(key)) != OK) {
printf("IS: WARNING: couldn't register F%d key: %d\n",
(key-F1+1), r);
}
}
- for (key=SF1; key<=SF12; key++) {
+ for (key=SF1; key<=SF6; key++) {
if ((r=fkey_enable(key)) != OK) {
printf("IS: WARNING: couldn't register SF%d key: %d\n",
(key-SF1+1), r);
# dependencies
a = pm.h $h/config.h $s/types.h $h/const.h $h/type.h \
- $i/ansi.h $i/fcntl.h $i/unistd.h $h/syslib.h \
+ $i/ansi.h $i/fcntl.h $i/unistd.h $h/syslib.h $h/utils.h \
$i/limits.h $i/errno.h const.h type.h proto.h glo.h
alloc.o: $a
#include <fcntl.h>
#include <unistd.h>
#include <minix/syslib.h>
+#include <minix/utils.h>
#include <limits.h>
#include <errno.h>