Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/modules/lua Only load a module if it is not already load...
details: https://anonhg.NetBSD.org/src/rev/2e7eebf20ace
branches: trunk
changeset: 353748:2e7eebf20ace
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Sat May 20 08:31:13 2017 +0000
description:
Only load a module if it is not already loaded in a state (much like userland
Lua handles require).
Fixes PR kern/52226.
diffstat:
sys/modules/lua/lua.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r af2bed4c865a -r 2e7eebf20ace sys/modules/lua/lua.c
--- a/sys/modules/lua/lua.c Sat May 20 08:00:47 2017 +0000
+++ b/sys/modules/lua/lua.c Sat May 20 08:31:13 2017 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: lua.c,v 1.21 2017/05/11 07:34:27 mbalmer Exp $ */
+/* $NetBSD: lua.c,v 1.22 2017/05/20 08:31:13 mbalmer Exp $ */
/*
+ * Copyright (c) 2011 - 2017 by Marc Balmer <mbalmer%NetBSD.org@localhost>.
* Copyright (c) 2014 by Lourival Vieira Neto <lneto%NetBSD.org@localhost>.
- * Copyright (c) 2011 - 2014 by Marc Balmer <mbalmer%NetBSD.org@localhost>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -514,6 +514,10 @@
if (md != NULL)
LIST_FOREACH(s, &lua_states, lua_next)
if (s->K->L == L) {
+ LIST_FOREACH(m, &s->lua_modules, mod_next)
+ if (m == md)
+ return 1;
+
if (lua_verbose)
device_printf(sc_self,
"require module %s\n",
Home |
Main Index |
Thread Index |
Old Index