Removed 'system process' magic from PM and FS.
This commit is contained in:
@@ -159,10 +159,7 @@ int flags; /* mode bits and flags */
|
||||
if (!fp->fp_sesldr || fp->fp_tty != 0) {
|
||||
flags |= O_NOCTTY;
|
||||
} else {
|
||||
for (rfp = &fproc[LOW_USER]; rfp < &fproc[NR_PROCS]; rfp++) {
|
||||
#if FUTURE_CODE /* check for all processes later */
|
||||
for (rfp = &fproc[0]; rfp < &fproc[NR_PROCS]; rfp++) {
|
||||
#endif
|
||||
if (rfp->fp_tty == dev) flags |= O_NOCTTY;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -47,13 +47,13 @@ PRIVATE void fproc_dmp()
|
||||
static int prev_i;
|
||||
printf("PROCESS TABLE (beta)\n");
|
||||
|
||||
printf("-pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n");
|
||||
printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n");
|
||||
for (i=prev_i; i<NR_PROCS; i++) {
|
||||
fp = &fproc[i];
|
||||
if (fp->fp_pid <= 0) continue;
|
||||
if (++n > 22) break;
|
||||
printf("%4d %2d/%d 0x%05x %2d (%d) %2d (%d) %3d %3d %3d %4d 0x%05x\n",
|
||||
fp->fp_pid,
|
||||
printf("%3d %4d %2d/%d 0x%05x %2d (%d) %2d (%d) %3d %3d %3d %4d 0x%05x\n",
|
||||
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,
|
||||
|
||||
+32
-32
@@ -23,6 +23,7 @@ struct super_block; /* proto.h needs to know this */
|
||||
#include <minix/callnr.h>
|
||||
#include <minix/com.h>
|
||||
#include <minix/keymap.h>
|
||||
#include <minix/const.h>
|
||||
#include "buf.h"
|
||||
#include "dmap.h"
|
||||
#include "file.h"
|
||||
@@ -31,6 +32,8 @@ struct super_block; /* proto.h needs to know this */
|
||||
#include "param.h"
|
||||
#include "super.h"
|
||||
|
||||
|
||||
|
||||
FORWARD _PROTOTYPE( void fs_init, (void) );
|
||||
FORWARD _PROTOTYPE( int igetenv, (char *var) );
|
||||
FORWARD _PROTOTYPE( void get_work, (void) );
|
||||
@@ -168,11 +171,19 @@ int result; /* result of the call (usually OK or error #) */
|
||||
PRIVATE void fs_init()
|
||||
{
|
||||
/* Initialize global variables, tables, etc. */
|
||||
|
||||
register struct inode *rip;
|
||||
int key, i;
|
||||
int key, s, i;
|
||||
message mess;
|
||||
|
||||
/* Certain relations must hold for the file system to work at all. Some
|
||||
* extra block_size requirements are checked at super-block-read-in time.
|
||||
*/
|
||||
if (OPEN_MAX > 127) panic("OPEN_MAX > 127", NO_NUM);
|
||||
if (NR_BUFS < 6) panic("NR_BUFS < 6", NO_NUM);
|
||||
if (V1_INODE_SIZE != 32) panic("V1 inode size != 32", NO_NUM);
|
||||
if (V2_INODE_SIZE != 64) panic("V2 inode size != 64", NO_NUM);
|
||||
if (OPEN_MAX > 8 * sizeof(long)) panic("Too few bits in fp_cloexec", NO_NUM);
|
||||
|
||||
/* The following initializations are needed to let dev_opcl succeed .*/
|
||||
fp = (struct fproc *) NULL;
|
||||
who = FS_PROC_NR;
|
||||
@@ -182,45 +193,38 @@ PRIVATE void fs_init()
|
||||
load_ram(); /* init RAM disk, load if it is root */
|
||||
load_super(root_dev); /* load super block for root device */
|
||||
|
||||
/* Initialize the 'fproc' fields for process 0 .. INIT. */
|
||||
for (i = 0; i <= LOW_USER; i+= 1) {
|
||||
if (i == FS_PROC_NR) continue; /* do not initialize FS */
|
||||
fp = &fproc[i];
|
||||
|
||||
/* Initialize the process table with help of the process manager messages.
|
||||
* Expect one message for each system process with its slot number and pid.
|
||||
* When no more processes follow, the magic process number NONE is sent.
|
||||
* Then, stop and synchronize with the PM.
|
||||
*/
|
||||
do {
|
||||
if (OK != (s=receive(PM_PROC_NR, &mess)))
|
||||
panic("FS couldn't receive from PM", s);
|
||||
if (NONE == mess.PR_PROC_NR) break;
|
||||
|
||||
fp = &fproc[mess.PR_PROC_NR];
|
||||
fp->fp_pid = mess.PR_PID;
|
||||
rip = get_inode(root_dev, ROOT_INODE);
|
||||
fp->fp_rootdir = rip;
|
||||
dup_inode(rip);
|
||||
fp->fp_rootdir = rip;
|
||||
fp->fp_workdir = rip;
|
||||
fp->fp_realuid = (uid_t) SYS_UID;
|
||||
fp->fp_effuid = (uid_t) SYS_UID;
|
||||
fp->fp_realgid = (gid_t) SYS_GID;
|
||||
fp->fp_effgid = (gid_t) SYS_GID;
|
||||
fp->fp_umask = ~0;
|
||||
fp->fp_pid = i < LOW_USER ? PID_SERVER : 1;
|
||||
}
|
||||
|
||||
/* Certain relations must hold for the file system to work at all.
|
||||
* (Some extra block_size requirements are checked at super-block-read-in
|
||||
* time.)
|
||||
*/
|
||||
if (OPEN_MAX > 127) panic("OPEN_MAX > 127", NO_NUM);
|
||||
if (NR_BUFS < 6) panic("NR_BUFS < 6", NO_NUM);
|
||||
if (V1_INODE_SIZE != 32) panic("V1 inode size != 32", NO_NUM);
|
||||
if (V2_INODE_SIZE != 64) panic("V2 inode size != 64", NO_NUM);
|
||||
if (OPEN_MAX > 8 * sizeof(long)) panic("Too few bits in fp_cloexec", NO_NUM);
|
||||
|
||||
/* Tell the memory task where my process table is for the sake of ps(1). */
|
||||
mess.m_type = DEV_IOCTL;
|
||||
mess.PROC_NR = FS_PROC_NR;
|
||||
mess.DEVICE = RAM_DEV;
|
||||
mess.REQUEST = MIOCSPSINFO;
|
||||
mess.ADDRESS = (void *) fproc;
|
||||
(void) sendrec(MEMORY, &mess);
|
||||
|
||||
} while (TRUE); /* continue until process NONE */
|
||||
mess.m_type = OK; /* tell PM that we succeeded */
|
||||
s=send(PM_PROC_NR, &mess); /* send synchronization message */
|
||||
|
||||
/* Register function keys with TTY. */
|
||||
for (key=SF5; key<=SF6; key++) {
|
||||
if ((i=fkey_enable(key))!=OK) {
|
||||
printf("Warning: FS couldn't register Shift+F%d key: %d\n",
|
||||
SF1-key+1, i);
|
||||
key-SF1+1, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,10 +309,6 @@ PRIVATE void load_ram(void)
|
||||
if (sendrec(MEMORY, &m_out) != OK || m_out.REP_STATUS != OK)
|
||||
panic("Can't set RAM disk size", NO_NUM);
|
||||
|
||||
/* Tell PM the RAM disk size, and wait for it to come "on-line". */
|
||||
m_out.MEM_CHUNK_SIZE = ((long) ram_size_kb * 1024) >> CLICK_SHIFT;
|
||||
if (sendrec(PM_PROC_NR, &m_out) != OK)
|
||||
panic("FS can't sync up with PM", NO_NUM);
|
||||
|
||||
#if ENABLE_CACHE2
|
||||
/* The RAM disk is a second level block cache while not otherwise used. */
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
echo "struct fs_sym_entry { unsigned long symoffset; char *symname; } fs_sym_entries[] = {" >$1
|
||||
nm -n fs | grep -v "^fs:$" | grep ' [tT] ' | awk '{ print "{ 0x" $1 ", \"" $3 "\" }, " }' >>$1
|
||||
echo "};" >>$1
|
||||
+8
-7
@@ -314,7 +314,7 @@ PUBLIC int do_exit()
|
||||
if (fp->fp_tty == 0) return(OK); /* no controlling tty */
|
||||
dev = fp->fp_tty;
|
||||
|
||||
for (rfp = &fproc[LOW_USER]; rfp < &fproc[NR_PROCS]; rfp++) {
|
||||
for (rfp = &fproc[0]; rfp < &fproc[NR_PROCS]; rfp++) {
|
||||
if (rfp->fp_tty == dev) rfp->fp_tty = 0;
|
||||
|
||||
for (i = 0; i < OPEN_MAX; i++) {
|
||||
@@ -364,18 +364,16 @@ PUBLIC int do_set()
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_revive()
|
||||
{
|
||||
/* A task, typically TTY, has now gotten the characters that were needed for a
|
||||
* previous read. The process did not get a reply when it made the call.
|
||||
/* A driver, typically TTY, has now gotten the characters that were needed for
|
||||
* a previous read. The process did not get a reply when it made the call.
|
||||
* Instead it was suspended. Now we can send the reply to wake it up. This
|
||||
* business has to be done carefully, since the incoming message is from
|
||||
* a task (to which no reply can be sent), and the reply must go to a process
|
||||
* a driver (to which no reply can be sent), and the reply must go to a process
|
||||
* that blocked earlier. The reply to the caller is inhibited by returning the
|
||||
* 'SUSPEND' pseudo error, and the reply to the blocked process is done
|
||||
* explicitly in revive().
|
||||
*/
|
||||
|
||||
if (who >= LOW_USER && fp->fp_pid != PID_SERVER) return(EPERM);
|
||||
|
||||
revive(m_in.REP_PROC_NR, m_in.REP_STATUS);
|
||||
return(SUSPEND); /* don't reply to the TTY task */
|
||||
}
|
||||
@@ -402,9 +400,12 @@ PUBLIC int do_svrctl()
|
||||
|
||||
/* Try to update device mapping. */
|
||||
major = (device.dev >> MAJOR) & BYTE;
|
||||
r=map_driver(major, who, device.style);
|
||||
return(r);
|
||||
#if DEAD_CODE
|
||||
if ((r=map_driver(major, who, device.style)) == OK)
|
||||
fp->fp_pid = PID_SERVER;
|
||||
return(r);
|
||||
#endif
|
||||
}
|
||||
default:
|
||||
return(EINVAL);
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
struct fs_sym_entry { unsigned long symoffset; char *symname; } fs_sym_entries[] = {
|
||||
{ 0x00000000, "" },
|
||||
{ 0x00000000, "begtext" },
|
||||
{ 0x00000000, "crtso" },
|
||||
{ 0x00000050, "___main" },
|
||||
{ 0x00000054, "_main" },
|
||||
{ 0x0000010d, "_get_wor" },
|
||||
{ 0x000001dc, "_buf_poo" },
|
||||
{ 0x00000282, "_reply" },
|
||||
{ 0x000002ba, "_fs_init" },
|
||||
{ 0x0000041a, "_igetenv" },
|
||||
{ 0x0000044e, "_load_ra" },
|
||||
{ 0x00000756, "_load_su" },
|
||||
{ 0x000007f8, "_do_crea" },
|
||||
{ 0x0000083c, "_do_open" },
|
||||
{ 0x000008a7, "_common_" },
|
||||
{ 0x00000b76, "_new_nod" },
|
||||
{ 0x00000c6e, "_pipe_op" },
|
||||
{ 0x00000cf7, "_do_mkno" },
|
||||
{ 0x00000da6, "_do_mkdi" },
|
||||
{ 0x00000f28, "_do_clos" },
|
||||
{ 0x000010a6, "_do_lsee" },
|
||||
{ 0x00001160, "_do_read" },
|
||||
{ 0x0000116d, "_read_wr" },
|
||||
{ 0x0000164a, "_rw_chun" },
|
||||
{ 0x000017ee, "_read_ma" },
|
||||
{ 0x0000194d, "_rd_indi" },
|
||||
{ 0x000019d2, "_read_ah" },
|
||||
{ 0x00001a36, "_rahead" },
|
||||
{ 0x00001bdc, "_do_writ" },
|
||||
{ 0x00001be9, "_write_m" },
|
||||
{ 0x00001e0b, "_wr_indi" },
|
||||
{ 0x00001e5f, "_clear_z" },
|
||||
{ 0x00001f29, "_new_blo" },
|
||||
{ 0x00002028, "_zero_bl" },
|
||||
{ 0x0000205c, "_do_pipe" },
|
||||
{ 0x000021d1, "_pipe_ch" },
|
||||
{ 0x0000234d, "_suspend" },
|
||||
{ 0x000023de, "_release" },
|
||||
{ 0x0000244c, "_revive" },
|
||||
{ 0x000024df, "_do_unpa" },
|
||||
{ 0x000025f0, "_map_dri" },
|
||||
{ 0x0000268d, "_map_con" },
|
||||
{ 0x000027b4, "_do_fkey" },
|
||||
{ 0x000027f7, "_fproc_d" },
|
||||
{ 0x000028c5, "_dtab_dm" },
|
||||
{ 0x000029f4, "_dev_ope" },
|
||||
{ 0x00002a51, "_dev_clo" },
|
||||
{ 0x00002a79, "_dev_io" },
|
||||
{ 0x00002b2d, "_gen_opc" },
|
||||
{ 0x00002b77, "_tty_opc" },
|
||||
{ 0x00002bfa, "_ctty_op" },
|
||||
{ 0x00002c16, "_do_sets" },
|
||||
{ 0x00002c4a, "_do_ioct" },
|
||||
{ 0x00002ccb, "_gen_io" },
|
||||
{ 0x00002da1, "_ctty_io" },
|
||||
{ 0x00002dfb, "_no_dev" },
|
||||
{ 0x00002e05, "_clone_o" },
|
||||
{ 0x00002ef8, "_eat_pat" },
|
||||
{ 0x00002f3d, "_last_di" },
|
||||
{ 0x00003009, "_get_nam" },
|
||||
{ 0x000030a3, "_advance" },
|
||||
{ 0x00003237, "_search_" },
|
||||
{ 0x000035a0, "_do_moun" },
|
||||
{ 0x0000394a, "_do_umou" },
|
||||
{ 0x000039ab, "_unmount" },
|
||||
{ 0x00003a68, "_name_to" },
|
||||
{ 0x00003aec, "_do_link" },
|
||||
{ 0x00003c76, "_do_unli" },
|
||||
{ 0x00003d86, "_do_rena" },
|
||||
{ 0x00004194, "_truncat" },
|
||||
{ 0x000042f0, "_remove_" },
|
||||
{ 0x000043bd, "_unlink_" },
|
||||
{ 0x0000445c, "_alloc_b" },
|
||||
{ 0x0000464f, "_free_bi" },
|
||||
{ 0x00004782, "_get_sup" },
|
||||
{ 0x000047d7, "_get_blo" },
|
||||
{ 0x0000481f, "_mounted" },
|
||||
{ 0x0000486f, "_read_su" },
|
||||
{ 0x00004b2c, "_get_ino" },
|
||||
{ 0x00004bab, "_put_ino" },
|
||||
{ 0x00004c0c, "_alloc_i" },
|
||||
{ 0x00004d16, "_wipe_in" },
|
||||
{ 0x00004d45, "_free_in" },
|
||||
{ 0x00004d7f, "_update_" },
|
||||
{ 0x00004dc0, "_rw_inod" },
|
||||
{ 0x00004ede, "_old_ico" },
|
||||
{ 0x00005030, "_new_ico" },
|
||||
{ 0x000051f2, "_dup_ino" },
|
||||
{ 0x00005200, "_get_blo" },
|
||||
{ 0x0000537c, "_put_blo" },
|
||||
{ 0x00005454, "_alloc_z" },
|
||||
{ 0x00005506, "_free_zo" },
|
||||
{ 0x0000554d, "_rw_bloc" },
|
||||
{ 0x0000561c, "_invalid" },
|
||||
{ 0x00005650, "_flushal" },
|
||||
{ 0x000056ae, "_rw_scat" },
|
||||
{ 0x000058c7, "_rm_lru" },
|
||||
{ 0x0000590c, "_get_fd" },
|
||||
{ 0x00005989, "_get_fil" },
|
||||
{ 0x000059b7, "_find_fi" },
|
||||
{ 0x000059f0, "_do_chdi" },
|
||||
{ 0x00005abb, "_do_chro" },
|
||||
{ 0x00005af4, "_change" },
|
||||
{ 0x00005b78, "_do_stat" },
|
||||
{ 0x00005bd6, "_do_fsta" },
|
||||
{ 0x00005c08, "_stat_in" },
|
||||
{ 0x00005d00, "_do_fsta" },
|
||||
{ 0x00005d54, "_do_chmo" },
|
||||
{ 0x00005e41, "_do_chow" },
|
||||
{ 0x00005f29, "_do_umas" },
|
||||
{ 0x00005f66, "_do_acce" },
|
||||
{ 0x00005fe3, "_forbidd" },
|
||||
{ 0x00006149, "_read_on" },
|
||||
{ 0x00006168, "_do_utim" },
|
||||
{ 0x0000624e, "_do_time" },
|
||||
{ 0x0000625f, "_do_stim" },
|
||||
{ 0x000062bd, "_do_tims" },
|
||||
{ 0x00006308, "_do_cmos" },
|
||||
{ 0x00006404, "_get_cmo" },
|
||||
{ 0x00006594, "_read_re" },
|
||||
{ 0x000065c5, "_bcd_to_" },
|
||||
{ 0x000065e2, "_dec_to_" },
|
||||
{ 0x00006604, "_lock_op" },
|
||||
{ 0x000069d3, "_lock_re" },
|
||||
{ 0x00006a20, "_do_gets" },
|
||||
{ 0x00006a27, "_do_dup" },
|
||||
{ 0x00006ad0, "_do_fcnt" },
|
||||
{ 0x00006c0e, "_do_sync" },
|
||||
{ 0x00006c99, "_do_rebo" },
|
||||
{ 0x00006d1a, "_do_fork" },
|
||||
{ 0x00006dc6, "_do_exec" },
|
||||
{ 0x00006e21, "_do_exit" },
|
||||
{ 0x00006fc5, "_do_set" },
|
||||
{ 0x0000702f, "_do_revi" },
|
||||
{ 0x00007068, "_do_svrc" },
|
||||
{ 0x0000710c, "_clock_t" },
|
||||
{ 0x00007151, "_fetch_n" },
|
||||
{ 0x000071e3, "_no_sys" },
|
||||
{ 0x000071ed, "_panic" },
|
||||
{ 0x0000727f, "_conv2" },
|
||||
{ 0x000072a9, "_conv4" },
|
||||
{ 0x000072f8, "_printf" },
|
||||
{ 0x00007610, "_kputc" },
|
||||
{ 0x000076bc, "_sys_abo" },
|
||||
{ 0x00007708, "_sys_exi" },
|
||||
{ 0x00007728, "_sys_get" },
|
||||
{ 0x00007768, "_sys_in" },
|
||||
{ 0x000077a4, "_sys_kil" },
|
||||
{ 0x000077c8, "_sys_out" },
|
||||
{ 0x000077fc, "_sys_vir" },
|
||||
{ 0x0000784c, "__taskca" },
|
||||
{ 0x00007878, "_clk_fla" },
|
||||
{ 0x000078c0, "_clk_tim" },
|
||||
{ 0x00007908, "_fkey_ct" },
|
||||
{ 0x0000792c, "_server_" },
|
||||
{ 0x00007968, "_atoi" },
|
||||
{ 0x00007980, "__calls" },
|
||||
{ 0x00007999, "_exit" },
|
||||
{ 0x000079bc, "_strtol" },
|
||||
{ 0x000079d7, "_strtoul" },
|
||||
{ 0x000079f2, "_string2" },
|
||||
{ 0x00007b8c, "__exit" },
|
||||
{ 0x00007b94, "__send" },
|
||||
{ 0x00007ba8, "__nb_sen" },
|
||||
{ 0x00007bbc, "__receiv" },
|
||||
{ 0x00007bd0, "__nb_rec" },
|
||||
{ 0x00007be4, "__sendre" },
|
||||
{ 0x00007bf8, "_memcpy" },
|
||||
{ 0x00007c18, "_memset" },
|
||||
{ 0x00007c3c, "slword" },
|
||||
{ 0x00007c52, "sword" },
|
||||
{ 0x00007c5b, "sbyte" },
|
||||
{ 0x00007c5d, "done" },
|
||||
{ 0x00007c68, "_strcmp" },
|
||||
{ 0x00007c78, "_strlen" },
|
||||
{ 0x00007c88, "_strncmp" },
|
||||
{ 0x00007c98, "___exit" },
|
||||
{ 0x00007cb8, "__memmov" },
|
||||
{ 0x00007cce, "__memcpy" },
|
||||
{ 0x00007ce0, "uplword" },
|
||||
{ 0x00007ced, "upword" },
|
||||
{ 0x00007cf4, "upbyte" },
|
||||
{ 0x00007cf6, "done" },
|
||||
{ 0x00007cfd, "downward" },
|
||||
{ 0x00007d18, "__strncm" },
|
||||
{ 0x00007d28, "compare" },
|
||||
{ 0x00007d34, "done" },
|
||||
{ 0x00007d48, "__strnle" },
|
||||
{ 0x00007d5c, "no0" },
|
||||
{ 0x00007d68, "__syscal" },
|
||||
{ 0x00007dac, ".blm" },
|
||||
{ 0x00007dc4, ".csa4" },
|
||||
{ 0x00007df0, ".csb4" },
|
||||
{ 0x00007e18, ".fat" },
|
||||
{ 0x00007e24, ".stop" },
|
||||
{ 0x00007e2c, ".trp" },
|
||||
{ 0x00007e44, "__etext" },
|
||||
{ 0x00007e44, "endtext" },
|
||||
};
|
||||
@@ -51,7 +51,6 @@ int flag; /* M3 means path may be in message */
|
||||
* If 'flag' = M3 and 'len' <= M3_STRING, the path is present in 'message'.
|
||||
* If it is not, go copy it from user space.
|
||||
*/
|
||||
|
||||
register char *rpu, *rpm;
|
||||
int r;
|
||||
|
||||
@@ -87,7 +86,6 @@ int flag; /* M3 means path may be in message */
|
||||
PUBLIC int no_sys()
|
||||
{
|
||||
/* Somebody has used an illegal system call number */
|
||||
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
@@ -125,7 +123,6 @@ int norm; /* TRUE if no swap, FALSE for byte swap */
|
||||
int w; /* promotion of 16-bit word to be swapped */
|
||||
{
|
||||
/* Possibly swap a 16-bit word between 8086 and 68000 byte order. */
|
||||
|
||||
if (norm) return( (unsigned) w & 0xFFFF);
|
||||
return( ((w&BYTE) << 8) | ( (w>>8) & BYTE));
|
||||
}
|
||||
@@ -139,7 +136,6 @@ int norm; /* TRUE if no swap, FALSE for byte swap */
|
||||
long x; /* 32-bit long to be byte swapped */
|
||||
{
|
||||
/* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
|
||||
|
||||
unsigned lo, hi;
|
||||
long l;
|
||||
|
||||
@@ -149,3 +145,4 @@ long x; /* 32-bit long to be byte swapped */
|
||||
l = ( (long) lo <<16) | hi;
|
||||
return(l);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user