aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/sys_ppc32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/sys_ppc32.c')
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c99
1 files changed, 0 insertions, 99 deletions
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index ff7de7b0797e..bb1cfcfdbbbb 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -61,42 +61,6 @@ asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp,
61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x)); 61 return compat_sys_select((int)n, inp, outp, exp, compat_ptr(tvp_x));
62} 62}
63 63
64int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
65{
66 compat_ino_t ino;
67 long err;
68
69 if (stat->size > MAX_NON_LFS || !new_valid_dev(stat->dev) ||
70 !new_valid_dev(stat->rdev))
71 return -EOVERFLOW;
72
73 ino = stat->ino;
74 if (sizeof(ino) < sizeof(stat->ino) && ino != stat->ino)
75 return -EOVERFLOW;
76
77 err = access_ok(VERIFY_WRITE, statbuf, sizeof(*statbuf)) ? 0 : -EFAULT;
78 err |= __put_user(new_encode_dev(stat->dev), &statbuf->st_dev);
79 err |= __put_user(ino, &statbuf->st_ino);
80 err |= __put_user(stat->mode, &statbuf->st_mode);
81 err |= __put_user(stat->nlink, &statbuf->st_nlink);
82 err |= __put_user(stat->uid, &statbuf->st_uid);
83 err |= __put_user(stat->gid, &statbuf->st_gid);
84 err |= __put_user(new_encode_dev(stat->rdev), &statbuf->st_rdev);
85 err |= __put_user(stat->size, &statbuf->st_size);
86 err |= __put_user(stat->atime.tv_sec, &statbuf->st_atime);
87 err |= __put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
88 err |= __put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
89 err |= __put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
90 err |= __put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
91 err |= __put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
92 err |= __put_user(stat->blksize, &statbuf->st_blksize);
93 err |= __put_user(stat->blocks, &statbuf->st_blocks);
94 err |= __put_user(0, &statbuf->__unused4[0]);
95 err |= __put_user(0, &statbuf->__unused4[1]);
96
97 return err;
98}
99
100/* Note: it is necessary to treat option as an unsigned int, 64/* Note: it is necessary to treat option as an unsigned int,
101 * with the corresponding cast to a signed int to insure that the 65 * with the corresponding cast to a signed int to insure that the
102 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 66 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
@@ -107,69 +71,6 @@ asmlinkage long compat_sys_sysfs(u32 option, u32 arg1, u32 arg2)
107 return sys_sysfs((int)option, arg1, arg2); 71 return sys_sysfs((int)option, arg1, arg2);
108} 72}
109 73
110static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
111{
112 long usec;
113
114 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
115 return -EFAULT;
116 if (__get_user(o->tv_sec, &i->tv_sec))
117 return -EFAULT;
118 if (__get_user(usec, &i->tv_usec))
119 return -EFAULT;
120 o->tv_nsec = usec * 1000;
121 return 0;
122}
123
124static inline long put_tv32(struct compat_timeval __user *o, struct timeval *i)
125{
126 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
127 (__put_user(i->tv_sec, &o->tv_sec) |
128 __put_user(i->tv_usec, &o->tv_usec)));
129}
130
131
132
133
134/* Translations due to time_t size differences. Which affects all
135 sorts of things, like timeval and itimerval. */
136extern struct timezone sys_tz;
137
138asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
139{
140 if (tv) {
141 struct timeval ktv;
142 do_gettimeofday(&ktv);
143 if (put_tv32(tv, &ktv))
144 return -EFAULT;
145 }
146 if (tz) {
147 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
148 return -EFAULT;
149 }
150
151 return 0;
152}
153
154
155
156asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
157{
158 struct timespec kts;
159 struct timezone ktz;
160
161 if (tv) {
162 if (get_ts32(&kts, tv))
163 return -EFAULT;
164 }
165 if (tz) {
166 if (copy_from_user(&ktz, tz, sizeof(ktz)))
167 return -EFAULT;
168 }
169
170 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
171}
172
173#ifdef CONFIG_SYSVIPC 74#ifdef CONFIG_SYSVIPC
174long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr, 75long compat_sys_ipc(u32 call, u32 first, u32 second, u32 third, compat_uptr_t ptr,
175 u32 fifth) 76 u32 fifth)