Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Oleg
On Fri, Nov 07, 2014 at 08:17:55AM +0100, k...@shike2.com wrote: perhaps a linked list would make sense, but atexits(2) doesn't say which order the functions will be run in. and it doesn't seem like a great idea to depend on atexits running things in a particular order. POSIX

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Charles Forsyth
On 6 November 2014 21:05, Oleg lego12...@yandex.ru wrote: I looked at atexit() and atexitdont() and i don't understand why these functions are implemented with a static array instead of singly linked list? May be somebody with a greater plan9 experience can help me with my question. It

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Oleg
On Fri, Nov 07, 2014 at 08:19:05AM +, Charles Forsyth wrote: On 6 November 2014 21:05, Oleg lego12...@yandex.ru wrote: I looked at atexit() and atexitdont() and i don't understand why these functions are implemented with a static array instead of singly linked list? May be somebody

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Charles Forsyth
On 7 November 2014 09:44, Oleg lego12...@yandex.ru wrote: f malloc works like in linux (at first invocation allocate more bytes than requested and then each malloc() use this already allocated by kernel area of memory), i think this isn't a big performance impact. I wasn't really thinking

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Charles Forsyth
On 7 November 2014 10:57, Steffen Nurpmeso sdao...@yandex.com wrote: Safety against asynchronous un-/registration can't be it, anyway. No, there's a lock. I meant avoiding too many possible interactions between low-level run-time functions and the rest of the library. (I'd consider atexit and

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Steffen Nurpmeso
Oleg lego12...@yandex.ru wrote: |On Fri, Nov 07, 2014 at 08:19:05AM +, Charles Forsyth wrote: | On 6 November 2014 21:05, Oleg lego12...@yandex.ru wrote: | | I looked at atexit() and atexitdont() and i don't understand why these | functions are implemented with a static array instead of

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Oleg
On Fri, Nov 07, 2014 at 11:49:08AM +, Charles Forsyth wrote: On 7 November 2014 10:57, Steffen Nurpmeso sdao...@yandex.com wrote: Safety against asynchronous un-/registration can't be it, anyway. No, there's a lock. I meant avoiding too many possible interactions between low-level

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Charles Forsyth
Not for atexit, but for some other functions, I've had to follow various trails in glibc, and it's just an intricate convoluted nightmare, so that probably colours my view.

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread sl
How can i send a patch to 9front? You can file an issue and link to your patch here: http://code.google.com/p/plan9front/issues/list Or you can sign up for the 9front mailing list and post there: http://9front.org/lists.html sl

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread erik quanstrom
On Fri Nov 7 07:26:55 EST 2014, charles.fors...@gmail.com wrote: Not for atexit, but for some other functions, I've had to follow various trails in glibc, and it's just an intricate convoluted nightmare, so that probably colours my view. calling malloc from the atexit path will pull

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Steffen Nurpmeso
Charles Forsyth charles.fors...@gmail.com wrote: |On 7 November 2014 10:57, Steffen Nurpmeso sdao...@yandex.com wrote: | | Safety against asynchronous un-/registration can't be it, anyway. | |No, there's a lock. I meant avoiding too many possible interactions between I thought more about

Re: [9fans] atexit() atexitdont()

2014-11-07 Thread Oleg
On Fri, Nov 07, 2014 at 02:53:11PM -0500, erik quanstrom wrote: On Fri Nov 7 07:26:55 EST 2014, charles.fors...@gmail.com wrote: Not for atexit, but for some other functions, I've had to follow various trails in glibc, and it's just an intricate convoluted nightmare, so that probably

[9fans] atexit() atexitdont()

2014-11-06 Thread Oleg
Hi, all. I looked at atexit() and atexitdont() and i don't understand why these functions are implemented with a static array instead of singly linked list? May be somebody with a greater plan9 experience can help me with my question. If i do: #include u.h #include libc.h void f1(void) {

Re: [9fans] atexit() atexitdont()

2014-11-06 Thread erik quanstrom
On Thu Nov 6 16:07:56 EST 2014, lego12...@yandex.ru wrote: Hi, all. I looked at atexit() and atexitdont() and i don't understand why these functions are implemented with a static array instead of singly linked list? May be somebody with a greater plan9 experience can help me with my

Re: [9fans] atexit() atexitdont()

2014-11-06 Thread Skip Tavakkolian
according to the man page: Before calling _exits with msg as an argument, exits calls in reverse order all the functions recorded by atexit. so i think your result should be f2, f1, f1. On Thu, Nov 6, 2014 at 1:26 PM, erik quanstrom quans...@quanstro.net wrote: On Thu Nov 6 16:07:56 EST

Re: [9fans] atexit() atexitdont()

2014-11-06 Thread Skip Tavakkolian
i'm wondering if print is the right instrument for knowing the order is right. On Thu, Nov 6, 2014 at 1:42 PM, Skip Tavakkolian skip.tavakkol...@gmail.com wrote: according to the man page: Before calling _exits with msg as an argument, exits calls in reverse order all the functions recorded

Re: [9fans] atexit() atexitdont()

2014-11-06 Thread Oleg
On Thu, Nov 06, 2014 at 04:26:04PM -0500, erik quanstrom wrote: On Thu Nov 6 16:07:56 EST 2014, lego12...@yandex.ru wrote: Hi, all. I looked at atexit() and atexitdont() and i don't understand why these functions are implemented with a static array instead of singly linked list? May

Re: [9fans] atexit() atexitdont()

2014-11-06 Thread lego12239
On Thu, Nov 06, 2014 at 01:44:30PM -0800, Skip Tavakkolian wrote: i'm wondering if print is the right instrument for knowing the order is right. You are right, but in this case it's irrelevant. The atexit.c source code is pretty disambiguous.

Re: [9fans] atexit() atexitdont()

2014-11-06 Thread k0ga
perhaps a linked list would make sense, but atexits(2) doesn't say which order the functions will be run in. and it doesn't seem like a great idea to depend on atexits running things in a particular order. POSIX says they must be called in reverse order.