patch-2.1.127 linux/arch/sparc64/kernel/sys_sunos32.c
Next file: linux/arch/sparc64/kernel/systbls.S
Previous file: linux/arch/sparc64/kernel/sys_sparc32.c
Back to the patch index
Back to the overall index
- Lines: 113
- Date:
Tue Oct 27 09:52:20 1998
- Orig file:
v2.1.126/linux/arch/sparc64/kernel/sys_sunos32.c
- Orig date:
Mon Oct 5 13:13:38 1998
diff -u --recursive --new-file v2.1.126/linux/arch/sparc64/kernel/sys_sunos32.c linux/arch/sparc64/kernel/sys_sunos32.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos32.c,v 1.18 1998/08/31 03:41:01 davem Exp $
+/* $Id: sys_sunos32.c,v 1.22 1998/10/26 20:01:13 davem Exp $
* sys_sunos32.c: SunOS binary compatability layer on sparc64.
*
* Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -68,6 +68,7 @@
struct file *file = NULL;
unsigned long retval, ret_type;
+ down(¤t->mm->mmap_sem);
lock_kernel();
current->personality |= PER_BSD;
if(flags & MAP_NORESERVE) {
@@ -117,6 +118,7 @@
fput(file);
out:
unlock_kernel();
+ up(¤t->mm->mmap_sem);
return (u32) retval;
}
@@ -131,6 +133,7 @@
unsigned long rlim;
unsigned long newbrk, oldbrk, brk = (unsigned long) baddr;
+ down(¤t->mm->mmap_sem);
lock_kernel();
if (brk < current->mm->end_code)
goto out;
@@ -178,6 +181,7 @@
retval = 0;
out:
unlock_kernel();
+ up(¤t->mm->mmap_sem);
return retval;
}
@@ -538,27 +542,17 @@
char mach[9];
};
-asmlinkage int sunos_uname(u32 u_name)
+asmlinkage int sunos_uname(struct sunos_utsname *name)
{
- struct sunos_utsname *name = (struct sunos_utsname *)A(u_name);
- int ret = -EFAULT;
+ int ret;
down(&uts_sem);
- if(!name)
- goto out;
- if(copy_to_user(&name->sname[0],
- &system_utsname.sysname[0],
- sizeof(name->sname) - 1))
- goto out;
- copy_to_user(&name->nname[0],
- &system_utsname.nodename[0],
- sizeof(name->nname) - 1);
- put_user('\0', &name->nname[8]);
- copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
- copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
- copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
- ret = 0;
-out:
+ ret = copy_to_user(&name->sname[0], &system_utsname.sysname[0], sizeof(name->sname) - 1);
+ ret |= copy_to_user(&name->nname[0], &system_utsname.nodename[0], sizeof(name->nname) - 1);
+ ret |= put_user('\0', &name->nname[8]);
+ ret |= copy_to_user(&name->rel[0], &system_utsname.release[0], sizeof(name->rel) - 1);
+ ret |= copy_to_user(&name->ver[0], &system_utsname.version[0], sizeof(name->ver) - 1);
+ ret |= copy_to_user(&name->mach[0], &system_utsname.machine[0], sizeof(name->mach) - 1);
up(&uts_sem);
return ret;
}
@@ -837,6 +831,8 @@
int ret = -EINVAL;
char *dev_fname = 0;
+ if (!capable (CAP_SYS_ADMIN))
+ return -EPERM;
lock_kernel();
/* We don't handle the integer fs type */
if ((flags & SMNT_NEWTYPE) == 0)
@@ -1211,9 +1207,6 @@
__kernel_ipc_pid_t32 shm_cpid;
__kernel_ipc_pid_t32 shm_lpid;
unsigned short shm_nattch;
- unsigned short shm_npages;
- u32 shm_pages;
- u32 attaches;
};
static inline int sunos_shmid_get(struct shmid_ds32 *user,
@@ -1230,8 +1223,7 @@
__get_user(kern->shm_ctime, &user->shm_ctime) ||
__get_user(kern->shm_cpid, &user->shm_cpid) ||
__get_user(kern->shm_lpid, &user->shm_lpid) ||
- __get_user(kern->shm_nattch, &user->shm_nattch) ||
- __get_user(kern->shm_npages, &user->shm_npages))
+ __get_user(kern->shm_nattch, &user->shm_nattch))
return -EFAULT;
return 0;
}
@@ -1250,8 +1242,7 @@
__put_user(kern->shm_ctime, &user->shm_ctime) ||
__put_user(kern->shm_cpid, &user->shm_cpid) ||
__put_user(kern->shm_lpid, &user->shm_lpid) ||
- __put_user(kern->shm_nattch, &user->shm_nattch) ||
- __put_user(kern->shm_npages, &user->shm_npages))
+ __put_user(kern->shm_nattch, &user->shm_nattch))
return -EFAULT;
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov