G'Day Nacho,
Thanks for writing this up and showing how DTrace and mdb can be useful.
Here are some comments.
* "Let's review execve(2) then ... since we know it's a system call"
- you start by discussing the libc execve() function (which
calls into the kernel via _syscall()). I have the feeling
the libc execve() function may be best called execve(3C), which
then calls execve(2); it might be best to ask someone in
code-discuss about that distinction.
* "syscall::exece:entry ... printf("fd: %d", arg0);"
- arg0 is the filename, not a file descriptor. You can try
trace(copyinstr(arg0));.
* About the mdb usage:
- Why was "struct execsw" in quotes?
- Why was struct execsw specified at all? (try "execsw::print")
- Where did +0x50 come from? (eg, "execsw,3::print struct execsw")
* Overall:
- it might help to put an enumerated list of events near the
end, to reinforce the order of events.
- good opportunity to include a:
dtrace -n 'fbt::findexec_by_hdr:entry {
printf("%.4S", stringof(arg0)); stack();
}'
to show how it is called twice, the first on '#!', the second
on the ELF file.
- A reference section at the end to point users to:
http://www.opensolaris.org/os/community/dtrace
http://www.opensolaris.org/os/community/mdb
Solaris Internals, 2nd Ed.
cheers,
Brendan
On Fri, Mar 07, 2008 at 02:55:42AM -0300, Ignacio Marambio Cat?n wrote:
> i left a little article at the contents projects about the way shell
> scripts works in the opensolaris environment[1]
> i would love to have it included in the opensolaris curriculum as it
> not only shows some parts of the opensolaris code but also uses
> serveral tools: the mdb. the source browser, DTrace and truss. I know
> the article is not as clear as it should be or as well formated, but
> i'm eager to correct whatever you feel it's necessary including the
> many typos i'm sure there are
>
> nacho
>
> [1] http://www.opensolaris.org/os/project/content/files/shells.pdf
> _______________________________________________
> docs-discuss mailing list
> docs-discuss at opensolaris.org
--
Brendan
[CA, USA]