Give pm its own brk() so malloc() works in pm. pm needs more stack for this.

This commit is contained in:
Ben Gras 2006-06-30 14:36:11 +00:00
parent b5179d7025
commit b654c02f55
3 changed files with 20 additions and 4 deletions

View file

@ -20,7 +20,7 @@ OBJ = main.o forkexit.o break.o exec.o time.o timers.o \
all build: $(SERVER)
$(SERVER): $(OBJ)
$(CC) -o $@ $(LDFLAGS) $(OBJ) -lsysutil -lsys -ltimers
install -S 256w $@
install -S 8k $@
# install with other servers
install: /usr/sbin/$(SERVER)

View file

@ -271,7 +271,6 @@ PRIVATE void pm_init()
if (OK != (s=sys_getimage(image)))
panic(__FILE__,"couldn't get image table: %d\n", s);
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++) {
if (ip->proc_nr >= 0) { /* task have negative nrs */
procs_in_use += 1; /* found user process */
@ -315,10 +314,8 @@ PRIVATE void pm_init()
mess.PR_ENDPT = rmp->mp_endpoint;
if (OK != (s=send(FS_PROC_NR, &mess)))
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. */
mproc[PM_PROC_NR].mp_pid = PM_PID; /* PM has magic pid */

View file

@ -11,6 +11,8 @@
* do_svrctl: process manager control
*/
#define brk _brk
#include "pm.h"
#include <minix/callnr.h>
#include <signal.h>
@ -520,3 +522,20 @@ PUBLIC int do_svrctl()
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;
}