summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-09 23:29:35 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-09 23:29:35 +0000
commit35385d7a83b4cae6d5ea5f80f3b3377d94178344 (patch)
tree49494d95dfef31ba4f9a697d31e4028cf65a57bd /arch
parentd9d8062e7b49943b2a2fb034f817a9fc217fd40f (diff)
Merge with 2.4.0-test3-pre7.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/ia64/ia32/sys_ia32.c19
-rw-r--r--arch/ia64/kernel/sys_ia64.c12
-rw-r--r--arch/mips/kernel/sysmips.c2
-rw-r--r--arch/ppc/amiga/chipram.c29
-rw-r--r--arch/ppc/kernel/syscalls.c8
-rw-r--r--arch/sparc/kernel/sys_sparc.c2
-rw-r--r--arch/sparc/kernel/sys_sunos.c49
-rw-r--r--arch/sparc64/kernel/sys_sparc.c4
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c11
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c49
11 files changed, 36 insertions, 151 deletions
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index e1617fbaa..2c3cabadc 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -230,7 +230,6 @@ asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, struct pt_r
int error;
char * filename;
- lock_kernel();
filename = getname(filenamei);
error = PTR_ERR(filename);
if (IS_ERR(filename))
@@ -238,7 +237,6 @@ asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, struct pt_r
error = do_execve(filename, argv, envp, regs);
putname(filename);
out:
- unlock_kernel();
return error;
}
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 95f8b1f54..1e9876eb4 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -708,7 +708,6 @@ sys32_getdents (unsigned int fd, void * dirent, unsigned int count)
buf.count = count;
buf.error = 0;
- lock_kernel();
error = vfs_readdir(file, filldir32, &buf);
if (error < 0)
goto out_putf;
@@ -720,7 +719,6 @@ sys32_getdents (unsigned int fd, void * dirent, unsigned int count)
}
out_putf:
- unlock_kernel();
fput(file);
out:
return error;
@@ -759,12 +757,9 @@ sys32_readdir (unsigned int fd, void * dirent, unsigned int count)
buf.count = 0;
buf.dirent = dirent;
- lock_kernel();
error = vfs_readdir(file, fillonedir32, &buf);
if (error >= 0)
error = buf.count;
- unlock_kernel();
-
fput(file);
out:
return error;
@@ -1028,7 +1023,6 @@ sys32_readv(int fd, struct iovec32 *vector, u32 count)
struct file *file;
long ret = -EBADF;
- lock_kernel();
file = fget(fd);
if(!file)
goto bad_file;
@@ -1041,7 +1035,6 @@ sys32_readv(int fd, struct iovec32 *vector, u32 count)
out:
fput(file);
bad_file:
- unlock_kernel();
return ret;
}
@@ -1051,7 +1044,6 @@ sys32_writev(int fd, struct iovec32 *vector, u32 count)
struct file *file;
int ret = -EBADF;
- lock_kernel();
file = fget(fd);
if(!file)
goto bad_file;
@@ -1066,7 +1058,6 @@ sys32_writev(int fd, struct iovec32 *vector, u32 count)
out:
fput(file);
bad_file:
- unlock_kernel();
return ret;
}
@@ -1852,7 +1843,6 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
{
int version, err;
- lock_kernel();
version = call >> 16; /* hack for backward compatibility */
call &= 0xffff;
@@ -1904,7 +1894,6 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
break;
}
- unlock_kernel();
return err;
}
@@ -3719,7 +3708,6 @@ sys32_sendmsg(int fd, struct msghdr32 *user_msg, unsigned user_flags)
}
kern_msg.msg_flags = user_flags;
- lock_kernel();
sock = sockfd_lookup(fd, &err);
if (sock != NULL) {
if (sock->file->f_flags & O_NONBLOCK)
@@ -3727,7 +3715,6 @@ sys32_sendmsg(int fd, struct msghdr32 *user_msg, unsigned user_flags)
err = sock_sendmsg(sock, &kern_msg, total_len);
sockfd_put(sock);
}
- unlock_kernel();
/* N.B. Use kfree here, as kern_msg.msg_controllen might change? */
if(ctl_buf != ctl)
@@ -3767,7 +3754,6 @@ sys32_recvmsg(int fd, struct msghdr32 *user_msg, unsigned int user_flags)
cmsg_ptr = (unsigned long) kern_msg.msg_control;
kern_msg.msg_flags = 0;
- lock_kernel();
sock = sockfd_lookup(fd, &err);
if (sock != NULL) {
struct scm_cookie scm;
@@ -3775,6 +3761,7 @@ sys32_recvmsg(int fd, struct msghdr32 *user_msg, unsigned int user_flags)
if (sock->file->f_flags & O_NONBLOCK)
user_flags |= MSG_DONTWAIT;
memset(&scm, 0, sizeof(scm));
+ lock_kernel();
err = sock->ops->recvmsg(sock, &kern_msg, total_len,
user_flags, &scm);
if(err >= 0) {
@@ -3805,9 +3792,9 @@ sys32_recvmsg(int fd, struct msghdr32 *user_msg, unsigned int user_flags)
scm_detach_fds32(&kern_msg, &scm);
}
}
+ unlock_kernel();
sockfd_put(sock);
}
- unlock_kernel();
if(uaddr != NULL && err >= 0)
err = move_addr_to_user(addr, kern_msg.msg_namelen, uaddr,
@@ -4707,11 +4694,9 @@ asmlinkage long
sys32_personality(unsigned long personality)
{
int ret;
- lock_kernel();
if (current->personality == PER_LINUX32 && personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
- unlock_kernel();
if (ret == PER_LINUX32)
ret = PER_LINUX;
return ret;
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index c25193cdc..0ccbe24a6 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -180,27 +180,21 @@ sys_ioperm (unsigned long from, unsigned long num, int on)
asmlinkage long
sys_iopl (int level, long arg1, long arg2, long arg3)
{
- lock_kernel();
printk(KERN_ERR "sys_iopl(level=%d)!\n", level);
- unlock_kernel();
return -ENOSYS;
}
asmlinkage long
sys_vm86 (long arg0, long arg1, long arg2, long arg3)
{
- lock_kernel();
printk(KERN_ERR "sys_vm86(%lx, %lx, %lx, %lx)!\n", arg0, arg1, arg2, arg3);
- unlock_kernel();
return -ENOSYS;
}
asmlinkage long
sys_modify_ldt (long arg0, long arg1, long arg2, long arg3)
{
- lock_kernel();
printk(KERN_ERR "sys_modify_ldt(%lx, %lx, %lx, %lx)!\n", arg0, arg1, arg2, arg3);
- unlock_kernel();
return -ENOSYS;
}
@@ -296,7 +290,6 @@ ia64_oldstat (char *filename, struct ia64_oldstat *statbuf)
struct nameidata nd;
int error;
- lock_kernel();
error = user_path_walk(filename, &nd);
if (!error) {
error = do_revalidate(nd.dentry);
@@ -304,7 +297,6 @@ ia64_oldstat (char *filename, struct ia64_oldstat *statbuf)
error = cp_ia64_old_stat(nd.dentry->d_inode, statbuf);
path_release(&nd);
}
- unlock_kernel();
return error;
}
@@ -314,7 +306,6 @@ ia64_oldlstat (char *filename, struct ia64_oldstat *statbuf) {
struct nameidata nd;
int error;
- lock_kernel();
error = user_path_walk_link(filename, &nd);
if (!error) {
error = do_revalidate(nd.dentry);
@@ -322,7 +313,6 @@ ia64_oldlstat (char *filename, struct ia64_oldstat *statbuf) {
error = cp_ia64_old_stat(nd.dentry->d_inode, statbuf);
path_release(&nd);
}
- unlock_kernel();
return error;
}
@@ -332,7 +322,6 @@ ia64_oldfstat (unsigned int fd, struct ia64_oldstat *statbuf)
struct file * f;
int err = -EBADF;
- lock_kernel();
f = fget(fd);
if (f) {
struct dentry * dentry = f->f_dentry;
@@ -342,7 +331,6 @@ ia64_oldfstat (unsigned int fd, struct ia64_oldstat *statbuf)
err = cp_ia64_old_stat(dentry->d_inode, statbuf);
fput(f);
}
- unlock_kernel();
return err;
}
diff --git a/arch/mips/kernel/sysmips.c b/arch/mips/kernel/sysmips.c
index 67383d84a..7d34f2d8c 100644
--- a/arch/mips/kernel/sysmips.c
+++ b/arch/mips/kernel/sysmips.c
@@ -49,7 +49,7 @@ sys_sysmips(int cmd, int arg1, int arg2, int arg3)
{
int *p;
char *name;
- int flags, tmp, len, retval;
+ int flags, tmp, len, retval, errno;
switch(cmd) {
case SETNAME: {
diff --git a/arch/ppc/amiga/chipram.c b/arch/ppc/amiga/chipram.c
index 31f91a794..259522584 100644
--- a/arch/ppc/amiga/chipram.c
+++ b/arch/ppc/amiga/chipram.c
@@ -1,15 +1,14 @@
/*
** linux/amiga/chipram.c
**
-** Modified 03-May-94 by Geert Uytterhoeven
-** (Geert.Uytterhoeven@cs.kuleuven.ac.be)
+** Modified 03-May-94 by Geert Uytterhoeven <geert@linux-m68k.org>
** - 64-bit aligned allocations for full AGA compatibility
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/zorro.h>
#include <asm/amigahw.h>
struct chip_desc {
@@ -25,6 +24,8 @@ struct chip_desc {
u_long amiga_chip_size;
static unsigned long chipavail;
+static struct resource chipram = { "Chip RAM", 0 };
+
unsigned long amiga_chip_avail( void )
{
#ifdef DEBUG
@@ -34,8 +35,7 @@ unsigned long amiga_chip_avail( void )
}
-__init
-void amiga_chip_init (void)
+void __init amiga_chip_init (void)
{
struct chip_desc *dp;
@@ -49,6 +49,8 @@ void amiga_chip_init (void)
*/
amiga_chip_size -= 0x4000;
#endif
+ chipram.end = amiga_chip_size-1;
+ request_resource(&iomem_resource, &chipram);
/* initialize start boundary */
@@ -72,7 +74,7 @@ void amiga_chip_init (void)
#endif
}
-void *amiga_chip_alloc (long size)
+void *amiga_chip_alloc(long size, const char *name)
{
/* last chunk */
struct chip_desc *dp;
@@ -82,7 +84,7 @@ void *amiga_chip_alloc (long size)
size = (size + 7) & ~7;
#ifdef DEBUG
- printk("chip_alloc: allocate %ld bytes\n", size);
+ printk("amiga_chip_alloc: allocate %ld bytes\n", size);
#endif
/*
@@ -108,14 +110,14 @@ void *amiga_chip_alloc (long size)
dp = DP((unsigned long)ptr + dp->length);
dp->alloced = 1;
#ifdef DEBUG
- printk ("chip_alloc: no split\n");
+ printk ("amiga_chip_alloc: no split\n");
#endif
} else {
/* split the extent; use the end part */
long newsize = dp->length - (2*sizeof(*dp) + size);
#ifdef DEBUG
- printk ("chip_alloc: splitting %d to %ld\n", dp->length,
+ printk ("amiga_chip_alloc: splitting %d to %ld\n", dp->length,
newsize);
#endif
dp->length = newsize;
@@ -134,14 +136,18 @@ void *amiga_chip_alloc (long size)
}
#ifdef DEBUG
- printk ("chip_alloc: returning %p\n", ptr);
+ printk ("amiga_chip_alloc: returning %p\n", ptr);
#endif
if ((unsigned long)ptr & 7)
- panic("chip_alloc: alignment violation\n");
+ panic("amiga_chip_alloc: alignment violation\n");
chipavail -= size + (2*sizeof(*dp)); /*MILAN*/
+ if (!request_mem_region(ZTWO_PADDR(ptr), size, name))
+ printk(KERN_WARNING "amiga_chip_alloc: region of size %ld at 0x%08lx "
+ "is busy\n", size, ZTWO_PADDR(ptr));
+
return ptr;
}
@@ -156,6 +162,7 @@ void amiga_chip_free (void *ptr)
#endif
/* deallocate the chunk */
sdp->alloced = edp->alloced = 0;
+ release_mem_region(ZTWO_PADDR(ptr), sdp->length);
/* check if we should merge with the previous chunk */
if (!sdp->first && !sdp[-1].alloced) {
diff --git a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
index 08d0bc44b..11aa42cad 100644
--- a/arch/ppc/kernel/syscalls.c
+++ b/arch/ppc/kernel/syscalls.c
@@ -52,25 +52,19 @@ asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
int sys_iopl(int a1, int a2, int a3, int a4)
{
- lock_kernel();
printk(KERN_ERR "sys_iopl(%x, %x, %x, %x)!\n", a1, a2, a3, a4);
- unlock_kernel();
return (-ENOSYS);
}
int sys_vm86(int a1, int a2, int a3, int a4)
{
- lock_kernel();
printk(KERN_ERR "sys_vm86(%x, %x, %x, %x)!\n", a1, a2, a3, a4);
- unlock_kernel();
return (-ENOSYS);
}
int sys_modify_ldt(int a1, int a2, int a3, int a4)
{
- lock_kernel();
printk(KERN_ERR "sys_modify_ldt(%x, %x, %x, %x)!\n", a1, a2, a3, a4);
- unlock_kernel();
return (-ENOSYS);
}
@@ -84,7 +78,6 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
{
int version, ret;
- lock_kernel();
version = call >> 16; /* hack for backward compatibility */
call &= 0xffff;
@@ -171,7 +164,6 @@ sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
break;
}
- unlock_kernel();
return ret;
}
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index 66221c796..848dba72e 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -100,7 +100,6 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
{
int version, err;
- lock_kernel();
version = call >> 16; /* hack for backward compatibility */
call &= 0xffff;
@@ -195,7 +194,6 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr,
else
err = -EINVAL;
out:
- unlock_kernel();
return err;
}
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index 1ba500986..73cb4580c 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -521,7 +521,6 @@ asmlinkage int sunos_fpathconf(int fd, int name)
{
int ret;
- lock_kernel();
switch(name) {
case _PCONF_LINK:
ret = LINK_MAX;
@@ -552,7 +551,6 @@ asmlinkage int sunos_fpathconf(int fd, int name)
ret = -EINVAL;
break;
}
- unlock_kernel();
return ret;
}
@@ -560,9 +558,7 @@ asmlinkage int sunos_pathconf(char *path, int name)
{
int ret;
- lock_kernel();
ret = sunos_fpathconf(0, name); /* XXX cheese XXX */
- unlock_kernel();
return ret;
}
@@ -575,7 +571,6 @@ asmlinkage int sunos_select(int width, fd_set *inp, fd_set *outp, fd_set *exp, s
int ret;
/* SunOS binaries expect that select won't change the tvp contents */
- lock_kernel();
ret = sys_select (width, inp, outp, exp, tvp);
if (ret == -EINTR && tvp) {
time_t sec, usec;
@@ -586,7 +581,6 @@ asmlinkage int sunos_select(int width, fd_set *inp, fd_set *outp, fd_set *exp, s
if (sec == 0 && usec == 0)
ret = 0;
}
- unlock_kernel();
return ret;
}
@@ -829,7 +823,6 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
int ret;
/* So stupid... */
- lock_kernel();
if((!pid || pid == current->pid) &&
!pgid) {
sys_setsid();
@@ -837,7 +830,6 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
} else {
ret = sys_setpgid(pid, pgid);
}
- unlock_kernel();
return ret;
}
@@ -847,9 +839,7 @@ asmlinkage int sunos_wait4(pid_t pid, unsigned int *stat_addr, int options, stru
{
int ret;
- lock_kernel();
ret = sys_wait4((pid ? pid : -1), stat_addr, options, ru);
- unlock_kernel();
return ret;
}
@@ -897,7 +887,6 @@ extern asmlinkage long sunos_sysconf (int name)
{
long ret;
- lock_kernel();
switch (name){
case _SC_ARG_MAX:
ret = ARG_MAX;
@@ -930,7 +919,6 @@ extern asmlinkage long sunos_sysconf (int name)
ret = -1;
break;
};
- unlock_kernel();
return ret;
}
@@ -940,7 +928,6 @@ asmlinkage int sunos_semsys(int op, unsigned long arg1, unsigned long arg2,
union semun arg4;
int ret;
- lock_kernel();
switch (op) {
case 0:
/* Most arguments match on a 1:1 basis but cmd doesn't */
@@ -976,7 +963,6 @@ asmlinkage int sunos_semsys(int op, unsigned long arg1, unsigned long arg2,
ret = -EINVAL;
break;
};
- unlock_kernel();
return ret;
}
@@ -987,7 +973,6 @@ asmlinkage int sunos_msgsys(int op, unsigned long arg1, unsigned long arg2,
unsigned long arg5;
int rval;
- lock_kernel();
switch(op) {
case 0:
rval = sys_msgget((key_t)arg1, (int)arg2);
@@ -997,8 +982,10 @@ asmlinkage int sunos_msgsys(int op, unsigned long arg1, unsigned long arg2,
(struct msqid_ds *)arg3);
break;
case 2:
+ lock_kernel();
sp = (struct sparc_stackf *)current->thread.kregs->u_regs[UREG_FP];
arg5 = sp->xxargs[0];
+ unlock_kernel();
rval = sys_msgrcv((int)arg1, (struct msgbuf *)arg2,
(size_t)arg3, (long)arg4, (int)arg5);
break;
@@ -1010,7 +997,6 @@ asmlinkage int sunos_msgsys(int op, unsigned long arg1, unsigned long arg2,
rval = -EINVAL;
break;
}
- unlock_kernel();
return rval;
}
@@ -1020,7 +1006,6 @@ asmlinkage int sunos_shmsys(int op, unsigned long arg1, unsigned long arg2,
unsigned long raddr;
int rval;
- lock_kernel();
switch(op) {
case 0:
/* sys_shmat(): attach a shared memory area */
@@ -1044,7 +1029,6 @@ asmlinkage int sunos_shmsys(int op, unsigned long arg1, unsigned long arg2,
rval = -EINVAL;
break;
};
- unlock_kernel();
return rval;
}
@@ -1058,9 +1042,12 @@ asmlinkage int sunos_shmsys(int op, unsigned long arg1, unsigned long arg2,
static inline int check_nonblock(int ret, int fd)
{
if (ret == -EAGAIN) {
- struct file * file = fcheck(fd);
- if (file && (file->f_flags & O_NDELAY))
- ret = -SUNOS_EWOULDBLOCK;
+ struct file * file = fget(fd);
+ if (file) {
+ if (file->f_flags & O_NDELAY)
+ ret = -SUNOS_EWOULDBLOCK;
+ fput(file);
+ }
}
return ret;
}
@@ -1078,9 +1065,7 @@ asmlinkage int sunos_read(unsigned int fd,char *buf,int count)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_read(fd,buf,count),fd);
- unlock_kernel();
return ret;
}
@@ -1088,9 +1073,7 @@ asmlinkage int sunos_readv(unsigned long fd, const struct iovec * vector, long c
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_readv(fd,vector,count),fd);
- unlock_kernel();
return ret;
}
@@ -1098,9 +1081,7 @@ asmlinkage int sunos_write(unsigned int fd,char *buf,int count)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_write(fd,buf,count),fd);
- unlock_kernel();
return ret;
}
@@ -1108,9 +1089,7 @@ asmlinkage int sunos_writev(unsigned long fd, const struct iovec * vector, long
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_writev(fd,vector,count),fd);
- unlock_kernel();
return ret;
}
@@ -1118,9 +1097,7 @@ asmlinkage int sunos_recv(int fd, void * ubuf, int size, unsigned flags)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_recv(fd,ubuf,size,flags),fd);
- unlock_kernel();
return ret;
}
@@ -1128,9 +1105,7 @@ asmlinkage int sunos_send(int fd, void * buff, int len, unsigned flags)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_send(fd,buff,len,flags),fd);
- unlock_kernel();
return ret;
}
@@ -1141,7 +1116,6 @@ asmlinkage int sunos_socket(int family, int type, int protocol)
{
int ret, one = 1;
- lock_kernel();
ret = sys_socket(family, type, protocol);
if (ret < 0)
goto out;
@@ -1149,7 +1123,6 @@ asmlinkage int sunos_socket(int family, int type, int protocol)
sys_setsockopt(ret, SOL_SOCKET, SO_BSDCOMPAT,
(char *)&one, sizeof(one));
out:
- unlock_kernel();
return ret;
}
@@ -1157,7 +1130,6 @@ asmlinkage int sunos_accept(int fd, struct sockaddr *sa, int *addrlen)
{
int ret, one = 1;
- lock_kernel();
while (1) {
ret = check_nonblock(sys_accept(fd,sa,addrlen),fd);
if (ret != -ENETUNREACH && ret != -EHOSTUNREACH)
@@ -1169,7 +1141,6 @@ asmlinkage int sunos_accept(int fd, struct sockaddr *sa, int *addrlen)
sys_setsockopt(ret, SOL_SOCKET, SO_BSDCOMPAT,
(char *)&one, sizeof(one));
out:
- unlock_kernel();
return ret;
}
@@ -1226,14 +1197,12 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, char *optval,
int tr_opt = optname;
int ret;
- lock_kernel();
if (level == SOL_IP) {
/* Multicast socketopts (ttl, membership) */
if (tr_opt >=2 && tr_opt <= 6)
tr_opt += 30;
}
ret = sys_setsockopt(fd, level, tr_opt, optval, optlen);
- unlock_kernel();
return ret;
}
@@ -1243,13 +1212,11 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname, char *optval,
int tr_opt = optname;
int ret;
- lock_kernel();
if (level == SOL_IP) {
/* Multicast socketopts (ttl, membership) */
if (tr_opt >=2 && tr_opt <= 6)
tr_opt += 30;
}
ret = sys_getsockopt(fd, level, tr_opt, optval, optlen);
- unlock_kernel();
return ret;
}
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 48cf27f38..ec3042398 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -111,7 +111,6 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
{
int err;
- lock_kernel();
/* No need for backward compatibility. We can start fresh... */
if (call <= SEMCTL)
@@ -177,7 +176,6 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
else
err = -EINVAL;
out:
- unlock_kernel();
return err;
}
@@ -198,11 +196,9 @@ extern asmlinkage long sys_personality(unsigned long);
asmlinkage int sparc64_personality(unsigned long personality)
{
int ret;
- lock_kernel();
if (current->personality == PER_LINUX32 && personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
- unlock_kernel();
if (ret == PER_LINUX32)
ret = PER_LINUX;
return ret;
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 8f3339bfa..8b917e303 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -1184,8 +1184,6 @@ asmlinkage long sys32_readv(int fd, struct iovec32 *vector, u32 count)
struct file *file;
long ret = -EBADF;
- lock_kernel();
-
file = fget(fd);
if(!file)
goto bad_file;
@@ -1195,7 +1193,6 @@ asmlinkage long sys32_readv(int fd, struct iovec32 *vector, u32 count)
fput(file);
bad_file:
- unlock_kernel();
return ret;
}
@@ -1204,8 +1201,6 @@ asmlinkage long sys32_writev(int fd, struct iovec32 *vector, u32 count)
struct file *file;
int ret = -EBADF;
- lock_kernel();
-
file = fget(fd);
if(!file)
goto bad_file;
@@ -1214,7 +1209,6 @@ asmlinkage long sys32_writev(int fd, struct iovec32 *vector, u32 count)
fput(file);
bad_file:
- unlock_kernel();
return ret;
}
@@ -4132,10 +4126,7 @@ asmlinkage long sparc32_open(const char * filename, int flags, int mode)
if (!IS_ERR(tmp)) {
fd = get_unused_fd();
if (fd >= 0) {
- struct file * f;
- lock_kernel();
- f = filp_open(tmp, flags, mode);
- unlock_kernel();
+ struct file * f = filp_open(tmp, flags, mode);
error = PTR_ERR(f);
if (IS_ERR(f))
goto out_error;
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 4d2a9173d..624a6b971 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -481,7 +481,6 @@ asmlinkage int sunos_fpathconf(int fd, int name)
{
int ret;
- lock_kernel();
switch(name) {
case _PCONF_LINK:
ret = LINK_MAX;
@@ -512,7 +511,6 @@ asmlinkage int sunos_fpathconf(int fd, int name)
ret = -EINVAL;
break;
}
- unlock_kernel();
return ret;
}
@@ -520,9 +518,7 @@ asmlinkage int sunos_pathconf(u32 u_path, int name)
{
int ret;
- lock_kernel();
ret = sunos_fpathconf(0, name); /* XXX cheese XXX */
- unlock_kernel();
return ret;
}
@@ -540,7 +536,6 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
int ret;
/* SunOS binaries expect that select won't change the tvp contents */
- lock_kernel();
ret = sys32_select (width, inp, outp, exp, tvp_x);
if (ret == -EINTR && tvp_x) {
struct timeval32 *tvp = (struct timeval32 *)A(tvp_x);
@@ -551,7 +546,6 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x)
if (sec == 0 && usec == 0)
ret = 0;
}
- unlock_kernel();
return ret;
}
@@ -798,7 +792,6 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
int ret;
/* So stupid... */
- lock_kernel();
if((!pid || pid == current->pid) &&
!pgid) {
sys_setsid();
@@ -806,7 +799,6 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
} else {
ret = sys_setpgid(pid, pgid);
}
- unlock_kernel();
return ret;
}
@@ -818,10 +810,8 @@ asmlinkage int sunos_wait4(__kernel_pid_t32 pid, u32 stat_addr, int options, u32
{
int ret;
- lock_kernel();
ret = sys32_wait4((pid ? pid : ((__kernel_pid_t32)-1)),
stat_addr, options, ru);
- unlock_kernel();
return ret;
}
@@ -838,9 +828,7 @@ asmlinkage int sunos_killpg(int pgrp, int sig)
asmlinkage int sunos_audit(void)
{
- lock_kernel();
printk ("sys_audit\n");
- unlock_kernel();
return -1;
}
@@ -868,7 +856,6 @@ extern asmlinkage s32 sunos_sysconf (int name)
{
s32 ret;
- lock_kernel();
switch (name){
case _SC_ARG_MAX:
ret = ARG_MAX;
@@ -901,7 +888,6 @@ extern asmlinkage s32 sunos_sysconf (int name)
ret = -1;
break;
};
- unlock_kernel();
return ret;
}
@@ -910,7 +896,6 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
union semun arg4;
int ret;
- lock_kernel();
switch (op) {
case 0:
/* Most arguments match on a 1:1 basis but cmd doesn't */
@@ -946,7 +931,6 @@ asmlinkage int sunos_semsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 ptr)
ret = -EINVAL;
break;
};
- unlock_kernel();
return ret;
}
@@ -1048,7 +1032,6 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
u32 arg5;
int rval;
- lock_kernel();
switch(op) {
case 0:
rval = sys_msgget((key_t)arg1, (int)arg2);
@@ -1102,7 +1085,6 @@ asmlinkage int sunos_msgsys(int op, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
rval = -EINVAL;
break;
}
- unlock_kernel();
return rval;
}
@@ -1162,7 +1144,6 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3)
mm_segment_t old_fs = get_fs();
int rval;
- lock_kernel();
switch(op) {
case 0:
/* sys_shmat(): attach a shared memory area */
@@ -1194,7 +1175,6 @@ asmlinkage int sunos_shmsys(int op, u32 arg1, u32 arg2, u32 arg3)
rval = -EINVAL;
break;
};
- unlock_kernel();
return rval;
}
@@ -1217,9 +1197,12 @@ asmlinkage int sunos_open(u32 fname, int flags, int mode)
static inline int check_nonblock(int ret, int fd)
{
if (ret == -EAGAIN) {
- struct file * file = fcheck(fd);
- if (file && (file->f_flags & O_NDELAY))
- ret = -SUNOS_EWOULDBLOCK;
+ struct file * file = fget(fd);
+ if (file) {
+ if (file->f_flags & O_NDELAY)
+ ret = -SUNOS_EWOULDBLOCK;
+ fput(file);
+ }
}
return ret;
}
@@ -1236,9 +1219,7 @@ asmlinkage int sunos_read(unsigned int fd, u32 buf, u32 count)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_read(fd, (char *)A(buf), count), fd);
- unlock_kernel();
return ret;
}
@@ -1246,9 +1227,7 @@ asmlinkage int sunos_readv(u32 fd, u32 vector, s32 count)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys32_readv(fd, vector, count), fd);
- unlock_kernel();
return ret;
}
@@ -1256,9 +1235,7 @@ asmlinkage int sunos_write(unsigned int fd, u32 buf, u32 count)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_write(fd, (char *)A(buf), count), fd);
- unlock_kernel();
return ret;
}
@@ -1266,9 +1243,7 @@ asmlinkage int sunos_writev(u32 fd, u32 vector, s32 count)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys32_writev(fd, vector, count), fd);
- unlock_kernel();
return ret;
}
@@ -1276,9 +1251,7 @@ asmlinkage int sunos_recv(int fd, u32 ubuf, int size, unsigned flags)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_recv(fd, (void *)A(ubuf), size, flags), fd);
- unlock_kernel();
return ret;
}
@@ -1286,9 +1259,7 @@ asmlinkage int sunos_send(int fd, u32 buff, int len, unsigned flags)
{
int ret;
- lock_kernel();
ret = check_nonblock(sys_send(fd, (void *)A(buff), len, flags), fd);
- unlock_kernel();
return ret;
}
@@ -1299,7 +1270,6 @@ asmlinkage int sunos_socket(int family, int type, int protocol)
{
int ret, one = 1;
- lock_kernel();
ret = sys_socket(family, type, protocol);
if (ret < 0)
goto out;
@@ -1307,7 +1277,6 @@ asmlinkage int sunos_socket(int family, int type, int protocol)
sys_setsockopt(ret, SOL_SOCKET, SO_BSDCOMPAT,
(char *)&one, sizeof(one));
out:
- unlock_kernel();
return ret;
}
@@ -1315,7 +1284,6 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen)
{
int ret, one = 1;
- lock_kernel();
while (1) {
ret = check_nonblock(sys_accept(fd, (struct sockaddr *)A(sa),
(int *)A(addrlen)), fd);
@@ -1328,7 +1296,6 @@ asmlinkage int sunos_accept(int fd, u32 sa, u32 addrlen)
sys_setsockopt(ret, SOL_SOCKET, SO_BSDCOMPAT,
(char *)&one, sizeof(one));
out:
- unlock_kernel();
return ret;
}
@@ -1376,14 +1343,12 @@ asmlinkage int sunos_setsockopt(int fd, int level, int optname, u32 optval,
int tr_opt = optname;
int ret;
- lock_kernel();
if (level == SOL_IP) {
/* Multicast socketopts (ttl, membership) */
if (tr_opt >=2 && tr_opt <= 6)
tr_opt += 30;
}
ret = sys_setsockopt(fd, level, tr_opt, (char *)A(optval), optlen);
- unlock_kernel();
return ret;
}
@@ -1393,13 +1358,11 @@ asmlinkage int sunos_getsockopt(int fd, int level, int optname,
int tr_opt = optname;
int ret;
- lock_kernel();
if (level == SOL_IP) {
/* Multicast socketopts (ttl, membership) */
if (tr_opt >=2 && tr_opt <= 6)
tr_opt += 30;
}
ret = sys32_getsockopt(fd, level, tr_opt, optval, optlen);
- unlock_kernel();
return ret;
}