Re: [networking-discuss] socket lib in solaris?
>[...] > 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? Use man -a socket (shows all the pages in different sections that match) or change /usr/share/man/man.cf to put 3xnet before 3socket (and 1t, for that matter). * offer an incentive for equal Solaris support of open-source apps (may not have to be cash, could be the usual swag too) * offer porting assistance (to include free access to suitable systems for doing the porting work on) * provide and widely publicize a guide to common problems and solutions regarding porting to Solaris and maybe * start bringing build environment and tools (and perhaps basic administrative functionality) into the standards process Some changes to be more like other OSs are reasonable; some perhaps are not. I don't know which this is. I don't think looking just like whichever of { Linux, *BSD, Mac OS X, ... } is always the answer though, unless you really want to throw in the towel, GPL DTrace and ZFS, put together a compatibility layer for existing Solaris binaries to run on Linux, and die, and I don't want to see that happen: there's just too much other good stuff here, and too much value in a diverse ecosystem. This message posted from opensolaris.org ___ networking-discuss mailing list networking-discuss@opensolaris.org
Re: [networking-discuss] socket lib in solaris?
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
Re: [networking-discuss] socket lib in solaris?
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: #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) */ > So, what specifically about libxnet allows ancilliary data to work and > what about libsocket prevents it? int _socket(int family, int type, int protocol) { return (_socket_create(family, type, protocol, SOV_DEFAULT)); } int __xnet_socket(int family, int type, int protocol) { return (_socket_create(family, type, protocol, SOV_XPG4_2)); } Then look at the functions that eventually end up checking the type, like sotpi_recvmsg calling so_cmsglen. If it's not XPG4.2, we ditch all of the ancillary data. -- 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?
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?
Bart Smaalders writes: > 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? No, they're disjoint, as I noted before. 3XNET has ancillary data, 3SOCKET does not. 3SOCKET has the legacy r* interfaces and *_r thread-safe functions, but 3XNET does not. 3XNET includes the name service bits, but 3SOCKET does not. (Except for name space purists, that last one might be a bit of a red herring, though, as users of -lsocket almost always include -lnsl to pick up the necessary name service functions.) Most other platforms long ago did away with this distinction and just make all of it available from libc. And this means that quite a few application writers these days _assume_ it's in libc everywhere, and force Solaris users into excruciating 'make LDFLAGS="-lsocket -lnsl"' experiments or (more likely) postings on various newsgroups asking why xyz-1.23 doesn't compile on Solaris. -- 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?
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?
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?
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?
Dan McDonald wrote: On Mon, Apr 10, 2006 at 06:44:51AM -0700, Darren Reed wrote: 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.) So my man -s 3xnet recvmsg Ancillary data usage is currently in some IPv6 apps. An advanced IPsec API that lets unconnected datagram sockets receive IPsec policy information (the moral equivalent of IPSEC_IN or whatever better mechanism which replaces it) would probably also use the XNET 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.) $ man -s 3xnet recvmsg 2>/dev/null | col -b | grep -i ancill | wc 0 0 0 Darren ___ networking-discuss mailing list networking-discuss@opensolaris.org
Re: [networking-discuss] socket lib in solaris?
Darren Reed wrote: 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.) 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?" This is a failing of ours in many areas. We fail completely to give our customers any direction. We have bunches of functions, the discussion of which always leads to something like "no new applications should use this", but there is nothing like this on the man page. Is 3XNET socket better than 3SOCKET socket or not? If I am writing a new application, which should I use? Shouldn't both of the man pages point to each other with a note about when you should use one or the other? -- blu Quidquid latine dictum sit, altum sonatur. -- Brian Utterback - OP/N1 RPE, Sun Microsystems, Inc. Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom ___ networking-discuss mailing list networking-discuss@opensolaris.org
Re: [networking-discuss] socket lib in solaris?
On Mon, Apr 10, 2006 at 06:44:51AM -0700, Darren Reed wrote: > 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.) So my man -s 3xnet recvmsg Ancillary data usage is currently in some IPv6 apps. An advanced IPsec API that lets unconnected datagram sockets receive IPsec policy information (the moral equivalent of IPSEC_IN or whatever better mechanism which replaces it) would probably also use the XNET recvmsg. Dan ___ networking-discuss mailing list networking-discuss@opensolaris.org
Re: [networking-discuss] socket lib in solaris?
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?
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.) 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?" Darren ___ networking-discuss mailing list networking-discuss@opensolaris.org
Re: [networking-discuss] socket lib in solaris?
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?
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?
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. [1] We have three if you count the old SunOS 4.x compatibility stuff, which I don't. -- 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?
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