From b654c02f5578d5be9690f6f798b157fa123e219d Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 30 Jun 2006 14:36:11 +0000 Subject: [PATCH] Give pm its own brk() so malloc() works in pm. pm needs more stack for this. --- servers/pm/Makefile | 2 +- servers/pm/main.c | 3 --- servers/pm/misc.c | 19 +++++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/servers/pm/Makefile b/servers/pm/Makefile index ed858f5a4..2904d09b9 100644 --- a/servers/pm/Makefile +++ b/servers/pm/Makefile @@ -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) diff --git a/servers/pm/main.c b/servers/pm/main.c index 0c38d98cf..274b538f3 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -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 */ diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 49db944c9..ca3d67f75 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -11,6 +11,8 @@ * do_svrctl: process manager control */ +#define brk _brk + #include "pm.h" #include #include @@ -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; +} +