Commit 9e3e77d5 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by David S. Miller

[SPARC64]: Add initial compat layer stuff.

parent 0390cb6c
...@@ -352,6 +352,11 @@ config SPARC32_COMPAT ...@@ -352,6 +352,11 @@ config SPARC32_COMPAT
This allows you to run 32-bit binaries on your Ultra. This allows you to run 32-bit binaries on your Ultra.
Everybody wants this; say Y. Everybody wants this; say Y.
config COMPAT
bool
depends on SPARC32_COMPAT
default y
config BINFMT_ELF32 config BINFMT_ELF32
tristate "Kernel support for 32-bit ELF binaries" tristate "Kernel support for 32-bit ELF binaries"
depends on SPARC32_COMPAT depends on SPARC32_COMPAT
......
...@@ -86,11 +86,7 @@ typedef struct { ...@@ -86,11 +86,7 @@ typedef struct {
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/elfcore.h> #include <linux/elfcore.h>
#include <linux/compat.h>
struct timeval32
{
int tv_sec, tv_usec;
};
#define elf_prstatus elf_prstatus32 #define elf_prstatus elf_prstatus32
struct elf_prstatus32 struct elf_prstatus32
...@@ -103,10 +99,10 @@ struct elf_prstatus32 ...@@ -103,10 +99,10 @@ struct elf_prstatus32
pid_t pr_ppid; pid_t pr_ppid;
pid_t pr_pgrp; pid_t pr_pgrp;
pid_t pr_sid; pid_t pr_sid;
struct timeval32 pr_utime; /* User time */ struct compat_timeval pr_utime; /* User time */
struct timeval32 pr_stime; /* System time */ struct compat_timeval pr_stime; /* System time */
struct timeval32 pr_cutime; /* Cumulative user time */ struct compat_timeval pr_cutime; /* Cumulative user time */
struct timeval32 pr_cstime; /* Cumulative system time */ struct compat_timeval pr_cstime; /* Cumulative system time */
elf_gregset_t pr_reg; /* GP registers */ elf_gregset_t pr_reg; /* GP registers */
int pr_fpvalid; /* True if math co-processor being used. */ int pr_fpvalid; /* True if math co-processor being used. */
}; };
...@@ -136,9 +132,9 @@ struct elf_prpsinfo32 ...@@ -136,9 +132,9 @@ struct elf_prpsinfo32
#include <linux/time.h> #include <linux/time.h>
#define jiffies_to_timeval jiffies_to_timeval32 #define jiffies_to_timeval jiffies_to_compat_timeval
static __inline__ void static __inline__ void
jiffies_to_timeval32(unsigned long jiffies, struct timeval32 *value) jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
{ {
value->tv_usec = (jiffies % HZ) * (1000000L / HZ); value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
value->tv_sec = jiffies / HZ; value->tv_sec = jiffies / HZ;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/compat.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp.h> #include <linux/smp.h>
...@@ -405,14 +406,9 @@ static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) ...@@ -405,14 +406,9 @@ static int do_video_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
return err; return err;
} }
struct timeval32 {
int tv_sec;
int tv_usec;
};
static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg) static int do_siocgstamp(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
struct timeval32 *up = (struct timeval32 *)arg; struct compat_timeval *up = (struct compat_timeval *)arg;
struct timeval ktv; struct timeval ktv;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
int err; int err;
...@@ -1743,8 +1739,8 @@ struct ppp_option_data32 { ...@@ -1743,8 +1739,8 @@ struct ppp_option_data32 {
#define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32) #define PPPIOCSCOMPRESS32 _IOW('t', 77, struct ppp_option_data32)
struct ppp_idle32 { struct ppp_idle32 {
__kernel_time_t32 xmit_idle; compat_time_t xmit_idle;
__kernel_time_t32 recv_idle; compat_time_t recv_idle;
}; };
#define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32) #define PPPIOCGIDLE32 _IOR('t', 63, struct ppp_idle32)
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/binfmts.h> #include <linux/binfmts.h>
#include <linux/compat.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/bitops.h> #include <asm/bitops.h>
...@@ -181,7 +182,7 @@ asmlinkage void do_rt_sigsuspend32(u32 uset, size_t sigsetsize, struct pt_regs * ...@@ -181,7 +182,7 @@ asmlinkage void do_rt_sigsuspend32(u32 uset, size_t sigsetsize, struct pt_regs *
sigset_t32 set32; sigset_t32 set32;
/* XXX: Don't preclude handling different sized sigset_t's. */ /* XXX: Don't preclude handling different sized sigset_t's. */
if (((__kernel_size_t32)sigsetsize) != sizeof(sigset_t)) { if (((compat_size_t)sigsetsize) != sizeof(sigset_t)) {
regs->tstate |= TSTATE_ICARRY; regs->tstate |= TSTATE_ICARRY;
regs->u_regs[UREG_I0] = EINVAL; regs->u_regs[UREG_I0] = EINVAL;
return; return;
......
...@@ -175,7 +175,7 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */ ...@@ -175,7 +175,7 @@ do_sys_recv: /* sys_recv(int, void *, size_t, unsigned int) */
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
nop nop
nop nop
do_sys_sendto: /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int, u32, int) */ do_sys_sendto: /* sys32_sendto(int, u32, compat_size_t, unsigned int, u32, int) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_sendto), %g1 sethi %hi(sys32_sendto), %g1
lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0x8] %asi, %o2
...@@ -184,7 +184,7 @@ do_sys_sendto: /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int, u32, i ...@@ -184,7 +184,7 @@ do_sys_sendto: /* sys32_sendto(int, u32, __kernel_size_t32, unsigned int, u32, i
ldswa [%o1 + 0x14] %asi, %o5 ldswa [%o1 + 0x14] %asi, %o5
jmpl %g1 + %lo(sys32_sendto), %g0 jmpl %g1 + %lo(sys32_sendto), %g0
lduwa [%o1 + 0x4] %asi, %o1 lduwa [%o1 + 0x4] %asi, %o1
do_sys_recvfrom: /* sys32_recvfrom(int, u32, __kernel_size_t32, unsigned int, u32, u32) */ do_sys_recvfrom: /* sys32_recvfrom(int, u32, compat_size_t, unsigned int, u32, u32) */
ldswa [%o1 + 0x0] %asi, %o0 ldswa [%o1 + 0x0] %asi, %o0
sethi %hi(sys32_recvfrom), %g1 sethi %hi(sys32_recvfrom), %g1
lduwa [%o1 + 0x8] %asi, %o2 lduwa [%o1 + 0x8] %asi, %o2
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/utime.h>
#include <linux/resource.h> #include <linux/resource.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/utsname.h> #include <linux/utsname.h>
...@@ -52,6 +51,7 @@ ...@@ -52,6 +51,7 @@
#include <linux/binfmts.h> #include <linux/binfmts.h>
#include <linux/dnotify.h> #include <linux/dnotify.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/compat.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/ipc.h> #include <asm/ipc.h>
...@@ -263,49 +263,20 @@ asmlinkage long sys32_getegid16(void) ...@@ -263,49 +263,20 @@ asmlinkage long sys32_getegid16(void)
/* 32-bit timeval and related flotsam. */ /* 32-bit timeval and related flotsam. */
struct timeval32 static long get_tv32(struct timeval *o, struct compat_timeval *i)
{
int tv_sec, tv_usec;
};
struct itimerval32
{
struct timeval32 it_interval;
struct timeval32 it_value;
};
static long get_tv32(struct timeval *o, struct timeval32 *i)
{ {
return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) || return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) ||
(__get_user(o->tv_sec, &i->tv_sec) | (__get_user(o->tv_sec, &i->tv_sec) |
__get_user(o->tv_usec, &i->tv_usec))); __get_user(o->tv_usec, &i->tv_usec)));
} }
static inline long put_tv32(struct timeval32 *o, struct timeval *i) static inline long put_tv32(struct compat_timeval *o, struct timeval *i)
{ {
return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) || return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
(__put_user(i->tv_sec, &o->tv_sec) | (__put_user(i->tv_sec, &o->tv_sec) |
__put_user(i->tv_usec, &o->tv_usec))); __put_user(i->tv_usec, &o->tv_usec)));
} }
static inline long get_it32(struct itimerval *o, struct itimerval32 *i)
{
return (!access_ok(VERIFY_READ, i32, sizeof(*i32)) ||
(__get_user(o->it_interval.tv_sec, &i->it_interval.tv_sec) |
__get_user(o->it_interval.tv_usec, &i->it_interval.tv_usec) |
__get_user(o->it_value.tv_sec, &i->it_value.tv_sec) |
__get_user(o->it_value.tv_usec, &i->it_value.tv_usec)));
}
static long put_it32(struct itimerval32 *o, struct itimerval *i)
{
return (!access_ok(VERIFY_WRITE, i32, sizeof(*i32)) ||
(__put_user(i->it_interval.tv_sec, &o->it_interval.tv_sec) |
__put_user(i->it_interval.tv_usec, &o->it_interval.tv_usec) |
__put_user(i->it_value.tv_sec, &o->it_value.tv_sec) |
__put_user(i->it_value.tv_usec, &o->it_value.tv_usec)));
}
extern asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on); extern asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on);
asmlinkage int sys32_ioperm(u32 from, u32 num, int on) asmlinkage int sys32_ioperm(u32 from, u32 num, int on)
...@@ -328,8 +299,8 @@ struct ipc_perm32 ...@@ -328,8 +299,8 @@ struct ipc_perm32
struct semid_ds32 { struct semid_ds32 {
struct ipc_perm32 sem_perm; /* permissions .. see ipc.h */ struct ipc_perm32 sem_perm; /* permissions .. see ipc.h */
__kernel_time_t32 sem_otime; /* last semop time */ compat_time_t sem_otime; /* last semop time */
__kernel_time_t32 sem_ctime; /* last change time */ compat_time_t sem_ctime; /* last change time */
u32 sem_base; /* ptr to first semaphore in array */ u32 sem_base; /* ptr to first semaphore in array */
u32 sem_pending; /* pending operations to be processed */ u32 sem_pending; /* pending operations to be processed */
u32 sem_pending_last; /* last pending operation */ u32 sem_pending_last; /* last pending operation */
...@@ -340,9 +311,9 @@ struct semid_ds32 { ...@@ -340,9 +311,9 @@ struct semid_ds32 {
struct semid64_ds32 { struct semid64_ds32 {
struct ipc64_perm sem_perm; /* this structure is the same on sparc32 and sparc64 */ struct ipc64_perm sem_perm; /* this structure is the same on sparc32 and sparc64 */
unsigned int __pad1; unsigned int __pad1;
__kernel_time_t32 sem_otime; compat_time_t sem_otime;
unsigned int __pad2; unsigned int __pad2;
__kernel_time_t32 sem_ctime; compat_time_t sem_ctime;
u32 sem_nsems; u32 sem_nsems;
u32 __unused1; u32 __unused1;
u32 __unused2; u32 __unused2;
...@@ -353,9 +324,9 @@ struct msqid_ds32 ...@@ -353,9 +324,9 @@ struct msqid_ds32
struct ipc_perm32 msg_perm; struct ipc_perm32 msg_perm;
u32 msg_first; u32 msg_first;
u32 msg_last; u32 msg_last;
__kernel_time_t32 msg_stime; compat_time_t msg_stime;
__kernel_time_t32 msg_rtime; compat_time_t msg_rtime;
__kernel_time_t32 msg_ctime; compat_time_t msg_ctime;
u32 wwait; u32 wwait;
u32 rwait; u32 rwait;
unsigned short msg_cbytes; unsigned short msg_cbytes;
...@@ -368,11 +339,11 @@ struct msqid_ds32 ...@@ -368,11 +339,11 @@ struct msqid_ds32
struct msqid64_ds32 { struct msqid64_ds32 {
struct ipc64_perm msg_perm; struct ipc64_perm msg_perm;
unsigned int __pad1; unsigned int __pad1;
__kernel_time_t32 msg_stime; compat_time_t msg_stime;
unsigned int __pad2; unsigned int __pad2;
__kernel_time_t32 msg_rtime; compat_time_t msg_rtime;
unsigned int __pad3; unsigned int __pad3;
__kernel_time_t32 msg_ctime; compat_time_t msg_ctime;
unsigned int msg_cbytes; unsigned int msg_cbytes;
unsigned int msg_qnum; unsigned int msg_qnum;
unsigned int msg_qbytes; unsigned int msg_qbytes;
...@@ -386,9 +357,9 @@ struct msqid64_ds32 { ...@@ -386,9 +357,9 @@ struct msqid64_ds32 {
struct shmid_ds32 { struct shmid_ds32 {
struct ipc_perm32 shm_perm; struct ipc_perm32 shm_perm;
int shm_segsz; int shm_segsz;
__kernel_time_t32 shm_atime; compat_time_t shm_atime;
__kernel_time_t32 shm_dtime; compat_time_t shm_dtime;
__kernel_time_t32 shm_ctime; compat_time_t shm_ctime;
__kernel_ipc_pid_t32 shm_cpid; __kernel_ipc_pid_t32 shm_cpid;
__kernel_ipc_pid_t32 shm_lpid; __kernel_ipc_pid_t32 shm_lpid;
unsigned short shm_nattch; unsigned short shm_nattch;
...@@ -397,12 +368,12 @@ struct shmid_ds32 { ...@@ -397,12 +368,12 @@ struct shmid_ds32 {
struct shmid64_ds32 { struct shmid64_ds32 {
struct ipc64_perm shm_perm; struct ipc64_perm shm_perm;
unsigned int __pad1; unsigned int __pad1;
__kernel_time_t32 shm_atime; compat_time_t shm_atime;
unsigned int __pad2; unsigned int __pad2;
__kernel_time_t32 shm_dtime; compat_time_t shm_dtime;
unsigned int __pad3; unsigned int __pad3;
__kernel_time_t32 shm_ctime; compat_time_t shm_ctime;
__kernel_size_t32 shm_segsz; compat_size_t shm_segsz;
__kernel_pid_t32 shm_cpid; __kernel_pid_t32 shm_cpid;
__kernel_pid_t32 shm_lpid; __kernel_pid_t32 shm_lpid;
unsigned int shm_nattch; unsigned int shm_nattch;
...@@ -965,37 +936,7 @@ asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned l ...@@ -965,37 +936,7 @@ asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned l
return sys_ftruncate(fd, (high << 32) | low); return sys_ftruncate(fd, (high << 32) | low);
} }
extern asmlinkage int sys_utime(char * filename, struct utimbuf * times); struct iovec32 { u32 iov_base; compat_size_t iov_len; };
struct utimbuf32 {
__kernel_time_t32 actime, modtime;
};
asmlinkage int sys32_utime(char * filename, struct utimbuf32 *times)
{
struct utimbuf t;
mm_segment_t old_fs;
int ret;
char *filenam;
if (!times)
return sys_utime(filename, NULL);
if (get_user (t.actime, &times->actime) ||
__get_user (t.modtime, &times->modtime))
return -EFAULT;
filenam = getname (filename);
ret = PTR_ERR(filenam);
if (!IS_ERR(filenam)) {
old_fs = get_fs();
set_fs (KERNEL_DS);
ret = sys_utime(filenam, &t);
set_fs (old_fs);
putname (filenam);
}
return ret;
}
struct iovec32 { u32 iov_base; __kernel_size_t32 iov_len; };
typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *); typedef ssize_t (*io_fn_t)(struct file *, char *, size_t, loff_t *);
typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *); typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *);
...@@ -1003,7 +944,7 @@ typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, ...@@ -1003,7 +944,7 @@ typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long,
static long do_readv_writev32(int type, struct file *file, static long do_readv_writev32(int type, struct file *file,
const struct iovec32 *vector, u32 count) const struct iovec32 *vector, u32 count)
{ {
__kernel_ssize_t32 tot_len; compat_ssize_t tot_len;
struct iovec iovstack[UIO_FASTIOV]; struct iovec iovstack[UIO_FASTIOV];
struct iovec *iov=iovstack, *ivp; struct iovec *iov=iovstack, *ivp;
struct inode *inode; struct inode *inode;
...@@ -1035,16 +976,16 @@ static long do_readv_writev32(int type, struct file *file, ...@@ -1035,16 +976,16 @@ static long do_readv_writev32(int type, struct file *file,
ivp = iov; ivp = iov;
retval = -EINVAL; retval = -EINVAL;
while(i > 0) { while(i > 0) {
__kernel_ssize_t32 tmp = tot_len; compat_ssize_t tmp = tot_len;
__kernel_ssize_t32 len; compat_ssize_t len;
u32 buf; u32 buf;
__get_user(len, &vector->iov_len); __get_user(len, &vector->iov_len);
__get_user(buf, &vector->iov_base); __get_user(buf, &vector->iov_base);
if (len < 0) /* size_t not fittina an ssize_t32 .. */ if (len < 0) /* size_t not fittina an compat_ssize_t .. */
goto out; goto out;
tot_len += len; tot_len += len;
if (tot_len < tmp) /* maths overflow on the ssize_t32 */ if (tot_len < tmp) /* maths overflow on the compat_ssize_t */
goto out; goto out;
ivp->iov_base = (void *)A(buf); ivp->iov_base = (void *)A(buf);
ivp->iov_len = (__kernel_size_t) len; ivp->iov_len = (__kernel_size_t) len;
...@@ -1331,7 +1272,7 @@ static void set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset) ...@@ -1331,7 +1272,7 @@ static void set_fd_set32(unsigned long n, u32 *ufdset, unsigned long *fdset)
asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x) asmlinkage int sys32_select(int n, u32 *inp, u32 *outp, u32 *exp, u32 tvp_x)
{ {
fd_set_bits fds; fd_set_bits fds;
struct timeval32 *tvp = (struct timeval32 *)AA(tvp_x); struct compat_timeval *tvp = (struct compat_timeval *)AA(tvp_x);
char *bits; char *bits;
unsigned long nn; unsigned long nn;
long timeout; long timeout;
...@@ -1692,8 +1633,8 @@ asmlinkage int sys32_mount(char *dev_name, char *dir_name, char *type, unsigned ...@@ -1692,8 +1633,8 @@ asmlinkage int sys32_mount(char *dev_name, char *dir_name, char *type, unsigned
} }
struct rusage32 { struct rusage32 {
struct timeval32 ru_utime; struct compat_timeval ru_utime;
struct timeval32 ru_stime; struct compat_timeval ru_stime;
s32 ru_maxrss; s32 ru_maxrss;
s32 ru_ixrss; s32 ru_ixrss;
s32 ru_idrss; s32 ru_idrss;
...@@ -1795,14 +1736,9 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info) ...@@ -1795,14 +1736,9 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
return ret; return ret;
} }
struct timespec32 {
s32 tv_sec;
s32 tv_nsec;
};
extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval); extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct timespec32 *interval) asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
{ {
struct timespec t; struct timespec t;
int ret; int ret;
...@@ -1817,28 +1753,6 @@ asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct timespec ...@@ -1817,28 +1753,6 @@ asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct timespec
return ret; return ret;
} }
extern asmlinkage int sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp);
asmlinkage int sys32_nanosleep(struct timespec32 *rqtp, struct timespec32 *rmtp)
{
struct timespec t;
int ret;
mm_segment_t old_fs = get_fs ();
if (get_user (t.tv_sec, &rqtp->tv_sec) ||
__get_user (t.tv_nsec, &rqtp->tv_nsec))
return -EFAULT;
set_fs (KERNEL_DS);
ret = sys_nanosleep(&t, rmtp ? &t : NULL);
set_fs (old_fs);
if (rmtp && ret == -EINTR) {
if (__put_user (t.tv_sec, &rmtp->tv_sec) ||
__put_user (t.tv_nsec, &rmtp->tv_nsec))
return -EFAULT;
}
return ret;
}
extern asmlinkage int sys_sigprocmask(int how, old_sigset_t *set, old_sigset_t *oset); extern asmlinkage int sys_sigprocmask(int how, old_sigset_t *set, old_sigset_t *oset);
asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *oset) asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *oset)
...@@ -1858,7 +1772,7 @@ asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *o ...@@ -1858,7 +1772,7 @@ asmlinkage int sys32_sigprocmask(int how, old_sigset_t32 *set, old_sigset_t32 *o
extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize); extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize);
asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset, __kernel_size_t32 sigsetsize) asmlinkage int sys32_rt_sigprocmask(int how, sigset_t32 *set, sigset_t32 *oset, compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
sigset_t32 s32; sigset_t32 s32;
...@@ -1909,7 +1823,7 @@ asmlinkage int sys32_sigpending(old_sigset_t32 *set) ...@@ -1909,7 +1823,7 @@ asmlinkage int sys32_sigpending(old_sigset_t32 *set)
extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize); extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize);
asmlinkage int sys32_rt_sigpending(sigset_t32 *set, __kernel_size_t32 sigsetsize) asmlinkage int sys32_rt_sigpending(sigset_t32 *set, compat_size_t sigsetsize)
{ {
sigset_t s; sigset_t s;
sigset_t32 s32; sigset_t32 s32;
...@@ -1934,7 +1848,7 @@ asmlinkage int sys32_rt_sigpending(sigset_t32 *set, __kernel_size_t32 sigsetsize ...@@ -1934,7 +1848,7 @@ asmlinkage int sys32_rt_sigpending(sigset_t32 *set, __kernel_size_t32 sigsetsize
asmlinkage int asmlinkage int
sys32_rt_sigtimedwait(sigset_t32 *uthese, siginfo_t32 *uinfo, sys32_rt_sigtimedwait(sigset_t32 *uthese, siginfo_t32 *uinfo,
struct timespec32 *uts, __kernel_size_t32 sigsetsize) struct compat_timespec *uts, compat_size_t sigsetsize)
{ {
int ret, sig; int ret, sig;
sigset_t these; sigset_t these;
...@@ -2139,14 +2053,14 @@ struct msghdr32 { ...@@ -2139,14 +2053,14 @@ struct msghdr32 {
u32 msg_name; u32 msg_name;
int msg_namelen; int msg_namelen;
u32 msg_iov; u32 msg_iov;
__kernel_size_t32 msg_iovlen; compat_size_t msg_iovlen;
u32 msg_control; u32 msg_control;
__kernel_size_t32 msg_controllen; compat_size_t msg_controllen;
unsigned msg_flags; unsigned msg_flags;
}; };
struct cmsghdr32 { struct cmsghdr32 {
__kernel_size_t32 cmsg_len; compat_size_t cmsg_len;
int cmsg_level; int cmsg_level;
int cmsg_type; int cmsg_type;
}; };
...@@ -2280,7 +2194,7 @@ static int cmsghdr_from_user32_to_kern(struct msghdr *kmsg, ...@@ -2280,7 +2194,7 @@ static int cmsghdr_from_user32_to_kern(struct msghdr *kmsg,
{ {
struct cmsghdr32 *ucmsg; struct cmsghdr32 *ucmsg;
struct cmsghdr *kcmsg, *kcmsg_base; struct cmsghdr *kcmsg, *kcmsg_base;
__kernel_size_t32 ucmlen; compat_size_t ucmlen;
__kernel_size_t kcmlen, tmp; __kernel_size_t kcmlen, tmp;
kcmlen = 0; kcmlen = 0;
...@@ -2646,7 +2560,7 @@ asmlinkage int sys32_recvmsg(int fd, struct msghdr32 *user_msg, unsigned int use ...@@ -2646,7 +2560,7 @@ asmlinkage int sys32_recvmsg(int fd, struct msghdr32 *user_msg, unsigned int use
err = move_addr_to_user(addr, kern_msg.msg_namelen, uaddr, uaddr_len); err = move_addr_to_user(addr, kern_msg.msg_namelen, uaddr, uaddr_len);
if(cmsg_ptr != 0 && err >= 0) { if(cmsg_ptr != 0 && err >= 0) {
unsigned long ucmsg_ptr = ((unsigned long)kern_msg.msg_control); unsigned long ucmsg_ptr = ((unsigned long)kern_msg.msg_control);
__kernel_size_t32 uclen = (__kernel_size_t32) (ucmsg_ptr - cmsg_ptr); compat_size_t uclen = (compat_size_t) (ucmsg_ptr - cmsg_ptr);
err |= __put_user(uclen, &user_msg->msg_controllen); err |= __put_user(uclen, &user_msg->msg_controllen);
} }
if(err >= 0) if(err >= 0)
...@@ -2734,7 +2648,7 @@ static int do_set_icmpv6_filter(int fd, int level, int optname, ...@@ -2734,7 +2648,7 @@ static int do_set_icmpv6_filter(int fd, int level, int optname,
static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int optlen) static int do_set_sock_timeout(int fd, int level, int optname, char *optval, int optlen)
{ {
struct timeval32 *up = (struct timeval32 *) optval; struct compat_timeval *up = (struct compat_timeval *) optval;
struct timeval ktime; struct timeval ktime;
mm_segment_t old_fs; mm_segment_t old_fs;
int err; int err;
...@@ -2772,7 +2686,7 @@ extern asmlinkage long sys_getsockopt(int fd, int level, int optname, ...@@ -2772,7 +2686,7 @@ extern asmlinkage long sys_getsockopt(int fd, int level, int optname,
static int do_get_sock_timeout(int fd, int level, int optname, char *optval, int *optlen) static int do_get_sock_timeout(int fd, int level, int optname, char *optval, int *optlen)
{ {
struct timeval32 *up = (struct timeval32 *) optval; struct compat_timeval *up = (struct compat_timeval *) optval;
struct timeval ktime; struct timeval ktime;
mm_segment_t old_fs; mm_segment_t old_fs;
int len, err; int len, err;
...@@ -2843,7 +2757,7 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old ...@@ -2843,7 +2757,7 @@ asmlinkage int sys32_sigaction (int sig, struct old_sigaction32 *act, struct old
asmlinkage int asmlinkage int
sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact, sys32_rt_sigaction(int sig, struct sigaction32 *act, struct sigaction32 *oact,
void *restorer, __kernel_size_t32 sigsetsize) void *restorer, compat_size_t sigsetsize)
{ {
struct k_sigaction new_ka, old_ka; struct k_sigaction new_ka, old_ka;
int ret; int ret;
...@@ -3481,7 +3395,7 @@ int asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2) ...@@ -3481,7 +3395,7 @@ int asmlinkage sys32_nfsservctl(int cmd, void *notused, void *notused2)
extern struct timezone sys_tz; extern struct timezone sys_tz;
extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz); extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
asmlinkage int sys32_gettimeofday(struct timeval32 *tv, struct timezone *tz) asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
{ {
if (tv) { if (tv) {
struct timeval ktv; struct timeval ktv;
...@@ -3496,7 +3410,7 @@ asmlinkage int sys32_gettimeofday(struct timeval32 *tv, struct timezone *tz) ...@@ -3496,7 +3410,7 @@ asmlinkage int sys32_gettimeofday(struct timeval32 *tv, struct timezone *tz)
return 0; return 0;
} }
asmlinkage int sys32_settimeofday(struct timeval32 *tv, struct timezone *tz) asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
{ {
struct timeval ktv; struct timeval ktv;
struct timezone ktz; struct timezone ktz;
...@@ -3513,46 +3427,9 @@ asmlinkage int sys32_settimeofday(struct timeval32 *tv, struct timezone *tz) ...@@ -3513,46 +3427,9 @@ asmlinkage int sys32_settimeofday(struct timeval32 *tv, struct timezone *tz)
return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL); return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
} }
extern int do_getitimer(int which, struct itimerval *value);
asmlinkage int sys32_getitimer(int which, struct itimerval32 *it)
{
struct itimerval kit;
int error;
error = do_getitimer(which, &kit);
if (!error && put_it32(it, &kit))
error = -EFAULT;
return error;
}
extern int do_setitimer(int which, struct itimerval *, struct itimerval *);
asmlinkage int sys32_setitimer(int which, struct itimerval32 *in, struct itimerval32 *out)
{
struct itimerval kin, kout;
int error;
if (in) {
if (get_it32(&kin, in))
return -EFAULT;
} else
memset(&kin, 0, sizeof(kin));
error = do_setitimer(which, &kin, out ? &kout : NULL);
if (error || !out)
return error;
if (put_it32(out, &kout))
return -EFAULT;
return 0;
}
asmlinkage int sys_utimes(char *, struct timeval *); asmlinkage int sys_utimes(char *, struct timeval *);
asmlinkage int sys32_utimes(char *filename, struct timeval32 *tvs) asmlinkage int sys32_utimes(char *filename, struct compat_timeval *tvs)
{ {
char *kfilename; char *kfilename;
struct timeval ktvs[2]; struct timeval ktvs[2];
...@@ -3636,23 +3513,21 @@ extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf, ...@@ -3636,23 +3513,21 @@ extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf, extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
size_t count, loff_t pos); size_t count, loff_t pos);
typedef __kernel_ssize_t32 ssize_t32; asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
compat_size_t count, u32 poshi, u32 poslo)
asmlinkage ssize_t32 sys32_pread64(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo)
{ {
return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
asmlinkage ssize_t32 sys32_pwrite64(unsigned int fd, char *ubuf, asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
__kernel_size_t32 count, u32 poshi, u32 poslo) compat_size_t count, u32 poshi, u32 poslo)
{ {
return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo)); return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
} }
extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count); extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
asmlinkage ssize_t32 sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count) asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count)
{ {
return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count); return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
} }
...@@ -3705,7 +3580,7 @@ struct timex32 { ...@@ -3705,7 +3580,7 @@ struct timex32 {
u32 modes; u32 modes;
s32 offset, freq, maxerror, esterror; s32 offset, freq, maxerror, esterror;
s32 status, constant, precision, tolerance; s32 status, constant, precision, tolerance;
struct timeval32 time; struct compat_timeval time;
s32 tick; s32 tick;
s32 ppsfreq, jitter, shift, stabil; s32 ppsfreq, jitter, shift, stabil;
s32 jitcnt, calcnt, errcnt, stbcnt; s32 jitcnt, calcnt, errcnt, stbcnt;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/compat.h>
#include <linux/mman.h> #include <linux/mman.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/swap.h> #include <linux/swap.h>
...@@ -528,11 +529,6 @@ asmlinkage int sunos_pathconf(u32 u_path, int name) ...@@ -528,11 +529,6 @@ asmlinkage int sunos_pathconf(u32 u_path, int name)
extern asmlinkage int extern asmlinkage int
sys32_select(int n, u32 inp, u32 outp, u32 exp, u32 tvp); sys32_select(int n, u32 inp, u32 outp, u32 exp, u32 tvp);
struct timeval32
{
int tv_sec, tv_usec;
};
asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x) asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
{ {
int ret; int ret;
...@@ -540,7 +536,7 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x) ...@@ -540,7 +536,7 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
/* SunOS binaries expect that select won't change the tvp contents */ /* SunOS binaries expect that select won't change the tvp contents */
ret = sys32_select (width, inp, outp, exp, tvp_x); ret = sys32_select (width, inp, outp, exp, tvp_x);
if (ret == -EINTR && tvp_x) { if (ret == -EINTR && tvp_x) {
struct timeval32 *tvp = (struct timeval32 *)A(tvp_x); struct compat_timeval *tvp = (struct compat_timeval *)A(tvp_x);
time_t sec, usec; time_t sec, usec;
__get_user(sec, &tvp->tv_sec); __get_user(sec, &tvp->tv_sec);
...@@ -948,9 +944,9 @@ struct msqid_ds32 ...@@ -948,9 +944,9 @@ struct msqid_ds32
struct ipc_perm32 msg_perm; struct ipc_perm32 msg_perm;
u32 msg_first; u32 msg_first;
u32 msg_last; u32 msg_last;
__kernel_time_t32 msg_stime; compat_time_t msg_stime;
__kernel_time_t32 msg_rtime; compat_time_t msg_rtime;
__kernel_time_t32 msg_ctime; compat_time_t msg_ctime;
u32 wwait; u32 wwait;
u32 rwait; u32 rwait;
unsigned short msg_cbytes; unsigned short msg_cbytes;
...@@ -1085,9 +1081,9 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4) ...@@ -1085,9 +1081,9 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
struct shmid_ds32 { struct shmid_ds32 {
struct ipc_perm32 shm_perm; struct ipc_perm32 shm_perm;
int shm_segsz; int shm_segsz;
__kernel_time_t32 shm_atime; compat_time_t shm_atime;
__kernel_time_t32 shm_dtime; compat_time_t shm_dtime;
__kernel_time_t32 shm_ctime; compat_time_t shm_ctime;
__kernel_ipc_pid_t32 shm_cpid; __kernel_ipc_pid_t32 shm_cpid;
__kernel_ipc_pid_t32 shm_lpid; __kernel_ipc_pid_t32 shm_lpid;
unsigned short shm_nattch; unsigned short shm_nattch;
......
...@@ -25,7 +25,7 @@ sys_call_table32: ...@@ -25,7 +25,7 @@ sys_call_table32:
/*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek /*15*/ .word sys32_chmod, sys32_lchown16, sparc_brk, sys_perfctr, sys32_lseek
/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16 /*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
/*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause /*25*/ .word sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
/*30*/ .word sys32_utime, sys_lchown, sys_fchown, sys_access, sys_nice /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
.word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile .word sys_chown, sys_sync, sys_kill, sys32_newstat, sys32_sendfile
/*40*/ .word sys32_newlstat, sys_dup, sys_pipe, sys32_times, sys_getuid /*40*/ .word sys32_newlstat, sys_dup, sys_pipe, sys32_times, sys_getuid
.word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 .word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16
...@@ -35,8 +35,8 @@ sys_call_table32: ...@@ -35,8 +35,8 @@ sys_call_table32:
.word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
/*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect /*70*/ .word sys_getegid, sys32_mmap, sys_setreuid, sys_munmap, sys_mprotect
.word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16 .word sys_madvise, sys_vhangup, sys32_truncate64, sys_mincore, sys32_getgroups16
/*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, sys32_setitimer, sys32_ftruncate64 /*80*/ .word sys32_setgroups16, sys_getpgrp, sys_setgroups, compat_sys_setitimer, sys32_ftruncate64
.word sys_swapon, sys32_getitimer, sys_setuid, sys_sethostname, sys_setgid .word sys_swapon, compat_sys_getitimer, sys_setuid, sys_sethostname, sys_setgid
/*90*/ .word sys_dup2, sys_setfsuid, sys32_fcntl, sys32_select, sys_setfsgid /*90*/ .word sys_dup2, sys_setfsuid, sys32_fcntl, sys32_select, sys_setfsgid
.word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_fsync, sys_setpriority32, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
/*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending /*100*/ .word sys_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
...@@ -68,7 +68,7 @@ sys_call_table32: ...@@ -68,7 +68,7 @@ sys_call_table32:
/*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_alloc_hugepages /*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_alloc_hugepages
.word sys_free_hugepages, sys_llseek, sys_mlock, sys_munlock, sys_mlockall .word sys_free_hugepages, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler /*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl /*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
.word sys_aplib .word sys_aplib
...@@ -166,8 +166,8 @@ sunos_sys_table: ...@@ -166,8 +166,8 @@ sunos_sys_table:
.word sys_mprotect, sys_madvise, sys_vhangup .word sys_mprotect, sys_madvise, sys_vhangup
.word sunos_nosys, sys_mincore, sys32_getgroups16 .word sunos_nosys, sys_mincore, sys32_getgroups16
.word sys32_setgroups16, sys_getpgrp, sunos_setpgrp .word sys32_setgroups16, sys_getpgrp, sunos_setpgrp
.word sys32_setitimer, sunos_nosys, sys_swapon .word compat_sys_setitimer, sunos_nosys, sys_swapon
.word sys32_getitimer, sys_gethostname, sys_sethostname .word compat_sys_getitimer, sys_gethostname, sys_sethostname
.word sunos_getdtablesize, sys_dup2, sunos_nop .word sunos_getdtablesize, sys_dup2, sunos_nop
.word sys32_fcntl, sunos_select, sunos_nop .word sys32_fcntl, sunos_select, sunos_nop
.word sys_fsync, sys_setpriority32, sunos_socket .word sys_fsync, sys_setpriority32, sunos_socket
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/file.h> #include <linux/file.h>
#include <linux/timex.h> #include <linux/timex.h>
#include <linux/major.h> #include <linux/major.h>
#include <linux/compat.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/string.h> #include <asm/string.h>
...@@ -597,12 +598,8 @@ asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit *rlim) ...@@ -597,12 +598,8 @@ asmlinkage int solaris_setrlimit64(unsigned int resource, struct rlimit *rlim)
return ret; return ret;
} }
struct timeval32 {
int tv_sec, tv_usec;
};
struct sol_ntptimeval { struct sol_ntptimeval {
struct timeval32 time; struct compat_timeval time;
s32 maxerror; s32 maxerror;
s32 esterror; s32 esterror;
}; };
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/compat.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/string.h> #include <asm/string.h>
...@@ -378,7 +379,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us ...@@ -378,7 +379,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
if(kern_msg.msg_controllen) { if(kern_msg.msg_controllen) {
struct sol_cmsghdr *ucmsg = (struct sol_cmsghdr *)kern_msg.msg_control; struct sol_cmsghdr *ucmsg = (struct sol_cmsghdr *)kern_msg.msg_control;
unsigned long *kcmsg; unsigned long *kcmsg;
__kernel_size_t32 cmlen; compat_size_t cmlen;
if(kern_msg.msg_controllen > sizeof(ctl) && if(kern_msg.msg_controllen > sizeof(ctl) &&
kern_msg.msg_controllen <= 256) { kern_msg.msg_controllen <= 256) {
...@@ -392,7 +393,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us ...@@ -392,7 +393,7 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr *user_msg, unsigned us
*kcmsg++ = (unsigned long)cmlen; *kcmsg++ = (unsigned long)cmlen;
err = -EFAULT; err = -EFAULT;
if(copy_from_user(kcmsg, &ucmsg->cmsg_level, if(copy_from_user(kcmsg, &ucmsg->cmsg_level,
kern_msg.msg_controllen - sizeof(__kernel_size_t32))) kern_msg.msg_controllen - sizeof(compat_size_t)))
goto out_freectl; goto out_freectl;
kern_msg.msg_control = ctl_buf; kern_msg.msg_control = ctl_buf;
} }
......
#ifndef _ASM_SPARC64_COMPAT_H
#define _ASM_SPARC64_COMPAT_H
/*
* Architecture specific compatibility types
*/
#include <linux/types.h>
typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
struct compat_timespec {
compat_time_t tv_sec;
s32 tv_nsec;
};
struct compat_timeval {
compat_time_t tv_sec;
s32 tv_usec;
};
#endif /* _ASM_SPARC64_COMPAT_H */
...@@ -48,10 +48,7 @@ typedef struct { ...@@ -48,10 +48,7 @@ typedef struct {
} __kernel_fsid_t; } __kernel_fsid_t;
/* Now 32bit compatibility types */ /* Now 32bit compatibility types */
typedef unsigned int __kernel_size_t32;
typedef int __kernel_ssize_t32;
typedef int __kernel_ptrdiff_t32; typedef int __kernel_ptrdiff_t32;
typedef int __kernel_time_t32;
typedef int __kernel_clock_t32; typedef int __kernel_clock_t32;
typedef int __kernel_pid_t32; typedef int __kernel_pid_t32;
typedef unsigned short __kernel_ipc_pid_t32; typedef unsigned short __kernel_ipc_pid_t32;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/compat.h>
#endif #endif
#endif #endif
...@@ -250,7 +251,7 @@ typedef struct sigaltstack { ...@@ -250,7 +251,7 @@ typedef struct sigaltstack {
typedef struct sigaltstack32 { typedef struct sigaltstack32 {
u32 ss_sp; u32 ss_sp;
int ss_flags; int ss_flags;
__kernel_size_t32 ss_size; compat_size_t ss_size;
} stack_t32; } stack_t32;
#define HAVE_ARCH_GET_SIGNAL_TO_DELIVER #define HAVE_ARCH_GET_SIGNAL_TO_DELIVER
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#define _SPARC64_STAT_H #define _SPARC64_STAT_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/compat.h>
#include <linux/time.h> #include <linux/time.h>
struct stat32 { struct stat32 {
...@@ -14,11 +15,11 @@ struct stat32 { ...@@ -14,11 +15,11 @@ struct stat32 {
__kernel_gid_t32 st_gid; __kernel_gid_t32 st_gid;
__kernel_dev_t32 st_rdev; __kernel_dev_t32 st_rdev;
__kernel_off_t32 st_size; __kernel_off_t32 st_size;
__kernel_time_t32 st_atime; compat_time_t st_atime;
unsigned int __unused1; unsigned int __unused1;
__kernel_time_t32 st_mtime; compat_time_t st_mtime;
unsigned int __unused2; unsigned int __unused2;
__kernel_time_t32 st_ctime; compat_time_t st_ctime;
unsigned int __unused3; unsigned int __unused3;
__kernel_off_t32 st_blksize; __kernel_off_t32 st_blksize;
__kernel_off_t32 st_blocks; __kernel_off_t32 st_blocks;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment