Subject: Re: [ksh93-integration-discuss] Integrating more shell builtins?
--------

> A few questions:
> 
>  - Where are docs for how to use nv_*()?
It should be in man/man3/nval.3.
>  - Does errormsg() produce non-local exits?  (my experiments say "yes")
Not if ERROR_warn(0) is used.  Otherwise, it  will do a siglongjmp()
down to an earlier context.
> 
>    Are there docs for all ksh93 internals that builtin authors are
>    allowed to use?  If so, where?
The man/man3/shell.3 and man/man3/nval.3 document all the currently
advertized interfaces.  You can also use ast library calls and many
C library calls.  You can't fork/exec process and wait for children.
> 
>  - Is there any way to write builtins portably to Bash and ksh93
>    equally?
I don't know what bash has for this.  The ksh93 interface has been
available for around 15 years (with several small changes).
> 
>  - How would one go about integrating more Solaris-specific builtins?
> 
>    I'm interested in integrating builtins for:
> 
>     - event ports
>     - pipe(2)
>     - sockets
The bltins directory for ksh93 has examples of shell builtins many
of which use only the documented interfaces.  The libcmd directory
of ast implements many builtins using only the advertized interface.
> 
> I have a webrev for Solaris event ports builtins right now, and it
> works:
> 
> http://cr.opensolaris.org/~nico/onnv-ksh93-w-evport/
> 
> With this you can access the file event monitor facility directly from
> the shell:
> 
> % builtin -f $ROOT/usr/lib/amd64/libshell.so.1 evport evport_create open
> % close evport_assoc evport_dissoc evport_get stat date
> % evport create p
> % ev=(events=FILE_MODIFIED user=1234567 src=file fo_name=/tmp)
> % nev=()
> % evport assoc p ev
> % evport get p nev
> % print $nev
> ( fo_name=/tmp revents=FILE_MODIFIED src=PORT_SOURCE_FILE user=1234567 )
> % 
> 
> Alert, timers and user-defined event sources not yet supported.  I doubt
> I'd ever bother with MQ event sources, and AIO makes no sense in the
> shell.  (Also, the timeout handling is broken, so don't pass a timeout
> to evport_get yet.)
> 
> Along the same lines one might add builtins for interfacing to libevent.
> That would be portable, unlike the event port scheme, though it wouldn't
> include a FEM interface (I think).
You might also consider adding some of these as object orient interfaces
create an Event type and having callback functions associated with
each event.
> 
> Nico
> -- 
> _______________________________________________
> ksh93-integration-discuss mailing list
> ksh93-integration-discuss at opensolaris.org
> http://mail.opensolaris.org/mailman/listinfo/ksh93-integration-discuss
> 

David Korn
dgk at research.att.com

Reply via email to