From e6e81ff8b3af3d1c38ce54365a810c7c1ebdb201 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 6 Jan 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-01-06 --- port/portdat.h | 3 ++- port/sysproc.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/port/portdat.h b/port/portdat.h index cdbe7a9e698f4563b4db17ab4caa213a4e8792fc..7e5051153c99cdee23be9d8d0f4bc9905c2b44f3 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -315,7 +315,8 @@ enum SG_PHYSICAL = 05, SG_SHDATA = 06, - SG_RONLY = 040, /* Segment is read only */ + SG_RONLY = 0040, /* Segment is read only */ + SG_CEXEC = 0100, /* Detach at exec */ }; #define PG_ONSWAP 1 diff --git a/port/sysproc.c b/port/sysproc.c index 07ff2582fd36e9fc723865422ee13c2cd1d0945e..cb6cc607867fdadfcc8f47dd8a617826ce86f4b3 100644 --- a/port/sysproc.c +++ b/port/sysproc.c @@ -330,7 +330,15 @@ sysexec(ulong *arg) */ for(i = SSEG; i <= BSEG; i++) { putseg(up->seg[i]); - up->seg[i] = 0; /* prevent a second free if we have an error */ + /* prevent a second free if we have an error */ + up->seg[i] = 0; + } + for(i = BSEG+1; i < NSEG; i++) { + s = up->seg[i]; + if(s != 0 && (s->type&SG_CEXEC)) { + putseg(s); + up->seg[i] = 0; + } } /*