[10161] in Athena Bugs
decmips 7.4G: manpage for getservbyname(3)/getservbyport(3)
daemon@ATHENA.MIT.EDU (Albert Dvornik)
Thu Dec 24 05:35:47 1992
To: bugs@Athena.MIT.EDU
Date: Thu, 24 Dec 92 05:35:38 EST
From: "Albert Dvornik" <bert@Athena.MIT.EDU>
System name: podge
Type and version: KN01 7.4G (1 update(s) to same version)
Display type: PMAX-MFB
What were you trying to do?
use the port number (either as an argument to getservbyport or
returned from getservby* in s_port field of struct servent)
What's wrong:
The ULTRIX manpage claims s_port field of struct servent is of
type long. It is defined as int in <netdb.h> (and listed as
such in BSD4.3 manpages.) All of the manpages say that
>s_port The port number at which the service resides. Port numbers
> are returned in network byte order.
However, s_port is not a network long; it's a network short
"packaged" in a network long. Ie, getservbyname("mail",NULL)
returns 0x1900 and NOT 0x19000000 on DECstations and VAXen.
What should have happened:
At the very least, the manpage should point out this fact.
Other structures (ie, sockaddr_in in <netinet/in.h>) use
shorts for storing port numbers.
Please describe any relevant documentation references: