diff --git a/ChangeLog b/ChangeLog
index 9e2b426029..12c99f651b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -815,4 +815,5 @@
load_ and exec_module() in a more familiar manner. It is not consistent
with more standard exec() functions, however, because (1) it returns
and (2) it requires symbol table arguments.
+ * lib/: Add fileno()
diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html
index f1bf734e98..0f4459c15e 100644
--- a/Documentation/NuttX.html
+++ b/Documentation/NuttX.html
@@ -1488,6 +1488,7 @@ nuttx-0.4.10 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
load_ and exec_module() in a more familiar manner. It is not consistent
with more standard exec() functions, however, because (1) it returns
and (2) it requires symbol table arguments.
+ * lib/: Add fileno()
nuttx-0.4.10 2009-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/Documentation/NuttxPortingGuide.html b/Documentation/NuttxPortingGuide.html
index 9acd622cdd..5c5b49ef1b 100644
--- a/Documentation/NuttxPortingGuide.html
+++ b/Documentation/NuttxPortingGuide.html
@@ -12,7 +12,7 @@
NuttX RTOS Porting Guide
- Last Updated: July 11, 2009
+ Last Updated: July 12, 2009
@@ -2347,6 +2347,117 @@ extern void up_ledoff(int led);
+THTTPD
+
+ -
+
CONFIG_THTTPD_PORT: THTTPD Server port number
+
+ -
+
CONFIG_THTTPD_IPADDR: Server IP address (no host name)
+
+ -
+
CONFIG_THTTPD_SERVER_ADDRESS: SERVER_ADDRESS: response
+
+ -
+
CONFIG_THTTPD_SERVER_SOFTWARE: SERVER_SOFTWARE: response
+
+ -
+
CONFIG_THTTPD_CGI_PATH:
+
+ -
+
CONFIG_THTTPD_CGI_PATTERN: Only CGI programs matching this
+ pattern will be executed. In fact, if this value is not defined
+ then no CGI logic will be built.
+
+ -
+
CONFIG_THTTPD_CGI_PRIORITY: Provides the priority of CGI child tasks
+
+ -
+
CONFIG_THTTPD_CGI_STACKSIZE: Provides the initial stack size of
+ CGI child task (will be overridden by the stack size in the NXFLAT
+ header)
+
+ -
+
CONFIG_THTTPD_CGI_BYTECOUNT: Byte output limit for CGI tasks.
+
+ -
+
CONFIG_THTTPD_CGI_TIMELIMIT: How many seconds to allow CGI programs
+ to run before killing them.
+
+ -
+
CONFIG_THTTPD_CGI_OUTFD: In NuttX, CGI cannot use stdout for output.
+ Rather, it must use this file descriptor number.
+
+ -
+
CONFIG_THTTPD_CHARSET- The default character set name to use with
+ text MIME types.
+
+ -
+
CONFIG_THTTPD_IOBUFFERSIZE:
+
+ -
+
CONFIG_THTTPD_INDEX_NAMES: A list of index filenames to check. The
+ files are searched for in this order.
+
+ -
+
CONFIG_AUTH_FILE: The file to use for authentication. If this is
+ defined then thttpd checks for this file in the local directory
+ before every fetch. If the file exists then authentication is done,
+ otherwise the fetch proceeds as usual. If you leave this undefined
+ then thttpd will not implement authentication at all and will not
+ check for auth files, which saves a bit of CPU time. A typical
+ value is ".htpasswd&quout;
+
+ -
+
CONFIG_THTTPD_LISTEN_BACKLOG: The listen() backlog queue length.
+
+ -
+
CONFIG_THTTPD_LINGER_MSEC: How many milliseconds to leave a connection
+ open while doing a lingering close.
+
+ -
+
CONFIG_THTTPD_OCCASIONAL_MSEC: How often to run the occasional
+ cleanup job.
+
+ -
+
CONFIG_THTTPD_IDLE_READ_LIMIT_SEC: How many seconds to allow for
+ reading the initial request on a new connection.
+
+ -
+
CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC: How many seconds before an
+ idle connection gets closed.
+
+ -
+
CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2: Tilde mapping.
+ Many URLs use ~username to indicate a user's home directory. thttpd
+ provides two options for mapping this construct to an actual filename.
+
+ -
+ Map ~username to <prefix>/username. This is the recommended choice.
+ Each user gets a subdirectory in the main web tree, and the tilde
+ construct points there. The prefix could be something like "users",
+ or it could be empty.
+
+ -
+ Map ~username to <user's homedir>/<postfix>. The postfix would be
+ the name of a subdirectory off of the user's actual home dir,
+ something like "public_html".
+
+
+ You can also leave both options undefined, and thttpd will not do
+ anything special about tildes. Enabling both options is an error.
+ Typical values, if they're defined, are "users" for
+ CONFIG_THTTPD_TILDE_MAP1 and "public_html" forCONFIG_THTTPD_TILDE_MAP2.
+
+ -
+
CONFIG_THTTPD_GENERATE_INDICES
+
+ -
+
CONFIG_THTTPD_URLPATTERN: If defined, then it will be used to match
+ and verify referrers.
+
+
+
USB Device-Side Support
USB Device Controller Driver
diff --git a/binfmt/binfmt_exec.c b/binfmt/binfmt_exec.c
index 8a25445c02..2305f6d638 100644
--- a/binfmt/binfmt_exec.c
+++ b/binfmt/binfmt_exec.c
@@ -96,24 +96,23 @@ int exec(FAR const char *filename, FAR const char **argv,
{
struct binary_s bin;
int ret;
- int i;
memset(&bin, 0, sizeof(struct binary_s));
bin.filename = filename;
bin.exports = exports;
- bin.nexports = NEXPORTS;
+ bin.nexports = nexports;
ret = load_module(&bin);
if (ret < 0)
{
- bdbg("ERROR: Failed to load program '%s'\n", dirlist[i]);
+ bdbg("ERROR: Failed to load program '%s'\n", filename);
return ERROR;
}
ret = exec_module(&bin, 50);
if (ret < 0)
{
- bdbg("ERROR: Failed to execute program '%s'\n", dirlist[i]);
+ bdbg("ERROR: Failed to execute program '%s'\n", filename);
unload_module(&bin);
return ERROR;
}
diff --git a/configs/README.txt b/configs/README.txt
index 04833669b0..9c23b9d923 100644
--- a/configs/README.txt
+++ b/configs/README.txt
@@ -353,6 +353,63 @@ defconfig -- This is a configuration file similar to the Linux
CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
+ THTTPD:
+ CONFIG_THTTPD_PORT - THTTPD Server port number
+ CONFIG_THTTPD_IPADDR - Server IP address (no host name)
+ CONFIG_THTTPD_SERVER_ADDRESS - SERVER_ADDRESS: response
+ CONFIG_THTTPD_SERVER_SOFTWARE - SERVER_SOFTWARE: response
+ CONFIG_THTTPD_CGI_PATH -
+ CONFIG_THTTPD_CGI_PATTERN - Only CGI programs matching this
+ pattern will be executed. In fact, if this value is not defined
+ then no CGI logic will be built.
+ CONFIG_THTTPD_CGI_PRIORITY - Provides the priority of CGI child tasks
+ CONFIG_THTTPD_CGI_STACKSIZE - Provides the initial stack size of
+ CGI child task (will be overridden by the stack size in the NXFLAT
+ header)
+ CONFIG_THTTPD_CGI_BYTECOUNT - Byte output limit for CGI tasks.
+ CONFIG_THTTPD_CGI_TIMELIMIT - How many seconds to allow CGI programs
+ to run before killing them.
+ CONFIG_THTTPD_CGI_OUTFD - In NuttX, CGI cannot use stdout for output.
+ Rather, it must use this file descriptor number.
+ CONFIG_THTTPD_CHARSET- The default character set name to use with
+ text MIME types.
+ CONFIG_THTTPD_IOBUFFERSIZE -
+ CONFIG_THTTPD_INDEX_NAMES - A list of index filenames to check. The
+ files are searched for in this order.
+ CONFIG_AUTH_FILE - The file to use for authentication. If this is
+ defined then thttpd checks for this file in the local directory
+ before every fetch. If the file exists then authentication is done,
+ otherwise the fetch proceeds as usual. If you leave this undefined
+ then thttpd will not implement authentication at all and will not
+ check for auth files, which saves a bit of CPU time. A typical
+ value is ".htpasswd"
+ CONFIG_THTTPD_LISTEN_BACKLOG - The listen() backlog queue length.
+ CONFIG_THTTPD_LINGER_MSEC - How many milliseconds to leave a connection
+ open while doing a lingering close.
+ CONFIG_THTTPD_OCCASIONAL_MSEC - How often to run the occasional
+ cleanup job.
+ CONFIG_THTTPD_IDLE_READ_LIMIT_SEC - How many seconds to allow for
+ reading the initial request on a new connection.
+ CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC - How many seconds before an
+ idle connection gets closed.
+ CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2 - Tilde mapping.
+ Many URLs use ~username to indicate a user's home directory. thttpd
+ provides two options for mapping this construct to an actual filename.
+ 1) Map ~username to /username. This is the recommended choice.
+ Each user gets a subdirectory in the main web tree, and the tilde
+ construct points there. The prefix could be something like "users",
+ or it could be empty.
+ 2) Map ~username to /. The postfix would be
+ the name of a subdirectory off of the user's actual home dir,
+ something like "public_html".
+ You can also leave both options undefined, and thttpd will not do
+ anything special about tildes. Enabling both options is an error.
+ Typical values, if they're defined, are "users" for
+ CONFIG_THTTPD_TILDE_MAP1 and "public_html"forCONFIG_THTTPD_TILDE_MAP2.
+ CONFIG_THTTPD_GENERATE_INDICES
+ CONFIG_THTTPD_URLPATTERN - If defined, then it will be used to match
+ and verify referrers.
+
USB device controller driver
CONFIG_USBDEV - Enables USB device support
CONFIG_USBDEV_ISOCHRONOUS - Build in extra support for isochronous
diff --git a/include/stdio.h b/include/stdio.h
index 9528600e75..728c1d634a 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -106,6 +106,7 @@ EXTERN int fclose(FAR FILE *stream);
EXTERN int fflush(FAR FILE *stream);
EXTERN int feof(FAR FILE *stream);
EXTERN int ferror(FAR FILE *stream);
+EXTERN int fileno(FAR FILE *stream);
EXTERN int fgetc(FAR FILE *stream);
EXTERN int fgetpos(FAR FILE *stream, FAR fpos_t *pos);
EXTERN char *fgets(FAR char *s, int n, FAR FILE *stream);
diff --git a/lib/Makefile b/lib/Makefile
index 0255234ac8..27fdd3b0cb 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -53,7 +53,7 @@ STRING_SRCS = lib_checkbase.c lib_isbasedigit.c lib_memset.c lib_memcpy.c \
CTYPE_SRCS =
-STDIO_SRCS = lib_printf.c lib_rawprintf.c lib_lowprintf.c \
+STDIO_SRCS = lib_fileno.c lib_printf.c lib_rawprintf.c lib_lowprintf.c \
lib_sprintf.c lib_snprintf.c lib_libsprintf.c lib_vsprintf.c \
lib_vsnprintf.c lib_libvsprintf.c lib_meminstream.c \
lib_memoutstream.c lib_lowinstream.c lib_lowoutstream.c \
diff --git a/lib/lib_fileno.c b/lib/lib_fileno.c
new file mode 100644
index 0000000000..b917989748
--- /dev/null
+++ b/lib/lib_fileno.c
@@ -0,0 +1,65 @@
+/****************************************************************************
+ * lib/lib_fileno.c
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "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
+ * COPYRIGHT OWNER OR CONTRIBUTORS 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include
+#include
+
+#include
+#include
+
+/****************************************************************************
+ * Global Functions
+ ****************************************************************************/
+
+int ileno(FAR FILE *stream)
+{
+ int ret = -1;
+ if (stream)
+ {
+ ret = stream->fs_filedes;
+ }
+
+ if (ret < 0)
+ {
+ errno = EBADF;
+ return ERROR;
+ }
+ return ret;
+}
+