mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
added vfork()
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@127 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
parent
1d263c9ab4
commit
69003c01ac
@ -89,6 +89,15 @@ config CONFIG_HTTP_LUA_PREFIX
|
|||||||
The location of Lua's installation prefix. This is also necessary for
|
The location of Lua's installation prefix. This is also necessary for
|
||||||
Lua's cgi launcher application.
|
Lua's cgi launcher application.
|
||||||
|
|
||||||
|
config CONFIG_HTTP_LUA_CGI_LAUNCHER
|
||||||
|
string "CGI launcher location"
|
||||||
|
default "/bin/cgi.exe" if CONFIG_PLATFORM_CYGWIN
|
||||||
|
default "/bin/cgi" if !CONFIG_PLATFORM_CYGWIN
|
||||||
|
depends on CONFIG_HTTP_ENABLE_LUA
|
||||||
|
help
|
||||||
|
The location of LUA's CGI launcher application (after
|
||||||
|
the CONFIG_HTTP_LUA_PREFIX)
|
||||||
|
|
||||||
config CONFIG_HTTP_BUILD_LUA
|
config CONFIG_HTTP_BUILD_LUA
|
||||||
bool "Build Lua"
|
bool "Build Lua"
|
||||||
default n
|
default n
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#ifdef CONFIG_HTTP_HAS_IPV6
|
#ifdef CONFIG_HTTP_HAS_IPV6
|
||||||
#define HAVE_IPV6
|
#define HAVE_IPV6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAXPOSTDATASIZE 30000
|
#define MAXPOSTDATASIZE 30000
|
||||||
#define MAXREQUESTLENGTH 256
|
#define MAXREQUESTLENGTH 256
|
||||||
#define BLOCKSIZE 4096
|
#define BLOCKSIZE 4096
|
||||||
|
@ -175,9 +175,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#if defined(CONFIG_HTTP_HAS_CGI)
|
#if defined(CONFIG_HTTP_HAS_CGI)
|
||||||
addcgiext(CONFIG_HTTP_CGI_EXTENSIONS);
|
addcgiext(CONFIG_HTTP_CGI_EXTENSIONS);
|
||||||
printf("addcgiext %s\n",CONFIG_HTTP_CGI_EXTENSIONS);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_HTTP_VERBOSE)
|
#if defined(CONFIG_HTTP_VERBOSE)
|
||||||
|
#if defined(CONFIG_HTTP_HAS_CGI)
|
||||||
|
printf("addcgiext %s\n", CONFIG_HTTP_CGI_EXTENSIONS);
|
||||||
|
#endif
|
||||||
printf("%s: listening on ports %d (http) and %d (https)\n",
|
printf("%s: listening on ports %d (http) and %d (https)\n",
|
||||||
server_version, CONFIG_HTTP_PORT, CONFIG_HTTP_HTTPS_PORT);
|
server_version, CONFIG_HTTP_PORT, CONFIG_HTTP_HTTPS_PORT);
|
||||||
TTY_FLUSH();
|
TTY_FLUSH();
|
||||||
@ -191,7 +194,6 @@ int main(int argc, char *argv[])
|
|||||||
setuid(32767);
|
setuid(32767);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_HTTP_IS_DAEMON
|
#ifdef CONFIG_HTTP_IS_DAEMON
|
||||||
fprintf(stderr, "ERR: fork is not working on uclinux\n");
|
|
||||||
if (fork() > 0) /* parent will die */
|
if (fork() > 0) /* parent will die */
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
|
25
httpd/proc.c
25
httpd/proc.c
@ -672,11 +672,11 @@ static void proccgi(struct connstruct *cn)
|
|||||||
TTY_FLUSH();
|
TTY_FLUSH();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef EMBED
|
|
||||||
|
/*
|
||||||
|
* use vfork() instead of fork() for performance
|
||||||
|
*/
|
||||||
if ((pid = vfork()) > 0) /* parent */
|
if ((pid = vfork()) > 0) /* parent */
|
||||||
#else
|
|
||||||
if ((pid = fork()) > 0) /* parent */
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Send POST query data to CGI script */
|
/* Send POST query data to CGI script */
|
||||||
if ((cn->reqtype == TYPE_POST) && (cn->content_length > 0))
|
if ((cn->reqtype == TYPE_POST) && (cn->content_length > 0))
|
||||||
@ -698,7 +698,7 @@ static void proccgi(struct connstruct *cn)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid < 0) /* fork failed */
|
if (pid < 0) /* vfork failed */
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
/* The problem child... */
|
/* The problem child... */
|
||||||
@ -772,7 +772,7 @@ static void proccgi(struct connstruct *cn)
|
|||||||
if (cgi_index >= CGI_ARG_SIZE)
|
if (cgi_index >= CGI_ARG_SIZE)
|
||||||
{
|
{
|
||||||
printf("Content-type: text/plain\n\nToo many CGI args\n");
|
printf("Content-type: text/plain\n\nToo many CGI args\n");
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy across the pointer indexes */
|
/* copy across the pointer indexes */
|
||||||
@ -786,7 +786,7 @@ static void proccgi(struct connstruct *cn)
|
|||||||
|
|
||||||
execve(myargs[0], myargs, cgiptr);
|
execve(myargs[0], myargs, cgiptr);
|
||||||
printf("Content-type: text/plain\n\nshouldn't get here\n");
|
printf("Content-type: text/plain\n\nshouldn't get here\n");
|
||||||
exit(1);
|
_exit(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,15 +969,8 @@ static void buildactualfile(struct connstruct *cn)
|
|||||||
* end as we need the directory name.
|
* end as we need the directory name.
|
||||||
*/
|
*/
|
||||||
if (cn->is_lua)
|
if (cn->is_lua)
|
||||||
#ifdef CONFIG_PLATFORM_CYGWIN
|
sprintf(cn->actualfile, "%s%s", CONFIG_HTTP_LUA_PREFIX,
|
||||||
sprintf(cn->actualfile, "%s/bin/cgi.exe", CONFIG_HTTP_LUA_PREFIX);
|
CONFIG_HTTP_LUA_CGI_LAUNCHER);
|
||||||
#else
|
|
||||||
#ifdef EMBED
|
|
||||||
sprintf(cn->actualfile, "%s", CONFIG_HTTP_LUA_PREFIX);
|
|
||||||
#else
|
|
||||||
sprintf(cn->actualfile, "%s/bin/cgi", CONFIG_HTTP_LUA_PREFIX);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user