"Richard L. Hamilton" wrote:

> > This is a sponsor request to implement the RFE/CR
> > #6451262 ("RFE:
> > /usr/bin/sleep should support floating-point values"
> > -
> > http://bugs.opensolaris.org/view_bug.do?bug_id=6451262
> > ).
> > An old draft for the matching ARC case can be found
> > at
> > http://svn.genunix.org/repos/on/branches/ksh93/gisburn
> > /arc/sleep/solaris_sleep_fasttrack.txt
> > (comments welcome) ...
> >
> > My contributor ID is "OS0025".
> Why do I think you're going to do this in terms of ksh93? :-)

Well, it's the easiest and cheapest way to do it and we have the
precedent of /usr/bin/ksh doing it for things like /usr/bin/test ... :-)

> Maybe since it's sleep builtin can do that?
> So, will it be
> #! /usr/bin/ksh93
> # do we need to set PATH to ensure the builtin is used?

Currently the "sleep" builtin is not bound to a PATH (one reason is to
avoid that the shell has to travel all PATH elements at the first usage
and |stat()| if there are other "sleep" commands around (which is
inacceptable for sub-second timeouts like $ sleep 0.001 #)).

> exec "$(basename "${0}")" "$...@}"
> Or will it be a C wrapper to call b_sleep() in libcmd?
> (which if done right could also call any of the builtins,
> given a suitable hard or symbolic link; and might have
> faster startup than ksh93 itself)

Both implementations are possible - it could be implemented using a
wrapper script (like "alias.sh" links /usr/bin/ksh builtins like "kill"
to /usr/bin/kill) or directly calling the builtins via the |b_sleep()|
function (note that |b_sleep()| lives in libshell, not libcmd since this
is "core functionality" which is slightly more deeply connected with
shell internals than you may think at the first look).
The first solution has the advantage that there is the precedent of
/usr/bin/ksh already doing this stuff for it's builtins and that the
code would be quite small... the 2nd version has the advantage of being
faster and requiring less startup time (but would use a project-private
API where the usage needs to be ARC'ed somehow (AFAIK that's called
"contracted", right ?)).



  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to