Re: [PATCH][2.3.0] Read-write locks instead semaphores on UTS structures

Jakub Jelinek (jj@sunsite.ms.mff.cuni.cz)
Thu, 13 May 1999 10:05:26 +0200


On Wed, May 12, 1999 at 04:50:22PM -0300, Marcelo Tosatti wrote:
> This patch implements read-write locks instead semaphores in UTS
> structures as noted by Linus in kernel/sys.c.
>
> Linus, can you apply this?
>
> - Marcelo

Minor correction:

> diff -Nur linux.orig/arch/sparc64/solaris/misc.c linux/arch/sparc64/solaris/misc.c
> --- linux.orig/arch/sparc64/solaris/misc.c Wed May 12 15:47:13 1999
> +++ linux/arch/sparc64/solaris/misc.c Wed May 12 15:47:34 1999
> @@ -261,7 +261,7 @@
> asmlinkage int solaris_utsname(u32 buf)
> {
> /* Why should we not lie a bit? */
> - down(&uts_sem);
> + write_lock(&uts_rwlock);

^^^^^^^^^^ read_lock is enough

> set_utsfield(((struct sol_utsname *)A(buf))->sysname,
> "SunOS", 0, 0);
> set_utsfield(((struct sol_utsname *)A(buf))->nodename,
> @@ -272,7 +272,7 @@
> "Generic", 0, 0);
> set_utsfield(((struct sol_utsname *)A(buf))->machine,
> machine(), 0, 0);
> - up(&uts_sem);
> + write_unlock(&uts_rwlock);

^^^^^^^^^^ and here as well (well, read_unlock, of course).

set_utsfield macro means set utsfield in userspace, it never touches kernel
uts structure (it would be weird if we set it sysname to SunOS for Linux
programs :) )

Cheers,
Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
UltraLinux | http://ultra.linux.cz/ | http://ultra.penguin.cz/
Linux version 2.3.1 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/