Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2007 08:50:10 GMT
From:      dongmei <dongmei@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 125132 for review
Message-ID:  <200708140850.l7E8oAVV094902@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=125132

Change 125132 by dongmei@dongmei2007 on 2007/08/14 08:49:24

	padding the before submit

Affected files ...

.. //depot/projects/soc2007/dongmei-auditanalyzer/file_access.c#2 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/gtk/list_view.c#5 edit
.. //depot/projects/soc2007/dongmei-auditanalyzer/tsess.h#2 edit

Differences ...

==== //depot/projects/soc2007/dongmei-auditanalyzer/file_access.c#2 (text+ko) ====

@@ -101,4 +101,89 @@
 	buffer_init(ts->record_buffer, 1500);
 	return ts;
 }
+/* Opens auditpipe and prepares a tsess struct. 
+  */
+tsess* tsess_open_online(int *err, char **err_info,gboolean do_random)
+{
+	struct stat statb;
+	tsess	*ts;
+	unsigned int	i;
+	gboolean use_stdin = FALSE;
 
+	if (eth_stat(DEFAULT_AUDIT_TRAIL, &statb) < 0) {
+			*err = errno;
+			return NULL;
+		}
+	if (S_ISFIFO(statb.st_mode)) {
+		/*
+		 * Opens of FIFOs are allowed only when not opening
+		 * for random access.
+		 *
+		 * XXX - currently, we do seeking when trying to find
+		 * out the file type, so we don't actually support
+		 * opening FIFOs.  However, we may eventually
+		 * do buffering that allows us to do at least some
+		 * file type determination even on pipes, so we
+		 * allow FIFO opens and let things fail later when
+		 * we try to seek.
+		 */
+		if (do_random) {
+			*err = TSESS_ERR_RANDOM_OPEN_PIPE;
+			return NULL;
+		}
+	} else if (S_ISDIR(statb.st_mode)) {
+		/*
+		 * Return different errors for "this is a directory"
+		 * and "this is some random special file type", so
+		 * the user can get a potentially more helpful error.
+		 */
+		*err = EISDIR;
+		return NULL;
+	}
+
+	/*
+	 * We need two independent descriptors for random access, so
+	 * they have different file positions.  If we're opening the
+	 * standard input, we can only dup it to get additional
+	 * descriptors, so we can't have two independent descriptors,
+	 * and thus can't do random access.
+	 */
+	errno = ENOMEM;
+	ts = g_malloc(sizeof(ts));
+	if (ts == NULL) {
+		*err = errno;
+		return NULL;
+	}
+
+	/* Open the file */
+	errno =TSESS_ERR_CANT_OPEN;
+	ts->fd = eth_open(DEFAULT_AUDIT_TRAIL, O_RDONLY|O_BINARY, 0000 /* no creation so don't matter */);
+	if (ts->fd < 0) {
+		*err = errno;
+		g_free(ts);
+		return NULL;
+	}
+	if (!(ts->fh = filed_open(ts->fd, "rb"))) {
+		*err = errno;
+		eth_close(ts->fd);
+		g_free(ts);
+		return NULL;
+	}
+
+	if (do_random) {
+		if (!(ts->random_fh = file_open(DEFAULT_AUDIT_TRAIL, "rb"))) {
+			*err = errno;
+			file_close(ts->fh);
+			g_free(ts);
+			return NULL;
+		}
+	} else
+		ts->random_fh = NULL;
+
+	/* initialization */
+	ts->data_offset = 0;
+
+	ts->record_buffer = g_malloc(sizeof(struct Buffer));
+	buffer_init(ts->record_buffer, 1500);
+	return ts;
+}

==== //depot/projects/soc2007/dongmei-auditanalyzer/gtk/list_view.c#5 (text+ko) ====

@@ -169,6 +169,23 @@
 	timestr[24] = '\0'; /* No new line */
 	return 0;
 }
+void
+record_list_append_test(gint32 number)
+{
+	GtkTreeIter iter;
+	/* add data to the list store */
+	
+	gtk_list_store_append (record_list, &iter);
+	
+		gtk_list_store_set (record_list, &iter,
+		  COLUMN_NUMBER, number,
+		  COLUMN_CREATE_TIME,"",
+		  COLUMN_MS,"",
+		  COLUMN_EVENT,"",
+		  COLUMN_VERSION,"",
+		  COLUMN_RECORD_LEN,0,
+		  -1);
+}
 
 void
 record_list_append(tokenstr_t *data,gint number)

==== //depot/projects/soc2007/dongmei-auditanalyzer/tsess.h#2 (text+ko) ====

@@ -4,6 +4,7 @@
 #include <glib.h>
 
 #define FILE_T	FILE *
+#define DEFAULT_AUDIT_TRAIL		"/dev/auditpipe"
 
 typedef struct tsess {
 	FILE_T			fh;
@@ -17,6 +18,7 @@
 
 tsess* tsess_open_offline(const char *filename, int *err, char **err_info,gboolean do_random);
 gint64 tsess_file_size(tsess *ts, int *err);
+tsess* tsess_open_online(int *err, char **err_info,gboolean do_random);
 
 /*
  * tsess error codes.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708140850.l7E8oAVV094902>