aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-12-05 12:34:56 +0100
committerSverker Eriksson <[email protected]>2011-12-05 12:35:06 +0100
commitb90d8b80b7c13771e998bf61c2d3f1f59037956c (patch)
treebfcc5cdcc51ba52fa7027ed3445a80a8b8004ee1 /erts/emulator/beam/erl_nif.c
parentbdc69e0c35229fe11c98c14715b040b2f0eee5aa (diff)
parent81f4a89125ba32955af21fef6cc631e050973a47 (diff)
downloadotp-b90d8b80b7c13771e998bf61c2d3f1f59037956c.tar.gz
otp-b90d8b80b7c13771e998bf61c2d3f1f59037956c.tar.bz2
otp-b90d8b80b7c13771e998bf61c2d3f1f59037956c.zip
Merge branch 'sverk/deprecate-nif-reload'
* sverk/deprecate-nif-reload: erts: Deprecate the NIF reload mechanism OTP-9771
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 143f631f58..58a09986d2 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -1507,6 +1507,7 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2)
Eterm ret = am_ok;
int veto;
struct erl_module_nif* lib = NULL;
+ int reload_warning = 0;
len = list_length(BIF_ARG_1);
if (len < 0) {
@@ -1646,6 +1647,7 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2)
else {
mod->nif->entry = NULL; /* to prevent 'unload' callback */
erts_unload_nif(mod->nif);
+ reload_warning = 1;
}
}
else {
@@ -1714,6 +1716,15 @@ BIF_RETTYPE load_nif_2(BIF_ALIST_2)
erts_smp_thr_progress_unblock();
erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
erts_free(ERTS_ALC_T_TMP, lib_name);
+
+ if (reload_warning) {
+ erts_dsprintf_buf_t* dsbufp = erts_create_logger_dsbuf();
+ erts_dsprintf(dsbufp,
+ "Repeated calls to erlang:load_nif from module '%T'.\n\n"
+ "The NIF reload mechanism is deprecated and must not "
+ "be used in production systems.\n", mod_atom);
+ erts_send_warning_to_logger(BIF_P->group_leader, dsbufp);
+ }
BIF_RET(ret);
}