getservent(3) Library Functions Manual getservent(3) getservent, getservbyname, getservbyport, setservent, endservent - LIBRARY Standard C library (libc, -lc) #include struct servent *getservent(void); struct servent *getservbyname(const char *name, const char *proto); struct servent *getservbyport(int port, const char *proto); void setservent(int stayopen); void endservent(void); getservent() , ( services(5)), servent, . . getservbyname() servent , name proto. proto NULL, . . getservbyport() servent , port ( ) proto. proto NULL, . . setservent() . stayopen , getserv*() . endservent() . servent : struct servent { char *s_name; /* */ char **s_aliases; /* */ int s_port; /* */ char *s_proto; /* */ } servent: s_name . s_aliases , NULL. s_port , . s_proto , . The getservent(), getservbyname(), and getservbyport() functions return a pointer to a statically allocated servent structure, or NULL if an error occurs or the end of the file is reached. /etc/services attributes(7). +----------------------------+----------------------------------------------------------+--------------------------+ | | | | +----------------------------+----------------------------------------------------------+--------------------------+ |getservent() | | MT-Unsafe race:servent | | | | race:serventbuf locale | +----------------------------+----------------------------------------------------------+--------------------------+ |getservbyname() | | MT-Unsafe | | | | race:servbyname locale | +----------------------------+----------------------------------------------------------+--------------------------+ |getservbyport() | | MT-Unsafe | | | | race:servbyport locale | +----------------------------+----------------------------------------------------------+--------------------------+ |setservent(), endservent() | | MT-Unsafe race:servent | | | | locale | +----------------------------+----------------------------------------------------------+--------------------------+ servent race:servent , setservent(), getservent() endservent(), . POSIX.1-2008. POSIX.1-2001, 4.3BSD. . getnetent(3), getprotoent(3), getservent_r(3), services(5) Azamat Hackimov , Dmitry Bolkhovskikh , Vladislav , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . getservent(3)