Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2010 19:28:02 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r207007 - head/sys/compat/freebsd32
Message-ID:  <201004211928.o3LJS2Tl046005@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Apr 21 19:28:01 2010
New Revision: 207007
URL: http://svn.freebsd.org/changeset/base/207007

Log:
  Extract the code to copy-out struct rusage32 from struct rusage
  into the new function.
  
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/freebsd32/freebsd32_util.h

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_misc.c	Wed Apr 21 19:03:34 2010	(r207006)
+++ head/sys/compat/freebsd32/freebsd32_misc.c	Wed Apr 21 19:28:01 2010	(r207007)
@@ -129,6 +129,28 @@ static int freebsd32_kevent_copyin(void 
 #define RETVAL_LO 0	
 #endif
 
+void
+freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32)
+{
+
+	TV_CP(*s, *s32, ru_utime);
+	TV_CP(*s, *s32, ru_stime);
+	CP(*s, *s32, ru_maxrss);
+	CP(*s, *s32, ru_ixrss);
+	CP(*s, *s32, ru_idrss);
+	CP(*s, *s32, ru_isrss);
+	CP(*s, *s32, ru_minflt);
+	CP(*s, *s32, ru_majflt);
+	CP(*s, *s32, ru_nswap);
+	CP(*s, *s32, ru_inblock);
+	CP(*s, *s32, ru_oublock);
+	CP(*s, *s32, ru_msgsnd);
+	CP(*s, *s32, ru_msgrcv);
+	CP(*s, *s32, ru_nsignals);
+	CP(*s, *s32, ru_nvcsw);
+	CP(*s, *s32, ru_nivcsw);
+}
+
 int
 freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
 {
@@ -146,22 +168,7 @@ freebsd32_wait4(struct thread *td, struc
 	if (uap->status != NULL)
 		error = copyout(&status, uap->status, sizeof(status));
 	if (uap->rusage != NULL && error == 0) {
-		TV_CP(ru, ru32, ru_utime);
-		TV_CP(ru, ru32, ru_stime);
-		CP(ru, ru32, ru_maxrss);
-		CP(ru, ru32, ru_ixrss);
-		CP(ru, ru32, ru_idrss);
-		CP(ru, ru32, ru_isrss);
-		CP(ru, ru32, ru_minflt);
-		CP(ru, ru32, ru_majflt);
-		CP(ru, ru32, ru_nswap);
-		CP(ru, ru32, ru_inblock);
-		CP(ru, ru32, ru_oublock);
-		CP(ru, ru32, ru_msgsnd);
-		CP(ru, ru32, ru_msgrcv);
-		CP(ru, ru32, ru_nsignals);
-		CP(ru, ru32, ru_nvcsw);
-		CP(ru, ru32, ru_nivcsw);
+		freebsd32_rusage_out(&ru, &ru32);
 		error = copyout(&ru32, uap->rusage, sizeof(ru32));
 	}
 	return (error);
@@ -755,22 +762,7 @@ freebsd32_getrusage(struct thread *td, s
 	if (error)
 		return (error);
 	if (uap->rusage != NULL) {
-		TV_CP(s, s32, ru_utime);
-		TV_CP(s, s32, ru_stime);
-		CP(s, s32, ru_maxrss);
-		CP(s, s32, ru_ixrss);
-		CP(s, s32, ru_idrss);
-		CP(s, s32, ru_isrss);
-		CP(s, s32, ru_minflt);
-		CP(s, s32, ru_majflt);
-		CP(s, s32, ru_nswap);
-		CP(s, s32, ru_inblock);
-		CP(s, s32, ru_oublock);
-		CP(s, s32, ru_msgsnd);
-		CP(s, s32, ru_msgrcv);
-		CP(s, s32, ru_nsignals);
-		CP(s, s32, ru_nvcsw);
-		CP(s, s32, ru_nivcsw);
+		freebsd32_rusage_out(&s, &s32);
 		error = copyout(&s32, uap->rusage, sizeof(s32));
 	}
 	return (error);

Modified: head/sys/compat/freebsd32/freebsd32_util.h
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_util.h	Wed Apr 21 19:03:34 2010	(r207006)
+++ head/sys/compat/freebsd32/freebsd32_util.h	Wed Apr 21 19:28:01 2010	(r207007)
@@ -94,9 +94,12 @@ int    syscall32_module_handler(struct m
 int    syscall32_helper_register(struct syscall_helper_data *sd);
 int    syscall32_helper_unregister(struct syscall_helper_data *sd);
 
-register_t *freebsd32_copyout_strings(struct image_params *imgp);
 struct iovec32;
+struct rusage32;
+register_t *freebsd32_copyout_strings(struct image_params *imgp);
 int	freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt,
 	    struct iovec **iov, int error);
+void	freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32);
+
 
 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_UTIL_H_ */



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