PERFORCE change 92789 for review

Robert Watson rwatson at FreeBSD.org
Sun Mar 5 07:45:26 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=92789

Change 92789 by rwatson at rwatson_peppercorn on 2006/03/05 15:45:02

	Define a new API, au_to_header32_tm(), which adds a struct timeval
	argument to the ordinary au_to_header32(), which is now implemented
	by wrapping au_to_header32_tm() and calling gettimeofday().
	#ifndef KERNEL the APIs that invoke gettimeofday(), rather than
	having a variable definition.  Don't try to retrieve time zone
	information using gettimeofday(), as it's not needed, and
	introduces possible failure modes.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/HISTORY#5 edit
.. //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#16 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#26 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#45 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/HISTORY#5 (text+ko) ====

@@ -13,6 +13,13 @@
 - Modify au_to_file() so that it accepts a timeval in user space, not just
   kernel -- this is not a Solaris BSM API so can be modified without
   causing compatibility issues.
+- Define a new API, au_to_header32_tm(), which adds a struct timeval
+  argument to the ordinary au_to_header32(), which is now implemented by
+  wrapping au_to_header32_tm() and calling gettimeofday().  #ifndef KERNEL
+  the APIs that invoke gettimeofday(), rather than having a variable
+  definition.  Don't try to retrieve time zone information using
+  gettimeofday(), as it's not needed, and introduces possible failure
+  modes.
 
 OpenBSM 1.0 alpha 5
 
@@ -140,4 +147,4 @@
   to support reloading of kernel event table.
 - Allow comments in /etc/security configuration files.
 
-$P4: //depot/projects/trustedbsd/openbsm/HISTORY#4 $
+$P4: //depot/projects/trustedbsd/openbsm/HISTORY#5 $

==== //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#16 (text+ko) ====

@@ -30,7 +30,7 @@
  *
  * @APPLE_BSD_LICENSE_HEADER_END@
  *
- * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#15 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_record.h#16 $
  */
 
 #ifndef _BSM_AUDIT_RECORD_H_
@@ -240,17 +240,14 @@
 
 token_t	*au_to_file(char *file, struct timeval tm);
 
-#if defined(KERNEL) || defined(_KERNEL)
-token_t	*au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod,
+token_t	*au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
 	    struct timeval tm);
-token_t	*au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod,
-	    struct timeval tm);
-#else
+#if !defined(KERNEL) && !defined(_KERNEL)
 token_t	*au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod);
 token_t	*au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod);
+token_t	*au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod);
 #endif
 
-token_t	*au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod);
 token_t	*au_to_me(void);
 token_t	*au_to_arg(char n, char *text, uint32_t v);
 token_t	*au_to_arg32(char n, char *text, uint32_t v);

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#26 (text+ko) ====

@@ -30,7 +30,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#25 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_audit.c#26 $
  */
 
 #include <sys/types.h>

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#45 (text+ko) ====

@@ -30,7 +30,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#44 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#45 $
  */
 
 #include <sys/types.h>
@@ -1112,24 +1112,13 @@
  * milliseconds of time    4 bytes/8 bytes (32-bit/64-bit value)
  */
 token_t *
-#if defined(KERNEL) || defined(_KERNEL)
-au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod,
+au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,
     struct timeval tm)
-#else
-au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod)
-#endif
 {
 	token_t *t;
 	u_char *dptr = NULL;
 	u_int32_t timems;
-#if !defined(KERNEL) && !defined(_KERNEL)
-	struct timeval tm;
-	struct timezone tzp;
 
-	if (gettimeofday(&tm, &tzp) == -1)
-		return (NULL);
-#endif
-
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int32_t) +
 	    sizeof(u_char) + 2 * sizeof(u_int16_t) + 2 * sizeof(u_int32_t));
 	if (t == NULL)
@@ -1149,7 +1138,18 @@
 	return (t);
 }
 
+#if !defined(KERNEL) && !defined(_KERNEL)
 token_t *
+au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod)
+{
+	struct timeval tm;
+
+	if (gettimeofday(&tm, NULL) == -1)
+		return (NULL);
+	return (au_to_header32_tm(rec_size, e_type, e_mod, tm));
+}
+
+token_t *
 au_to_header64(__unused int rec_size, __unused au_event_t e_type,
     __unused au_emod_t e_mod)
 {
@@ -1164,6 +1164,7 @@
 
 	return (au_to_header32(rec_size, e_type, e_mod));
 }
+#endif
 
 /*
  * token ID                1 byte


More information about the p4-projects mailing list