Changeset 1648
- Timestamp:
- 07/08/08 23:09:23 (2 months ago)
- Files:
-
- nebula/trunk/ChangeLog (modified) (1 diff)
- nebula/trunk/client/nebulaclient.c (modified) (2 diffs)
- nebula/trunk/src/Makefile.am (modified) (1 diff)
- nebula/trunk/src/classify.c (modified) (2 diffs)
- nebula/trunk/src/nebula.c (modified) (3 diffs)
- nebula/trunk/src/nebula.h (modified) (2 diffs)
- nebula/trunk/src/sig.c (modified) (1 diff)
- nebula/trunk/src/signals.c (modified) (1 diff)
- nebula/trunk/src/util.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
nebula/trunk/ChangeLog
r1642 r1648 1 1 0.2.3 2 2 - enable realtime signal thread control only if available 3 - *BSD compatibility changes 4 - default host and port in nebulaclient fixed 3 5 0.2.2 4 6 - new threading concept: one clustering thread and one or more signature generation threads poll job queues nebula/trunk/client/nebulaclient.c
r1623 r1648 134 134 cbuf_len = 0; 135 135 cbuf = NULL; 136 nebula_port = 12345;136 nebula_port = 4712; 137 137 nebula_host = NULL; 138 138 dirname = NULL; … … 219 219 220 220 // prepare socket 221 if (!nebula_host && ((nebula_host = strdup("localhost")) == NULL)) { 222 fprintf(stderr, "Error - Unable to allocate memory: %s.\n", strerror(errno)); 223 exit(EXIT_FAILURE); 224 } 221 225 if ((host = gethostbyname(nebula_host)) == NULL) { 222 226 fprintf(stderr, "Error - Unable to resolve %s: %s.\n", nebula_host, strerror(errno)); nebula/trunk/src/Makefile.am
r1623 r1648 5 5 bin_PROGRAMS = nebula 6 6 nebula_SOURCES = signals.c signals.h \ 7 sem.c sem.h \ 7 8 md5.c md5.h \ 8 9 sha512.c sha512.h \ nebula/trunk/src/classify.c
r1642 r1648 44 44 45 45 for (;;) { 46 if ( sem_wait(&sessions_semaphore) == -1) {46 if (repsem_wait(&sessions_semaphore) == -1) { 47 47 fprintf(stderr, "Error - Unable to decrement semaphore: %s.\n", strerror(errno)); 48 48 exit(EXIT_FAILURE); … … 275 275 276 276 // wake up a signature generation thread 277 if ( sem_post(&siggen_semaphore) == -1) {277 if (repsem_post(&siggen_semaphore) == -1) { 278 278 fprintf(stderr, "Error - Unable to increment semaphore: %s.\n", strerror(errno)); 279 279 exit(EXIT_FAILURE); nebula/trunk/src/nebula.c
r1626 r1648 141 141 142 142 // initialize semaphore 143 if (( sem_init(&sessions_semaphore, 0, 0) == -1) ||144 ( sem_init(&sessions_semaphore, 0, 0) == -1)) {143 if ((repsem_init(&sessions_semaphore, 0, 0) == -1) || 144 (repsem_init(&sessions_semaphore, 0, 0) == -1)) { 145 145 fprintf(stderr, "Error - Unable to initialize semaphore: %s.\n", strerror(errno)); 146 146 exit(EXIT_FAILURE); … … 275 275 exit(EXIT_FAILURE); 276 276 } 277 if (pthread_create(&ntid, &ptattr, pt_pollgq, (void *) >hread_no)) {277 if (pthread_create(&ntid, &ptattr, pt_pollgq, NULL)) { 278 278 fprintf(stderr, "Error - Cannot create signature generation thread: %s.\n", strerror(errno)); 279 279 exit(EXIT_FAILURE); … … 417 417 418 418 // wake up a classification thread 419 if ( sem_post(&sessions_semaphore) == -1) {419 if (repsem_post(&sessions_semaphore) == -1) { 420 420 fprintf(stderr, "Error - Unable to increment semaphore: %s.\n", strerror(errno)); 421 421 exit(EXIT_FAILURE); nebula/trunk/src/nebula.h
r1623 r1648 28 28 29 29 #include <pthread.h> 30 #include <semaphore.h>30 //#include <semaphore.h> 31 31 32 32 #include "avl.h" 33 33 #include "cluster.h" 34 34 #include "hash.h" 35 #include "sem.h" 35 36 #include "session.h" 36 37 #include "stree.h" … … 72 73 pthread_rwlock_t sighash_trie_lock; 73 74 74 sem_t sessions_semaphore;75 sem_t siggen_semaphore;75 repsem_t sessions_semaphore; 76 repsem_t siggen_semaphore; 76 77 77 78 #endif nebula/trunk/src/sig.c
r1623 r1648 360 360 361 361 for (;;) { 362 if ( sem_wait(&siggen_semaphore) == -1) {362 if (repsem_wait(&siggen_semaphore) == -1) { 363 363 fprintf(stderr, "Error - Unable to decrement semaphore: %s.\n", strerror(errno)); 364 364 exit(EXIT_FAILURE); nebula/trunk/src/signals.c
r1642 r1648 96 96 exit(EXIT_SUCCESS); 97 97 } 98 if (sig == SIGSEGV) printf("----> segfault.\n"); 98 99 99 100 // signal indicates an error nebula/trunk/src/util.c
r1623 r1648 129 129 130 130 // destroy semaphores 131 if ( sem_getvalue(&sessions_semaphore, &i) == -1) {131 if (repsem_getvalue(&sessions_semaphore, &i) == -1) { 132 132 fprintf(stderr, "Error - Unable to get semaphore value: %s.\n", strerror(errno)); 133 133 exit(EXIT_FAILURE); 134 134 } 135 for (; i; i--) sem_wait(&sessions_semaphore);136 if ( sem_destroy(&sessions_semaphore) == -1) {135 for (; i; i--) repsem_wait(&sessions_semaphore); 136 if (repsem_destroy(&sessions_semaphore) == -1) { 137 137 fprintf(stderr, "Error - Unable to destroy semaphore: %s.\n", strerror(errno)); 138 138 exit(EXIT_FAILURE); 139 139 } 140 140 141 if ( sem_getvalue(&siggen_semaphore, &i) == -1) {141 if (repsem_getvalue(&siggen_semaphore, &i) == -1) { 142 142 fprintf(stderr, "Error - Unable to get semaphore value: %s.\n", strerror(errno)); 143 143 exit(EXIT_FAILURE); 144 144 } 145 for (; i; i--) sem_wait(&siggen_semaphore);146 if ( sem_destroy(&siggen_semaphore) == -1) {145 for (; i; i--) repsem_wait(&siggen_semaphore); 146 if (repsem_destroy(&siggen_semaphore) == -1) { 147 147 fprintf(stderr, "Error - Unable to destroy semaphore: %s.\n", strerror(errno)); 148 148 exit(EXIT_FAILURE);
