aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2012-10-31 23:31:50 +0100
committerRickard Green <[email protected]>2012-12-03 21:18:07 +0100
commit7e789df8dd9c7d86e9cc354521a37aa598aa5ec8 (patch)
tree9fee41a6df34f7bb26ce1020f6f3333bd2665d90 /erts/emulator/beam/io.c
parentef302baca81ceaedbfb128fae60a42e53910f061 (diff)
downloadotp-7e789df8dd9c7d86e9cc354521a37aa598aa5ec8.tar.gz
otp-7e789df8dd9c7d86e9cc354521a37aa598aa5ec8.tar.bz2
otp-7e789df8dd9c7d86e9cc354521a37aa598aa5ec8.zip
Improve configuration of process and port tables
Diffstat (limited to 'erts/emulator/beam/io.c')
-rw-r--r--erts/emulator/beam/io.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 21fc76b8db..1177e7e691 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -1238,13 +1238,10 @@ release_port(void *vport)
}
#endif
-/* initialize the port array */
-void init_io(void)
+void erts_init_io(int port_tab_size,
+ int port_tab_size_ignore_files)
{
ErlDrvEntry** dp;
- char maxports[21]; /* enough for any 64-bit integer */
- size_t maxportssize = sizeof(maxports);
- int port_tab_size;
#ifdef ERTS_SMP
init_xports_list_alloc();
@@ -1252,15 +1249,16 @@ void init_io(void)
pdl_init();
- if (erts_sys_getenv("ERL_MAX_PORTS", maxports, &maxportssize) == 0)
- port_tab_size = atoi(maxports);
- else
- port_tab_size = sys_max_files();
+ if (!port_tab_size_ignore_files) {
+ int max_files = sys_max_files();
+ if (port_tab_size < max_files)
+ port_tab_size = max_files;
+ }
if (port_tab_size > ERTS_MAX_PORTS)
port_tab_size = ERTS_MAX_PORTS;
- if (port_tab_size < 1024)
- port_tab_size = 1024;
+ else if (port_tab_size < ERTS_MIN_PORTS)
+ port_tab_size = ERTS_MIN_PORTS;
erts_smp_mtx_init(&erts_driver_list_lock,"driver_list");
driver_list = NULL;