Glenn Fowler wrote:
> On Tue, 28 Mar 2006 05:15:02 +0200 Roland Mainz wrote:
> > While working on the ksh93 integration into the OpenSolaris codebase I
> > found small bug - it seems that /dev/tcp and /dev/udp are not
> > compiled-in into the binary (I used
> > http://svn.genunix.org/repos/on/branches/ksh93/gisburn/scripts/buildksh93.ksh
> > to build 2006-02-14 ksh93r) - is this a bug or was this done
> > intentionally for some (unknown) reason ?
> 
> the iffe scripts look for these to enable /dev/tcp
>         #include <sys/socket.h>

This file is present in Solaris 10 (S10 Update 1):
% ls -l /usr/include/sys/socket.h
-rw-r--r--   1 root     bin        15447 Oct 17 20:01
/usr/include/sys/socket.h

>         #include <netinet/in.h>

% ls -l /usr/include/netinet/in.h
-rw-r--r--   1 root     bin        40289 Oct 17 20:01
/usr/include/netinet/in.h

>         socket() in default libs

|socket()| in Solaris sits in libsocket and needs the linker flags
"-lsocket -lnsl" (in that exact order) ...

> when endabled this should produce the date
>         cat < /dev/tcp/localhost/13
> what does this show:
>         egrep 'socket|net' $INSTALLROOT/src/cmd/ksh93/FEATURE/poll

-- snip --
% egrep 'socket|net' ~/ksh93/build1/src/cmd/ksh93/features/poll
hdr,sys poll,socket,netinet/in
lib     select,poll,socket
lib     htons,htonl sys/types.h sys/socket.h netinet/in.h
typ     fd_set sys/socket.h sys/select.h
tst     pipe_socketpair note{ use socketpair() for peekable pipe() }end
execute{
        #include <sys/socket.h>
                    socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 ||
                if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 ||
tst     socketpair_devfd note{ /dev/fd/N handles socketpair() }end
execute{
        #include <sys/socket.h>
                if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 ||
tst     socketpair_shutdown_mode note{ fchmod() after socketpair()
shutdown() }end execute{
        #include <sys/socket.h>
                if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 ||
-- snip --

----

Bye,
Roland

-- 
  __ .  . __
 (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