Subject was: Fork+exec works.

Martin Bochnig wrote:

>
> Why don't you just try the mini-sample shell in Rich Teer's "Solaris 
> Systems Programming"? It's only half a page short.

I downloaded and built Rich Teer's mini-sample shell.
In my workspace, it is in usr/src/cmd/sspsh,
where ssp is for Solaris System Programming.

I defined just what I need, so I don't #include ssp.h.

The first problem was that there were several references
to undefined symbols.  They could be broken down into
four categories:

    internationalization;

    explicitly named 64-bit versions of functions,
    such as ftruncate64;

    c89 functions;

    dynamic linking functions:
        _ld_libc(), dlopen(), _dlsym(), _dl_close();


I changed usr/src/lib/libc/ppc/Makefile to add the same set
of rules for objs/* to build libc.a as was done for pics/*
to build lic.so.1.  Solaris product no longer builds anything
statically, so I have had to update the old rules for libc.a
to reflect chages that have taken place in the rules for
libc.so.1.

I added $ROOT/lib/libc_i18n.a in the Makefile for sspsh.
In fact, because there are circular dependencies between
libc and libc_i18n, I had to name libc.a twice, once before
libc_i18n, and once after.

I added empty _dl* functions.

Now, it builds without any error from the linker.

One bit of bad news is that the resulting executable
is approx. 2MBytes.  This is because it uses stdio,
which brings in a big chunk of the libc world.

I ran sspsh on the target.  It fails in _findbuf() when
it calls isatty().  I think it gets real confused when
there is not device tree to speak of, and file descriptor
0 is not there.

So, I have a pretty good idea what I will be working on,
tomorrow.

-- Guy Shaw


Reply via email to