9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] APE's main
@ 2007-04-26 15:10 Federico G. Benavento
  2007-04-26 15:14 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Federico G. Benavento @ 2007-04-26 15:10 UTC (permalink / raw)
  To: 9fans

hola,

I've been porting pdcurses using draw(2) and event(2),
the thing is that einit() creates some procs that are killed when
exit() is called, and I think APE's main wasn't doing it.
since I'm an ignorant on the subject at hand I brute forced
/sys/src/ape/lib/ap/386/main9.s and now it seems to work
as spected. My question is:  "does this look right" ?

lotte% yesterday -d /sys/src/ape/lib/ap/386/main9.s
diff /n/dump/2007/0426/sys/src/ape/lib/ap/386/main9.s /sys/src/ape/lib/ap/386/main9.s
10a11
> 	MOVL	$_exits<>(SB), AX
13a15,17
> 
> DATA	_exits<>+0(SB)/4, $"main"
> GLOBL	_exits<>+0(SB), $5

thanks

Federico G. Benavento

---
/bin/fortune:
*** {02.38.001} Win - Multiple Trillian vulnerabilities

note: I'm porting lynx as a test case for the curses port
if anyone wants to play with it a binary and some cfg files
that should be in /tmp are at:
http://plan9.homeip.net/magic/webls?dir=/misc



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

* Re: [9fans] APE's main
  2007-04-26 15:10 [9fans] APE's main Federico G. Benavento
@ 2007-04-26 15:14 ` Russ Cox
  2007-04-26 15:34   ` Federico G. Benavento
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2007-04-26 15:14 UTC (permalink / raw)
  To: 9fans

> lotte% yesterday -d /sys/src/ape/lib/ap/386/main9.s
> diff /n/dump/2007/0426/sys/src/ape/lib/ap/386/main9.s /sys/src/ape/lib/ap/386/main9.s
> 10a11
>> 	MOVL	$_exits<>(SB), AX
> 13a15,17
>> 
>> DATA	_exits<>+0(SB)/4, $"main"
>> GLOBL	_exits<>+0(SB), $5

> My question is:  "does this look right" ?

no, not at all.  you are passing "main" to
the exit function, which expects an integer.
the old one was correct: it passes the return
value of int main() to exit.  

i'm confused about why changing the
exit value would make things start working
anyway.  maybe it didn't really.

my guess would be your actual problem
is that draw and event use atexit, which
ape doesn't provide.  i'm surprised that
you don't get link errors.

russ



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

* Re: [9fans] APE's main
  2007-04-26 15:14 ` Russ Cox
@ 2007-04-26 15:34   ` Federico G. Benavento
  0 siblings, 0 replies; 3+ messages in thread
From: Federico G. Benavento @ 2007-04-26 15:34 UTC (permalink / raw)
  To: 9fans

> no, not at all.  you are passing "main" to
> the exit function, which expects an integer.
> the old one was correct: it passes the return
> value of int main() to exit.  
> 
yeah, now I see it

> i'm confused about why changing the
> exit value would make things start working
> anyway.  maybe it didn't really.
> 
I have no idea, what I know is that if I manually do
exit(0) in main() the event procs are killed by atexit()
and without exit(0) stay there.

> my guess would be your actual problem
> is that draw and event use atexit, which
> ape doesn't provide.  i'm surprised that
> you don't get link errors.
> 
ape has atexit() /sys/src/ape/lib/ap/stdio/atexit.c 

thanks for the explanation

Federico G. Benavento

---
/bin/fortune:
Please wait. This can take some time.



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

end of thread, other threads:[~2007-04-26 15:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-26 15:10 [9fans] APE's main Federico G. Benavento
2007-04-26 15:14 ` Russ Cox
2007-04-26 15:34   ` Federico G. Benavento

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).