Module Name:    src
Committed By:   christos
Date:           Sat Apr 11 14:42:28 UTC 2009

Modified Files:
        src/sys/kern: sys_pipe.c
        src/sys/sys: pipe.h

Log Message:
- maintain timespec internally.
- set birthtime too.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.25 -r1.26 src/sys/sys/pipe.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.109 src/sys/kern/sys_pipe.c:1.110
--- src/sys/kern/sys_pipe.c:1.109	Sat Apr  4 06:12:51 2009
+++ src/sys/kern/sys_pipe.c	Sat Apr 11 10:42:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pipe.c,v 1.109 2009/04/04 10:12:51 ad Exp $	*/
+/*	$NetBSD: sys_pipe.c,v 1.110 2009/04/11 14:42:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.109 2009/04/04 10:12:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.110 2009/04/11 14:42:28 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -349,7 +349,7 @@
 	KASSERT(pipe != NULL);
 	*pipep = pipe;
 	error = 0;
-	getmicrotime(&pipe->pipe_ctime);
+	getnanotime(&pipe->pipe_ctime);
 	pipe->pipe_atime = pipe->pipe_ctime;
 	pipe->pipe_mtime = pipe->pipe_ctime;
 	pipe->pipe_lock = mutex;
@@ -585,7 +585,7 @@
 	}
 
 	if (error == 0)
-		getmicrotime(&rpipe->pipe_atime);
+		getnanoime(&rpipe->pipe_atime);
 	pipeunlock(rpipe);
 
 unlocked_error:
@@ -1032,7 +1032,7 @@
 		error = 0;
 
 	if (error == 0)
-		getmicrotime(&wpipe->pipe_mtime);
+		getnanotime(&wpipe->pipe_mtime);
 
 	/*
 	 * We have something to offer, wake up select/poll.
@@ -1186,16 +1186,16 @@
 {
 	struct pipe *pipe = fp->f_data;
 
-	memset((void *)ub, 0, sizeof(*ub));
+	memset(ub, 0, sizeof(*ub));
 	ub->st_mode = S_IFIFO | S_IRUSR | S_IWUSR;
 	ub->st_blksize = pipe->pipe_buffer.size;
 	if (ub->st_blksize == 0 && pipe->pipe_peer)
 		ub->st_blksize = pipe->pipe_peer->pipe_buffer.size;
 	ub->st_size = pipe->pipe_buffer.cnt;
 	ub->st_blocks = (ub->st_size) ? 1 : 0;
-	TIMEVAL_TO_TIMESPEC(&pipe->pipe_atime, &ub->st_atimespec);
-	TIMEVAL_TO_TIMESPEC(&pipe->pipe_mtime, &ub->st_mtimespec);
-	TIMEVAL_TO_TIMESPEC(&pipe->pipe_ctime, &ub->st_ctimespec);
+	ub->st_atimespec = pipe->pipe_atime;
+	ub->st_mtimespec = pipe->pipe_mtime;
+	ub->st_ctimespec = ub->st_birthtimespec = pipe->pipe_ctime;
 	ub->st_uid = kauth_cred_geteuid(fp->f_cred);
 	ub->st_gid = kauth_cred_getegid(fp->f_cred);
 

Index: src/sys/sys/pipe.h
diff -u src/sys/sys/pipe.h:1.25 src/sys/sys/pipe.h:1.26
--- src/sys/sys/pipe.h:1.25	Sun Feb  1 13:23:04 2009
+++ src/sys/sys/pipe.h	Sat Apr 11 10:42:28 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: pipe.h,v 1.25 2009/02/01 18:23:04 ad Exp $ */
+/* $NetBSD: pipe.h,v 1.26 2009/04/11 14:42:28 christos Exp $ */
 
 /*
  * Copyright (c) 1996 John S. Dyson
@@ -109,9 +109,9 @@
 	struct	pipebuf pipe_buffer;	/* data storage */
 	struct	pipemapping pipe_map;	/* pipe mapping for direct I/O */
 	struct	selinfo pipe_sel;	/* for compat with select */
-	struct	timeval pipe_atime;	/* time of last access */
-	struct	timeval pipe_mtime;	/* time of last modify */
-	struct	timeval pipe_ctime;	/* time of status change */
+	struct	timespec pipe_atime;	/* time of last access */
+	struct	timespec pipe_mtime;	/* time of last modify */
+	struct	timespec pipe_ctime;	/* time of status change */
 	pid_t	pipe_pgid;		/* process group for sigio */
 	struct	pipe *pipe_peer;	/* link with other direction */
 	u_int	pipe_state;		/* pipe status info */

Reply via email to