Skip to content

Commit

Permalink
Makefiles aligned with each other. Some new build rules. Smarter
Browse files Browse the repository at this point in the history
Makefiles for optional modules.  Log notices should be standardized
throughout the system.
  • Loading branch information
kriston committed Aug 15, 2000
1 parent 7f23eb1 commit 62f20af
Show file tree
Hide file tree
Showing 22 changed files with 357 additions and 517 deletions.
16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2000-08-15 Kriston J. Rehberg <[email protected]>

* nsext: Ten guesses why $(NSHOME)/include/nsextmsg.h was
duplicated here.

* nssybpd: Hopefully, the log statements will be easier to
understand by both admins and developers. It's still messy since
it uses syslog. Makefile redone to use standard AOLserver rules.
RPATH is used a little more intelligently. Removed files that had
no business living there.

* include/Makefile.global: Took stab at RPATH support on Solaris
to perhaps remove the need for LD_LIBRARY_PATH on an
intelligenly-administered system. New rule for libnspd.a.


2000-08-14 Kriston J. Rehberg <[email protected]>

* Makefile: nsvhr has been resurrected and enjoys our full
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include $(NSHOME)/include/Makefile.global
# Choose the modules you want and put them in the MODULES variable below.
# A typical web server might load nssock, nslog, and nsperm.
#
# nssock -- serves HTTP and HTTPS
# nssock -- serves HTTP (nssock) and HTTPS (nsssl)
# nscgi -- CGI module
# nscp -- Control port remote administration interface
# nslog -- Common log format module
Expand All @@ -34,9 +34,8 @@ include $(NSHOME)/include/Makefile.global
# nssolid -- Solid driver (requires Solid library)
#

MODULES = nssock nscgi nscp nslog nsperm nsext nspd nsftp nsvhr
#MODULES = nspostgres nssybpd nssolid nsunix

MODULES = nssock nscgi nscp nslog nsperm nsext nspd \
nsftp nsunix nsvhr nspostgres nssybpd nssolid

#
# AOLserver main executable statically-links the thread and tcl libraries.
Expand Down
12 changes: 10 additions & 2 deletions include/Makefile.global
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ AR = ar
ARFLAGS = rv
RANLIB = true

#
# RPATH is only used by some platforms (so far).
#
RPATH = $(PREFIX)/lib:/usr/local/aolserver/lib:/opt/aolserver/lib:/usr/local/lib

#
# Auto-detect the platform
#
Expand Down Expand Up @@ -128,7 +133,7 @@ ifeq (SunOS,$(shell uname))
# LDSO=$(LD) -G
CFLAGS+=-D_POSIX_PTHREAD_SEMANTICS -fPIC -Wall -Wno-unused
NSDLIBS=-lm
LIBS+=-lsocket -lnsl -ldl -lposix4 -lpthread -lresolv
LIBS+=-lsocket -lnsl -ldl -lposix4 -lpthread -lresolv -R $(RPATH)
LD=/usr/ccs/bin/ld
AR=/usr/ccs/bin/ar
CFLAGS+=-DUSE_PTHREAD_SYSSCOPE=1 -DUSE_DUPHIGH=1 -DHAVE_FORK1=1
Expand Down Expand Up @@ -290,6 +295,9 @@ LIBTCL8X=$(NSHOME)/$(TCL8X_DIR)/unix/$(TCL8X_LIB)
#
all:

libnspd: $(NSHOME)/nspd/libnspd.a
(cd $(NSHOME)/nspd && $(MAKE) all)

libtcl76:
(cd $(NSHOME)/$(TCL76_DIR) && $(MAKE) all)

Expand All @@ -302,7 +310,7 @@ libtcl8x:
libtcl8x-clean:
(cd $(NSHOME)/$(TCL8X_DIR) && $(MAKE) clean)

libnsthread:
libnsthread: $(NSHOME)/thread/libnsthread.a
(cd $(NSHOME)/thread && $(MAKE) all)

libnsthread-clean:
Expand Down
4 changes: 3 additions & 1 deletion nscgi/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

NSHOME = ..

#
# Module name
#
Expand All @@ -9,5 +11,5 @@ MOD = nscgi.so
#
OBJS = nscgi.o

include ../include/Makefile.module
include $(NSHOME)/include/Makefile.module

34 changes: 16 additions & 18 deletions nscgi/nscgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/


static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscgi/nscgi.c,v 1.3 2000/08/02 23:38:25 kriston Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscgi/nscgi.c,v 1.4 2000/08/15 20:24:33 kriston Exp $, compiled: " __DATE__ " " __TIME__;

#include "ns.h"
#include <sys/stat.h>
Expand Down Expand Up @@ -207,8 +207,8 @@ Ns_ModuleInit(char *server, char *module)
if (!initialized) {
devNull = open(DEVNULL, O_RDONLY);
if (devNull < 0) {
Ns_Log(Error, "%s: open(%s) failed: %s",
module, DEVNULL, strerror(errno));
Ns_Log(Error, "nscgi: open(%s) failed: %s",
DEVNULL, strerror(errno));
return NS_ERROR;
}
Ns_DupHigh(&devNull);
Expand Down Expand Up @@ -755,7 +755,7 @@ CgiFree(Cgi *cgiPtr)
*/

if (cgiPtr->pid != -1 && Ns_WaitProcess(cgiPtr->pid) != NS_OK) {
Ns_Log(Error, "CgiFree: wait for %s failed: %s",
Ns_Log(Error, "nscgi: wait for %s failed: %s",
cgiPtr->exec, strerror(errno));
}
}
Expand Down Expand Up @@ -974,8 +974,7 @@ CgiExec(Cgi *cgiPtr, Ns_Conn *conn)
*/

if (pipe(opipe) != 0) {
Ns_Log(Error, "%s: pipe() failed: %s",
cgiPtr->modPtr->module, strerror(errno));
Ns_Log(Error, "nscgi: pipe() failed: %s", strerror(errno));
return NS_ERROR;
}
Ns_CloseOnExec(opipe[0]);
Expand Down Expand Up @@ -1025,8 +1024,8 @@ CgiRead(Cgi *cgiPtr)
if (n > 0) {
cgiPtr->cnt = n;
} else if (n < 0) {
Ns_Log(Error, "%s: pipe read() from %s failed: %s",
cgiPtr->modPtr->module, cgiPtr->exec, strerror(errno));
Ns_Log(Error, "nscgi: pipe read() from %s failed: %s",
cgiPtr->exec, strerror(errno));
}
return n;
}
Expand Down Expand Up @@ -1247,7 +1246,7 @@ CgiRegister(Mod *modPtr, char *map)
method = ds1.string;
url = NextWord(method);
if (*method == '\0' || *url == '\0') {
Ns_Log(Error, "%s: invalid mapping: %s", modPtr->module, map);
Ns_Log(Error, "nscgi: invalid mapping: %s", map);
goto done;
}

Expand All @@ -1258,7 +1257,7 @@ CgiRegister(Mod *modPtr, char *map)
Ns_NormalizePath(&ds2, path);
path = ds2.string;
if (!Ns_PathIsAbsolute(path) || access(path, R_OK) != 0) {
Ns_Log(Error, "%s: invalid directory: %s", modPtr->module, path);
Ns_Log(Error, "nscgi: invalid directory: %s", path);
goto done;
}
}
Expand All @@ -1267,8 +1266,8 @@ CgiRegister(Mod *modPtr, char *map)
mapPtr->modPtr = modPtr;
mapPtr->url = ns_strdup(url);
mapPtr->path = ns_strcopy(path);
Ns_Log(Notice, "%s: %s %s%s%s",
modPtr->module, method, url, path ? " -> " : "", path ? path : "");
Ns_Log(Notice, "nscgi: %s %s%s%s",
method, url, path ? " -> " : "", path ? path : "");
Ns_RegisterRequest(modPtr->server, method, url,
CgiRequest, CgiFreeMap, mapPtr, 0);

Expand Down Expand Up @@ -1421,7 +1420,7 @@ CgiGetTmp(Mod *modPtr)
Ns_DStringInit(&ds);
tmp = Ns_MakePath(&ds, modPtr->tmpdir, "cgi.XXXXXX", NULL);
if (mktemp(tmp) == NULL || tmp[0] == '\0') {
Ns_Log(Error, "CgiGetTemp: %s: mktemp(%s) failed: %s",
Ns_Log(Error, "nscgi: %s: mktemp(%s) failed: %s",
modPtr->server, tmp, strerror(errno));
} else {
int flags = O_RDWR|O_CREAT|O_TRUNC;
Expand All @@ -1432,8 +1431,8 @@ CgiGetTmp(Mod *modPtr)
#else
fd = open(tmp, flags, 0600);
if (fd >= 0 && unlink(tmp) != 0) {
Ns_Log(Error, "CgiGetTmp: "
"unlink(%s) failed: %s", tmp, strerror(errno));
Ns_Log(Error, "nscgi: unlink(%s) failed: %s",
tmp, strerror(errno));
close(fd);
fd = -1;
}
Expand All @@ -1443,9 +1442,8 @@ CgiGetTmp(Mod *modPtr)
}
#endif
if (fd < 0) {
Ns_Log(Error, "CgiGetTmp: "
"could not open temp file %s: %s",
modPtr->server, tmp, strerror(errno));
Ns_Log(Error, "nscgi: could not open temp file %s: %s",
tmp, strerror(errno));
} else {
tmpPtr = ns_malloc(sizeof(Tmp));
tmpPtr->nextPtr = NULL;
Expand Down
4 changes: 3 additions & 1 deletion nscp/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

NSHOME = ..

#
# Module name
#
Expand All @@ -10,5 +12,5 @@ MOD = nscp.so
OBJS = nscp.o


include ../include/Makefile.module
include $(NSHOME)/include/Makefile.module

14 changes: 7 additions & 7 deletions nscp/nscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Tcl commands.
*/

static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.3 2000/08/02 23:38:25 kriston Exp $, compiled: " __DATE__ " " __TIME__;
static const char *RCSID = "@(#) $Header: /Users/dossy/Desktop/cvs/aolserver/nscp/nscp.c,v 1.4 2000/08/15 20:24:33 kriston Exp $, compiled: " __DATE__ " " __TIME__;

#include "ns.h"

Expand Down Expand Up @@ -106,10 +106,10 @@ Ns_ModuleInit(char *s, char *module)
}
lsock = Ns_SockListen(addr, port);
if (lsock == INVALID_SOCKET) {
Ns_Log(Error, "%s: could not listen on %s:%d", module, addr, port);
Ns_Log(Error, "nscp: could not listen on %s:%d", addr, port);
return NS_ERROR;
}
Ns_Log(Notice, "%s: listening on %s:%d", module, addr, port);
Ns_Log(Notice, "nscp: listening on %s:%d", addr, port);
Ns_RegisterProcInfo(AcceptProc, "nscp", ArgProc);
Ns_SockCallback(lsock, AcceptProc, NULL, NS_SOCK_READ|NS_SOCK_EXIT);

Expand All @@ -132,18 +132,18 @@ Ns_ModuleInit(char *s, char *module)
if (STRIEQ(key, "user")) {
pass = strchr(user, ':');
if (pass == NULL) {
Ns_Log(Error, "%s: invalid user entry: %s", module, user);
Ns_Log(Error, "nscp: invalid user entry: %s", user);
continue;
}
} else if (!STRIEQ(key, "permuser")) {
Ns_Log(Error, "%s: invalid user key: %s", module, key);
Ns_Log(Error, "nscp: invalid user key: %s", key);
continue;
}
if (pass != NULL) {
*pass = '\0';
}
hPtr = Tcl_CreateHashEntry(&users, user, &new);
Ns_Log(Notice, "%s: added user: %s", module, user);
Ns_Log(Notice, "nscp: added user: %s", user);
if (pass != NULL) {
*pass++ = ':';
end = strchr(pass, ':');
Expand All @@ -158,7 +158,7 @@ Ns_ModuleInit(char *s, char *module)
Tcl_SetHashValue(hPtr, pass);
}
if (users.numEntries == 0) {
Ns_Log(Warning, "%s: no authorized users", module);
Ns_Log(Warning, "nscp: no authorized users");
}

return NS_OK;
Expand Down
8 changes: 6 additions & 2 deletions nsext/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

NSHOME = ..

#
# Module name
#
Expand All @@ -12,8 +14,10 @@ OBJS = nsext.o nsextmsg.o
#
# Header files
#
HDRS = nsextmsg.h
# Note: nsextmsg.h lives in AOLserver's include directory
#
HDRS = $(NSHOME)/include/nsextmsg.h


include ../include/Makefile.module
include $(NSHOME)/include/Makefile.module

Loading

0 comments on commit 62f20af

Please sign in to comment.