On Thu, 22 Feb 2007 22:34:05 +0100 [EMAIL PROTECTED] (Joerg Schilling) wrote:
> - How is the I/O redirection done for ksh93 builtins?
ksh and its builtins use -last sfio for io
external builtins that do io must also use sfio
sfio provides a <stdio.h> wrapper so external builtins
using <stdio.h> are possible as long as they are built against
-last and the ast headers
> - How does ksh93 look for shared libs and how does it
> find which builtin commands are inside a shared lib?
internally ksh uses the ast -ldll library to locate plugin libraries
in a machine independent fashion (builtin library == plugin library in this
scheme)
-ldll maps generic names valid on all sw platforms to sw specific names
the physical library files must reside in ../lib/SUBSYSTEM directories on $PATH
e.g., libfind for ksh on solaris would be ../lib/ksh/libfind.so
at the shell prompt the "builtin" command handles plugin libs and buitins
for libfind, given the above plugin lib name and b_find builtin name:
builtin -f find find
(see builtin --man and/or builtin --html)
> - How does ksh93 e.g. know to load libcmd and how does
> it e.g. know that there is a b_ls() inside?
by default (the default ast build) ksh pulls in -lcmd and makes
some of the -lcmd builtins visible
the complete list is in the <cmdlist.h> header
the other builtins in -lcmd can then be activated by, e.g. for b_foo:
builtin foo
builtin implementations must return / close / free and resources before
returning
interrupts are blocked by ksh while builtins execute
so time is also a managed resource
builtins that may run a long time announce this via ERROR_NOTIFY in the
boilerplate initialization:
#include <cmd.h>
int b_foo(int argc, char** argv, void* context)
{
cmdinit(argc, argv, context, ERROR_CATALOG, ERROR_NOTIFY);
...
}
and then must periodically test
cmdquit() != 0
which means the builtin should free resources and return with and error status
-- Glenn Fowler -- AT&T Research, Florham Park NJ --
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code