diff --git a/share/libc/arpa/inet.h b/share/libc/arpa/inet.h index 8e9cf21bdc537ec1fb4e4f53f1f946fd149858e8..773e7d87a2e5f1132865407f3879b5a3fc392785 100644 --- a/share/libc/arpa/inet.h +++ b/share/libc/arpa/inet.h @@ -23,4 +23,10 @@ // According to POSIX, definitions from both arpa/inet.h and netinet/in.h // may be exported by one another, so everything is defined in a common file. +#ifndef __FC_ARPA_INET +#define __FC_ARPA_INET +#include "features.h" +__PUSH_FC_STDLIB #include "../__fc_inet.h" +__POP_FC_STDLIB +#endif diff --git a/share/libc/getopt.h b/share/libc/getopt.h index 6788b728779835daa8f5d3e12b7e9d08a85d47d0..b7f2116363d0e4cbf4068287e0f98a9f9e7756cf 100644 --- a/share/libc/getopt.h +++ b/share/libc/getopt.h @@ -27,14 +27,7 @@ __PUSH_FC_STDLIB __BEGIN_DECLS -extern char *optarg; -extern int optind, opterr, optopt; - -/*@ - assigns \result, *optarg, optind, opterr, optopt - \from argc, argv[0..argc-1], optstring[0..]; - */ -extern int getopt(int argc, char * const argv[], const char *optstring); +#include "unistd.h" /* GNU specific */ struct option diff --git a/share/libc/netinet/in.h b/share/libc/netinet/in.h index 8e9cf21bdc537ec1fb4e4f53f1f946fd149858e8..e582651699c7282ef7ec944c133d44e3d351f50a 100644 --- a/share/libc/netinet/in.h +++ b/share/libc/netinet/in.h @@ -23,4 +23,10 @@ // According to POSIX, definitions from both arpa/inet.h and netinet/in.h // may be exported by one another, so everything is defined in a common file. +#ifndef __FC_NETINET_IN +#define __FC_NETINET_IN +#include "features.h" +__PUSH_FC_STDLIB #include "../__fc_inet.h" +__POP_FC_STDLIB +#endif diff --git a/share/libc/sys/select.h b/share/libc/sys/select.h index 8e1608d267e3da518ee4f933fc4e891b2e3a3a30..dc854567f329a5d5114a336774aa5d0b1bbe6688 100644 --- a/share/libc/sys/select.h +++ b/share/libc/sys/select.h @@ -26,7 +26,7 @@ __PUSH_FC_STDLIB __BEGIN_DECLS -#include "__fc_select.h" +#include "../__fc_select.h" __END_DECLS __POP_FC_STDLIB diff --git a/share/libc/sys/socket.h b/share/libc/sys/socket.h index 20b339c5ed8e978866fbbcb07cd91fdd55b3c0b0..c8d2a9ae4c3ce84d3762610595f048d30339c701 100644 --- a/share/libc/sys/socket.h +++ b/share/libc/sys/socket.h @@ -46,7 +46,7 @@ struct sockaddr_storage { sa_family_t ss_family; }; -#include "../__fc_define_iovec.h" +#include "sys/uio.h" struct cmsghdr { socklen_t cmsg_len; diff --git a/share/libc/sys/time.h b/share/libc/sys/time.h index b860763f4d3909a5c198a66af5701417801f78c9..426f637688704543ab931b8ea5d48424d621bdaf 100644 --- a/share/libc/sys/time.h +++ b/share/libc/sys/time.h @@ -205,6 +205,11 @@ extern int timerisset(struct timeval *tvp); #define timercmp(a, b, _CMP) _timercmp(a, b) extern int _timercmp(struct timeval *a, struct timeval *b); +// From POSIX, and for better compatibility with existing code bases: +// "Inclusion of the <sys/time.h> header may make visible all symbols +// from the <sys/select.h> header." +#include "select.h" + __END_DECLS __POP_FC_STDLIB #endif diff --git a/share/libc/unistd.h b/share/libc/unistd.h index 9ee67070df73b4a30d6884ac5c8f021896bac633..e0c2a6817d3815b62976ad186b17f3947b859aec 100644 --- a/share/libc/unistd.h +++ b/share/libc/unistd.h @@ -34,7 +34,7 @@ __PUSH_FC_STDLIB #include "__fc_define_pid_t.h" #include "__fc_define_useconds_t.h" #include "__fc_define_intptr_t.h" -#include "__fc_select.h" + #include "limits.h" @@ -1096,7 +1096,7 @@ extern int tcsetpgrp(int, pid_t); extern int truncate(const char *, off_t); extern volatile char __fc_ttyname[TTY_NAME_MAX]; -extern char *__fc_p_ttyname = __fc_ttyname; +volatile char *__fc_p_ttyname = __fc_ttyname; /*@ // missing: may assign to errno: EBADF, ENOTTY @@ -1188,6 +1188,15 @@ int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); */ int setresgid(gid_t rgid, gid_t egid, gid_t sgid); +extern char *optarg; +extern int optind, opterr, optopt; + +/*@ + assigns \result, *optarg, optind, opterr, optopt + \from argc, argv[0..argc-1], optstring[0..]; + */ +extern int getopt(int argc, char * const argv[], const char *optstring); + __END_DECLS