[comp.protocols.tcp-ip] MIT/CMU PC/IP under Microsoft C V. 4.0?

earle@jplopto.uucp (Greg Earle) (10/24/87)

I just tried to bring up PC/IP using Micosoft C V. 4.0 (as opposed to 3.0,
the original development environment).  The PC/IP code contains some things
which are meant to emulate certain UNIX standard C library behavior; for
example in UNIX calling `exit()' really calls some cleanup functions, and
then `_exit()' for the crash and burn.  PC/IP tries to emulate this by
redefining a UNIXish exit() function, and adding a function `exit_hook(func)'
to add a cleanup function to the exit() list.  MSC V 4.0 barfs on this, because
it causes exit() to be multiply defined when LINK'ed.  I tried to get around
this by attempting to manually call the exit handlers installed by exit_hook
before any exit()'s that come after an exit_hook, and removing the PC/IP
exit() redefinition.  I don't think this is working correctly, because the
net result (using a MICOM/Interlan NI5010 board) is that the very first PC/IP
program run (after bootup) works fine, but after that, any succeeding programs
hang the system, waiting for the disk or ramdisk (i.e., disk light goes on,
no diagnostics show on console if enabled, disk light stays on forever, PC
clone hangs and has to be power-cycled).  I take this to mean that the PC/IP
program or library is not resetting an Interrupt somehow, thus locking out
succeeding invocations of other PC/IP programs - presumably due to my Operator
Error :-( .  Also, a printf.c file calls a function with an argument called
`signed', which now seems to be a reserved keyword in MSC 4.0. [NB: This is
using Suntronics PC/AT clones; Phoenix or ALM BIOS]

Since MSC 4.0 supports exit() doing cleanup with handlers using onexit(),
I'd like to find out if there is a newer version available for FTP
that already takes advantage of this fact (and other V3 - V4 enhancements).
Sorry to bother the TCP/IP list with this, but I thought I'd find a few PC/IP
users on it ...

	Greg Earle		earle@jplopto.JPL.NASA.GOV
	S(*CENSORED*)t		earle%jplopto@jpl-elroy.ARPA	[aka:]
	Rockwell International	earle%jplopto@elroy.JPL.NASA.GOV
	Seal Beach, CA		...!cit-vax!elroy!smeagol!jplopto!earle

ROMKEY@XX.LCS.MIT.EDU (John Romkey) (10/27/87)

When we wrote PC/IP, we needed a way to make sure that certain functions
were called when the program exited. Most importantly, we had to shutdown
the network interface and release its interrupt and the clock interrupt.
If you don't do that, the next time you run a program and a network
interrupt happens (like, a packet shows up for you), the PC will jump
off into hyperspace and you'll get a DOS-shattering KABOOM.

So we defined our own exit() routine; no problem, we had control over the
whole standard I/O library for the C (cross-)compiler we were using.

Then Drew Perkins at CMU ported it to MSC, and MSC 4.0 came along, and MSC 4.0
broke the exit_hook() stuff we defined. The right way to fix it is to
get rid of PC/IP's own exit() function and to change exit_hook() to just call
the MSC onexit() function. Don't worry, MSC 5.0 will probably break
this again, as they've renamed it to atexit() in 5.0.

MIT is no longer working on PC/IP. You can get a version of it for MSC 4.0
over the net from CMU; FTP Software also sells a commercial version that
works with MSC 4.0. I don't know the state of any of the other offshoots
of it regarding rolling your own programs.
				- john romkey
				 ftp software
-------