luci-0.10: merge r7347 - r7354

This commit is contained in:
Jo-Philipp Wich 2011-08-12 10:33:40 +00:00
parent 7c058daf01
commit 1fe5639832
11 changed files with 179 additions and 23 deletions

View file

@ -150,6 +150,7 @@ function run()
if tpids[pid] ~= true then
tpids[pid](pid, stat, code)
end
tpids[pid] = nil
end
pid, stat, code = nixio.wait(-1, "nohang")
end

View file

@ -10,6 +10,7 @@ AXTLS_VERSION = 1.2.1
AXTLS_DIR = axTLS
AXTLS_FILE = $(AXTLS_DIR)-$(AXTLS_VERSION).tar.gz
NIXIO_TLS ?= openssl
NIXIO_SHADOW ?= $(shell echo 'int main(void){ return !getspnam("root"); }' | $(CC) -include shadow.h -xc -o/dev/null - 2>/dev/null && echo yes)
NIXIO_SO = nixio.so
NIXIO_LDFLAGS =
@ -20,8 +21,8 @@ else
endif
NIXIO_OBJ = src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o \
src/poll.o src/io.o src/file.o src/splice.o src/process.o src/syslog.o \
src/bit.o src/binary.o src/fs.o src/user.o \
src/protoent.o src/poll.o src/io.o src/file.o src/splice.o src/process.o \
src/syslog.o src/bit.o src/binary.o src/fs.o src/user.o \
$(if $(NIXIO_TLS),src/tls-crypto.o src/tls-context.o src/tls-socket.o,)
ifeq ($(NIXIO_TLS),axtls)
@ -45,6 +46,10 @@ ifeq ($(NIXIO_TLS),)
NIXIO_CFLAGS += -DNO_TLS
endif
ifneq ($(NIXIO_SHADOW),yes)
NIXIO_CFLAGS += -DNO_SHADOW
endif
ifeq ($(OS),SunOS)
NIXIO_LDFLAGS += -lsocket -lnsl -lsendfile

View file

@ -37,6 +37,39 @@ module "nixio"
-- <li>ifindex = Interface Index (Linux, "packet"-family)</li>
-- </ul>
--- Get protocol entry by name.
-- @usage This function returns nil if the given protocol is unknown.
-- @class function
-- @name nixio.getprotobyname
-- @param name protocol name to lookup
-- @return Table containing the following fields: <ul>
-- <li>name = Protocol Name</li>
-- <li>proto = Protocol Number</li>
-- <li>aliases = Table of alias names</li>
-- </ul>
--- Get protocol entry by number.
-- @usage This function returns nil if the given protocol is unknown.
-- @class function
-- @name nixio.getprotobynumber
-- @param proto protocol number to lookup
-- @return Table containing the following fields: <ul>
-- <li>name = Protocol Name</li>
-- <li>proto = Protocol Number</li>
-- <li>aliases = Table of alias names</li>
-- </ul>
--- Get all or a specifc proto entry.
-- @class function
-- @name nixio.getproto
-- @param proto protocol number or name to lookup (optional)
-- @return Table (or if no parameter is given, a table of tables)
-- containing the following fields: <ul>
-- <li>name = Protocol Name</li>
-- <li>proto = Protocol Number</li>
-- <li>aliases = Table of alias names</li>
-- </ul>
--- Create a new socket and bind it to a network address.
-- This function is a shortcut for calling nixio.socket and then bind()
-- on the socket object.
@ -431,4 +464,4 @@ module "nixio"
-- @class function
-- @name nixio.tls
-- @param mode TLS-Mode ["client", "server"]
-- @return TLSContext Object
-- @return TLSContext Object

View file

@ -180,7 +180,7 @@ static int nixio_sock__bind_connect(lua_State *L, int do_bind) {
}
/* on success */
if (!status) {
if (!status || errno == EINPROGRESS) {
break;
}
}

View file

@ -22,7 +22,7 @@
#include <errno.h>
#include <signal.h>
#define VERSION 0.3
#define VERSION 0.4
/* pushes nil, error number and errstring on the stack */
@ -133,6 +133,7 @@ NIXIO_API int luaopen_nixio(lua_State *L) {
nixio_open_sockopt(L);
nixio_open_bind(L);
nixio_open_address(L);
nixio_open_protoent(L);
nixio_open_poll(L);
nixio_open_io(L);
nixio_open_splice(L);
@ -198,6 +199,8 @@ NIXIO_API int luaopen_nixio(lua_State *L) {
NIXIO_PUSH_CONSTANT(SIGSEGV);
#ifndef __WINNT__
NIXIO_PUSH_CONSTANT(EALREADY);
NIXIO_PUSH_CONSTANT(EINPROGRESS);
NIXIO_PUSH_CONSTANT(EWOULDBLOCK);
NIXIO_PUSH_CONSTANT(ELOOP);
NIXIO_PUSH_CONSTANT(EOVERFLOW);

View file

@ -111,6 +111,7 @@ void nixio_open_socket(lua_State *L);
void nixio_open_sockopt(lua_State *L);
void nixio_open_bind(lua_State *L);
void nixio_open_address(lua_State *L);
void nixio_open_protoent(lua_State *L);
void nixio_open_poll(lua_State *L);
void nixio_open_io(lua_State *L);
void nixio_open_splice(lua_State *L);

103
libs/nixio/src/protoent.c Normal file
View file

@ -0,0 +1,103 @@
/*
* nixio - Linux I/O library for lua
*
* Copyright (C) 2011 Jo-Philipp Wich <jow@openwrt.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "nixio.h"
#ifndef __WINNT__
#include <netdb.h>
#endif
/**
* protoent conversion helper
*/
static int nixio__pushprotoent(lua_State *L, struct protoent *e) {
int i;
if (e) {
lua_newtable(L);
lua_pushstring(L, e->p_name);
lua_setfield(L, -2, "name");
lua_pushnumber(L, e->p_proto);
lua_setfield(L, -2, "proto");
lua_newtable(L);
for (i = 0; e->p_aliases[i]; i++) {
lua_pushstring(L, e->p_aliases[i]);
lua_rawseti(L, -2, i+1);
}
lua_setfield(L, -2, "aliases");
return 1;
} else {
return 0;
}
}
/**
* getprotobyname(name)
*/
static int nixio_getprotobyname(lua_State *L) {
const char *name = luaL_checkstring(L, 1);
struct protoent *res = getprotobyname(name);
return nixio__pushprotoent(L, res);
}
/**
* getprotobynumber(proto)
*/
static int nixio_getprotobynumber(lua_State *L) {
int proto = luaL_checkinteger(L, 1);
struct protoent *res = getprotobynumber(proto);
return nixio__pushprotoent(L, res);
}
/**
* getproto(name_or_proto)
*/
static int nixio_getproto(lua_State *L) {
int i = 1;
struct protoent *res;
if (lua_isnumber(L, 1)) {
return nixio_getprotobynumber(L);
} else if (lua_isstring(L, 1)) {
return nixio_getprotobyname(L);
} else if (lua_isnoneornil(L, 1)) {
setprotoent(1);
lua_newtable(L);
while ((res = getprotoent()) != NULL) {
nixio__pushprotoent(L, res);
lua_rawseti(L, -2, i++);
}
endprotoent();
return 1;
} else {
return luaL_argerror(L, 1, "supported values: <protoname>, <protonumber>");
}
}
/* module table */
static const luaL_reg R[] = {
{"getprotobyname", nixio_getprotobyname},
{"getprotobynumber", nixio_getprotobynumber},
{"getproto", nixio_getproto},
{NULL, NULL}
};
void nixio_open_protoent(lua_State *L) {
luaL_register(L, NULL, R);
}

View file

@ -28,7 +28,9 @@
#include <pwd.h>
#ifndef BSD
#ifndef NO_SHADOW
#include <shadow.h>
#endif
#include <crypt.h>
#endif
@ -162,6 +164,7 @@ static int nixio_getpw(lua_State *L) {
}
#ifndef BSD
#ifndef NO_SHADOW
static int nixio__push_spwd(lua_State *L, struct spwd *sp) {
lua_createtable(L, 0, 9);
lua_pushstring(L, sp->sp_namp);
@ -216,6 +219,7 @@ static int nixio_getsp(lua_State *L) {
return nixio__push_spwd(L, sp);
}
}
#endif /* !NO_SHADOW */
#endif /* !BSD */
static int nixio_crypt(lua_State *L) {
@ -239,7 +243,9 @@ static const luaL_reg R[] = {
{"getgr", nixio_getgr},
{"getpw", nixio_getpw},
#ifndef BSD
#ifndef NO_SHADOW
{"getsp", nixio_getsp},
#endif
#endif
{NULL, NULL}
};

View file

@ -3,13 +3,15 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-05-26 17:57+0200\n"
"PO-Revision-Date: 2009-05-20 23:51+0200\n"
"Last-Translator: Stefan Pirwitz <i18n@freifunk-bno.de>\n"
"PO-Revision-Date: 2011-08-07 16:59+0200\n"
"Last-Translator: Manuel <freifunk@somakoma.de>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Pootle 1.1.0\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Pootle 2.0.4\n"
#. Asterisk General Options
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:1
@ -19,7 +21,7 @@ msgstr "Grundeinstellungen für Asterisk"
#. AGI directory
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:2
msgid "AGI directory"
msgstr "AGI - Verzeichniss"
msgstr "AGI - Verzeichnis"
#. Cache recorded sound files during recording
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:3
@ -29,7 +31,6 @@ msgstr "Puffere aufgenommene Audiodateien während der Aufname."
#. Debug Level
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:4
#, fuzzy
msgid "Debug Level"
msgstr "Fehlerausgabestufe"
@ -52,24 +53,22 @@ msgstr "Hohe Priorität"
#. Initialise Crypto
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:8
msgid "Initialise Crypto"
msgstr ""
msgstr "Verschlüsselung initialisieren"
#. Use Internal Timing
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:9
msgid "Use Internal Timing"
msgstr ""
msgstr "Interne Zeitreferenz benutzen"
#. Log directory
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:10
#, fuzzy
msgid "Log directory"
msgstr "AGI - Verzeichniss"
msgstr "Log - Verzeichnis"
#. Maximum number of calls allowed
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:11
#, fuzzy
msgid "Maximum number of calls allowed"
msgstr "AGI - Verzeichniss"
msgstr "Maximale Anruferanzahl"
#. Maximum load to stop accepting new calls
#: applications/luci-asterisk/luasrc/i18n/asterisk.en.lua:12

View file

@ -1,17 +1,22 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Last-Translator: Automatically generated\n"
"PO-Revision-Date: 2011-08-07 17:01+0200\n"
"Last-Translator: Manuel <freifunk@somakoma.de>\n"
"Language-Team: none\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Pootle 2.0.4\n"
msgid ""
"With this menu you can configure network diagnostics, such as network device "
"scans and ping tests."
msgstr ""
"Hier werden die Netzwerk Diagnose Tools konfiguriert (zB. Netzwerkscans und "
"Pings)."
msgid ""
"The entries in the menu allow you to perform diagnostic tests on your system "
@ -19,7 +24,7 @@ msgid ""
msgstr ""
msgid "Configure Diagnostics"
msgstr ""
msgstr "Diagnose-Tests konfigurieren"
msgid "l_d_diag"
msgstr ""

View file

@ -3,8 +3,8 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-06-10 03:40+0200\n"
"PO-Revision-Date: 2011-06-18 10:16+0200\n"
"Last-Translator: fredb <fblistes+luci@free.fr>\n"
"PO-Revision-Date: 2011-08-07 16:47+0200\n"
"Last-Translator: Manuel <freifunk@somakoma.de>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
@ -44,7 +44,7 @@ msgid "40MHz 2nd channel above"
msgstr "Second canal de 40 MHz suivant"
msgid "40MHz 2nd channel below"
msgstr "Decond canal de 40 MHz précédent"
msgstr "Second canal de 40 MHz précédent"
msgid "5 Minute Load:"
msgstr "Charge sur 5 minutes :"
@ -2233,8 +2233,8 @@ msgid ""
"The following files are detected by the system and will be kept "
"automatically during sysupgrade"
msgstr ""
"LEs fichiers suivants ont été détectés par le système et seront "
"automatiquement< préservés pendant la mise à jour"
"Les fichiers suivants ont été détectés par le système et seront "
"automatiquement préservés pendant la mise à jour"
msgid "The following rules are currently active on this system."
msgstr "Les règles suivantes sont actuellement actives sur ce système."