From 200fbe924466720bd2a8c5eb05b05d67b0a2414c Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 14 Mar 2013 15:42:19 +0100 Subject: Added support for ENEA OSE This port has support for both non-smp and smp. It contains a new way to do io checking in which erts_poll_wait receives the payload of the polled entity. This has implications for all linked-in drivers. --- erts/emulator/sys/ose/erl_main.c | 70 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 erts/emulator/sys/ose/erl_main.c (limited to 'erts/emulator/sys/ose/erl_main.c') diff --git a/erts/emulator/sys/ose/erl_main.c b/erts/emulator/sys/ose/erl_main.c new file mode 100644 index 0000000000..21cfce9463 --- /dev/null +++ b/erts/emulator/sys/ose/erl_main.c @@ -0,0 +1,70 @@ +/* + * %CopyrightBegin% + * + * Copyright Ericsson AB 2000-2009. All Rights Reserved. + * + * The contents of this file are subject to the Erlang Public License, + * Version 1.1, (the "License"); you may not use this file except in + * compliance with the License. You should have received a copy of the + * Erlang Public License along with this software. If not, it can be + * retrieved online at http://www.erlang.org/. + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * %CopyrightEnd% + */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include "sys.h" +#include "erl_vm.h" +#include "global.h" + +#include "shell.h" +#include "ramlog.h" +#include "ose_err/ose_err.h" + +static PROCESS mainPid; + +#ifdef DEBUG +static OSADDRESS err_handler(OSBOOLEAN user_called, OSERRCODE ecode, OSERRCODE extra) { + fprintf(stderr,"err_handler: %p %p\n",ecode,extra); + return 1; +} +#endif + +static int +cmd_ek(int argc, char **argv) { + kill_proc(mainPid); + return 0; +} + +static int +cmd_erl_start(int argc, char **argv) { + ramlog_printf("\n"); + ramlog_printf("================================================================\n"); + ramlog_printf("\n"); +#ifdef DEBUG + create_error_handler(get_bid(current_process()),err_handler,0x100); +#endif + erl_start(argc, argv); + return 0; +} + +int +main(int argc, char **argv) { + mainPid = current_process(); + + shell_add_cmd_attrs("start_beam", "start_beam [params]", "Start the Erlang VM", + cmd_erl_start, OS_PRI_PROC, 20, 0xF000); + + shell_add_cmd_attrs("ek", "ek", "Kills the Erlang VM", + cmd_ek, OS_PRI_PROC, 20, 0x100); + + stop(current_process()); + + return 0; +} -- cgit v1.2.3 From 8ed59e4a9dddf083d2046e1bd58f397221928c0e Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Tue, 15 Oct 2013 18:10:47 +0200 Subject: ose: Change start way to use arguments to beam.smp directly The old way registered a shell command that needed to be executed. This way is more flexible as you can also use the lmconf file to set arguments there. --- erts/emulator/sys/ose/erl_main.c | 44 +--------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) (limited to 'erts/emulator/sys/ose/erl_main.c') diff --git a/erts/emulator/sys/ose/erl_main.c b/erts/emulator/sys/ose/erl_main.c index 21cfce9463..322058c87b 100644 --- a/erts/emulator/sys/ose/erl_main.c +++ b/erts/emulator/sys/ose/erl_main.c @@ -16,53 +16,11 @@ * * %CopyrightEnd% */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif -#include "sys.h" -#include "erl_vm.h" -#include "global.h" - -#include "shell.h" -#include "ramlog.h" -#include "ose_err/ose_err.h" - -static PROCESS mainPid; - -#ifdef DEBUG -static OSADDRESS err_handler(OSBOOLEAN user_called, OSERRCODE ecode, OSERRCODE extra) { - fprintf(stderr,"err_handler: %p %p\n",ecode,extra); - return 1; -} -#endif - -static int -cmd_ek(int argc, char **argv) { - kill_proc(mainPid); - return 0; -} - -static int -cmd_erl_start(int argc, char **argv) { - ramlog_printf("\n"); - ramlog_printf("================================================================\n"); - ramlog_printf("\n"); -#ifdef DEBUG - create_error_handler(get_bid(current_process()),err_handler,0x100); -#endif - erl_start(argc, argv); - return 0; -} int main(int argc, char **argv) { - mainPid = current_process(); - - shell_add_cmd_attrs("start_beam", "start_beam [params]", "Start the Erlang VM", - cmd_erl_start, OS_PRI_PROC, 20, 0xF000); - shell_add_cmd_attrs("ek", "ek", "Kills the Erlang VM", - cmd_ek, OS_PRI_PROC, 20, 0x100); + erl_start(argc,argv); stop(current_process()); -- cgit v1.2.3 From a6788ea337a2319a2d1a42ee4618553a1c7765bf Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Wed, 30 Oct 2013 17:56:37 +0100 Subject: ose: Fix various build environment issues --- erts/emulator/sys/ose/erl_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'erts/emulator/sys/ose/erl_main.c') diff --git a/erts/emulator/sys/ose/erl_main.c b/erts/emulator/sys/ose/erl_main.c index 322058c87b..a17fc7eabc 100644 --- a/erts/emulator/sys/ose/erl_main.c +++ b/erts/emulator/sys/ose/erl_main.c @@ -17,10 +17,25 @@ * %CopyrightEnd% */ +#include + int main(int argc, char **argv) { + /* When starting using pm_create -c ARGV="-- -root ..", argv[0] is the first + part of ARGV and not the name of the executable. So we shuffle some + pointers here to make erl_start happy. */ + if (argv[0][0] == '-') { + int i; + char **tmp_argv = malloc(sizeof(char*)*(argc+1)); + for (i = 0; i < argc; i++) + tmp_argv[i+1] = argv[i]; + tmp_argv = "beam"; + erl_start(argc,tmp_argv); + free(tmp_argv); + } else { erl_start(argc,argv); + } stop(current_process()); -- cgit v1.2.3 From 809ee10f37bac29b3056f4fb09c072b951e29f0c Mon Sep 17 00:00:00 2001 From: Lukas Larsson Date: Thu, 14 Nov 2013 18:18:12 +0100 Subject: ose: Fix starting with pm_create For some reason starting with pm_create offsets the input argument list by one, so we have to adjust them before calling erl_start. --- erts/emulator/sys/ose/erl_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'erts/emulator/sys/ose/erl_main.c') diff --git a/erts/emulator/sys/ose/erl_main.c b/erts/emulator/sys/ose/erl_main.c index a17fc7eabc..03119c3fec 100644 --- a/erts/emulator/sys/ose/erl_main.c +++ b/erts/emulator/sys/ose/erl_main.c @@ -17,8 +17,16 @@ * %CopyrightEnd% */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include +#include "sys.h" +#include "erl_vm.h" +#include "global.h" +#include "ose.h" + int main(int argc, char **argv) { @@ -30,8 +38,8 @@ main(int argc, char **argv) { char **tmp_argv = malloc(sizeof(char*)*(argc+1)); for (i = 0; i < argc; i++) tmp_argv[i+1] = argv[i]; - tmp_argv = "beam"; - erl_start(argc,tmp_argv); + tmp_argv[0] = "beam"; + erl_start(argc+1,tmp_argv); free(tmp_argv); } else { erl_start(argc,argv); -- cgit v1.2.3