mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
[PATCH] namespaces: utsname: switch to using uts namespaces
Replace references to system_utsname to the per-process uts namespace where appropriate. This includes things like uname. Changes: Per Eric Biederman's comments, use the per-process uts namespace for ELF_PLATFORM, sunrpc, and parts of net/ipv4/ipconfig.c [[email protected]: UML fix] [[email protected]: cleanup] [[email protected]: build fix] Signed-off-by: Serge E. Hallyn <[email protected]> Cc: Kirill Korotaev <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: Herbert Poetzl <[email protected]> Cc: Andrey Savochkin <[email protected]> Signed-off-by: Cedric Le Goater <[email protected]> Cc: Jeff Dike <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
0bdd7aab7f
commit
e9ff3990f0
35 changed files with 180 additions and 160 deletions
|
|
@ -266,16 +266,21 @@ static int hpux_uname(struct hpux_utsname *name)
|
|||
|
||||
down_read(&uts_sem);
|
||||
|
||||
error = __copy_to_user(&name->sysname,&system_utsname.sysname,HPUX_UTSLEN-1);
|
||||
error |= __put_user(0,name->sysname+HPUX_UTSLEN-1);
|
||||
error |= __copy_to_user(&name->nodename,&system_utsname.nodename,HPUX_UTSLEN-1);
|
||||
error |= __put_user(0,name->nodename+HPUX_UTSLEN-1);
|
||||
error |= __copy_to_user(&name->release,&system_utsname.release,HPUX_UTSLEN-1);
|
||||
error |= __put_user(0,name->release+HPUX_UTSLEN-1);
|
||||
error |= __copy_to_user(&name->version,&system_utsname.version,HPUX_UTSLEN-1);
|
||||
error |= __put_user(0,name->version+HPUX_UTSLEN-1);
|
||||
error |= __copy_to_user(&name->machine,&system_utsname.machine,HPUX_UTSLEN-1);
|
||||
error |= __put_user(0,name->machine+HPUX_UTSLEN-1);
|
||||
error = __copy_to_user(&name->sysname, &utsname()->sysname,
|
||||
HPUX_UTSLEN - 1);
|
||||
error |= __put_user(0, name->sysname + HPUX_UTSLEN - 1);
|
||||
error |= __copy_to_user(&name->nodename, &utsname()->nodename,
|
||||
HPUX_UTSLEN - 1);
|
||||
error |= __put_user(0, name->nodename + HPUX_UTSLEN - 1);
|
||||
error |= __copy_to_user(&name->release, &utsname()->release,
|
||||
HPUX_UTSLEN - 1);
|
||||
error |= __put_user(0, name->release + HPUX_UTSLEN - 1);
|
||||
error |= __copy_to_user(&name->version, &utsname()->version,
|
||||
HPUX_UTSLEN - 1);
|
||||
error |= __put_user(0, name->version + HPUX_UTSLEN - 1);
|
||||
error |= __copy_to_user(&name->machine, &utsname()->machine,
|
||||
HPUX_UTSLEN - 1);
|
||||
error |= __put_user(0, name->machine + HPUX_UTSLEN - 1);
|
||||
|
||||
up_read(&uts_sem);
|
||||
|
||||
|
|
@ -373,8 +378,8 @@ int hpux_utssys(char *ubuf, int n, int type)
|
|||
/* TODO: print a warning about using this? */
|
||||
down_write(&uts_sem);
|
||||
error = -EFAULT;
|
||||
if (!copy_from_user(system_utsname.sysname, ubuf, len)) {
|
||||
system_utsname.sysname[len] = 0;
|
||||
if (!copy_from_user(utsname()->sysname, ubuf, len)) {
|
||||
utsname()->sysname[len] = 0;
|
||||
error = 0;
|
||||
}
|
||||
up_write(&uts_sem);
|
||||
|
|
@ -400,8 +405,8 @@ int hpux_utssys(char *ubuf, int n, int type)
|
|||
/* TODO: print a warning about this? */
|
||||
down_write(&uts_sem);
|
||||
error = -EFAULT;
|
||||
if (!copy_from_user(system_utsname.release, ubuf, len)) {
|
||||
system_utsname.release[len] = 0;
|
||||
if (!copy_from_user(utsname()->release, ubuf, len)) {
|
||||
utsname()->release[len] = 0;
|
||||
error = 0;
|
||||
}
|
||||
up_write(&uts_sem);
|
||||
|
|
@ -422,13 +427,13 @@ int hpux_getdomainname(char *name, int len)
|
|||
|
||||
down_read(&uts_sem);
|
||||
|
||||
nlen = strlen(system_utsname.domainname) + 1;
|
||||
nlen = strlen(utsname()->domainname) + 1;
|
||||
|
||||
if (nlen < len)
|
||||
len = nlen;
|
||||
if(len > __NEW_UTS_LEN)
|
||||
goto done;
|
||||
if(copy_to_user(name, system_utsname.domainname, len))
|
||||
if(copy_to_user(name, utsname()->domainname, len))
|
||||
goto done;
|
||||
err = 0;
|
||||
done:
|
||||
|
|
|
|||
Loading…
Reference in a new issue