Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Jan 2003 04:57:13 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Arun Sharma <arun@sharma-home.net>
Cc:        hackers@freebsd.org
Subject:   Re: listing sysinit order ?
Message-ID:  <3E2AA0A9.C8386AED@mindspring.com>
References:  <20030118203706.GA21624@sharma-home.net> <3E29D775.EA2323A9@mindspring.com> <3E29DDDB.6000906@sharma-home.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Arun Sharma wrote:
> Terry Lambert wrote:
> > Arun Sharma wrote:
> >
> >>So my question is, is there a simple tool to list the order in which
> >>various initialization/probe routines get called in mi_startup ? If not,
> >>what would it take to write one ?
> >
> > more /sys/sys/kernel.h
> 
> Yes, I'm aware of this one, but it doesn't tell me very pricisely which
> drivers get initialized in what order.


They get initialized by the ordinal value of the initializer;
if you know the ordinal value, then you can know the driver.

If you are asking for a reverse map... it's not there.  That's
because the kernel doesn't know what's linked into it (or we
would not have needed SYSINIT in the first place).

If you are asking for a reverse map, the closes you are going
to get is:

	find /sys -name \*.x | xargs fgrep SYSINIT | more


> > You can not cause messages to be printed until after SI_SUB_CONSOLE;
> > if you want to put a printf in the init_main.c, verify that the
> > sysinit_sub_id is > SI_SUB_CONSOLE before attempting to call the
> > printf.
> 
> At that point only a function pointer is available. Is there a good way
> of converting it into a printable string ?

No, actually, it's a sysinit structure.  The function pointer is
only one member, e.g.:

                if ((*sipp)->subsystem == SI_SUB_DONE)
                        continue;
 
                /* Call function */
                (*((*sipp)->func))((*sipp)->udata);

If you change this to:

                if ((*sipp)->subsystem == SI_SUB_DONE)
                        continue;

		if ((*sipp)->subsystem > SI_SUB_CONSOLE)
			printf( "init_main: SYSINIT %d %s\n",
				(*sipp)->subsystem,
				(*sipp)->order);
 
                /* Call function */
                (*((*sipp)->func))((*sipp)->udata);

You will get the information you seem to be asking for (unless I'm
misunderstanding you, and you are trying to lead upo asking for a
string identifier, and for some reason you don't want to come out
and ask for a modification of the SYSINIT macro, for some reason...). 

-- Terry

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?3E2AA0A9.C8386AED>