Date: Thu, 25 Jan 2001 12:50:13 -0800 From: Mike Smith <msmith@freebsd.org> To: Alfred Perlstein <bright@wintelcom.net> Cc: "Alexander N. Kabaev" <ak03@gte.com>, hackers@FreeBSD.ORG Subject: Re: SYSINIT for userland? Message-ID: <200101252050.f0PKoD801434@mass.dis.org> In-Reply-To: Your message of "Thu, 25 Jan 2001 12:19:59 PST." <20010125121959.W26076@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
> * Alexander N. Kabaev <ak03@gte.com> [010125 12:16] wrote: > > Will functions marked with __attribute__((__constructor__)) or > > __attribute__((__destructor__)) satisfy your needs? > > Compiler will insert calls to these functions gets into .init section of the > > resulting ELF module which in turn will be called automatically at the program > > startup time. I do not remember exactly, but there might be even priority > > parameter you can specify with these attributes to manage the order in which > > these functions will be called. > > Actually, the order can be kludged by just having these __constructors__ > sort themselves into a list. Then all you need is a function call > in main() to actually start these puppies up. :) > > It's still a bit off what I was looking for which would be putting > these hooks into shared libaries hinged on pthread initialization, > dns init, etc... You can actually do almost all of this with the ELF evilness that the loader uses (on i386) for doing its version of sysinits. Then you would just need to teach the C startup code to go looking for the appropriate section(s). -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101252050.f0PKoD801434>