From owner-freebsd-hackers Thu Jan 25 12:34:54 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.dis.org (unknown [169.237.8.131]) by hub.freebsd.org (Postfix) with ESMTP id 1E80D37B698 for ; Thu, 25 Jan 2001 12:34:35 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.1/8.11.1) with ESMTP id f0PKoD801434; Thu, 25 Jan 2001 12:50:13 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200101252050.f0PKoD801434@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: Alfred Perlstein Cc: "Alexander N. Kabaev" , hackers@FreeBSD.ORG Subject: Re: SYSINIT for userland? In-reply-to: Your message of "Thu, 25 Jan 2001 12:19:59 PST." <20010125121959.W26076@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 25 Jan 2001 12:50:13 -0800 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > * Alexander N. Kabaev [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