OBS User unknown 2007-01-15 22:49:03 +00:00 committed by Git OBS Bridge
commit 6ba5006c90
10 changed files with 513 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,88 @@
--- cgi-fcgi/cgi-fcgi.c
+++ cgi-fcgi/cgi-fcgi.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
#include "fcgi_config.h"
@@ -145,7 +146,7 @@
static int bytesToRead; /* number of bytes to read from Web Server */
-static int appServerSock = -1; /* Socket connected to FastCGI application,
+static size_t appServerSock = -1; /* Socket connected to FastCGI application,
* used by AppServerReadHandler and
* AppServerWriteHandler. */
static Buffer fromAS; /* Bytes read from the FCGI application server. */
@@ -640,7 +641,7 @@
}
if((av[ac] = (char *)malloc(strlen(tp1)+1)) == NULL) {
fprintf(stderr, "Cannot allocate %d bytes\n",
- strlen(tp1)+1);
+ (int)strlen(tp1)+1);
exit(-1);
}
strcpy(av[ac++], tp1);
--- examples/threaded.c
+++ examples/threaded.c
@@ -24,7 +24,7 @@
static void *doit(void *a)
{
- int rc, i, thread_id = (int)a;
+ size_t rc, i, thread_id = (size_t)a;
pid_t pid = getpid();
FCGX_Request request;
char *server_name;
@@ -53,7 +53,7 @@
"<h1>FastCGI Hello! (multi-threaded C, fcgiapp library)</h1>"
"Thread %d, Process %ld<p>"
"Request counts for %d threads running on host <i>%s</i><p><code>",
- thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
+ (int)thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
sleep(2);
@@ -71,7 +71,7 @@
int main(void)
{
- int i;
+ size_t i;
pthread_t id[THREAD_COUNT];
FCGX_Init();
--- include/fcgios.h
+++ include/fcgios.h
@@ -93,7 +93,7 @@
# if defined(__STDC__) || defined(__cplusplus)
typedef void *ClientData;
# else
- typedef int *ClientData;
+ typedef size_t *ClientData;
# endif /* __STDC__ */
#define _CLIENTDATA
#endif
--- libfcgi/os_unix.c
+++ libfcgi/os_unix.c
@@ -1155,7 +1155,7 @@
for (;;) {
do {
-#ifdef HAVE_SOCKLEN
+#ifdef HAVE_SYS_SOCKET_H
socklen_t len = sizeof(sa);
#else
int len = sizeof(sa);
@@ -1255,7 +1255,7 @@
struct sockaddr_in in;
struct sockaddr_un un;
} sa;
-#ifdef HAVE_SOCKLEN
+#ifdef HAVE_SYS_SOCKET_H
socklen_t len = sizeof(sa);
#else
int len = sizeof(sa);

View File

@ -0,0 +1,33 @@
--- cgi-fcgi/Makefile.am
+++ cgi-fcgi/Makefile.am
@@ -2,7 +2,7 @@
bin_PROGRAMS = cgi-fcgi
INCLUDEDIR = ../include
-CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
+AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \
$(INCLUDEDIR)/fcgiapp.h \
--- examples/Makefile.am
+++ examples/Makefile.am
@@ -11,7 +11,7 @@
EXTRA_PROGRAMS = threaded echo-cpp
INCLUDEDIR = ../include
-CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
+AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \
$(INCLUDEDIR)/fcgiapp.h \
--- libfcgi/Makefile.am
+++ libfcgi/Makefile.am
@@ -1,7 +1,7 @@
# $Id: Makefile.am,v 1.9 2001/12/22 03:16:20 robs Exp $
INCLUDEDIR = ../include
-CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
+AM_CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include
INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \
$(INCLUDEDIR)/fcgiapp.h \

View File

@ -0,0 +1,121 @@
Index: cgi-fcgi/cgi-fcgi.c
===================================================================
--- cgi-fcgi/cgi-fcgi.c.orig
+++ cgi-fcgi/cgi-fcgi.c
@@ -22,6 +22,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <sys/wait.h>
+#include <signal.h>
#include "fcgi_config.h"
@@ -583,7 +585,7 @@
#define MAXARGS 16
static int ParseArgs(int argc, char *argv[],
int *doBindPtr, int *doStartPtr,
- char *connectPathPtr, char *appPathPtr, int *nServersPtr) {
+ char *connectPathPtr, char *appPathPtr, int *nServersPtr, int *doDaemonPtr) {
int i,
x,
err = 0,
@@ -599,6 +601,7 @@
*connectPathPtr = '\0';
*appPathPtr = '\0';
*nServersPtr = 0;
+ *doDaemonPtr = TRUE;
for(i = 0; i < MAXARGS; i++)
av[i] = NULL;
@@ -649,7 +652,7 @@
}
}
err = ParseArgs(ac, av, doBindPtr, doStartPtr,
- connectPathPtr, appPathPtr, nServersPtr);
+ connectPathPtr, appPathPtr, nServersPtr, doDaemonPtr);
for(x = 1; x < ac; x++) {
ASSERT(av[x] != NULL);
free(av[x]);
@@ -673,7 +676,9 @@
} else {
strcpy(connectPathPtr, argv[i]);
}
- } else {
+ } else if(!strcmp(argv[i], "-supervise")) {
+ *doDaemonPtr = FALSE;
+ } else {
fprintf(stderr, "Unknown option %s\n", argv[i]);
err++;
}
@@ -718,6 +723,15 @@
return err;
}
+void handle_shutdown(int s)
+{
+ /* Kill our children processes */
+ signal(s, SIG_IGN);
+ kill(0, s);
+
+ exit(0);
+}
+
int main(int argc, char **argv)
{
char **envp = environ;
@@ -728,20 +742,22 @@
int headerLen, valueLen;
char *equalPtr;
FCGI_BeginRequestRecord beginRecord;
- int doBind, doStart, nServers;
+ int doBind, doStart, nServers, doDaemon;
char appPath[MAXPATHLEN], bindPath[MAXPATHLEN];
+ int pid;
if(ParseArgs(argc, argv, &doBind, &doStart,
- (char *) &bindPath, (char *) &appPath, &nServers)) {
+ (char *) &bindPath, (char *) &appPath, &nServers, &doDaemon)) {
fprintf(stderr,
"Usage:\n"
" cgi-fcgi -f <cmdPath> , or\n"
" cgi-fcgi -connect <connName> <appPath> [<nServers>] , or\n"
-" cgi-fcgi -start -connect <connName> <appPath> [<nServers>] , or\n"
+" cgi-fcgi -start -connect [-supervise] <connName> <appPath> [<nServers>] , or\n"
" cgi-fcgi -bind -connect <connName> ,\n"
"where <connName> is either the pathname of a UNIX domain socket\n"
"or (if -bind is given) a hostName:portNumber specification\n"
-"or (if -start is given) a :portNumber specification (uses local host).\n");
+"or (if -start is given) a :portNumber specification (uses local host).\n"
+"-supervise is for running with runit or daemontools.\n");
exit(1);
}
@@ -757,12 +773,27 @@
bytesToRead = 0;
}
+ /* Become a process group leader */
+ setsid();
+
+ /* Register our signal handler */
+ signal(SIGHUP, handle_shutdown);
+ signal(SIGINT, handle_shutdown);
+ signal(SIGTERM, handle_shutdown);
+
if(doBind) {
appServerSock = OS_FcgiConnect(bindPath);
}
if(doStart && (!doBind || appServerSock < 0)) {
FCGI_Start(bindPath, appPath, nServers);
if(!doBind) {
+ if(!doDaemon) {
+ for(pid=nServers; pid != 0; pid--) {
+ wait(0);
+ }
+ }
+ signal(SIGTERM, SIG_IGN);
+ kill(0, SIGTERM);
exit(0);
} else {
appServerSock = OS_FcgiConnect(bindPath);

47
FastCGI.changes Normal file
View File

@ -0,0 +1,47 @@
-------------------------------------------------------------------
Fri Oct 20 03:27:49 CEST 2006 - mrueckert@suse.de
- remove perl_make_install for now ... i wont build for fedora
any time soon.
-------------------------------------------------------------------
Fri Sep 15 10:37:47 CEST 2006 - mrueckert@suse.de
- add perl_make_install for all distros other than suse.
-------------------------------------------------------------------
Fri Sep 8 03:02:47 CEST 2006 - mrueckert@suse.de
- add README.supervise
- small spec file cleanup
-------------------------------------------------------------------
Thu Sep 7 16:42:33 CEST 2006 - mrueckert@suse.de
- applied patch from
http://rubyists.com/articles/2005/05/03/spawn-fcgi-in-the-foreground
to run fastcgi application in foreground this is useful for tools
like runit/daemontools/initng
-------------------------------------------------------------------
Thu Aug 24 07:00:16 CEST 2006 - mrueckert@suse.de
- run ldconfig
-------------------------------------------------------------------
Wed Mar 8 04:11:07 CET 2006 - mrueckert@suse.de
- readded gcc-c++ to the BuildRequires
Seems it got lost in the automatic BuildRequires conversion.
fixes C++ bindings.
-------------------------------------------------------------------
Wed Jan 25 21:31:12 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Wed Aug 17 14:39:21 CEST 2005 - mrueckert@suse.de
- Initial package with version 2.4.0

158
FastCGI.spec Normal file
View File

@ -0,0 +1,158 @@
#
# spec file for package FastCGI (Version 2.4.0)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: FastCGI
Version: 2.4.0
Release: 23
#
Group: Development/Languages/C and C++
License: Other uncritical OpenSource License
#
BuildRequires: gcc-c++
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
URL: http://www.fastcgi.com
Source: http://www.fastcgi.com/dist/fcgi.tar.bz2
Source1: README.supervise
Patch0: FastCGI-makefile.am_cppflags.patch
Patch1: FastCGI-clientdata_pointer.patch
Patch2: FastCGI-supervise_cgi-fcgi.patch
#
Summary: A Scalable, Open Extension to CGI
%description
FastCGI is a language-independent, scalable, open extension to CGI that
provides high performance without the limitations of server-specific
APIs.
%package devel
Group: Development/Languages/C and C++
Summary: A scalable, open extension to CGI
Requires: %{name} = %{version}
Requires: glibc-devel
%description devel
FastCGI is a language independent, scalable, open extension to CGI that
provides high performance without the limitations of server specific
APIs.
%package -n perl-FastCGI
Group: Development/Languages/C and C++
Summary: A scalable, open extension to CGI
Requires: %{name} = %{version}
%description -n perl-FastCGI
FastCGI is a language independent, scalable, open extension to CGI that
provides high performance without the limitations of server specific
APIs.
%prep
%setup -n fcgi-%{version}
%patch0
%patch1
%patch2
touch NEWS AUTHORS ChangeLog COPYING
find doc/{fastcgi-prog-guide,fastcgi-whitepaper} -type f -print0 | xargs -r0 chmod 0644
%build
autoreconf -fi
%configure --includedir=%{_includedir}/fastcgi
%{__make} all
pushd perl
%configure --includedir=%{_includedir}/fastcgi
%{__perl} Makefile.PL
%{__make} all
popd
%install
%makeinstall
pushd perl
%perl_make_install
%perl_process_packlist
popd
pushd examples
%{__make} clean
popd
%{__install} -Dd -m 0755 \
%{buildroot}%{_mandir}/man{1,3}/ \
%{buildroot}%{_docdir}/%{name}/examples/
%{__install} -m 0644 examples/* %{buildroot}%{_docdir}/%{name}/examples/
%{__install} -m 0644 doc/*.1 %{buildroot}%{_mandir}/man1/
%{__install} -m 0644 doc/*.3 %{buildroot}%{_mandir}/man3/
%{__install} -m 0644 doc/*.htm* doc/*.gif LICENSE.TERMS README \
%{buildroot}%{_docdir}/%{name}/
%{__install} -m 0644 perl/README %{buildroot}%{_docdir}/%{name}/README.perl
%{__install} -m 0644 perl/ChangeLog %{buildroot}%{_docdir}/%{name}/ChangeLog.perl
%{__cp} -vr doc/{fastcgi-prog-guide,fastcgi-whitepaper} java %{S:1} \
%{buildroot}%{_docdir}/%{name}/
%clean
%{__rm} -rf %{buildroot};
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%{_bindir}/cgi-fcgi
%{_libdir}/libfcgi*.so*
%{_mandir}/man1/*.1.gz
%doc %{_docdir}/%{name}
%files devel
%defattr(-,root,root)
%{_libdir}/libfcgi*.a
%{_libdir}/libfcgi*.la
%dir %{_includedir}/fastcgi/
%{_includedir}/fastcgi/*
%{_mandir}/man3/*.3.gz
%files -n perl-FastCGI
%defattr(-,root,root)
%{_mandir}/man3/*.3pm.gz
%{perl_vendorarch}/FCGI.pm
%dir %{perl_vendorarch}/auto/FCGI
%{perl_vendorarch}/auto/FCGI/*.*
%{perl_vendorarch}/auto/FCGI/.packlist
%{_var}/adm/perl-modules/%{name}
%changelog -n FastCGI
* Fri Oct 20 2006 - mrueckert@suse.de
- remove perl_make_install for now ... i wont build for fedora
any time soon.
* Fri Sep 15 2006 - mrueckert@suse.de
- add perl_make_install for all distros other than suse.
* Fri Sep 08 2006 - mrueckert@suse.de
- add README.supervise
- small spec file cleanup
* Thu Sep 07 2006 - mrueckert@suse.de
- applied patch from
http://rubyists.com/articles/2005/05/03/spawn-fcgi-in-the-foreground
to run fastcgi application in foreground this is useful for tools
like runit/daemontools/initng
* Thu Aug 24 2006 - mrueckert@suse.de
- run ldconfig
* Wed Mar 08 2006 - mrueckert@suse.de
- readded gcc-c++ to the BuildRequires
Seems it got lost in the automatic BuildRequires conversion.
fixes C++ bindings.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Aug 17 2005 - mrueckert@suse.de
- Initial package with version 2.4.0

39
README.supervise Normal file
View File

@ -0,0 +1,39 @@
taken from http://rubyists.com/articles/2005/05/03/spawn-fcgi-in-the-foreground:
spawn-fcgi in the foreground!
by Bougyman Tue, 03 May 2005 11:00:00 GMT
Been looking for a clean way to spawn fastcgi listeners in the foreground and I
believe Trey has figured it out. This patch should take care of it by keeping
spawn-fcgi from losing track of the copied listening processes and allow full
supervison. To use, call your cgi-fcgi -start -connect $host:$port script with
the -supervise option, like:
cgi-fcgi -start -supervise -connect 127.0.0.1:1791 /path/to/dispatch.fcgi
Full Supervise run script becomes
#!/bin/sh
RAIL_NUMBER=$(basename $PWD|awk -F'-' '{print $2}')
RAILS_HOST=$(<env/RAILS_HOST)
RAILS_ROOT=$(<env/RAILS_ROOT)
RAILS_PORT=179$RAIL_NUMBER
exec envdir ./env \
cgi-fcgi -supervise -start -connect \
$RAILS_HOST:$RAILS_PORT \
$RAILS_ROOT/public/dispatch.fcgi
This would be in a script called run in your ~/service/someapp-$RAIL_NUMBER
directory, where $RAIL_NUMBER is 1-99. The references to ./env require a
directory named env to be set up in the same directory as the run script.
This should have at least 3 files in it:
RAILS_ROOT => contains one line that is the full path to your rails root directory.
RAILS_ENV => contains one word, either production or development
RAILS_HOST => contains one IP address or FQDN
You can set any other environment variables in this way by simply creating a
file with the variable name and its contents will become the value of that
environment variable. Because of the envdir ./env call before the cgi-fcgi
call, your rails application has access to any variables set in this way.

3
fcgi.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b06a3f9e7e693d26bbe85ae3c20b968ad29c0f5db4a21187991d174f17aa56d5
size 376749

0
ready Normal file
View File