Path: utzoo!attcan!uunet!mcvax!enea!kth!draken!duvan!drs-ano
From: drs-ano@duvan.nada.kth.se (Gunnar Nordmark)
Newsgroups: comp.sys.amiga
Subject: Re: I Want my ZombieMsg Back!!!
Summary: /* An error in arpbase.h caused the problem. */
Keywords: ARP ASyncRun
Message-ID: <423@draken.nada.kth.se>
Date: 23 Jun 88 07:55:39 GMT
References: <421@draken.nada.kth.se>
Sender: news@nada.kth.se
Reply-To: G@epsilon.stacken.kth.se (Gunnar Nordmark)
Organization: The Royal Inst. of Techn., Stockholm
Lines: 66

In article <421@draken.nada.kth.se> G@epsilon.stacken.kth.se (Gunnar Nordmark) writes:
>Last night I rebooted my machine X times and couldn't figure out what was
>wrong with my program, it just hang.  After many hours I located the problem
>to a WaitPort() on a so called ZombieMsg that the ARP ASyncRun is supposed to
>return when the child process dies. I have set up the message with a reply
>port and put a pointer to it in pcb_LastGasp :-) but ASyncRun just ignores it.

The problem is solved.
There is a *SERIOUS* bug in the header file arpbase.h (1.1 REL2) that I
received from comp.sys.amiga a while ago - the structure definition for
ProcessControlBlock is garbled. I discovered this when I compared the
C-header with the assembler version, they didn't match:

---------  this is from arpbase.h  ----------

struct ProcessControlBlock {
	ULONG	pcb_StackSize;		/* Stacksize for new process */
	BYTE	pcb_Pri;		/* Priority of new task */
	BYTE	pcb_Control;		/* Control bits, see defines below */
	APTR	pcb_TrapCode;		/* Optional Trap Code */
	ULONG	pcb_Input,p_Output;	/* Optional stdin, stdout */
	union {
		ULONG	pcb_SplatFile;	/* File to use for Open("*") */
		BYTE	*pcb_ConName;	/* CON: filename */
	} pcb_Console;
	ULONG	pcb_SplatFile;		/* File to use for Open("*") */
	CPTR	pcb_LoadedCode; 	/* If not null, will not load/unload code */
	struct ZombieMsg *pcb_LastGasp;	 /* ReplyMsg() to be filled in by exit */
	struct MsgPort	*pcb_WBProcess;	/* Valid only when PRB_NOCLI */
};


---------  and now look at arpbase.i  ----------

	STRUCTURE ProcessControlBlock,0
		ULONG	pcb_StackSize	; Stacksize for new process
		BYTE	pcb_Pri		; Priority of new process 
		BYTE	pcb_Control	; Control bits, see BITDEF's below.
		APTR	pcb_TrapCode	; Optional trapcode vector
		ULONG	pcb_Input	; Optional default input
		ULONG	pcb_Output	; Optional default output
		UNION	pcb_Console,4
		    UMEMB pcb_Splatfile ; file to use for Open("*")
		    UMEMB pcb_ConName	; CON: filename 
		ULONG	pcb_LoadedCode	; If not null, use this code
		CPTR	pcb_LastGasp	; ReplyMsg to be filled in by exit code
		CPTR	pcb_WBProcess	; Valid only when PRB_NOCLI.
		LABEL	pcb_Sizeof

---------------------

Do you see the difference?  (Well, it's hard not to)
arpbase.h has two (!) pcb_Splatfile fields. (Guess why my program dived :-)
An other difference is that pcb_Output is defined as p_Output in
the C header. Ok, the latter looks like a transmission error, but the
two pcb_Splatfile fields can't be explained by this.
So I'm afraid that it was a buggy arpbase.h that made it out on the net.

I changed my arpbase.h to conform with arpbase.i, and voila! It worked!

There is nothing wrong with ASyncRun(), it runs like a champ. (Thank God)

SNAIL: Gunnar Nordmark          VOICE: (+46) 8 - 755 42 52
       Nora strand 5
       S-182 34 DANDERYD        EMAIL: G@epsilon.stacken.kth.se
       SWEDEN                          nordmark@vaxkab.sunet.se