From 9e34d5b91fda4c1021090fa00a8921cc2c8d2cb8 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 7 Mar 2019 17:27:44 +0100 Subject: [socket] Preliminary - make socket configurable Preliminary work to make socket configurable (enable and disable). OTP-15658 --- erts/emulator/Makefile.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 448f41b523..1c85c4e827 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -843,6 +843,14 @@ ESOCK_RUN_OBJS = \ $(OBJDIR)/socket_dbg.o \ $(OBJDIR)/socket_tarray.o \ $(OBJDIR)/socket_util.o +ifeq ($(USE_ESOCK), yes) +ESOCK_NIF_OBJS = \ + $(OBJDIR)/socket_nif.o \ + $(OBJDIR)/net_nif.o +else +ESOCK_NIF_OBJS = \ + $(OBJDIR)/net_nif.o +endif else ESOCK_RUN_OBJS = endif @@ -903,8 +911,7 @@ NIF_OBJS = \ $(OBJDIR)/prim_buffer_nif.o \ $(OBJDIR)/prim_file_nif.o \ $(OBJDIR)/zlib_nif.o \ - $(OBJDIR)/socket_nif.o \ - $(OBJDIR)/net_nif.o + $(ESOCK_NIF_OBJS) ifeq ($(TARGET),win32) DRV_OBJS = \ -- cgit v1.2.3 From b6c6aba478e314f60647bf2868eb4ebc59d3c719 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Tue, 19 Mar 2019 18:19:49 +0100 Subject: [socket|net] Final prep The config options --[en|dis]able-esock now works as expected. --- erts/emulator/Makefile.in | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 1c85c4e827..a9f3bb8e89 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -633,6 +633,15 @@ GENERATE += $(TTF_DIR)/driver_tab.c # This list must be consistent with PRE_LOADED_MODULES in # erts/preloaded/src/Makefile. +ifeq ($(USE_ESOCK), yes) +ESOCK_PRELOAD_BEAM = \ + $(ERL_TOP)/erts/preloaded/ebin/socket.beam \ + $(ERL_TOP)/erts/preloaded/ebin/net.beam +else +ESOCK_PRELOAD_BEAM = \ + $(ERL_TOP)/erts/preloaded/ebin/net.beam +endif + PRELOAD_BEAM = $(ERL_TOP)/erts/preloaded/ebin/erts_code_purger.beam \ $(ERL_TOP)/erts/preloaded/ebin/erl_init.beam \ $(ERL_TOP)/erts/preloaded/ebin/init.beam \ @@ -641,8 +650,7 @@ PRELOAD_BEAM = $(ERL_TOP)/erts/preloaded/ebin/erts_code_purger.beam \ $(ERL_TOP)/erts/preloaded/ebin/prim_inet.beam \ $(ERL_TOP)/erts/preloaded/ebin/prim_file.beam \ $(ERL_TOP)/erts/preloaded/ebin/zlib.beam \ - $(ERL_TOP)/erts/preloaded/ebin/socket.beam \ - $(ERL_TOP)/erts/preloaded/ebin/net.beam \ + $(ESOCK_PRELOAD_BEAM) \ $(ERL_TOP)/erts/preloaded/ebin/prim_zip.beam \ $(ERL_TOP)/erts/preloaded/ebin/erl_prim_loader.beam \ $(ERL_TOP)/erts/preloaded/ebin/erlang.beam \ @@ -835,6 +843,15 @@ EMU_OBJS = \ $(OBJDIR)/beam_catches.o $(OBJDIR)/code_ix.o \ $(OBJDIR)/beam_ranges.o + +ifeq ($(USE_ESOCK), yes) + +# WE ARE USING ESOCK + +ESOCK_NIF_OBJS = \ + $(OBJDIR)/socket_nif.o \ + $(OBJDIR)/net_nif.o + ifneq ($(TARGET), win32) # These are *currently* only needed for non-win32, # since the nif-functions for socket and net are basically @@ -843,18 +860,20 @@ ESOCK_RUN_OBJS = \ $(OBJDIR)/socket_dbg.o \ $(OBJDIR)/socket_tarray.o \ $(OBJDIR)/socket_util.o -ifeq ($(USE_ESOCK), yes) -ESOCK_NIF_OBJS = \ - $(OBJDIR)/socket_nif.o \ - $(OBJDIR)/net_nif.o else -ESOCK_NIF_OBJS = \ - $(OBJDIR)/net_nif.o +ESOCK_RUN_OBJS = endif + else + +# WE ARE *NOT* USING ESOCK + +ESOCK_NIF_OBJS = ESOCK_RUN_OBJS = + endif + RUN_OBJS += \ $(OBJDIR)/erl_alloc.o $(OBJDIR)/erl_mtrace.o \ $(OBJDIR)/erl_alloc_util.o $(OBJDIR)/erl_goodfit_alloc.o \ -- cgit v1.2.3 From e87bc034ae3f13cfcfab8677a10a088850c747a0 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 28 Mar 2019 14:44:45 +0100 Subject: [socket|net|test] Update test suites to handle disabled esock --- erts/emulator/test/net_SUITE.erl | 17 +++++++++++------ erts/emulator/test/socket_SUITE.erl | 31 ++++++++++++++++++------------- 2 files changed, 29 insertions(+), 19 deletions(-) (limited to 'erts/emulator') diff --git a/erts/emulator/test/net_SUITE.erl b/erts/emulator/test/net_SUITE.erl index 1a973cacb2..6111fc76a5 100644 --- a/erts/emulator/test/net_SUITE.erl +++ b/erts/emulator/test/net_SUITE.erl @@ -127,12 +127,17 @@ api_basic_cases() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init_per_suite(Config) -> - case os:type() of - {win32, _} -> - not_yet_implemented(); - _ -> - %% ?LOGGER:start(), - Config + case lists:member(socket, erlang:loaded()) of + true -> + case os:type() of + {win32, _} -> + not_yet_implemented(); + _ -> + %% ?LOGGER:start(), + Config + end; + false -> + {skip, "esock disabled"} end. end_per_suite(_) -> diff --git a/erts/emulator/test/socket_SUITE.erl b/erts/emulator/test/socket_SUITE.erl index cefbe4c1f8..e3545ccbf9 100644 --- a/erts/emulator/test/socket_SUITE.erl +++ b/erts/emulator/test/socket_SUITE.erl @@ -1385,22 +1385,27 @@ ttest_ssockt_csockt_cases() -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% init_per_suite(Config) -> - case os:type() of - {win32, _} -> - not_yet_implemented(); - _ -> - case quiet_mode(Config) of - default -> - ?LOGGER:start(), - Config; - Quiet -> - ?LOGGER:start(Quiet), - [{esock_test_quiet, Quiet}|Config] - end + case lists:member(socket, erlang:loaded()) of + true -> + case os:type() of + {win32, _} -> + (catch not_yet_implemented()); + _ -> + case quiet_mode(Config) of + default -> + ?LOGGER:start(), + Config; + Quiet -> + ?LOGGER:start(Quiet), + [{esock_test_quiet, Quiet}|Config] + end + end; + false -> + {skip, "esock disabled"} end. end_per_suite(_) -> - ?LOGGER:stop(), + (catch ?LOGGER:stop()), ok. -- cgit v1.2.3