On Sun, May 22, 2016 at 12:00:37PM +0300, Niko Tyni wrote: > > About the description of the netbase package though: it currently only > > contains for text files in /etc that are seldomly used. For fun I just > > purged netbase, and it doesn't really break anything. I wouldn't call it > > "necessary infrastucture for basic TCP/IP networking" anymore. > > Well, getservbyname(3) is used by 945 packages according to > codesearch.debian.net, and getprotobyname(3) by 551 packages. > Those use /etc/services and /etc/protocols by default AFAIK. > Doesn't seem that seldom to me?
Hm, I did not expect that, but according to codesearch.debian.net you are right. I'm actually stunned by the amount of programs that do something like: struct protoent *pe = getprotobyname("TCP"); int s = socket(AF_INET, SOCK_STREAM, pe->p_proto); ...when there is the perfectly fine IPPROTO_TCP. Every time getprotobyname() or getservbyname() is called, glibc opens /etc/protocols or /etc/services and parses the whole file. What a waste: it takes more effort to program it like this, it wastes CPU cycles and disk IO, and it has more potential to fail. I would only have expected tools like tcpdump and nmap to actually use those files. -- Met vriendelijke groet / with kind regards, Guus Sliepen <g...@debian.org>
signature.asc
Description: Digital signature