Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
- Fix for default mtree style
- Update libelf
- Importing libexecinfo
- Resynchronize GCC, mpc, gmp, mpfr
- build.sh: Replace params with show-params.
This has been done as the make target has been renamed in the same
way, while a new target named params has been added. This new
target generates a file containing all the parameters, instead of
printing it on the console.
- Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
get getservbyport() out of the inner loop
Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.5 2011/11/08 01:52:05 joerg Exp $
|
||||
# $NetBSD: Makefile,v 1.6 2013/11/13 09:49:08 mbalmer Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
.if ${MKPIC} != "no"
|
||||
# No support for shared libraries and pic code.
|
||||
SUBDIR+= gpio sqlite
|
||||
SUBDIR+= gpio sqlite syslog
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gpio.c,v 1.7 2012/03/15 02:02:21 joerg Exp $ */
|
||||
/* $NetBSD: gpio.c,v 1.8 2013/10/26 09:18:00 mbalmer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Marc Balmer <marc@msys.ch>
|
||||
@@ -255,13 +255,14 @@ static void
|
||||
gpio_set_info(lua_State *L)
|
||||
{
|
||||
lua_pushliteral(L, "_COPYRIGHT");
|
||||
lua_pushliteral(L, "Copyright (C) 2011 Marc Balmer <marc@msys.ch>");
|
||||
lua_pushliteral(L, "Copyright (C) 2011, 2013 Marc Balmer "
|
||||
"<marc@msys.ch>");
|
||||
lua_settable(L, -3);
|
||||
lua_pushliteral(L, "_DESCRIPTION");
|
||||
lua_pushliteral(L, "GPIO interface for Lua");
|
||||
lua_settable(L, -3);
|
||||
lua_pushliteral(L, "_VERSION");
|
||||
lua_pushliteral(L, "gpio 1.0.1");
|
||||
lua_pushliteral(L, "gpio 1.0.2");
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
|
||||
@@ -288,6 +289,7 @@ luaopen_gpio(lua_State* L)
|
||||
int n;
|
||||
|
||||
luaL_register(L, "gpio", methods);
|
||||
luaL_register(L, NULL, gpio_methods);
|
||||
gpio_set_info(L);
|
||||
|
||||
/* The gpio metatable */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* $NetBSD: sqlite.c,v 1.5 2012/11/02 12:24:52 mbalmer Exp $ */
|
||||
/* $NetBSD: sqlite.c,v 1.6 2013/10/27 12:38:08 mbalmer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 Marc Balmer <marc@msys.ch>
|
||||
* Copyright (c) 2011, 2013 Marc Balmer <marc@msys.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -81,11 +81,14 @@ sqlite_open(lua_State *L)
|
||||
sqlite3 **db;
|
||||
|
||||
db = lua_newuserdata(L, sizeof(sqlite3 *));
|
||||
lua_pushinteger(L, sqlite3_open_v2(luaL_checkstring(L, -3), db,
|
||||
(int)luaL_checkinteger(L, -2), NULL));
|
||||
|
||||
luaL_getmetatable(L, SQLITE_DB_METATABLE);
|
||||
lua_setmetatable(L, -3);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
if (lua_gettop(L) > 2)
|
||||
lua_pushinteger(L, sqlite3_open_v2(luaL_checkstring(L, -3), db,
|
||||
(int)luaL_checkinteger(L, -2), NULL));
|
||||
else
|
||||
lua_pushinteger(L, sqlite3_open(luaL_checkstring(L, -2), db));
|
||||
return 2;
|
||||
|
||||
}
|
||||
@@ -362,8 +365,10 @@ static const struct constant sqlite_constant[] = {
|
||||
{ "INTERRUPT", SQLITE_INTERRUPT },
|
||||
{ "IOERR", SQLITE_IOERR },
|
||||
{ "CORRUPT", SQLITE_CORRUPT },
|
||||
{ "NOTFOUND", SQLITE_NOTFOUND },
|
||||
{ "FULL", SQLITE_FULL },
|
||||
{ "CANTOPEN", SQLITE_CANTOPEN },
|
||||
{ "PROTOCOL", SQLITE_PROTOCOL },
|
||||
{ "EMPTY", SQLITE_EMPTY },
|
||||
{ "SCHEMA", SQLITE_SCHEMA },
|
||||
{ "TOOBIG", SQLITE_TOOBIG },
|
||||
@@ -375,14 +380,13 @@ static const struct constant sqlite_constant[] = {
|
||||
{ "FORMAT", SQLITE_FORMAT },
|
||||
{ "RANGE", SQLITE_RANGE },
|
||||
{ "NOTADB", SQLITE_NOTADB },
|
||||
|
||||
{ "ROW", SQLITE_ROW },
|
||||
{ "DONE", SQLITE_DONE },
|
||||
|
||||
/* File modes */
|
||||
{ "OPEN_READONLY", SQLITE_OPEN_READONLY },
|
||||
{ "OPEN_READWRITE", SQLITE_OPEN_READWRITE },
|
||||
{ "OPEN_CREATE", SQLITE_OPEN_CREATE },
|
||||
{ "OPEN_CREATE", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE },
|
||||
|
||||
{ NULL, 0 }
|
||||
};
|
||||
@@ -391,14 +395,14 @@ static void
|
||||
gpio_set_info(lua_State *L)
|
||||
{
|
||||
lua_pushliteral(L, "_COPYRIGHT");
|
||||
lua_pushliteral(L, "Copyright (C) 2011, 2012 by "
|
||||
lua_pushliteral(L, "Copyright (C) 2011, 2012, 2013 by "
|
||||
"Marc Balmer <marc@msys.ch>");
|
||||
lua_settable(L, -3);
|
||||
lua_pushliteral(L, "_DESCRIPTION");
|
||||
lua_pushliteral(L, "SQLite interface for Lua");
|
||||
lua_settable(L, -3);
|
||||
lua_pushliteral(L, "_VERSION");
|
||||
lua_pushliteral(L, "sqlite 1.0.2");
|
||||
lua_pushliteral(L, "sqlite 1.0.3");
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
|
||||
@@ -443,6 +447,8 @@ luaopen_sqlite(lua_State* L)
|
||||
sqlite3_initialize();
|
||||
|
||||
luaL_register(L, "sqlite", sqlite_methods);
|
||||
luaL_register(L, NULL, db_methods);
|
||||
luaL_register(L, NULL, stmt_methods);
|
||||
gpio_set_info(L);
|
||||
|
||||
/* The database connection metatable */
|
||||
|
||||
6
lib/lua/syslog/Makefile
Normal file
6
lib/lua/syslog/Makefile
Normal file
@@ -0,0 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.1 2013/11/12 14:32:03 mbalmer Exp $
|
||||
|
||||
LUA_MODULES= syslog
|
||||
LUA_SRCS.syslog= syslog.c
|
||||
|
||||
.include <bsd.lua.mk>
|
||||
165
lib/lua/syslog/syslog.c
Normal file
165
lib/lua/syslog/syslog.c
Normal file
@@ -0,0 +1,165 @@
|
||||
/* $NetBSD: syslog.c,v 1.1 2013/11/12 14:32:03 mbalmer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Marc Balmer <marc@msys.ch>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* Lua binding for syslog */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int luaopen_syslog(lua_State *);
|
||||
|
||||
static int
|
||||
syslog_openlog(lua_State *L)
|
||||
{
|
||||
const char *ident;
|
||||
int option;
|
||||
int facility;
|
||||
|
||||
ident = luaL_checkstring(L, 1);
|
||||
option = luaL_checkinteger(L, 2);
|
||||
facility = luaL_checkinteger(L, 3);
|
||||
openlog(ident, option, facility);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
syslog_syslog(lua_State *L)
|
||||
{
|
||||
syslog(luaL_checkint(L, 1), "%s", luaL_checkstring(L, 2));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
syslog_closelog(lua_State *L)
|
||||
{
|
||||
closelog();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
syslog_setlogmask(lua_State *L)
|
||||
{
|
||||
lua_pushinteger(L, setlogmask(luaL_checkint(L, 1)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
syslog_set_info(lua_State *L)
|
||||
{
|
||||
lua_pushliteral(L, "_COPYRIGHT");
|
||||
lua_pushliteral(L, "Copyright (C) 2013 by "
|
||||
"Marc Balmer <marc@msys.ch>");
|
||||
lua_settable(L, -3);
|
||||
lua_pushliteral(L, "_DESCRIPTION");
|
||||
lua_pushliteral(L, "syslog binding for Lua");
|
||||
lua_settable(L, -3);
|
||||
lua_pushliteral(L, "_VERSION");
|
||||
lua_pushliteral(L, "syslog 1.0.0");
|
||||
lua_settable(L, -3);
|
||||
}
|
||||
|
||||
struct constant {
|
||||
const char *name;
|
||||
int value;
|
||||
};
|
||||
|
||||
#define CONSTANT(NAME) { #NAME, NAME }
|
||||
|
||||
static struct constant syslog_constant[] = {
|
||||
/* syslog options */
|
||||
CONSTANT(LOG_CONS),
|
||||
CONSTANT(LOG_NDELAY),
|
||||
CONSTANT(LOG_NOWAIT),
|
||||
CONSTANT(LOG_ODELAY),
|
||||
CONSTANT(LOG_PERROR),
|
||||
CONSTANT(LOG_PID),
|
||||
|
||||
/* syslog facilities */
|
||||
CONSTANT(LOG_AUTH),
|
||||
CONSTANT(LOG_AUTHPRIV),
|
||||
CONSTANT(LOG_CRON),
|
||||
CONSTANT(LOG_DAEMON),
|
||||
CONSTANT(LOG_FTP),
|
||||
CONSTANT(LOG_KERN),
|
||||
CONSTANT(LOG_LOCAL0),
|
||||
CONSTANT(LOG_LOCAL1),
|
||||
CONSTANT(LOG_LOCAL2),
|
||||
CONSTANT(LOG_LOCAL3),
|
||||
CONSTANT(LOG_LOCAL4),
|
||||
CONSTANT(LOG_LOCAL5),
|
||||
CONSTANT(LOG_LOCAL6),
|
||||
CONSTANT(LOG_LOCAL7),
|
||||
CONSTANT(LOG_LPR),
|
||||
CONSTANT(LOG_MAIL),
|
||||
CONSTANT(LOG_NEWS),
|
||||
CONSTANT(LOG_SYSLOG),
|
||||
CONSTANT(LOG_USER),
|
||||
CONSTANT(LOG_UUCP),
|
||||
|
||||
/* syslog levels */
|
||||
CONSTANT(LOG_EMERG),
|
||||
CONSTANT(LOG_ALERT),
|
||||
CONSTANT(LOG_CRIT),
|
||||
CONSTANT(LOG_ERR),
|
||||
CONSTANT(LOG_WARNING),
|
||||
CONSTANT(LOG_NOTICE),
|
||||
CONSTANT(LOG_INFO),
|
||||
CONSTANT(LOG_DEBUG),
|
||||
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
luaopen_syslog(lua_State *L)
|
||||
{
|
||||
int n;
|
||||
struct luaL_Reg luasyslog[] = {
|
||||
{ "openlog", syslog_openlog },
|
||||
{ "syslog", syslog_syslog },
|
||||
{ "closelog", syslog_closelog },
|
||||
{ "setlogmask", syslog_setlogmask },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
#if LUA_VERSION_NUM >= 502
|
||||
luaL_newlib(L, luasyslog);
|
||||
#else
|
||||
luaL_register(L, "syslog", luasyslog);
|
||||
#endif
|
||||
syslog_set_info(L);
|
||||
for (n = 0; syslog_constant[n].name != NULL; n++) {
|
||||
lua_pushinteger(L, syslog_constant[n].value);
|
||||
lua_setfield(L, -2, syslog_constant[n].name);
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user