Changeset a50432366e0c6614924558d1aa82eaa82b967a0b
- Timestamp:
- 04/25/08 18:20:34
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1209147634 +0000
- git-parent:
[d67a38b6a56900457dc690b2dd62cbd081dca6aa]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1209147634 +0000
- Message:
compiles on linux -- still no eventer, refs #12
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4b96846 |
ra504323 |
|
| 28 | 28 | fi |
|---|
| 29 | 29 | |
|---|
| | 30 | CPPFLAGS='-I$(top_srcdir)/src' |
|---|
| | 31 | |
|---|
| 30 | 32 | case $host in |
|---|
| 31 | 33 | *-*-darwin*) |
|---|
| 32 | 34 | PICFLAGS="-fPIC" |
|---|
| 33 | 35 | MODULELD="$CC -bundle -flat_namespace -undefined suppress" |
|---|
| | 36 | SHLD="$CC -dynamiclib -flat_namespace -undefined suppress" |
|---|
| 34 | 37 | MODULEEXT=bundle |
|---|
| | 38 | RLDFLAG="-Wl,--rpath=" |
|---|
| 35 | 39 | ;; |
|---|
| 36 | 40 | *-*-solaris*) |
|---|
| 37 | 41 | PICFLAGS="-Kpic" |
|---|
| 38 | 42 | MODULELD="$CC -G" |
|---|
| | 43 | SHLD="$CC -G" |
|---|
| 39 | 44 | MODULEEXT=so |
|---|
| | 45 | RLDFLAG="-R" |
|---|
| 40 | 46 | ;; |
|---|
| 41 | 47 | *-*-openbsd*) |
|---|
| … | … | |
| 43 | 49 | LDFLAGS="$LDFLAGS -Wl,-E" |
|---|
| 44 | 50 | MODULELD="$CC -shared" |
|---|
| | 51 | SHLD="$CC -shared" |
|---|
| 45 | 52 | MODULEEXT=so |
|---|
| 46 | 53 | LDFLAGS="$LDFLAGS -L/usr/local/lib" |
|---|
| 47 | 54 | CFLAGS="$CFLAGS -I/usr/local/include -I/usr/local/include/postgresql" |
|---|
| | 55 | RLDFLAG="-Wl,--rpath=" |
|---|
| | 56 | ;; |
|---|
| | 57 | *-*-linux*) |
|---|
| | 58 | CPPFLAGS="$CPPFLAGS -D__USE_XOPEN" |
|---|
| | 59 | PICFLAGS="-fpic" |
|---|
| | 60 | MODULELD="$CC -shared" |
|---|
| | 61 | SHLD="$CC -shared" |
|---|
| | 62 | MODULEEXT=so |
|---|
| | 63 | RLDFLAG="-Wl,--rpath=" |
|---|
| 48 | 64 | ;; |
|---|
| 49 | 65 | *) |
|---|
| … | … | |
| 51 | 67 | MODULELD="$CC -shared" |
|---|
| 52 | 68 | MODULEEXT=so |
|---|
| | 69 | RLDFLAG="-Wl,--rpath=" |
|---|
| 53 | 70 | ;; |
|---|
| 54 | 71 | esac |
|---|
| | 72 | AC_SUBST(SHLD) |
|---|
| | 73 | AC_SUBST(RLDFLAG) |
|---|
| 55 | 74 | AC_SUBST(MODULELD) |
|---|
| 56 | 75 | AC_SUBST(MODULEEXT) |
|---|
| … | … | |
| 103 | 122 | ] |
|---|
| 104 | 123 | ) |
|---|
| | 124 | |
|---|
| | 125 | SERVERINC=`pg_config --includedir-server` |
|---|
| | 126 | CFLAGS="-I$SERVERINC" |
|---|
| 105 | 127 | AC_TRY_LINK([ |
|---|
| 106 | 128 | #include <libpq-fe.h> |
|---|
| … | … | |
| 199 | 221 | ctype.h unistd.h time.h sys/stat.h sys/event.h libkern/OSAtomic.h \ |
|---|
| 200 | 222 | term.h termio.h termios.h curses.h sys/cdefs.h pwd.h netinet/in_systm.h \ |
|---|
| 201 | | util.h sys/time.h sys/mman.h) |
|---|
| | 223 | sys/ioctl_compat.h util.h sys/time.h sys/mman.h) |
|---|
| 202 | 224 | |
|---|
| 203 | 225 | AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [ |
|---|
| … | … | |
| 211 | 233 | if test "x$ac_cv_have_kqueue" = "xyes" ; then |
|---|
| 212 | 234 | AC_DEFINE(HAVE_KQUEUE) |
|---|
| | 235 | EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.o" |
|---|
| 213 | 236 | have_kqueue=1 |
|---|
| 214 | 237 | fi |
|---|
| 215 | 238 | |
|---|
| | 239 | AC_SUBST(EVENTER_OBJS) |
|---|
| 216 | 240 | |
|---|
| 217 | 241 | AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ |
|---|
| … | … | |
| 368 | 392 | AC_SUBST(mansubdir) |
|---|
| 369 | 393 | |
|---|
| 370 | | CPPFLAGS='-I$(top_srcdir)/src' |
|---|
| 371 | 394 | SHCFLAGS="$PICFLAGS $CFLAGS" |
|---|
| 372 | 395 | AC_SUBST(SHCFLAGS) |
|---|
| … | … | |
| 402 | 425 | src/eventer/Makefile |
|---|
| 403 | 426 | src/jlog/Makefile |
|---|
| | 427 | src/jlog/perl/Makefile.PL |
|---|
| 404 | 428 | src/modules/Makefile |
|---|
| 405 | 429 | src/utils/Makefile |
|---|
| ref59bc7 |
ra504323 |
|
| 24 | 24 | top_srcdir=@top_srcdir@ |
|---|
| 25 | 25 | |
|---|
| 26 | | SUBS=utils jlog eventer modules noitedit |
|---|
| | 26 | SUBS=utils eventer modules noitedit |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | NOIT_OBJS=noitd.o noit_listener.o \ |
|---|
| … | … | |
| 39 | 39 | all: noitd stratcond |
|---|
| 40 | 40 | |
|---|
| 41 | | make-subdirs: serf/.libs/libserf-0.a |
|---|
| | 41 | make-subdirs: serf/.libs/libserf-0.o jlog/libjlog.a |
|---|
| 42 | 42 | for dir in $(SUBS) ; do \ |
|---|
| 43 | 43 | (cd $$dir && make) ; \ |
|---|
| 44 | 44 | done |
|---|
| 45 | 45 | |
|---|
| | 46 | jlog/libjlog.a: |
|---|
| | 47 | (cd jlog && make libjlog.a) |
|---|
| | 48 | |
|---|
| 46 | 49 | serf/.libs/libserf-0.a: |
|---|
| 47 | 50 | (cd serf && python serfmake) |
|---|
| | 51 | |
|---|
| | 52 | serf/.libs/libserf-0.o: serf/.libs/libserf-0.a |
|---|
| | 53 | ld -r -o serf/.libs/libserf-0.o \ |
|---|
| | 54 | serf/.libs/context.o serf/buckets/.libs/*.o |
|---|
| 48 | 55 | |
|---|
| 49 | 56 | noitd: make-subdirs $(NOIT_OBJS) |
|---|
| ref59bc7 |
ra504323 |
|
| 11 | 11 | |
|---|
| 12 | 12 | OBJS= eventer.o eventer_impl.o \ |
|---|
| 13 | | eventer_kqueue_impl.o \ |
|---|
| | 13 | @EVENTER_OBJS@ \ |
|---|
| 14 | 14 | eventer_POSIX_fd_opset.o \ |
|---|
| 15 | 15 | eventer_SSL_fd_opset.o \ |
|---|
| r4b96846 |
ra504323 |
|
| 23 | 23 | |
|---|
| 24 | 24 | postgres.@MODULEEXT@: postgres.lo |
|---|
| 25 | | @$(MODULELD) $(LDFLAGS) -o $@ postgres.lo @SERFLIBS@ ../serf/.libs/libserf-0.a $(PGLIBS) -lz -lssl -lcrypto |
|---|
| | 25 | @$(MODULELD) $(LDFLAGS) -o $@ postgres.lo @SERFLIBS@ $(PGLIBS) -lz -lssl -lcrypto |
|---|
| 26 | 26 | @echo "- linking $@" |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | http.@MODULEEXT@: http.lo |
|---|
| 29 | | @$(MODULELD) $(LDFLAGS) -o $@ http.lo @SERFLIBS@ ../serf/.libs/libserf-0.a -lz -lssl -lcrypto |
|---|
| | 29 | @$(MODULELD) $(LDFLAGS) -o $@ http.lo @SERFLIBS@ ../serf/.libs/libserf-0.o -lz -lssl -lcrypto |
|---|
| 30 | 30 | @echo "- linking $@" |
|---|
| 31 | 31 | |
|---|
| r4b96846 |
ra504323 |
|
| 19 | 19 | #include <netinet/ip_icmp.h> |
|---|
| 20 | 20 | #include <math.h> |
|---|
| | 21 | #ifndef MAXFLOAT |
|---|
| | 22 | #include <float.h> |
|---|
| | 23 | #define MAXFLOAT FLT_MAX |
|---|
| | 24 | #endif |
|---|
| 21 | 25 | |
|---|
| 22 | 26 | #include "noit_module.h" |
|---|
| r900807d |
ra504323 |
|
| 47 | 47 | #undef HAVE_TERMIO_H |
|---|
| 48 | 48 | #undef HAVE_TERMIOS_H |
|---|
| | 49 | #undef HAVE_SYS_IOCTL_COMPAT_H |
|---|
| 49 | 50 | #undef HAVE_UTIL_H |
|---|
| 50 | 51 | #undef HAVE_CURSES_H |
|---|
| r2962688 |
ra504323 |
|
| 17 | 17 | #endif |
|---|
| 18 | 18 | #include <arpa/telnet.h> |
|---|
| | 19 | #include <signal.h> |
|---|
| 19 | 20 | |
|---|
| 20 | 21 | #include "eventer/eventer.h" |
|---|
| r1d69a01 |
ra504323 |
|
| 38 | 38 | #include <ctype.h> |
|---|
| 39 | 39 | #include <sys/ioctl.h> |
|---|
| | 40 | #ifdef HAVE_SYS_IOCTL_COMPAT_H |
|---|
| 40 | 41 | #include <sys/ioctl_compat.h> |
|---|
| | 42 | #endif |
|---|
| 41 | 43 | #include <arpa/telnet.h> |
|---|
| 42 | 44 | #include "noit_console.h" |
|---|
| … | … | |
| 591 | 593 | #endif |
|---|
| 592 | 594 | #else |
|---|
| | 595 | #ifdef EXTPROC |
|---|
| 593 | 596 | return(termbuf.c_lflag & EXTPROC); |
|---|
| | 597 | #endif |
|---|
| 594 | 598 | #endif |
|---|
| 595 | 599 | } |
|---|
| r065b034 |
ra504323 |
|
| 44 | 44 | #include <arpa/telnet.h> |
|---|
| 45 | 45 | #include <sys/ioctl.h> |
|---|
| | 46 | #ifdef HAVE_IOCTL_COMPAT_H |
|---|
| 46 | 47 | #include <sys/ioctl_compat.h> |
|---|
| | 48 | #endif |
|---|
| 47 | 49 | #ifdef HAVE_TERMIOS_H |
|---|
| 48 | 50 | #include <termios.h> |
|---|
| r5c5207e |
ra504323 |
|
| 51 | 51 | #endif |
|---|
| 52 | 52 | |
|---|
| | 53 | #ifdef HAVE_TERMIO_H |
|---|
| | 54 | #define USE_TERMIO |
|---|
| 53 | 55 | #endif |
|---|
| | 56 | |
|---|
| | 57 | #endif |
|---|
| r61a834e |
ra504323 |
|
| 9 | 9 | #include <errno.h> |
|---|
| 10 | 10 | #include <sys/time.h> |
|---|
| | 11 | #include <sys/types.h> |
|---|
| 11 | 12 | #include <sys/socket.h> |
|---|
| 12 | 13 | #include <sys/ioctl.h> |
|---|
| … | … | |
| 156 | 157 | struct sockaddr_in addr4; |
|---|
| 157 | 158 | struct sockaddr_in6 addr6; |
|---|
| 158 | | struct sockaddr_un unix; |
|---|
| | 159 | struct sockaddr_un addru; |
|---|
| 159 | 160 | } s; |
|---|
| 160 | 161 | const char *event_name; |
|---|
| … | … | |
| 221 | 222 | } |
|---|
| 222 | 223 | } |
|---|
| 223 | | strncpy(s.unix.sun_path, host, sizeof(s.unix.sun_path)-1); |
|---|
| 224 | | sockaddr_len = sizeof(s.unix); |
|---|
| | 224 | strncpy(s.addru.sun_path, host, sizeof(s.addru.sun_path)-1); |
|---|
| | 225 | sockaddr_len = sizeof(s.addru); |
|---|
| 225 | 226 | } |
|---|
| 226 | 227 | else { |
|---|
| rbce2dd5 |
ra504323 |
|
| 12 | 12 | #include <unistd.h> |
|---|
| 13 | 13 | #include <netinet/in.h> |
|---|
| | 14 | #include <sys/un.h> |
|---|
| 14 | 15 | #include <arpa/inet.h> |
|---|
| 15 | 16 | #include <libpq-fe.h> |
|---|
| … | … | |
| 90 | 91 | __get_conn_q_for_remote(struct sockaddr *remote) { |
|---|
| 91 | 92 | conn_q *cq; |
|---|
| 92 | | if(noit_hash_retrieve(&ds_conns, (const char *)remote, remote->sa_len, |
|---|
| 93 | | (void **)&cq)) |
|---|
| | 93 | int len = 0; |
|---|
| | 94 | switch(remote->sa_family) { |
|---|
| | 95 | case AF_INET: len = sizeof(struct sockaddr_in); break; |
|---|
| | 96 | case AF_INET6: len = sizeof(struct sockaddr_in6); break; |
|---|
| | 97 | case AF_UNIX: len = SUN_LEN(((struct sockaddr_un *)remote)); break; |
|---|
| | 98 | default: return NULL; |
|---|
| | 99 | } |
|---|
| | 100 | if(noit_hash_retrieve(&ds_conns, (const char *)remote, len, (void **)&cq)) |
|---|
| 94 | 101 | return cq; |
|---|
| 95 | 102 | cq = calloc(1, sizeof(*cq)); |
|---|
| 96 | | cq->remote = malloc(remote->sa_len); |
|---|
| 97 | | memcpy(cq->remote, remote, remote->sa_len); |
|---|
| | 103 | cq->remote = malloc(len); |
|---|
| | 104 | memcpy(cq->remote, remote, len); |
|---|
| 98 | 105 | cq->jobq = calloc(1, sizeof(*cq->jobq)); |
|---|
| 99 | 106 | eventer_jobq_init(cq->jobq); |
|---|
| … | … | |
| 101 | 108 | /* Add one thread */ |
|---|
| 102 | 109 | eventer_jobq_increase_concurrency(cq->jobq); |
|---|
| 103 | | noit_hash_store(&ds_conns, (const char *)cq->remote, cq->remote->sa_len, cq); |
|---|
| | 110 | noit_hash_store(&ds_conns, (const char *)cq->remote, len, cq); |
|---|
| 104 | 111 | return cq; |
|---|
| 105 | 112 | } |
|---|
| r78d7296 |
ra504323 |
|
| 336 | 336 | |
|---|
| 337 | 337 | /* Initiate a connection */ |
|---|
| 338 | | ctx->r.remote.sa_len = ctx->remote_len; |
|---|
| 339 | 338 | rv = connect(fd, &ctx->r.remote, ctx->remote_len); |
|---|
| 340 | 339 | if(rv == -1 && errno != EINPROGRESS) goto reschedule; |
|---|