#include <sys/vfs.h>
#include <libipulog/libipulog.h>
-#include "vserver.h"
+/* #include "vserver.h" */
struct ipulog_handle {
int fd;
int fd, len;
char snum[MAX_EPOCH_SIZE];
len=snprintf(snum, MAX_EPOCH_SIZE-1,"%d", n);
- fd = open(LAST_EPOCH_FILE, O_RDWR|O_CREAT|O_TRUNC);
+ fd = open(LAST_EPOCH_FILE, O_RDWR|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
if (fd == -1) {
my_log(LOG_ERR, "open() failed: %s.The next restart will resume logging from epoch id 0.",LAST_EPOCH_FILE);
return;
system(gzip_cmd);
}
snprintf(cur_output_file,MAX_PATH_LEN,"%s.%d",fname,cur_epoch);
- if ((write_fd = open(cur_output_file, O_RDWR|O_CREAT|O_TRUNC)) < 0) {
+ if ((write_fd = open(cur_output_file, O_RDWR|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH)) < 0) {
my_log(LOG_ERR, "open(): %s (%s)\n", cur_output_file, strerror(errno));
exit(1);
}
setuser();
- //pthread_mutexattr_setprotocol(&md->MutexAttr,PTHREAD_PRIO_INHERIT);
-
for (;;) {
pthread_mutex_lock(&emit_mutex);
while (!flows_emit) {
timeout.tv_sec = now.tv_sec + emit_timeout;
/* Do not wait until emit_packet will filled - it may be too long */
if (pthread_cond_timedwait(&emit_cond, &emit_mutex, &timeout) && emit_count) {
- my_log(LOG_INFO,"Timeout: %d, %d",emit_count, timeout.tv_sec);
+ //my_log(LOG_INFO,"Timeout: %d, %d",emit_count, timeout.tv_sec);
pthread_mutex_unlock(&emit_mutex);
goto sendit;
}
/* It's going to be expensive calling this syscall on every flow.
* We should keep a local hash table, for now just bear the overhead... - Sapan*/
- flow->slice_id=0;
-
- if (ulog_msg->mark > 0) {
- flow->slice_id = xid_to_slice_id(ulog_msg->mark);
- }
+ flow->slice_id = ulog_msg->mark;
- if (flow->slice_id < 1)
- flow->slice_id = ulog_msg->mark; // Couldn't look up the slice id, let's at least store the local xid
+ /*if (flow->slice_id < 1)
+ flow->slice_id = ulog_msg->mark; // Couldn't look up the slice id, let's at least store the local xid*/
if ((flow->dip.s_addr == inet_addr("10.0.0.8")) || (flow->sip.s_addr == inet_addr("10.0.0.8"))) {
/* Initialization */
- init_slice_id_hash();
+ // init_slice_id_hash();
hash_init(); /* Actually for crc16 only */
mem_init(sizeof(struct Flow), bulk_quantity, memory_limit);
for (i = 0; i < 1 << HASH_BITS; i++) pthread_mutex_init(&flows_mutex[i], 0);