From e782e769442a664232b83488690e552de3753c61 Mon Sep 17 00:00:00 2001 From: Jorrit Herder Date: Thu, 2 Jun 2005 12:43:21 +0000 Subject: [PATCH] Created new findproc system call to the PM (to replace similar kernel functionality). Currently working on memory allocation (not yet finished). --- drivers/memory/memory.c | 51 +++++++++----------------------- include/minix/callnr.h | 14 +++++---- include/unistd.h | 1 + kernel/sendmask.h | 2 ++ lib/other/Makefile | 4 +++ lib/other/_findproc.c | 19 ++++++++++++ lib/other/_getprocnr.c | 2 +- lib/syscall/Makefile | 4 +++ lib/syscall/findproc.s | 7 +++++ servers/fs/dmap.c | 4 +++ servers/fs/main.c | 64 +++++++++++++++++++++++------------------ servers/fs/table.c | 2 ++ servers/inet/inet.c | 5 +++- servers/inet/mnx_eth.c | 6 +++- servers/pm/misc.c | 54 ++++++++++++++++++++++++++++++++-- servers/pm/param.h | 2 ++ servers/pm/proto.h | 2 ++ servers/pm/table.c | 4 ++- servers/pm/trace.c | 8 +++--- 19 files changed, 173 insertions(+), 82 deletions(-) create mode 100644 lib/other/_findproc.c create mode 100644 lib/syscall/findproc.s diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index 0f92e0e24..568d26488 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -30,9 +30,7 @@ PRIVATE int m_seg[NR_DEVS]; /* segment index of each device */ PRIVATE int m_device; /* current device */ PRIVATE struct kinfo kinfo; /* need kernel info */ PRIVATE struct machine machine; /* need machine info */ -PRIVATE struct memory mem[NR_MEMS]; /* physical memory chunks */ -FORWARD _PROTOTYPE( int alloc_mem, (phys_bytes size, phys_bytes *base) ); FORWARD _PROTOTYPE( char *m_name, (void) ); FORWARD _PROTOTYPE( struct device *m_prepare, (int device) ); FORWARD _PROTOTYPE( int m_transfer, (int proc_nr, int opcode, off_t position, @@ -196,7 +194,7 @@ unsigned nr_req; /* length of request vector */ chunk = (left > ZERO_BUF_SIZE) ? ZERO_BUF_SIZE : left; if (OK != (s=sys_vircopy(SELF, D, (vir_bytes) zero, proc_nr, D, user_vir, chunk))) - printf("MEMORY: sys_vircopy failed: %d\n", s); + report("MEM","sys_vircopy failed", s); left -= chunk; } } @@ -232,7 +230,7 @@ message *m_ptr; #if (CHIP == INTEL) && ENABLE_USERPRIV && ENABLE_USERIOPL if (m_device == MEM_DEV || m_device == KMEM_DEV) { sys_enable_iop(m_ptr->PROC_NR); - printf("MEMORY: sys_enable_iop for proc nr %d.\n", m_ptr->PROC_NR); + report("MEM", "sys_enable_iop for proc nr", m_ptr->PROC_NR); } #endif @@ -248,10 +246,6 @@ PRIVATE void m_init() /* Initialize this task. All minor devices are initialized one by one. */ int i, s; - /* Get memory addresses from the kernel. */ - if (OK != (s=sys_getmemchunks(&mem))) { - panic("MEM","Couldn't get memory chunks.",s); - } if (OK != (s=sys_getkinfo(&kinfo))) { panic("MEM","Couldn't get kernel information.",s); } @@ -305,7 +299,7 @@ PRIVATE void m_init() #endif /* !(CHIP == INTEL) */ /* Initialization succeeded. Print welcome message. */ - printf("User-space memory driver (RAM disk, etc.) has been initialized.\n"); + report("MEM","user-space memory driver has been initialized.", NO_NUM); } @@ -327,23 +321,28 @@ message *m_ptr; /* pointer to control message */ /* FS wants to create a new RAM disk with the given size. */ phys_bytes ramdev_size; phys_bytes ramdev_base; + message m; int s; if (m_ptr->PROC_NR != FS_PROC_NR) return(EPERM); /* Try to allocate a piece of memory for the RAM disk. */ ramdev_size = m_ptr->POSITION; - if (OK != (s=alloc_mem(ramdev_size, &ramdev_base))) - panic("MEM","Couldn't allocate kernel memory", s); - dv->dv_base = cvul64(ramdev_base); - dv->dv_size = cvul64(ramdev_size); - printf("Test MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size); + + printf("MEM: about to send to PM (ramdev_size %u)\n", ramdev_size); + m.m_type = MEM_ALLOC; + m.m4_l1 = ramdev_size; + if (OK != (s=sendrec(PM_PROC_NR, &m))) + report("MEM", "Couldn't sendrec to PM", s); + dv->dv_size = cvul64(m.m4_l1); + dv->dv_base = cvul64(m.m4_l2); + printf("MEM: PM (s=%d) gave base 0x%06x, size 0x%06x\n", s, dv->dv_base, dv->dv_size); if (OK != (s=sys_kmalloc(ramdev_size, &ramdev_base))) panic("MEM","Couldn't allocate kernel memory", s); dv->dv_base = cvul64(ramdev_base); dv->dv_size = cvul64(ramdev_size); - printf("Real MEM: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size); + printf("MEM allocated: base 0x%06x, size 0x%06x\n", dv->dv_base, dv->dv_size); if (OK != (s=sys_segctl(&m_seg[RAM_DEV], (u16_t *) &s, (vir_bytes *) &s, ramdev_base, ramdev_size))) { panic("MEM","Couldn't install remote segment.",s); @@ -370,26 +369,4 @@ struct partition *entry; entry->sectors = 32; } -/*===========================================================================* - * malloc_mem * - *===========================================================================*/ -PRIVATE int alloc_mem(chunk_size, chunk_base) -phys_bytes chunk_size; /* number of bytes requested */ -phys_bytes *chunk_base; /* base of memory area found */ -{ -/* Request a piece of memory from one of the free memory chunks. */ - phys_clicks tot_clicks; - struct memory *memp; - - tot_clicks = (chunk_size+ CLICK_SIZE-1) >> CLICK_SHIFT; - memp = &mem[NR_MEMS]; - while ((--memp)->size < tot_clicks) { - if (memp == mem) { - return(ENOMEM); - } - } - memp->size -= tot_clicks; - *chunk_base = (memp->base + memp->size) << CLICK_SHIFT; - return(OK); -} diff --git a/include/minix/callnr.h b/include/minix/callnr.h index c1b9bf5d9..0165857f2 100755 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -1,4 +1,4 @@ -#define NCALLS 83 /* number of system calls allowed */ +#define NCALLS 85 /* number of system calls allowed */ #define EXIT 1 #define FORK 2 @@ -62,12 +62,14 @@ #define SIGPROCMASK 74 #define SIGRETURN 75 -#define REBOOT 76 +#define REBOOT 76 /* to PM */ /* MINIX specific calls, e.g., to support system services. */ #define SVRCTL 77 -#define CMOSTIME 78 -#define GETSYSINFO 79 /* to MM or FS */ -#define GETPROCNR 80 /* to MM */ +#define CMOSTIME 78 /* to FS */ +#define GETSYSINFO 79 /* to PM or FS */ +#define GETPROCNR 80 /* to PM */ -#define FSTATFS 82 +#define FSTATFS 82 /* to FS */ +#define MEM_ALLOC 83 /* to PM */ +#define MEM_FREE 84 /* to PM */ diff --git a/include/unistd.h b/include/unistd.h index a5921db6e..f618688db 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -144,6 +144,7 @@ _PROTOTYPE( int fttyslot, (int _fd) ); _PROTOTYPE( char *crypt, (const char *_key, const char *_salt) ); _PROTOTYPE( int getsysinfo, (int who, int what, void *where) ); _PROTOTYPE( int getprocnr, (int *proc_nr) ); +_PROTOTYPE( int findproc, (char *proc_name, int *proc_nr) ); #endif _PROTOTYPE( int setcache, (int kb)); diff --git a/kernel/sendmask.h b/kernel/sendmask.h index f1b17683f..2885ddea1 100644 --- a/kernel/sendmask.h +++ b/kernel/sendmask.h @@ -88,6 +88,7 @@ allow(1, IS_PROC_NR) /* output diagnostics */ \ allow(1, SYSTASK) \ allow(1, TTY) \ + allow(1, MEMORY) \ allow(1, CLOCK) \ allow(1, INIT_PROC_NR) \ allow(1, FS_PROC_NR) \ @@ -136,6 +137,7 @@ allow(1, SYSTASK) /* system functionality needed */ \ allow(1, CLOCK) /* check clock alarms */ \ allow(1, TTY) /* output diagnostics */ \ + allow(1, PM_PROC_NR) /* PM alloc mem */ \ allow(1, FS_PROC_NR) /* FS is interface to the driver */ #define PRN_SENDMASK \ diff --git a/lib/other/Makefile b/lib/other/Makefile index c05c91a73..50374ed76 100755 --- a/lib/other/Makefile +++ b/lib/other/Makefile @@ -16,6 +16,7 @@ OBJECTS = \ $(LIBRARY)(_svrctl.o) \ $(LIBRARY)(_getsysinfo.o) \ $(LIBRARY)(_getprocnr.o) \ + $(LIBRARY)(_findproc.o) \ $(LIBRARY)(asynchio.o) \ $(LIBRARY)(configfile.o) \ $(LIBRARY)(crypt.o) \ @@ -78,6 +79,9 @@ $(LIBRARY)(_svrctl.o): _svrctl.c $(LIBRARY)(_getprocnr.o): _getprocnr.c $(CC1) _getprocnr.c +$(LIBRARY)(_findproc.o): _findproc.c + $(CC1) _findproc.c + $(LIBRARY)(_getsysinfo.o): _getsysinfo.c $(CC1) _getsysinfo.c diff --git a/lib/other/_findproc.c b/lib/other/_findproc.c new file mode 100644 index 000000000..8e110d9f6 --- /dev/null +++ b/lib/other/_findproc.c @@ -0,0 +1,19 @@ +#include +#define findproc _findproc +#include +#include + + +PUBLIC int findproc(proc_name, proc_nr) +char *proc_name; /* name of process to search for */ +int *proc_nr; /* return process number here */ +{ + message m; + + m.m1_p1 = proc_name; + m.m1_i1 = strlen(proc_name) + 1; + if (_syscall(MM, GETPROCNR, &m) < 0) return(-1); + *proc_nr = m.m1_i1; + return(0); +} + diff --git a/lib/other/_getprocnr.c b/lib/other/_getprocnr.c index 688a7caba..8c613dcad 100644 --- a/lib/other/_getprocnr.c +++ b/lib/other/_getprocnr.c @@ -7,7 +7,7 @@ PUBLIC int getprocnr(proc_nr) int *proc_nr; /* return process number here */ { message m; - + m.m1_i1 = 0; /* tell PM to get own process nr */ if (_syscall(MM, GETPROCNR, &m) < 0) return(-1); *proc_nr = m.m1_i1; return(0); diff --git a/lib/syscall/Makefile b/lib/syscall/Makefile index 41bee90db..ffc4977a6 100755 --- a/lib/syscall/Makefile +++ b/lib/syscall/Makefile @@ -44,6 +44,7 @@ OBJECTS = \ $(LIBRARY)(getppid.o) \ $(LIBRARY)(getuid.o) \ $(LIBRARY)(getprocnr.o) \ + $(LIBRARY)(findproc.o) \ $(LIBRARY)(ioctl.o) \ $(LIBRARY)(isatty.o) \ $(LIBRARY)(kill.o) \ @@ -218,6 +219,9 @@ $(LIBRARY)(getppid.o): getppid.s $(LIBRARY)(getprocnr.o): getprocnr.s $(CC1) getprocnr.s +$(LIBRARY)(findproc.o): findproc.s + $(CC1) findproc.s + $(LIBRARY)(getuid.o): getuid.s $(CC1) getuid.s diff --git a/lib/syscall/findproc.s b/lib/syscall/findproc.s new file mode 100644 index 000000000..806e4842d --- /dev/null +++ b/lib/syscall/findproc.s @@ -0,0 +1,7 @@ +.sect .text +.extern __findproc +.define _findproc +.align 2 + +_findproc: + jmp __findproc diff --git a/servers/fs/dmap.c b/servers/fs/dmap.c index c0c227c95..4cc69232a 100644 --- a/servers/fs/dmap.c +++ b/servers/fs/dmap.c @@ -7,6 +7,7 @@ #include "fproc.h" #include "dmap.h" #include +#include #include #include @@ -142,8 +143,11 @@ PUBLIC void map_controllers() for (dp = drivertab; dp < drivertab + sizeof(drivertab)/sizeof(drivertab[0]); dp++) { if (strcmp(ctrlr_type, dp->wini_type) == 0) { /* found driver name */ +#if DEAD_CODE if ((s=sys_getprocnr(&proc_nr, /* lookup proc nr */ dp->proc_name, strlen(dp->proc_name)+1)) == OK) { +#endif + if ((s=findproc(dp->proc_name, &proc_nr)) == OK) { for (i=0; i< max_major; i++) { /* find mapping */ if (dmap[i].dmap_driver == CTRLR(c)) { if (map_driver(i, proc_nr, STYLE_DEV) == OK) { diff --git a/servers/fs/main.c b/servers/fs/main.c index ce867c4fd..fe9328aaf 100644 --- a/servers/fs/main.c +++ b/servers/fs/main.c @@ -96,7 +96,6 @@ PRIVATE void get_work() /* Normally wait for new input. However, if 'reviving' is * nonzero, a suspended process must be awakened. */ - register struct fproc *rp; if (reviving != 0) { @@ -174,10 +173,35 @@ PRIVATE void fs_init() { /* Initialize global variables, tables, etc. */ register struct inode *rip; + register struct fproc *rfp; int key, s, i; message mess; - /* Certain relations must hold for the file system to work at all. Some + /* 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(__FILE__,"FS couldn't receive from PM", s); + if (NONE == mess.PR_PROC_NR) break; + + rfp = &fproc[mess.PR_PROC_NR]; + rfp->fp_pid = mess.PR_PID; + rfp->fp_realuid = (uid_t) SYS_UID; + rfp->fp_effuid = (uid_t) SYS_UID; + rfp->fp_realgid = (gid_t) SYS_GID; + rfp->fp_effgid = (gid_t) SYS_GID; + rfp->fp_umask = ~0; + + } while (TRUE); /* continue until process NONE */ + mess.m_type = OK; /* tell PM that we succeeded */ + s=send(PM_PROC_NR, &mess); /* send synchronization message */ + + + /* All process table entries have been set. Continue with FS initialization. + * 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(__FILE__,"OPEN_MAX > 127", NO_NUM); @@ -190,37 +214,21 @@ PRIVATE void fs_init() fp = (struct fproc *) NULL; who = FS_PROC_NR; - map_controllers(); /* map controller devices to drivers */ buf_pool(); /* initialize buffer pool */ + map_controllers(); /* map controller devices to drivers */ load_ram(); /* init RAM disk, load if it is root */ load_super(root_dev); /* load super block for root device */ - /* 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(__FILE__,"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); - 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; - - } while (TRUE); /* continue until process NONE */ - mess.m_type = OK; /* tell PM that we succeeded */ - s=send(PM_PROC_NR, &mess); /* send synchronization message */ + /* The root device can now be accessed; set process directories. */ + for (rfp=&fproc[0]; rfp < &fproc[NR_PROCS]; rfp++) { + if (rfp->fp_pid != PID_FREE) { + rip = get_inode(root_dev, ROOT_INODE); + dup_inode(rip); + rfp->fp_rootdir = rip; + rfp->fp_workdir = rip; + } + } /* Register function keys with TTY. */ for (key=SF5; key<=SF6; key++) { diff --git a/servers/fs/table.c b/servers/fs/table.c index c415f476e..76155ef30 100644 --- a/servers/fs/table.c +++ b/servers/fs/table.c @@ -100,6 +100,8 @@ PUBLIC _PROTOTYPE (int (*call_vec[]), (void) ) = { no_sys, /* 80 = unused */ no_sys, /* 81 = unused */ do_fstatfs, /* 82 = fstatfs */ + no_sys, /* 83 = memalloc */ + no_sys, /* 84 = memfree */ }; /* This should not fail with "array size is negative": */ extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1]; diff --git a/servers/inet/inet.c b/servers/inet/inet.c index cf3bbe223..c656e58ea 100644 --- a/servers/inet/inet.c +++ b/servers/inet/inet.c @@ -175,8 +175,11 @@ PRIVATE void nw_init() if (svrctl(SYSSIGNON, (void *) NULL) == -1) pause(); /* Our new identity as a server. */ +#if DEAD_CODE if (get_proc_nr(&this_proc, NULL) != OK) - ip_panic(( "unable to find own process nr\n")); +#endif + if (getprocnr(&this_proc) != OK) + ip_panic(( "unable to get own process nr\n")); /* Register the device group. */ device.dev= ip_dev; diff --git a/servers/inet/mnx_eth.c b/servers/inet/mnx_eth.c index 76663fc26..f8bd24a43 100644 --- a/servers/inet/mnx_eth.c +++ b/servers/inet/mnx_eth.c @@ -19,6 +19,8 @@ Copyright 1995 Philip Homburg #include "generic/sr.h" #include +#define _MINIX +#include THIS_FILE @@ -39,8 +41,10 @@ PUBLIC void osdep_eth_init() for (i= 0, eth_port= eth_port_table, ecp= eth_conf; iec_task); +#if DEAD_CODE r = sys_getprocnr(&tasknr, ecp->ec_task, strlen(ecp->ec_task)); +#endif + r = findproc(ecp->ec_task, &tasknr); if (r != OK) { ip_panic(( "unable to find task %s: %d\n", diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 3376a44e6..90ee10d25 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -3,8 +3,10 @@ * The entry points into this file are: * do_reboot: kill all processes, then reboot system * do_svrctl: process manager control - * do_getsysinfo: request copy of PM data structure - * do_getprocnr: get process slot number (like getpid) + * do_getsysinfo: request copy of PM data structure (Jorrit N. Herder) + * do_getprocnr: lookup process slot number (Jorrit N. Herder) + * do_memalloc: allocate a chunk of memory (Jorrit N. Herder) + * do_memfree: deallocate a chunk of memory (Jorrit N. Herder) */ #include "pm.h" @@ -22,6 +24,30 @@ FORWARD _PROTOTYPE( char *find_key, (const char *params, const char *key)); /* PM gets a copy of all boot monitor parameters. */ PRIVATE char monitor_params[128*sizeof(char *)]; +/*=====================================================================* + * do_memalloc * + *=====================================================================*/ +PUBLIC int do_memalloc() +{ + vir_clicks mem_clicks; + phys_clicks mem_base; + printf("PM got request to allocate %u KB\n", m_in.memsize); + + mem_clicks = (m_in.memsize + CLICK_SIZE -1 ) >> CLICK_SHIFT; + mem_base = alloc_mem(mem_clicks); + if (mem_base == NO_MEM) return(ENOMEM); + mp->mp_reply.membase = (phys_bytes) (mem_base << CLICK_SHIFT); + return(OK); +} + +/*=====================================================================* + * do_memfree * + *=====================================================================*/ +PUBLIC int do_memfree() +{ + return(OK); +} + /*=====================================================================* * do_getsysinfo * *=====================================================================*/ @@ -36,7 +62,29 @@ PUBLIC int do_getsysinfo() *=====================================================================*/ PUBLIC int do_getprocnr() { - mp->mp_reply.procnr = who; + register struct mproc *rmp; + static char search_key[PROC_NAME_LEN]; + int key_len; + int s; + + if (m_in.namelen > 0) { /* lookup process by name */ + key_len = MAX(m_in.namelen, PROC_NAME_LEN); + if (OK != (s=sys_datacopy(who, (vir_bytes) m_in.addr, + SELF, (vir_bytes) search_key, key_len))) + return(s); + search_key[key_len] = '\0'; /* terminate for safety */ + for (rmp = &mproc[0]; rmp < &mproc[NR_PROCS]; rmp++) { + if (rmp->mp_flags & IN_USE && + strncmp(rmp->mp_name, search_key, key_len)==0) { + mp->mp_reply.procnr = (int) (rmp - mproc); + return(OK); + } + } + return(ESRCH); + } + else { /* return own process number */ + mp->mp_reply.procnr = who; + } return(OK); } diff --git a/servers/pm/param.h b/servers/pm/param.h index f75ebaf1f..6bf30cf0a 100644 --- a/servers/pm/param.h +++ b/servers/pm/param.h @@ -33,6 +33,8 @@ #define svrctl_req m2_i1 #define svrctl_argp m2_p1 #define stime m2_l1 +#define memsize m4_l1 +#define membase m4_l2 /* The following names are synonyms for the variables in a reply message. */ #define reply_res m_type diff --git a/servers/pm/proto.h b/servers/pm/proto.h index c6f8b0856..a01efbf40 100644 --- a/servers/pm/proto.h +++ b/servers/pm/proto.h @@ -56,6 +56,8 @@ _PROTOTYPE( int do_reboot, (void) ); _PROTOTYPE( int do_getsysinfo, (void) ); _PROTOTYPE( int do_getprocnr, (void) ); _PROTOTYPE( int do_svrctl, (void) ); +_PROTOTYPE( int do_memalloc, (void) ); +_PROTOTYPE( int do_memfree, (void) ); _PROTOTYPE( int do_mstats, (void) ); #if (MACHINE == MACINTOSH) diff --git a/servers/pm/table.c b/servers/pm/table.c index 57de92881..9efd53360 100644 --- a/servers/pm/table.c +++ b/servers/pm/table.c @@ -98,7 +98,9 @@ _PROTOTYPE (int (*call_vec[NCALLS]), (void) ) = { do_getsysinfo, /* 79 = getsysinfo */ do_getprocnr, /* 80 = getprocnr */ no_sys, /* 81 = unused */ - no_sys, /* 82 = unused */ + no_sys, /* 82 = fstatfs */ + do_memalloc, /* 83 = memalloc */ + do_memfree, /* 84 = memfree */ }; /* This should not fail with "array size is negative": */ extern int dummy[sizeof(call_vec) == NCALLS * sizeof(call_vec[0]) ? 1 : -1]; diff --git a/servers/pm/trace.c b/servers/pm/trace.c index 27098b452..dc21338ee 100644 --- a/servers/pm/trace.c +++ b/servers/pm/trace.c @@ -29,7 +29,7 @@ #define NIL_MPROC ((struct mproc *) 0) -FORWARD _PROTOTYPE( struct mproc *findproc, (pid_t lpid) ); +FORWARD _PROTOTYPE( struct mproc *find_proc, (pid_t lpid) ); /*===========================================================================* * do_trace * @@ -46,7 +46,7 @@ PUBLIC int do_trace() mp->mp_reply.reply_trace = 0; return(OK); } - if ((child=findproc(m_in.pid))==NIL_MPROC || !(child->mp_flags & STOPPED)) { + if ((child=find_proc(m_in.pid))==NIL_MPROC || !(child->mp_flags & STOPPED)) { return(ESRCH); } /* all the other calls are made by the parent fork of the debugger to @@ -75,9 +75,9 @@ PUBLIC int do_trace() } /*===========================================================================* - * findproc * + * find_proc * *===========================================================================*/ -PRIVATE struct mproc *findproc(lpid) +PRIVATE struct mproc *find_proc(lpid) pid_t lpid; { register struct mproc *rmp; -- 2.44.0