From: Philip Homburg Date: Thu, 11 May 2006 14:47:31 +0000 (+0000) Subject: Changes for restarting disk drivers and new interface between PM and FS. X-Git-Tag: v3.1.3~368 X-Git-Url: http://zhaoyanbai.com/repos/icons/debian/static/doxygen.log?a=commitdiff_plain;h=71917d638340792c0372e26e33231de4641cc657;p=minix.git Changes for restarting disk drivers and new interface between PM and FS. --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 7e9118ff2..f6a4c3683 100755 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -54,9 +54,12 @@ #define GETPGRP 63 /* The following are not system calls, but are processed like them. */ -#define UNPAUSE 65 /* to MM or FS: check for EINTR */ +#define UNPAUSE 65 /* to PM or FS: check for EINTR */ +#define EXEC_NEWMEM 66 /* from FS to PM: new memory map for exec */ #define REVIVE 67 /* to FS: revive a sleeping process */ #define TASK_REPLY 68 /* to FS: reply code from tty task */ +#define FORK_NB 69 /* to PM: special fork call for RS */ +#define EXEC_RESTART 70 /* to PM: final part of exec for RS */ /* Posix signal handling. */ #define SIGACTION 71 diff --git a/include/minix/com.h b/include/minix/com.h index ae70ace53..e9e8c958e 100755 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -439,7 +439,9 @@ #define PR_TRACING m1_i3 /* flag to indicate tracing is on/ off */ #define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */ #define PR_IP_PTR m1_p3 /* initial value for ip after exec */ -#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */ +#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap + * and sys_fork + */ /* Field names for SYS_INT86 */ #define INT86_REG86 m1_p1 /* pointer to registers */ @@ -462,6 +464,9 @@ #define RS_REFRESH (RS_RQ_BASE + 2) /* restart system service */ #define RS_RESCUE (RS_RQ_BASE + 3) /* set rescue directory */ #define RS_SHUTDOWN (RS_RQ_BASE + 4) /* alert about shutdown */ +#define RS_UP_COPY (RS_RQ_BASE + 5) /* start system service and + * keep the binary in memory + */ # define RS_CMD_ADDR m1_p1 /* command string */ # define RS_CMD_LEN m1_i1 /* length of command */ @@ -504,5 +509,78 @@ #define GET_KMESS 101 /* get kmess from TTY */ # define GETKM_PTR m1_p1 +#define PM_BASE 0x900 +#define PM_GET_WORK (PM_BASE + 1) /* Get work from PM */ +#define PM_IDLE (PM_BASE + 2) /* PM doesn't have any more work */ +#define PM_BUSY (PM_BASE + 3) /* A reply from FS is needed */ +#define PM_STIME (PM_BASE + 4) /* Tell FS about the new system time */ +#define PM_STIME_TIME m1_i1 /* boottime */ +#define PM_SETSID (PM_BASE + 5) /* Tell FS about the session leader */ +#define PM_SETSID_PROC m1_i1 /* process */ +#define PM_SETGID (PM_BASE + 6) /* Tell FS about the new group IDs */ +#define PM_SETGID_PROC m1_i1 /* process */ +#define PM_SETGID_EGID m1_i2 /* effective group id */ +#define PM_SETGID_RGID m1_i3 /* real group id */ +#define PM_SETUID (PM_BASE + 7) /* Tell FS about the new user IDs */ +#define PM_SETUID_PROC m1_i1 /* process */ +#define PM_SETUID_EGID m1_i2 /* effective user id */ +#define PM_SETUID_RGID m1_i3 /* real user id */ +#define PM_FORK (PM_BASE + 8) /* Tell FS about the new process */ +#define PM_FORK_PPROC m1_i1 /* parent process */ +#define PM_FORK_CPROC m1_i2 /* child process */ +#define PM_FORK_CPID m1_i3 /* child pid */ +#define PM_EXIT (PM_BASE + 9) /* Tell FS about the exiting process */ +#define PM_EXIT_PROC m1_i1 /* process */ +#define PM_UNPAUSE (PM_BASE + 10) /* interrupted process */ +#define PM_UNPAUSE_PROC m1_i1 /* process */ +#define PM_REBOOT (PM_BASE + 11) /* Tell FS that we about to reboot */ +#define PM_EXEC (PM_BASE + 12) /* Forward exec call to FS */ +#define PM_EXEC_PROC m1_i1 /* process */ +#define PM_EXEC_PATH m1_p1 /* executable */ +#define PM_EXEC_PATH_LEN m1_i2 /* length of path including + * terminating nul + */ +#define PM_EXEC_FRAME m1_p2 /* arguments and environment */ +#define PM_EXEC_FRAME_LEN m1_i3 /* size of frame */ +#define PM_FORK_NB (PM_BASE + 13) /* Tell FS about the fork_nb call */ +#define PM_DUMPCORE (PM_BASE + 14) /* Ask FS to generate a core dump */ +#define PM_CORE_PROC m1_i1 +#define PM_CORE_SEGPTR m1_p1 +#define PM_UNPAUSE_TR (PM_BASE + 15) /* interrupted process (for tracing) */ +#define PM_EXIT_TR (PM_BASE + 16) /* Tell FS about the exiting process + * (for tracing) + */ + +/* Replies */ +#define PM_EXIT_REPLY (PM_BASE + 20) /* Reply from FS */ +#define PM_REBOOT_REPLY (PM_BASE + 21) /* Reply from FS */ +#define PM_EXEC_REPLY (PM_BASE + 22) /* Reply from FS */ + /* PM_EXEC_PROC m1_i1 */ +#define PM_EXEC_STATUS m1_i2 /* OK or failure */ +#define PM_CORE_REPLY (PM_BASE + 23) /* Reply from FS */ + /* PM_CORE_PROC m1_i1 */ +#define PM_CORE_STATUS m1_i2 /* OK or failure */ +#define PM_EXIT_REPLY_TR (PM_BASE + 24) /* Reply from FS */ + +/* Parameters for the EXEC_NEWMEM call */ +#define EXC_NM_PROC m1_i1 /* process that needs new map */ +#define EXC_NM_PTR m1_p1 /* parameters in struct exec_newmem */ +/* Results: + * the status will be in m_type. + * the top of the stack will be in m1_i1. + * the following flags will be in m1_i2: + */ +#define EXC_NM_RF_LOAD_TEXT 1 /* Load text segment (otherwise the + * text segment is already present) + */ +#define EXC_NM_RF_ALLOW_SETUID 2 /* Setuid execution is allowed (tells + * FS to update its uid and gid + * fields. + */ + +/* Parameters for the EXEC_RESTART call */ +#define EXC_RS_PROC m1_i1 /* process that needs to be restarted */ +#define EXC_RS_RESULT m1_i2 /* result of the exec */ + #endif /* _MINIX_COM_H */ diff --git a/include/minix/config.h b/include/minix/config.h index 2c41c56ec..841e6fc44 100755 --- a/include/minix/config.h +++ b/include/minix/config.h @@ -71,7 +71,7 @@ #define ENABLE_CACHE2 0 /* Enable or disable swapping processes to disk. */ -#define ENABLE_SWAP 1 +#define ENABLE_SWAP 0 /* Include or exclude an image of /dev/boot in the boot image. * Please update the makefile in /usr/src/tools/ as well. diff --git a/include/minix/syslib.h b/include/minix/syslib.h index 584913759..201c500b8 100755 --- a/include/minix/syslib.h +++ b/include/minix/syslib.h @@ -29,7 +29,7 @@ _PROTOTYPE( int sys_abort, (int how, ...)); _PROTOTYPE( int sys_enable_iop, (int proc)); _PROTOTYPE( int sys_exec, (int proc, char *ptr, char *aout, vir_bytes initpc)); -_PROTOTYPE( int sys_fork, (int parent, int child, int *)); +_PROTOTYPE( int sys_fork, (int parent, int child, int *, struct mem_map *ptr)); _PROTOTYPE( int sys_newmap, (int proc, struct mem_map *ptr)); _PROTOTYPE( int sys_exit, (int proc)); _PROTOTYPE( int sys_trace, (int req, int proc, long addr, long *data_p)); diff --git a/include/minix/type.h b/include/minix/type.h index 06a398be6..d4a0c74f8 100755 --- a/include/minix/type.h +++ b/include/minix/type.h @@ -147,4 +147,21 @@ struct mem_range phys_bytes mr_limit; /* Highest memory address in range */ }; +/* For EXEC_NEWMEM */ +struct exec_newmem +{ + vir_bytes text_bytes; + vir_bytes data_bytes; + vir_bytes bss_bytes; + vir_bytes tot_bytes; + vir_bytes args_bytes; + int sep_id; + dev_t st_dev; + ino_t st_ino; + time_t st_ctime; + uid_t new_uid; + gid_t new_gid; + char progname[16]; /* Should be at least PROC_NAME_LEN */ +}; + #endif /* _TYPE_H */ diff --git a/include/unistd.h b/include/unistd.h index 03f741d9f..4ae87ead4 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -186,9 +186,11 @@ _PROTOTYPE( int allocmem, (phys_bytes size, phys_bytes *base) ); _PROTOTYPE( int freemem, (phys_bytes size, phys_bytes base) ); #define DEV_MAP 1 #define DEV_UNMAP 2 -#define mapdriver(driver, device, style) devctl(DEV_MAP, driver, device, style) +#define mapdriver(driver, device, style, force) \ + devctl(DEV_MAP, driver, device, style, force) #define unmapdriver(device) devctl(DEV_UNMAP, 0, device, 0) -_PROTOTYPE( int devctl, (int ctl_req, int driver, int device, int style)); +_PROTOTYPE( int devctl, (int ctl_req, int driver, int device, int style, + int force) ); /* For compatibility with other Unix systems */ _PROTOTYPE( int getpagesize, (void) ); diff --git a/lib/other/_devctl.c b/lib/other/_devctl.c index a7454c854..ca30bfda5 100644 --- a/lib/other/_devctl.c +++ b/lib/other/_devctl.c @@ -3,13 +3,15 @@ #include -PUBLIC int devctl(int ctl_req, int proc_nr, int dev_nr, int dev_style) +PUBLIC int devctl(int ctl_req, int proc_nr, int dev_nr, int dev_style, + int force) { message m; m.m4_l1 = ctl_req; m.m4_l2 = proc_nr; m.m4_l3 = dev_nr; m.m4_l4 = dev_style; + m.m4_l5 = force; if (_syscall(FS, DEVCTL, &m) < 0) return(-1); return(0); } diff --git a/lib/syslib/sys_fork.c b/lib/syslib/sys_fork.c index f42cb295b..3b5a5e01f 100755 --- a/lib/syslib/sys_fork.c +++ b/lib/syslib/sys_fork.c @@ -1,9 +1,10 @@ #include "syslib.h" -PUBLIC int sys_fork(parent, child, child_endpoint) +PUBLIC int sys_fork(parent, child, child_endpoint, map_ptr) int parent; /* process doing the fork */ int child; /* which proc has been created by the fork */ int *child_endpoint; +struct mem_map *map_ptr; { /* A process has forked. Tell the kernel. */ @@ -12,6 +13,7 @@ int *child_endpoint; m.PR_ENDPT = parent; m.PR_SLOT = child; + m.PR_MEM_PTR = map_ptr; r = _taskcall(SYSTASK, SYS_FORK, &m); *child_endpoint = m.PR_ENDPT; return r;