patch-2.4.0-test3 linux/arch/sparc64/kernel/sys_sunos32.c

Next file: linux/arch/sparc64/lib/Makefile
Previous file: linux/arch/sparc64/kernel/sys_sparc32.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/arch/sparc64/kernel/sys_sunos32.c linux/arch/sparc64/kernel/sys_sunos32.c
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos32.c,v 1.49 2000/06/22 11:42:25 davem Exp $
+/* $Id: sys_sunos32.c,v 1.51 2000/07/06 01:41:29 davem Exp $
  * sys_sunos32.c: SunOS binary compatability layer on sparc64.
  *
  * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -68,8 +68,6 @@
 	struct file *file = NULL;
 	unsigned long retval, ret_type;
 
-	down(&current->mm->mmap_sem);
-	lock_kernel();
 	if(flags & MAP_NORESERVE) {
 		static int cnt;
 		if (cnt++ < 10)
@@ -102,18 +100,18 @@
 	flags &= ~_MAP_NEW;
 
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+	down(&current->mm->mmap_sem);
 	retval = do_mmap(file,
 			 (unsigned long) addr, (unsigned long) len,
 			 (unsigned long) prot, (unsigned long) flags,
 			 (unsigned long) off);
+	up(&current->mm->mmap_sem);
 	if(!ret_type)
 		retval = ((retval < 0xf0000000) ? 0 : retval);
 out_putf:
 	if (file)
 		fput(file);
 out:
-	unlock_kernel();
-	up(&current->mm->mmap_sem);
 	return (u32) retval;
 }
 
@@ -321,8 +319,6 @@
 	if(!file)
 		goto out;
 
-	lock_kernel();
-
 	error = -EINVAL;
 	if(cnt < (sizeof(struct sunos_dirent) + 255))
 		goto out_putf;
@@ -344,7 +340,6 @@
 	}
 
 out_putf:
-	unlock_kernel();
 	fput(file);
 out:
 	return error;
@@ -406,8 +401,6 @@
 	if(!file)
 		goto out;
 
-	lock_kernel();
-
 	error = -EINVAL;
 	if(cnt < (sizeof(struct sunos_direntry) + 255))
 		goto out_putf;
@@ -429,7 +422,6 @@
 	}
 
 out_putf:
-	unlock_kernel();
 	fput(file);
 out:
 	return error;
@@ -489,7 +481,6 @@
 {
 	int ret;
 
-	lock_kernel();
 	switch(name) {
 	case _PCONF_LINK:
 		ret = LINK_MAX;
@@ -520,7 +511,6 @@
 		ret = -EINVAL;
 		break;
 	}
-	unlock_kernel();
 	return ret;
 }
 
@@ -528,9 +518,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = sunos_fpathconf(0, name); /* XXX cheese XXX */
-	unlock_kernel();
 	return ret;
 }
 
@@ -548,7 +536,6 @@
 	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);
@@ -559,7 +546,6 @@
 		if (sec == 0 && usec == 0)
 			ret = 0;
 	}
-	unlock_kernel();
 	return ret;
 }
 
@@ -806,7 +792,6 @@
 	int ret;
 
 	/* So stupid... */
-	lock_kernel();
 	if((!pid || pid == current->pid) &&
 	   !pgid) {
 		sys_setsid();
@@ -814,7 +799,6 @@
 	} else {
 		ret = sys_setpgid(pid, pgid);
 	}
-	unlock_kernel();
 	return ret;
 }
 
@@ -826,10 +810,8 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = sys32_wait4((pid ? pid : ((__kernel_pid_t32)-1)),
 			  stat_addr, options, ru);
-	unlock_kernel();
 	return ret;
 }
 
@@ -846,9 +828,7 @@
 
 asmlinkage int sunos_audit(void)
 {
-	lock_kernel();
 	printk ("sys_audit\n");
-	unlock_kernel();
 	return -1;
 }
 
@@ -876,7 +856,6 @@
 {
 	s32 ret;
 
-	lock_kernel();
 	switch (name){
 	case _SC_ARG_MAX:
 		ret = ARG_MAX;
@@ -909,7 +888,6 @@
 		ret = -1;
 		break;
 	};
-	unlock_kernel();
 	return ret;
 }
 
@@ -918,7 +896,6 @@
 	union semun arg4;
 	int ret;
 
-	lock_kernel();
 	switch (op) {
 	case 0:
 		/* Most arguments match on a 1:1 basis but cmd doesn't */
@@ -954,7 +931,6 @@
 		ret = -EINVAL;
 		break;
 	};
-	unlock_kernel();
 	return ret;
 }
 
@@ -1056,7 +1032,6 @@
 	u32 arg5;
 	int rval;
 
-	lock_kernel();
 	switch(op) {
 	case 0:
 		rval = sys_msgget((key_t)arg1, (int)arg2);
@@ -1110,7 +1085,6 @@
 		rval = -EINVAL;
 		break;
 	}
-	unlock_kernel();
 	return rval;
 }
 
@@ -1170,7 +1144,6 @@
 	mm_segment_t old_fs = get_fs();
 	int rval;
 
-	lock_kernel();
 	switch(op) {
 	case 0:
 		/* sys_shmat(): attach a shared memory area */
@@ -1202,7 +1175,6 @@
 		rval = -EINVAL;
 		break;
 	};
-	unlock_kernel();
 	return rval;
 }
 
@@ -1225,9 +1197,12 @@
 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;
 }
@@ -1244,9 +1219,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = check_nonblock(sys_read(fd, (char *)A(buf), count), fd);
-	unlock_kernel();
 	return ret;
 }
 
@@ -1254,9 +1227,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = check_nonblock(sys32_readv(fd, vector, count), fd);
-	unlock_kernel();
 	return ret;
 }
 
@@ -1264,9 +1235,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = check_nonblock(sys_write(fd, (char *)A(buf), count), fd);
-	unlock_kernel();
 	return ret;
 }
 
@@ -1274,9 +1243,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = check_nonblock(sys32_writev(fd, vector, count), fd);
-	unlock_kernel();
 	return ret;
 }
 
@@ -1284,9 +1251,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = check_nonblock(sys_recv(fd, (void *)A(ubuf), size, flags), fd);
-	unlock_kernel();
 	return ret;
 }
 
@@ -1294,9 +1259,7 @@
 {
 	int ret;
 
-	lock_kernel();
 	ret = check_nonblock(sys_send(fd, (void *)A(buff), len, flags), fd);
-	unlock_kernel();
 	return ret;
 }
 
@@ -1307,7 +1270,6 @@
 {
 	int ret, one = 1;
 
-	lock_kernel();
 	ret = sys_socket(family, type, protocol);
 	if (ret < 0)
 		goto out;
@@ -1315,7 +1277,6 @@
 	sys_setsockopt(ret, SOL_SOCKET, SO_BSDCOMPAT,
 		       (char *)&one, sizeof(one));
 out:
-	unlock_kernel();
 	return ret;
 }
 
@@ -1323,7 +1284,6 @@
 {
 	int ret, one = 1;
 
-	lock_kernel();
 	while (1) {
 		ret = check_nonblock(sys_accept(fd, (struct sockaddr *)A(sa),
 						(int *)A(addrlen)), fd);
@@ -1336,7 +1296,6 @@
 	sys_setsockopt(ret, SOL_SOCKET, SO_BSDCOMPAT,
 		       (char *)&one, sizeof(one));
 out:
-	unlock_kernel();
 	return ret;
 }
 
@@ -1384,14 +1343,12 @@
 	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;
 }
 
@@ -1401,13 +1358,11 @@
 	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;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)