[comp.unix.aux] MacOS => A/UX porting woes

sysmark@physics.utoronto.ca (Mark Bartelt) (03/13/91)

We recently installed A/UX on one of our MacII systems, and the person who
uses this Mac is having trouble porting one of his Mac applications to run
under A/UX.  I confess to not knowing much about the Mac environment, so
I may be leaving out relevant details.  Anyway, here goes a first pass at
a description of the problem, though it's rather hard to know exactly what
details one might need to make a pass at diagnosing it ...

He has an application that he wrote himself, and has used for quite some
time under MacOS (where he used Think-C to compile his stuff).  After some
minor fiddling to remove function prototypes so that A/UX cc would accept
the program as valid, it compiles/loads just fine.  The program launches
and runs OK, whether invoked by double-clicking its icon, or run from a
command shell.  If he lets it exit normally, all seems well.

The problems occur when he tries to run a desk accessory.  Or clicks the
finder's icon in the upper-right corner of the screen.  Or clicks in some
other window on the desktop.  When he does any of these things while his
program is running, everything hangs catastrophically (keyboard input and
mouse clicks are ignored).  Things are so thoroughly hung, in fact, that
the system has to be rebooted.  After much puzzlement, he found that he
can duplicate the problem in a much smaller program, fairly closely modeled
after a test program that Apple provided in /mac/src/something as an example.
What he's found is:

Apple's test program compiles and runs just fine if compiled with A/UX cc.
In other words, one can do other things (like starting a DA) while the test
program is running.  However, the test program misbehaves in the same way
as his program if it's compiled with gcc!  (His program, for what it's worth,
misbehaves whether it's compiled with gcc or A/UX cc.)

Short of posting the complete source code for his program and having you
all take a look at it (something which I'm *sure* you're incredibly eager
to do), I can't think of anything else that may be relevant.  Oh, yeah, he
is running in 32-bit mode, if that makes any difference.

He's a bit surprised by all this (as am I), not so much by the fact that
his program doesn't work (after all, it may be buggy in some weird way
that just never showed up under MacOS), but by the fact that it's possible
to hang the entire system when running under A/UX.  We'd both been under
the impression that A/UX ran user processes in a protected mode, so that,
as with other UNIXes, a buggy user-mode program could bugger itself but
not hang/crash the system.  Are we mistaken?

Anyway, if anyone has a clue/pointer/suggestion as to what his program
might be doing wrong (perhaps someone has encountered similar problems
porting home-brew applications from MacOS to A/UX), I'd certainly enjoy
hearing them.  Thanks mucho.

Mark Bartelt                                                 416/978-5619
Canadian Institute for                           sysmark@cita.toronto.edu
Theoretical Astrophysics                         sysmark@cita.utoronto.ca

d88-jwa@byse.nada.kth.se (Jon W{tte) (03/14/91)

In article <> sysmark@physics.utoronto.ca (Mark Bartelt) writes:

   program is running.  However, the test program misbehaves in the same way
   as his program if it's compiled with gcc!  (His program, for what it's
   worth, misbehaves whether it's compiled with gcc or A/UX cc.)

gcc compiling needs some defines (-DAUX_SOURCE) and maybe a call to
setcompat() in the init phase of the program. This is handled automagically
by cc

   that just never showed up under MacOS), but by the fact that it's possible
   to hang the entire system when running under A/UX.  We'd both been under
   the impression that A/UX ran user processes in a protected mode, so that,
   as with other UNIXes, a buggy user-mode program could bugger itself but

Did you have a getty on one of the serial ports ? I always have,
so I can fire up a comm program on my girlfriends SE and kill -9
the mac when it hangs.

You can also try command-control-I (for interrupt) or command-control-E
(for exit) if you have MacsBug 6.2.anything installed. That ususally
gets you out of the mac environment. (You might have to type
^Jscreenrestore^Jstty sane^J by hand afterwards, though)

You could also use THINK C under A/UX 24bit mode, but you can't use the
built-in "Run" command, you have to build an application to test it.

Now, if Symantec hears this:

I WANT A A/UX-COMPATIBLE THINK C, THANK YOU ! (After all, I bought the
darned thing to get support...) Oh, well, I know how it is with users
shouting and management setting other priorities. C++ would be nice,
as would ANSI C, and extensible editor, (and/or better support for
external editors... like keyboard shortcuts in all dialogs !)

That's it.

							h+@nada.kth.se
							Jon W{tte
--
"The IM-IV file manager chapter documents zillions of calls, all of which
seem to do almost the same thing and none of which seem to do what I want
them to do."  --  Juri Munkki in comp.sys.mac.programmer

justin@Apple.COM (Justin Walker) (03/23/91)

In article <D88-JWA.91Mar14085711@byse.nada.kth.se> d88-jwa@byse.nada.kth.se (Jon W{tte) writes:
>In article <> sysmark@physics.utoronto.ca (Mark Bartelt) writes:
> ...
>Did you have a getty on one of the serial ports ? I always have,
>so I can fire up a comm program on my girlfriends SE and kill -9
>the mac when it hangs.
>
>You can also try command-control-I (for interrupt) or command-control-E
>(for exit) if you have MacsBug 6.2.anything installed. That ususally
>gets you out of the mac environment. (You might have to type
>^Jscreenrestore^Jstty sane^J by hand afterwards, though)
>
	The cmd-ctrl-I and cmd-ctrl-e sequences work regardless of the
presence of MacsBug.  If MacsBug is installed, cmd-ctrl-I will get you
MacsBug, like the "abort" programmers switch.  You shouldn't ever need to
"kill -9" startmac; use cmd-ctrl-e instead.

>That's it.
>
>							h+@nada.kth.se
>							Jon W{tte

Cheers,

Justin

Justin C. Walker, Curmudgeon-At-Large   *
A/UX Engineering                        |
Apple Computer, Inc.                    |  Try visualizing whirled peas.
10300 Bubb Rd,                          |
Cupertino, CA 95014                     *
-- 
Justin C. Walker, Curmudgeon-At-Large   *
A/UX Group                              |
Apple Computer, Inc.                    |  When meetings are outlawed,
10300 Bubb Rd,                          |    Only outlaws will have meetings
Cupertino, CA 95014                     *