Give pm its own brk() so malloc() works in pm. pm needs more stack for this.
This commit is contained in:
parent
b5179d7025
commit
b654c02f55
3 changed files with 20 additions and 4 deletions
|
@ -20,7 +20,7 @@ OBJ = main.o forkexit.o break.o exec.o time.o timers.o \
|
||||||
all build: $(SERVER)
|
all build: $(SERVER)
|
||||||
$(SERVER): $(OBJ)
|
$(SERVER): $(OBJ)
|
||||||
$(CC) -o $@ $(LDFLAGS) $(OBJ) -lsysutil -lsys -ltimers
|
$(CC) -o $@ $(LDFLAGS) $(OBJ) -lsysutil -lsys -ltimers
|
||||||
install -S 256w $@
|
install -S 8k $@
|
||||||
|
|
||||||
# install with other servers
|
# install with other servers
|
||||||
install: /usr/sbin/$(SERVER)
|
install: /usr/sbin/$(SERVER)
|
||||||
|
|
|
@ -271,7 +271,6 @@ PRIVATE void pm_init()
|
||||||
if (OK != (s=sys_getimage(image)))
|
if (OK != (s=sys_getimage(image)))
|
||||||
panic(__FILE__,"couldn't get image table: %d\n", s);
|
panic(__FILE__,"couldn't get image table: %d\n", s);
|
||||||
procs_in_use = 0; /* start populating table */
|
procs_in_use = 0; /* start populating table */
|
||||||
printf("Building process table:"); /* show what's happening */
|
|
||||||
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
|
for (ip = &image[0]; ip < &image[NR_BOOT_PROCS]; ip++) {
|
||||||
if (ip->proc_nr >= 0) { /* task have negative nrs */
|
if (ip->proc_nr >= 0) { /* task have negative nrs */
|
||||||
procs_in_use += 1; /* found user process */
|
procs_in_use += 1; /* found user process */
|
||||||
|
@ -315,10 +314,8 @@ PRIVATE void pm_init()
|
||||||
mess.PR_ENDPT = rmp->mp_endpoint;
|
mess.PR_ENDPT = rmp->mp_endpoint;
|
||||||
if (OK != (s=send(FS_PROC_NR, &mess)))
|
if (OK != (s=send(FS_PROC_NR, &mess)))
|
||||||
panic(__FILE__,"can't sync up with FS", s);
|
panic(__FILE__,"can't sync up with FS", s);
|
||||||
printf(" %s", ip->proc_name); /* display process name */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf(".\n"); /* last process done */
|
|
||||||
|
|
||||||
/* Override some details. INIT, PM, FS and RS are somewhat special. */
|
/* Override some details. INIT, PM, FS and RS are somewhat special. */
|
||||||
mproc[PM_PROC_NR].mp_pid = PM_PID; /* PM has magic pid */
|
mproc[PM_PROC_NR].mp_pid = PM_PID; /* PM has magic pid */
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
* do_svrctl: process manager control
|
* do_svrctl: process manager control
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define brk _brk
|
||||||
|
|
||||||
#include "pm.h"
|
#include "pm.h"
|
||||||
#include <minix/callnr.h>
|
#include <minix/callnr.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -520,3 +522,20 @@ PUBLIC int do_svrctl()
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*===========================================================================*
|
||||||
|
* _brk *
|
||||||
|
*===========================================================================*/
|
||||||
|
|
||||||
|
extern char *_brksize;
|
||||||
|
PUBLIC int brk(brk_addr)
|
||||||
|
char *brk_addr;
|
||||||
|
{
|
||||||
|
/* PM wants to call brk() itself. */
|
||||||
|
if(real_brk(&mproc[PM_PROC_NR], (vir_bytes) brk_addr) != OK) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
_brksize = brk_addr;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue