Skip to content
Snippets Groups Projects
Commit b18129d8 authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[Libc] move declarations for better POSIX compliance; minor fix

parent bffa0795
No related branches found
No related tags found
No related merge requests found
...@@ -23,4 +23,10 @@ ...@@ -23,4 +23,10 @@
// According to POSIX, definitions from both arpa/inet.h and netinet/in.h // 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. // 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" #include "../__fc_inet.h"
__POP_FC_STDLIB
#endif
...@@ -27,14 +27,7 @@ __PUSH_FC_STDLIB ...@@ -27,14 +27,7 @@ __PUSH_FC_STDLIB
__BEGIN_DECLS __BEGIN_DECLS
extern char *optarg; #include "unistd.h"
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);
/* GNU specific */ /* GNU specific */
struct option struct option
......
...@@ -23,4 +23,10 @@ ...@@ -23,4 +23,10 @@
// According to POSIX, definitions from both arpa/inet.h and netinet/in.h // 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. // 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" #include "../__fc_inet.h"
__POP_FC_STDLIB
#endif
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
__PUSH_FC_STDLIB __PUSH_FC_STDLIB
__BEGIN_DECLS __BEGIN_DECLS
#include "__fc_select.h" #include "../__fc_select.h"
__END_DECLS __END_DECLS
__POP_FC_STDLIB __POP_FC_STDLIB
......
...@@ -46,7 +46,7 @@ struct sockaddr_storage { ...@@ -46,7 +46,7 @@ struct sockaddr_storage {
sa_family_t ss_family; sa_family_t ss_family;
}; };
#include "../__fc_define_iovec.h" #include "sys/uio.h"
struct cmsghdr { struct cmsghdr {
socklen_t cmsg_len; socklen_t cmsg_len;
......
...@@ -205,6 +205,11 @@ extern int timerisset(struct timeval *tvp); ...@@ -205,6 +205,11 @@ extern int timerisset(struct timeval *tvp);
#define timercmp(a, b, _CMP) _timercmp(a, b) #define timercmp(a, b, _CMP) _timercmp(a, b)
extern int _timercmp(struct timeval *a, struct timeval *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 __END_DECLS
__POP_FC_STDLIB __POP_FC_STDLIB
#endif #endif
...@@ -34,7 +34,7 @@ __PUSH_FC_STDLIB ...@@ -34,7 +34,7 @@ __PUSH_FC_STDLIB
#include "__fc_define_pid_t.h" #include "__fc_define_pid_t.h"
#include "__fc_define_useconds_t.h" #include "__fc_define_useconds_t.h"
#include "__fc_define_intptr_t.h" #include "__fc_define_intptr_t.h"
#include "__fc_select.h"
#include "limits.h" #include "limits.h"
...@@ -1096,7 +1096,7 @@ extern int tcsetpgrp(int, pid_t); ...@@ -1096,7 +1096,7 @@ extern int tcsetpgrp(int, pid_t);
extern int truncate(const char *, off_t); extern int truncate(const char *, off_t);
extern volatile char __fc_ttyname[TTY_NAME_MAX]; 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 // missing: may assign to errno: EBADF, ENOTTY
...@@ -1188,6 +1188,15 @@ int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); ...@@ -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); 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 __END_DECLS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment