From: Andrew Morton <[email-masked]>

Might as well introduce some CodingStyle while we're there.

How come this code uses int64_t and not u64?

Cc: David Woodhouse <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

 fs/compat.c                 |   51 ++++++++++++++++++++-------------------
 fs/select.c                 |   57 ++++++++++++++++++++++++--------------------
 include/linux/compat.h      |    2 -
 include/linux/poll.h        |    3 +-
 i386/kernel/syscall_table.S |    0 
 ppc/kernel/misc.S           |    0 
 ppc64/kernel/misc.S         |    0 
 ppc64/kernel/signal32.c     |    0 
 asm-i386/unistd.h           |    0 
 asm-ppc/unistd.h            |    0 
 asm-ppc64/unistd.h          |    0 
 11 files changed, 62 insertions(+), 51 deletions(-)

diff -puN arch/i386/kernel/syscall_table.S~pselect-ppoll-system-calls-tidy arch/i386/kernel/syscall_table.S
diff -puN arch/ppc64/kernel/misc.S~pselect-ppoll-system-calls-tidy arch/ppc64/kernel/misc.S
diff -puN arch/ppc64/kernel/signal32.c~pselect-ppoll-system-calls-tidy arch/ppc64/kernel/signal32.c
diff -puN arch/ppc/kernel/misc.S~pselect-ppoll-system-calls-tidy arch/ppc/kernel/misc.S
diff -puN fs/compat.c~pselect-ppoll-system-calls-tidy fs/compat.c
--- 25/fs/compat.c~pselect-ppoll-system-calls-tidy	2005-06-26 15:59:28.000000000 -0700
+++ 25-akpm/fs/compat.c	2005-06-26 15:59:28.000000000 -0700
@@ -1597,8 +1597,8 @@ static void select_bits_free(void *bits,
 #define MAX_SELECT_SECONDS \
 	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
-int compat_core_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp,
-			   compat_ulong_t __user *exp, long *timeout)
+int compat_core_sys_select(int n, compat_ulong_t __user *inp,
+	compat_ulong_t __user *outp, compat_ulong_t __user *exp, long *timeout)
 {
 	fd_set_bits fds;
 	char *bits;
@@ -1658,9 +1658,9 @@ out_nofds:
 	return ret;
 }
 
-asmlinkage long
-compat_sys_select(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp,
-		compat_ulong_t __user *exp, struct compat_timeval __user *tvp)
+asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
+	compat_ulong_t __user *outp, compat_ulong_t __user *exp,
+	struct compat_timeval __user *tvp)
 {
 	long timeout = MAX_SCHEDULE_TIMEOUT;
 	struct compat_timeval tv;
@@ -1676,9 +1676,9 @@ compat_sys_select(int n, compat_ulong_t 
 
 	do {
 		if (tvp) {
-			if ((unsigned long) tv.tv_sec < MAX_SELECT_SECONDS) {
+			if ((unsigned long)tv.tv_sec < MAX_SELECT_SECONDS) {
 				timeout = ROUND_UP(tv.tv_usec, 1000000/HZ);
-				timeout += tv.tv_sec * (unsigned long) HZ;
+				timeout += tv.tv_sec * (unsigned long)HZ;
 				tv.tv_sec = 0;
 				tv.tv_usec = 0;
 			} else {
@@ -1703,10 +1703,11 @@ compat_sys_select(int n, compat_ulong_t 
 
 	return ret;
 }
-asmlinkage long
-compat_sys_pselect7(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp,
-		    compat_ulong_t __user *exp, struct compat_timespec __user *tsp,
-		    compat_sigset_t __user *sigmask, compat_size_t sigsetsize)
+
+asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
+	compat_ulong_t __user *outp, compat_ulong_t __user *exp,
+	struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask,
+	compat_size_t sigsetsize)
 {
 	compat_sigset_t s32;
 	sigset_t ksigmask, sigsaved;
@@ -1735,9 +1736,9 @@ compat_sys_pselect7(int n, compat_ulong_
 
 	do {
 		if (tsp) {
-			if ((unsigned long) ts.tv_sec < MAX_SELECT_SECONDS) {
+			if ((unsigned long)ts.tv_sec < MAX_SELECT_SECONDS) {
 				timeout = ROUND_UP(ts.tv_nsec, 1000000000/HZ);
-				timeout += ts.tv_sec * (unsigned long) HZ;
+				timeout += ts.tv_sec * (unsigned long)HZ;
 				ts.tv_sec = 0;
 				ts.tv_nsec = 0;
 			} else {
@@ -1766,28 +1767,30 @@ compat_sys_pselect7(int n, compat_ulong_
 	return ret;
 }
 
-asmlinkage long
-compat_sys_pselect6(int n, compat_ulong_t __user *inp, compat_ulong_t __user *outp,
-		   compat_ulong_t __user *exp, struct compat_timespec __user *tsp,
-		    void __user *sig)
+asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
+	compat_ulong_t __user *outp, compat_ulong_t __user *exp,
+	struct compat_timespec __user *tsp, void __user *sig)
 {
 	compat_size_t sigsetsize = 0;
 	compat_uptr_t up = 0;
 
 	if (sig) {
-		if (!access_ok(VERIFY_READ, sig, sizeof(compat_uptr_t) + sizeof(compat_size_t))
-		    || __get_user(up, (compat_uptr_t __user *)sig)
-		    || __get_user(sigsetsize, (compat_size_t __user *)(sig+sizeof(up))))
+		if (!access_ok(VERIFY_READ, sig,
+				sizeof(compat_uptr_t)+sizeof(compat_size_t)) ||
+		    	__get_user(up, (compat_uptr_t __user *)sig) ||
+		    	__get_user(sigsetsize,
+				(compat_size_t __user *)(sig+sizeof(up))))
 			return -EFAULT;
 	}
-	return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up), sigsetsize);
+	return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up),
+					sigsetsize);
 }
 
 #define MAX_INT64_SECONDS (((int64_t)(~((uint64_t)0)>>1)/HZ)-1)
 
-asmlinkage long
-compat_sys_ppoll(struct pollfd __user * ufds, unsigned int nfds, struct compat_timespec __user *tsp,
-		 const compat_sigset_t __user *sigmask, compat_size_t sigsetsize)
+asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
+	unsigned int nfds, struct compat_timespec __user *tsp,
+	const compat_sigset_t __user *sigmask, compat_size_t sigsetsize)
 {
 	compat_sigset_t s32;
 	sigset_t ksigmask, sigsaved;
diff -puN fs/select.c~pselect-ppoll-system-calls-tidy fs/select.c
--- 25/fs/select.c~pselect-ppoll-system-calls-tidy	2005-06-26 15:59:28.000000000 -0700
+++ 25-akpm/fs/select.c	2005-06-26 16:00:00.000000000 -0700
@@ -355,8 +355,8 @@ out_nofds:
 	return ret;
 }
 
-asmlinkage long
-sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
+asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
+			fd_set __user *exp, struct timeval __user *tvp)
 {
 	long timeout = MAX_SCHEDULE_TIMEOUT;
 	struct timeval tv;
@@ -372,9 +372,9 @@ sys_select(int n, fd_set __user *inp, fd
 
 	do {
 		if (tvp) {
-			if ((unsigned long) tv.tv_sec < MAX_SELECT_SECONDS) {
+			if ((unsigned long)tv.tv_sec < MAX_SELECT_SECONDS) {
 				timeout = ROUND_UP(tv.tv_usec, 1000000/HZ);
-				timeout += tv.tv_sec * (unsigned long) HZ;
+				timeout += tv.tv_sec * (unsigned long)HZ;
 				tv.tv_sec = 0;
 				tv.tv_usec = 0;
 			} else {
@@ -394,15 +394,15 @@ sys_select(int n, fd_set __user *inp, fd
 			tv.tv_sec++;
 			tv.tv_usec -= 1000000;
 		}
-		(void)copy_to_user(tvp, &tv, sizeof(tv));
+		copy_to_user(tvp, &tv, sizeof(tv));
 	}
 
 	return ret;
 }
 
-asmlinkage long
-sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
-	     struct timespec __user *tsp, const sigset_t __user *sigmask, size_t sigsetsize)
+asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
+		fd_set __user *exp, struct timespec __user *tsp,
+		const sigset_t __user *sigmask, size_t sigsetsize)
 {
 	long timeout = MAX_SCHEDULE_TIMEOUT;
 	sigset_t ksigmask, sigsaved;
@@ -452,7 +452,7 @@ sys_pselect7(int n, fd_set __user *inp, 
 			ts.tv_sec++;
 			ts.tv_nsec -= 1000000000;
 		}
-		(void)copy_to_user(tsp, &ts, sizeof(ts));
+		copy_to_user(tsp, &ts, sizeof(ts));
 	}
 
 	if (sigmask)
@@ -460,21 +460,23 @@ sys_pselect7(int n, fd_set __user *inp, 
 	return ret;
 }
 
-/* Most architectures can't handle 7-argument syscalls. So we provide
-   a 6-argument version where the sixth argument is a pointer to a
-   structure which has a pointer to the sigset_t itself followed by
-   a size_t containing the sigset size. */
-asmlinkage long
-sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
-	     struct timespec __user *tsp, void __user *sig)
+/*
+ * Most architectures can't handle 7-argument syscalls. So we provide a
+ * 6-argument version where the sixth argument is a pointer to a structure
+ * which has a pointer to the sigset_t itself followed by a size_t containing
+ * the sigset size.
+ */
+asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
+	fd_set __user *exp, struct timespec __user *tsp, void __user *sig)
 {
 	size_t sigsetsize = 0;
 	sigset_t __user *up = NULL;
 
 	if (sig) {
-		if (!access_ok(VERIFY_READ, sig, sizeof(void *) + sizeof(size_t))
+		if (!access_ok(VERIFY_READ, sig, sizeof(void *)+sizeof(size_t))
 		    || __get_user(up, (sigset_t * __user *)sig)
-		    || __get_user(sigsetsize, (size_t * __user)(sig+sizeof(void *))))
+		    || __get_user(sigsetsize,
+				(size_t * __user)(sig+sizeof(void *))))
 			return -EFAULT;
 	}
 
@@ -551,7 +553,7 @@ static int do_poll(unsigned int nfds,  s
 	return count;
 }
 
-int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, int64_t timeout)
+int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, int64_t timeout)
 {
 	struct poll_wqueues table;
  	int fdcount, err;
@@ -639,14 +641,17 @@ out_fds:
 	return err;
 }
 
-asmlinkage long sys_poll(struct pollfd __user * ufds, unsigned int nfds, long timeout)
+asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
+			long timeout)
 {
 	if (timeout) {
 		/* Careful about overflow in the intermediate values */
-		if ((unsigned long) timeout < MAX_SCHEDULE_TIMEOUT / HZ)
+		if ((unsigned long)timeout < MAX_SCHEDULE_TIMEOUT / HZ) {
 			timeout = (unsigned long)(timeout*HZ+999)/1000+1;
-		else /* Negative or overflow */
+		} else {
+			/* Negative or overflow */
 			timeout = -1;
+		}
 	}
 
 	return do_sys_poll(ufds, nfds, (int64_t)timeout);
@@ -654,8 +659,9 @@ asmlinkage long sys_poll(struct pollfd _
 
 #define MAX_INT64_SECONDS (((int64_t)(~((uint64_t)0)>>1)/HZ)-1)
 
-asmlinkage long sys_ppoll(struct pollfd __user * ufds, unsigned int nfds, struct timespec __user *tsp,
-			  const sigset_t __user *sigmask, size_t sigsetsize)
+asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds,
+	struct timespec __user *tsp, const sigset_t __user *sigmask,
+	size_t sigsetsize)
 {
 	sigset_t ksigmask, sigsaved;
 	struct timespec ts;
@@ -669,8 +675,9 @@ asmlinkage long sys_ppoll(struct pollfd 
 		if (ts.tv_sec < MAX_INT64_SECONDS) {
 			timeout = ROUND_UP(ts.tv_sec, 1000000000/HZ);
 			timeout += ts.tv_sec * HZ;
-		} else
+		} else {
 			timeout = MAX_SCHEDULE_TIMEOUT;
+		}
 	}
 
 	if (sigmask) {
diff -puN include/asm-i386/unistd.h~pselect-ppoll-system-calls-tidy include/asm-i386/unistd.h
diff -puN include/asm-ppc64/unistd.h~pselect-ppoll-system-calls-tidy include/asm-ppc64/unistd.h
diff -puN include/asm-ppc/unistd.h~pselect-ppoll-system-calls-tidy include/asm-ppc/unistd.h
diff -puN include/linux/compat.h~pselect-ppoll-system-calls-tidy include/linux/compat.h
--- 25/include/linux/compat.h~pselect-ppoll-system-calls-tidy	2005-06-26 15:59:28.000000000 -0700
+++ 25-akpm/include/linux/compat.h	2005-06-26 15:59:28.000000000 -0700
@@ -48,7 +48,7 @@ typedef struct {
 	compat_sigset_word	sig[_COMPAT_NSIG_WORDS];
 } compat_sigset_t;
 
-extern void sigset_from_compat (sigset_t *set, compat_sigset_t *compat);
+extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat);
 extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
 extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
 extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
diff -puN include/linux/poll.h~pselect-ppoll-system-calls-tidy include/linux/poll.h
--- 25/include/linux/poll.h~pselect-ppoll-system-calls-tidy	2005-06-26 15:59:28.000000000 -0700
+++ 25-akpm/include/linux/poll.h	2005-06-26 15:59:28.000000000 -0700
@@ -93,7 +93,8 @@ void zero_fd_set(unsigned long nr, unsig
 }
 
 extern int do_select(int n, fd_set_bits *fds, long *timeout);
-extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds, int64_t timeout);
+extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
+			int64_t timeout);
 
 #endif /* KERNEL */
 
_