tracing system calls

Guy Harris guy at gorodish.Sun.COM
Fri Sep 9 03:14:17 AEST 1988


> How does this implementation compare to the SysVr3 shared libraries?
> I had been under the impression there that shared libraries were
> mapped into the address space by the kernel, not by the user process.
> Is there any particular advantage between the two schemes, or does
> SysVr3 do it like Sun OS-4?

S5R3 does it in the kernel.  SunOS 4.0 does it in user mode.  The advantage to
the latter is that it's done in user mode; this means the code that does it
isn't wired-down code in the kernel, and means that it's easier to debug,
replace, etc..

It also means it's easier to make it more powerful; the SunOS shared libraries
are not tied to specific locations, and relocation is done when the library is
mapped in.  Process A can map the library in at address A, while process B can
map it in at address B.  This obviates the need to "register" shared libraries
at particular addresses.

In addition, you can specify a "search path" for shared libraries, so that you
can provide a "private" shared library that, for example, could wrap all system
calls that take pathnames with code that knows how to expand "~username", so
that all dynamically-linked programs will understand "~username" (with one
exception; set-UID and set-GID programs ignore this path, for obvious reasons).
Not all of the mechanism to make this convenient is present in the current
release, but it will probably appear in future releases.

You could also provide a run-time interface to the dynamic linker, so you can
write code that, for example, reads the name of a shared library file from
another file, and then gets a pointer to the routine named "foobar" in that
file and calls it.  This could be convenient for structured document editors;
if you wanted to define a new kind of frame within a document, say a frame for
editing PERT charts, you could make the implementation of that frame into a
shared library file and tell the editor that the code to implement this kind of
frame is in "/usr/local/docedit/lib/pert_frame.so".  Again, this mechanism is
not currently present, but will probably appear eventually.



More information about the Comp.unix.wizards mailing list