9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] too good to pass up (SRB Comments)
@ 2006-04-28 13:30 erik quanstrom
  2006-04-28 21:13 ` geoff
  0 siblings, 1 reply; 9+ messages in thread
From: erik quanstrom @ 2006-04-28 13:30 UTC (permalink / raw)
  To: 9fans

it was not cleaned up in the xinu bsd source.  iirc, on a vax,
it would coredump fairly reliably.  i spent some time trying
to figure out what the malfunction was, but never could.

i blamed nfs, since it was the convient thing to do, and
started using byron's rc.

the coding style was never a significant problem.  if it were,
i could have easily written a script to replace the odd #defines.

- erik

On Fri Apr 28 08:12:19 CDT 2006, brantley@coraid.com wrote:
> That was really John Mashy's fault, as I understand it.  He suggested
> it to SRB.  I had to deal with it when I ported V7 to the 68K.  Too
> bad every processor wasn't as clean in this reguard as the PDP-11.
>
> For those who might not have heard of this, SRB caught segfault
> signals, allocated more memory and just returned.  The instruction
> that caused the segfault would restart.  It was an automatic memory
> allocator.  Problem was that not all processors could pull off this
> sort of stunt.
>
> Geoff cleaned this up years ago.
>
> > not even his allocator?
> >
> > - erik
> >
> > On Fri Apr 28 08:02:29 CDT 2006, brantley@coraid.com wrote:
> >> > Not that I'm defending writing C as
> >> > though it were Algol 68...
> >>
> >> I kind of liked it after the initial shock.
> >> Even inspired the Obfuscated C Contest.
> >> I don't think SRB's code was obfuscated, though.
> >>
> >>
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-04-28 21:13 ` geoff
@ 2006-04-28 21:06   ` quanstro
  2006-04-30 10:35   ` Richard Miller
  1 sibling, 0 replies; 9+ messages in thread
From: quanstro @ 2006-04-28 21:06 UTC (permalink / raw)
  To: 9fans

i read this several weeks ago.  thanks for taking the time to document this.
i found it very instructive.

- erik

On Fri Apr 28 16:14:49 CDT 2006, geoff@collyer.net wrote:
> The cleanup I did was relatively late in the game (1988) and was done
> to the Ninth Edition Unix sh.  My stak.c is available at my web page
> (www.collyer.net/who/geoff) but the fixes didn't get back into most
> shells (Cray may have picked them up).
>
> As I noted in the corresponding paper, A Partial Tour Through the UNIX
> Shell,
>
> 	The shell was the last program ported to the Interdata during
> 	the original UNIX port, due to the difficulty of getting the
> 	details of restarting faulting instructions just right, which
> 	is why the Seventh Edition (also known as ``V7'') distribution
> 	tape includes /bin/osh, the Sixth Edition shell.
>
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-04-28 13:30 [9fans] too good to pass up (SRB Comments) erik quanstrom
@ 2006-04-28 21:13 ` geoff
  2006-04-28 21:06   ` quanstro
  2006-04-30 10:35   ` Richard Miller
  0 siblings, 2 replies; 9+ messages in thread
From: geoff @ 2006-04-28 21:13 UTC (permalink / raw)
  To: 9fans

The cleanup I did was relatively late in the game (1988) and was done
to the Ninth Edition Unix sh.  My stak.c is available at my web page
(www.collyer.net/who/geoff) but the fixes didn't get back into most
shells (Cray may have picked them up).

As I noted in the corresponding paper, A Partial Tour Through the UNIX
Shell,

	The shell was the last program ported to the Interdata during
	the original UNIX port, due to the difficulty of getting the
	details of restarting faulting instructions just right, which
	is why the Seventh Edition (also known as ``V7'') distribution
	tape includes /bin/osh, the Sixth Edition shell.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-04-28 21:13 ` geoff
  2006-04-28 21:06   ` quanstro
@ 2006-04-30 10:35   ` Richard Miller
  2006-05-01  1:01     ` geoff
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Miller @ 2006-04-30 10:35 UTC (permalink / raw)
  To: 9fans

geoff@collyer.net said:

> 	The shell was the last program ported to the Interdata during
> 	the original UNIX port, due to the difficulty of getting the
> 	details of restarting faulting instructions just right, which
> 	is why the Seventh Edition (also known as ``V7'') distribution
> 	tape includes /bin/osh, the Sixth Edition shell.

The Wollongong University version of the Bourne shell on the Interdata
contains this comment:

	/***
	 *** Don't rely on hardware to recover from address errors!
	 ***/

I took the easy way out and rewrote the allocator to make sure it
extended the address space before the memory was used, rather than
relying on recoverable address faults.  Much more portable.

-- Richard



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-04-30 10:35   ` Richard Miller
@ 2006-05-01  1:01     ` geoff
  2006-05-01  9:21       ` Richard Miller
  0 siblings, 1 reply; 9+ messages in thread
From: geoff @ 2006-05-01  1:01 UTC (permalink / raw)
  To: 9fans

Allocating the space before use would be straightforward for Bourne's
`heap' storage (the blok.c allocator).  Did you modify all the `stak'
macros and functions also to increase the break as needed?

There were other advantages to using the C library's malloc, notably
being able to call arbitrary C library functions, such as the
directory-reading routines, even if they used malloc.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-05-01  1:01     ` geoff
@ 2006-05-01  9:21       ` Richard Miller
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Miller @ 2006-05-01  9:21 UTC (permalink / raw)
  To: 9fans

> Did you modify all the `stak'
> macros and functions also to increase the break as needed?

I must have done.

On the other hand, the C stack (for all programs, not just sh)
had a fixed size determined at ld time, because I decided to
have the stack grow downwards as it did on the pdp11, even though
the interdata could only extend memory segments upwards.  I was
worried that all sorts of things might break if the stack went
the other way, but in hindsight this was probably the biggest
mistake I made in that project.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-04-28 13:10 ` [9fans] too good to pass up (SRB Comments) Brantley Coile
@ 2006-05-02  6:32   ` Roman Shaposhnik
  2006-05-01 21:22     ` Taj Khattra
  0 siblings, 1 reply; 9+ messages in thread
From: Roman Shaposhnik @ 2006-05-02  6:32 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Fri, 2006-04-28 at 09:10 -0400, Brantley Coile wrote:
> That was really John Mashy's fault, as I understand it.  He suggested
> it to SRB.  I had to deal with it when I ported V7 to the 68K.  Too
> bad every processor wasn't as clean in this reguard as the PDP-11.
> 
> For those who might not have heard of this, SRB caught segfault
> signals, allocated more memory and just returned.  The instruction
> that caused the segfault would restart.  It was an automatic memory
> allocator.  Problem was that not all processors could pull off this
> sort of stunt.

  That's some tricky programming! Do you know of any place one can get
an access to the original code ?

Thanks,
Roman.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-05-02  6:32   ` Roman Shaposhnik
@ 2006-05-01 21:22     ` Taj Khattra
  0 siblings, 0 replies; 9+ messages in thread
From: Taj Khattra @ 2006-05-01 21:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

>   That's some tricky programming! Do you know of any place one can get
> an access to the original code ?

you can browse it here:
http://minnie.tuhs.org/UnixTree/V7/usr/src/cmd/sh/fault.c.html


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [9fans] too good to pass up (SRB Comments)
  2006-04-28 13:01 [9fans] too good to pass up erik quanstrom
@ 2006-04-28 13:10 ` Brantley Coile
  2006-05-02  6:32   ` Roman Shaposhnik
  0 siblings, 1 reply; 9+ messages in thread
From: Brantley Coile @ 2006-04-28 13:10 UTC (permalink / raw)
  To: 9fans

That was really John Mashy's fault, as I understand it.  He suggested
it to SRB.  I had to deal with it when I ported V7 to the 68K.  Too
bad every processor wasn't as clean in this reguard as the PDP-11.

For those who might not have heard of this, SRB caught segfault
signals, allocated more memory and just returned.  The instruction
that caused the segfault would restart.  It was an automatic memory
allocator.  Problem was that not all processors could pull off this
sort of stunt.

Geoff cleaned this up years ago.

> not even his allocator?
>
> - erik
>
> On Fri Apr 28 08:02:29 CDT 2006, brantley@coraid.com wrote:
>> > Not that I'm defending writing C as
>> > though it were Algol 68...
>>
>> I kind of liked it after the initial shock.
>> Even inspired the Obfuscated C Contest.
>> I don't think SRB's code was obfuscated, though.
>>
>>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-05-02  6:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-28 13:30 [9fans] too good to pass up (SRB Comments) erik quanstrom
2006-04-28 21:13 ` geoff
2006-04-28 21:06   ` quanstro
2006-04-30 10:35   ` Richard Miller
2006-05-01  1:01     ` geoff
2006-05-01  9:21       ` Richard Miller
  -- strict thread matches above, loose matches on Subject: below --
2006-04-28 13:01 [9fans] too good to pass up erik quanstrom
2006-04-28 13:10 ` [9fans] too good to pass up (SRB Comments) Brantley Coile
2006-05-02  6:32   ` Roman Shaposhnik
2006-05-01 21:22     ` Taj Khattra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).