diff options
author | Micael Karlberg <[email protected]> | 2019-03-28 16:31:52 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-04-17 16:56:33 +0200 |
commit | 8f4db4b202b59d5b1b1e9ec5c2e2967bf91211b3 (patch) | |
tree | b0780e0d47f9c59d3d0da0f29af2985af52df4bc /erts | |
parent | f623fffd4f2925c81d0b613bbc77897e3b887098 (diff) | |
download | otp-8f4db4b202b59d5b1b1e9ec5c2e2967bf91211b3.tar.gz otp-8f4db4b202b59d5b1b1e9ec5c2e2967bf91211b3.tar.bz2 otp-8f4db4b202b59d5b1b1e9ec5c2e2967bf91211b3.zip |
[socket] Fixed various windows issues
Building on windows broken again:
* The 'inline' keywork needs som work on windows.
* Function was outside of if-def.
* Missing prototypes resulted in default prototypes.
In this case, the actual problem was missing if-defs
for win32 (that made functions exist on windows
when they should not). Not sure why it compiled just
fine on win32 but not win64 though.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/nifs/common/socket_nif.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index ac1beba344..c2dddf8aa4 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -119,7 +119,6 @@ - /* AND HERE WE MAY HAVE A BUNCH OF DEFINES....SEE INET DRIVER.... */ @@ -332,6 +331,20 @@ static void (*esock_sctp_freepaddrs)(struct sockaddr *addrs) = NULL; #include "socket_int.h" #include "socket_util.h" + +#if defined(ERTS_INLINE) +# define ESOCK_INLINE ERTS_INLINE +#else +# if defined(__GNUC__) +# define ESOCK_INLINE __inline__ +# elif defined(__WIN32__) +# define ESOCK_INLINE __inline +# else +# define ESOCK_INLINE +# endif +#endif + + #if defined(SOL_IPV6) || defined(IPPROTO_IPV6) #define HAVE_IPV6 #endif @@ -2897,7 +2910,7 @@ static ESockData data; /* These two (inline) functions are primarily intended for debugging, * that is, to make it easy to add debug printouts. */ -static inline void esock_free_env(const char* slogan, ErlNifEnv* env) +static ESOCK_INLINE void esock_free_env(const char* slogan, ErlNifEnv* env) { SGDBG( ("SOCKET", "env free - %s: 0x%lX\r\n", slogan, env) ); @@ -2905,7 +2918,7 @@ static inline void esock_free_env(const char* slogan, ErlNifEnv* env) } -static inline ErlNifEnv* esock_alloc_env(const char* slogan) +static ESOCK_INLINE ErlNifEnv* esock_alloc_env(const char* slogan) { ErlNifEnv* env = enif_alloc_env(); @@ -17354,7 +17367,6 @@ char* esock_send_msg(ErlNifEnv* env, else return NULL; } -#endif // #if defined(__WIN32__) @@ -17447,6 +17459,7 @@ ERL_NIF_TERM mk_socket(ErlNifEnv* env, return MKT2(env, esock_atom_socket, sockRef); } +#endif // #if defined(__WIN32__) /* ---------------------------------------------------------------------- @@ -17538,6 +17551,8 @@ int esock_select_cancel(ErlNifEnv* env, * Return value indicates if a new requestor was activated or not. */ +#if !defined(__WIN32__) + #define ACTIVATE_NEXT_FUNCS \ ACTIVATE_NEXT_FUNC_DECL(acceptor, read, currentAcceptor, acceptorsQ) \ ACTIVATE_NEXT_FUNC_DECL(writer, write, currentWriter, writersQ) \ @@ -17615,7 +17630,7 @@ ACTIVATE_NEXT_FUNCS #undef ACTIVATE_NEXT_FUNC_DECL - +#endif // if !defined(__WIN32__) /* ---------------------------------------------------------------------- @@ -18221,6 +18236,7 @@ void socket_stop(ErlNifEnv* env, void* obj, int fd, int is_direct_call) * Handle current requestor (reader, writer or acceptor) during * socket stop. */ +#if !defined(__WIN32__) static void socket_stop_handle_current(ErlNifEnv* env, const char* role, @@ -18254,14 +18270,14 @@ void socket_stop_handle_current(ErlNifEnv* env, * nif_abort message with the specified reason to each member, * and if the 'free' argument is TRUE, the queue will be emptied. */ -#if !defined(__WIN32__) -static void inform_waiting_procs(ErlNifEnv* env, - const char* role, - ESockDescriptor* descP, - ERL_NIF_TERM sockRef, - ESockRequestQueue* q, - BOOLEAN_T free, - ERL_NIF_TERM reason) +static +void inform_waiting_procs(ErlNifEnv* env, + const char* role, + ESockDescriptor* descP, + ERL_NIF_TERM sockRef, + ESockRequestQueue* q, + BOOLEAN_T free, + ERL_NIF_TERM reason) { ESockRequestQueueElement* currentP = q->first; ESockRequestQueueElement* nextP; |