Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144541332
D51158.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D51158.id.diff
View Options
diff --git a/libexec/flua/linit_flua.c b/libexec/flua/linit_flua.c
--- a/libexec/flua/linit_flua.c
+++ b/libexec/flua/linit_flua.c
@@ -57,18 +57,11 @@
#endif
/* FreeBSD Extensions */
{"lfs", luaopen_lfs},
- {"posix.fnmatch", luaopen_posix_fnmatch},
- {"posix.libgen", luaopen_posix_libgen},
- {"posix.stdlib", luaopen_posix_stdlib},
- {"posix.sys.stat", luaopen_posix_sys_stat},
- {"posix.sys.utsname", luaopen_posix_sys_utsname},
- {"posix.sys.wait", luaopen_posix_sys_wait},
- {"posix.unistd", luaopen_posix_unistd},
+ {"posix", luaopen_posix},
{"fbsd", luaopen_fbsd},
{NULL, NULL}
};
-
LUALIB_API void luaL_openlibs (lua_State *L) {
const luaL_Reg *lib;
/* "require" functions from 'loadedlibs' and set results to global table */
@@ -77,4 +70,3 @@
lua_pop(L, 1); /* remove lib */
}
}
-
diff --git a/libexec/flua/modules/lposix.h b/libexec/flua/modules/lposix.h
--- a/libexec/flua/modules/lposix.h
+++ b/libexec/flua/modules/lposix.h
@@ -7,10 +7,4 @@
#include <lua.h>
-int luaopen_posix_fnmatch(lua_State *L);
-int luaopen_posix_libgen(lua_State *L);
-int luaopen_posix_stdlib(lua_State *L);
-int luaopen_posix_sys_stat(lua_State *L);
-int luaopen_posix_sys_utsname(lua_State *L);
-int luaopen_posix_sys_wait(lua_State *L);
-int luaopen_posix_unistd(lua_State *L);
+int luaopen_posix(lua_State *L);
diff --git a/libexec/flua/modules/lposix.c b/libexec/flua/modules/lposix.c
--- a/libexec/flua/modules/lposix.c
+++ b/libexec/flua/modules/lposix.c
@@ -590,21 +590,21 @@
#undef REG_SIMPLE
#undef REG_DEF
-int
+static int
luaopen_posix_libgen(lua_State *L)
{
luaL_newlib(L, libgenlib);
return (1);
}
-int
+static int
luaopen_posix_stdlib(lua_State *L)
{
luaL_newlib(L, stdliblib);
return (1);
}
-int
+static int
luaopen_posix_fnmatch(lua_State *L)
{
luaL_newlib(L, fnmatchlib);
@@ -622,14 +622,21 @@
return 1;
}
-int
+static int
luaopen_posix_sys_stat(lua_State *L)
{
luaL_newlib(L, sys_statlib);
return (1);
}
-int
+static int
+luaopen_posix_sys_utsname(lua_State *L)
+{
+ luaL_newlib(L, sys_utsnamelib);
+ return 1;
+}
+
+static int
luaopen_posix_sys_wait(lua_State *L)
{
luaL_newlib(L, sys_waitlib);
@@ -655,16 +662,38 @@
return (1);
}
-int
-luaopen_posix_sys_utsname(lua_State *L)
+static int
+luaopen_posix_unistd(lua_State *L)
{
- luaL_newlib(L, sys_utsnamelib);
- return 1;
+ luaL_newlib(L, unistdlib);
+ return (1);
}
int
-luaopen_posix_unistd(lua_State *L)
+luaopen_posix(lua_State *L)
{
- luaL_newlib(L, unistdlib);
+ lua_newtable(L); /* posix */
+
+ luaL_requiref(L, "posix.fnmatch", luaopen_posix_fnmatch, 0);
+ lua_setfield(L, -2, "fnmatch");
+
+ luaL_requiref(L, "posix.libgen", luaopen_posix_libgen, 0);
+ lua_setfield(L, -2, "libgen");
+
+ luaL_requiref(L, "posix.stdlib", luaopen_posix_stdlib, 0);
+ lua_setfield(L, -2, "stdlib");
+
+ lua_newtable(L); /* posix.sys */
+ luaL_requiref(L, "posix.sys.stat", luaopen_posix_sys_stat, 0);
+ lua_setfield(L, -2, "stat");
+ luaL_requiref(L, "posix.sys.utsname", luaopen_posix_sys_utsname, 0);
+ lua_setfield(L, -2, "utsname");
+ luaL_requiref(L, "posix.sys.wait", luaopen_posix_sys_wait, 0);
+ lua_setfield(L, -2, "wait");
+ lua_setfield(L, -2, "sys");
+
+ luaL_requiref(L, "posix.unistd", luaopen_posix_unistd, 0);
+ lua_setfield(L, -2, "unistd");
+
return (1);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 10, 9:08 AM (15 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28619375
Default Alt Text
D51158.id.diff (3 KB)
Attached To
Mode
D51158: lposix: Clean up the posix namespace definitions
Attached
Detach File
Event Timeline
Log In to Comment