Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread Paul Durrant
On 4/8/06, Xie Gang [EMAIL PROTECTED] wrote:
 I wrote a socket program and compiled it on solaris. I found it quite 
 different from linux. The gcc did not search for the socket lib 
 automatically. The -lsocket must be given.
 I don't know why this happens.

On Linux the socket calls are in (g)libc so it's not that the linux
linker magically searches for libsocket.so - such a library simply
does not exist on Linux. However, I do sympathise - the fact that one
needs to add -lsocket to the linker flags trips up many an open source
app. when building it on Solaris and it gets annoying after a while.

  Paul

--
Paul Durrant
http://www.linkedin.com/in/pdurrant
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread Darren Reed

James Carlson wrote:


Paul Durrant writes:
 


On 4/8/06, Xie Gang [EMAIL PROTECTED] wrote:
   


I wrote a socket program and compiled it on solaris. I found it quite different 
from linux. The gcc did not search for the socket lib automatically. The 
-lsocket must be given.
I don't know why this happens.
 


On Linux the socket calls are in (g)libc so it's not that the linux
linker magically searches for libsocket.so - such a library simply
does not exist on Linux. However, I do sympathise - the fact that one
needs to add -lsocket to the linker flags trips up many an open source
app. when building it on Solaris and it gets annoying after a while.
   



True, but the deeper issue is that we have at least two[1] competing
and incompatible sockets interfaces -- one is the 3SOCKET old-BSD
style family and the other is the 3XNET standards-compliant family.

In most cases, folks really want 3XNET (one example issue: this is the
only way to get ancillary data) and yet they stumble into libsocket
first.  The few things 3XNET doesn't offer (*_r, r*, and ether_*
functions) are seldom needed.
 



I never even knew about 3XNET...why would I want it?
What does the standards compliance give me besides the
tags words standards compliance?
Why is 3XNET what other folks want when we don't?
(Using ldd on /usr/bin is very disappointing.)

And how does anyone learn about 3XNET if man socket, etc,
will show 3SOCKET first and using it gives them either 100% of
what they want or very close to it?

I suspect the easiest way to get more people using 3XNET would
be to submit a patch to the maintainers of autoconf to search for
and use -lxnet on SunOS 5 before -lsocket/-lnsl.  So long as they
don't want to use any of the functions that aren't in it.

As for *_r being seldom needed, we need to be more forward
thinking than that, especially considering niagara and threads.

Darren

___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread James Carlson
Darren Reed writes:
 I never even knew about 3XNET...why would I want it?

Ancillary data doesn't work in 3SOCKET.  It does in 3XNET.  That's the
big reason.

 What does the standards compliance give me besides the
 tags words standards compliance?

I don't care a whit about buzzword compliance of any sort.  However,
the existence of the standards is intended to provide for *better*
portability of applications.

 And how does anyone learn about 3XNET if man socket, etc,
 will show 3SOCKET first and using it gives them either 100% of
 what they want or very close to it?

Agreed; it's a real mess.

 As for *_r being seldom needed, we need to be more forward
 thinking than that, especially considering niagara and threads.

You have to have a multithreaded application that is walking the name
service databases in multiple threads at the same time (setprotoent/
getprotoent/endprotoent in each) for it to matter much, which is why I
claim it's seldom needed.  The rest of the functionality is likely
better handled by getaddrinfo/getnameinfo, which are already
thread-safe.

I think it'd be better just to make the ordinary lookup functions
thread-safe.  Special *_r entry points are pretty ugly to me and make
coding for multithreaded applications much harder than necessary.

-- 
James Carlson, KISS Network[EMAIL PROTECTED]
Sun Microsystems / 1 Network Drive 71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread James Carlson
Darren Reed writes:
 James Carlson wrote:
 
 Darren Reed writes:
 
 I never even knew about 3XNET...why would I want it?
 
 
 Ancillary data doesn't work in 3SOCKET.  It does in 3XNET.  That's the
 big reason.
 
 
 Ok, so there are no compelling reasons to use 3XNET unless someone
 needs to interact with ancillary data (whatever that is - there
 are no man page references to this on sendmsg/recvmsg.)

It's all the things you can receive and send as special socket
options.  See all of the IP_RECV* flags, for a start.

  So my
 conclusion is that ancillary data is rare and the need for 3XNET
 rarer still - but all the same, we provide for it - and thus there
 is no reason not to tell people to use libsocket unless they come
 back and say where is my ancillary data?

If you feel compelled to use libsocket for some reason (e.g., dragging
in libnsl as well because libsocket is incomplete is a good thing, the
crufty old struct msghdr definition you get that has msg_accrights is
comforting), then I won't bother to argue the point.  Both are
supported.

The point is that having two is confusing, and of the two, 3XNET is
better for modern applications (i.e., those attempting to use socket
options), so I'd recommend it first.  The other one seems to have
little going for it but the well-known name and prestige location in
the man page search path.

-- 
James Carlson, KISS Network[EMAIL PROTECTED]
Sun Microsystems / 1 Network Drive 71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread Dan McDonald
On Mon, Apr 10, 2006 at 07:29:46AM -0700, Darren Reed wrote:
 
 man -s 3xnet recvmsg
 
 
 Ok, I've just installed a Solaris 10 Update 2 beta and that man page text
 is not present on my box.  Is your text from nevada?  (btw, I checked the
 man page before making the above comment and checked again upon
 reading your comments and it isn't there.)

Ooof.  I am using Nevada (build 36), and apparently the man page must've been
fixed in that timeframe.  I saw your results on an S10 box...

 $ man -s 3xnet recvmsg 2/dev/null | col -b | grep -i ancill | wc
   0   0   0

But on mine...

$ man -s 3xnet recvmsg 2/dev/null | col -b | grep -i ancill | wc
   3  29 197
$ uname -a
SunOS everywhere 5.11 snv_36 i86pc i386 i86pc
$ 

So you may wish to check the bugs under manpage/section3xnet for the
appropriate bug that is fixed in Nevada, but not in S10 Update N.

Dan
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread James Carlson
Darren Reed writes:
 Ok, I've just installed a Solaris 10 Update 2 beta and that man page text
 is not present on my box.  Is your text from nevada?  (btw, I checked the
 man page before making the above comment and checked again upon
 reading your comments and it isn't there.)

The feature has been there for a long time, but the man pages were
only recently updated.   See CR 6353020.

-- 
James Carlson, KISS Network[EMAIL PROTECTED]
Sun Microsystems / 1 Network Drive 71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread Bart Smaalders

James Carlson wrote:


The point is that having two is confusing, and of the two, 3XNET is
better for modern applications (i.e., those attempting to use socket
options), so I'd recommend it first.  The other one seems to have
little going for it but the well-known name and prestige location in
the man page search path.



So why are there two different libraries? Isn't the xnet
functionality a proper superset of libsocket?


- Bart


--
Bart Smaalders  Solaris Kernel Performance
[EMAIL PROTECTED]   http://blogs.sun.com/barts
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread Nicolas Williams
On Mon, Apr 10, 2006 at 10:09:31AM -0700, Bart Smaalders wrote:
 James Carlson wrote:
 
 The point is that having two is confusing, and of the two, 3XNET is
 better for modern applications (i.e., those attempting to use socket
 options), so I'd recommend it first.  The other one seems to have
 little going for it but the well-known name and prestige location in
 the man page search path.
 
 
 So why are there two different libraries? Isn't the xnet
 functionality a proper superset of libsocket?

libxnet is a filter on libsocket and libnsl...

The 3SOCKET and 3XNET manpages reference the same header files, and no
-D... pre-processor options, and the libxnet socket functions are just
filters on the libsocket socket functions.

So, what specifically about libxnet allows ancilliary data to work and
what about libsocket prevents it?

Nico
-- 
___
networking-discuss mailing list
networking-discuss@opensolaris.org


Re: [networking-discuss] socket lib in solaris?

2006-04-10 Thread Nicolas Williams
On Mon, Apr 10, 2006 at 02:46:53PM -0400, James Carlson wrote:
 Nicolas Williams writes:
  The 3SOCKET and 3XNET manpages reference the same header files, and no
  -D... pre-processor options, and the libxnet socket functions are just
  filters on the libsocket socket functions.
 
 That's not true.  Look at this in socket.h:

Ah, there's a reference to the standards(5) man page in the 3XNET man
pages, and that in turn describes what pre-processor symbols should be
defined in order to get ancilliary data in socket.h:

 #if defined(_XPG4_2) || defined(_KERNEL)
   void*msg_control;   /* ancillary data */
   socklen_t   msg_controllen; /* ancillary data buffer len */
   int msg_flags;  /* flags on received message */
 #else
   caddr_t msg_accrights;  /* access rights sent/received */
   int msg_accrightslen;
 #endif/* defined(_XPG4_2) || defined(_KERNEL) */


I find the standards(5) reference a tad oblique, considering that
there's no text anywhere in the man page about the need to get the right
compilation environment...

There's not even the name of the standards, if any, beyond X/Open that
3XNET conforms to.

Worse, the 3XNET man pages only mention X/Open in the page header, and
don't mention any version numbers, so looking at the 3XNET and
standards(5) man pages how is the reader supposed to know that
ancilliary data only works with libxnet in the XPG4v2 environment?

(Or am I misreading socket.h and ancilliary data works with XPG3 also?)

Nico
-- 
___
networking-discuss mailing list
networking-discuss@opensolaris.org