summaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-18 00:24:27 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-18 00:24:27 +0000
commitb9558d5f86c471a125abf1fb3a3882fb053b1f8c (patch)
tree707b53ec64e740a7da87d5f36485e3cd9b1c794e /kernel/sys.c
parentb3ac367c7a3e6047abe74817db27e34e759f279f (diff)
Merge with Linux 2.3.41.
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index cc368de01..57940edea 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -828,21 +828,16 @@ out:
return 1;
}
-/*
- * This should really be a blocking read-write lock
- * rather than a semaphore. Anybody want to implement
- * one?
- */
-DECLARE_MUTEX(uts_sem);
+DECLARE_RWSEM(uts_sem);
asmlinkage long sys_newuname(struct new_utsname * name)
{
int errno = 0;
- down(&uts_sem);
+ down_read(&uts_sem);
if (copy_to_user(name,&system_utsname,sizeof *name))
errno = -EFAULT;
- up(&uts_sem);
+ up_read(&uts_sem);
return errno;
}
@@ -854,13 +849,13 @@ asmlinkage long sys_sethostname(char *name, int len)
return -EPERM;
if (len < 0 || len > __NEW_UTS_LEN)
return -EINVAL;
- down(&uts_sem);
+ down_write(&uts_sem);
errno = -EFAULT;
if (!copy_from_user(system_utsname.nodename, name, len)) {
system_utsname.nodename[len] = 0;
errno = 0;
}
- up(&uts_sem);
+ up_write(&uts_sem);
return errno;
}
@@ -870,14 +865,14 @@ asmlinkage long sys_gethostname(char *name, int len)
if (len < 0)
return -EINVAL;
- down(&uts_sem);
+ down_read(&uts_sem);
i = 1 + strlen(system_utsname.nodename);
if (i > len)
i = len;
errno = 0;
if (copy_to_user(name, system_utsname.nodename, i))
errno = -EFAULT;
- up(&uts_sem);
+ up_read(&uts_sem);
return errno;
}
@@ -894,13 +889,13 @@ asmlinkage long sys_setdomainname(char *name, int len)
if (len < 0 || len > __NEW_UTS_LEN)
return -EINVAL;
- down(&uts_sem);
+ down_write(&uts_sem);
errno = -EFAULT;
if (!copy_from_user(system_utsname.domainname, name, len)) {
errno = 0;
system_utsname.domainname[len] = 0;
}
- up(&uts_sem);
+ up_write(&uts_sem);
return errno;
}