Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Add locking, requested by yamt. Note that locking i...



details:   https://anonhg.NetBSD.org/src/rev/47977b93d385
branches:  trunk
changeset: 773026:47977b93d385
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jan 25 14:04:09 2012 +0000

description:
Add locking, requested by yamt. Note that locking is not used everywhere
for these.

diffstat:

 sys/kern/sys_descrip.c   |   8 ++++----
 sys/kern/uipc_syscalls.c |  12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (72 lines):

diff -r ac733378b1d2 -r 47977b93d385 sys/kern/sys_descrip.c
--- a/sys/kern/sys_descrip.c    Wed Jan 25 13:29:58 2012 +0000
+++ b/sys/kern/sys_descrip.c    Wed Jan 25 14:04:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_descrip.c,v 1.24 2012/01/25 00:28:36 christos Exp $        */
+/*     $NetBSD: sys_descrip.c,v 1.25 2012/01/25 14:04:09 christos Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.24 2012/01/25 00:28:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_descrip.c,v 1.25 2012/01/25 14:04:09 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -409,9 +409,9 @@
 
        case F_SETNOSIGPIPE:
                if (SCARG(uap, arg))
-                       fp->f_flag |= FNOSIGPIPE;
+                       atomic_or_uint(&fp->f_flag, FNOSIGPIPE);
                else
-                       fp->f_flag &= ~FNOSIGPIPE;
+                       atomic_and_uint(&fp->f_flag, ~FNOSIGPIPE);
                *retval = 0;
                break;
 
diff -r ac733378b1d2 -r 47977b93d385 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Wed Jan 25 13:29:58 2012 +0000
+++ b/sys/kern/uipc_syscalls.c  Wed Jan 25 14:04:09 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.151 2012/01/25 00:28:36 christos Exp $     */
+/*     $NetBSD: uipc_syscalls.c,v 1.152 2012/01/25 14:04:09 christos Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.151 2012/01/25 00:28:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.152 2012/01/25 14:04:09 christos Exp $");
 
 #include "opt_pipe.h"
 
@@ -974,9 +974,9 @@
 
        error = sosetopt(so, &sopt);
        if (so->so_options & SO_NOSIGPIPE)
-               fp->f_flag |= FNOSIGPIPE;
+               atomic_or_uint(&fp->f_flag, FNOSIGPIPE);
        else
-               fp->f_flag &= ~FNOSIGPIPE;
+               atomic_and_uint(&fp->f_flag, ~FNOSIGPIPE);
 
  out:
        sockopt_destroy(&sopt);
@@ -1014,9 +1014,9 @@
        sockopt_init(&sopt, SCARG(uap, level), SCARG(uap, name), 0);
 
        if (fp->f_flag & FNOSIGPIPE)
-               so->so_options |= SO_NOSIGPIPE;
+               atomic_or_uint(&so->so_options, SO_NOSIGPIPE);
        else
-               so->so_options &= ~SO_NOSIGPIPE;
+               atomic_and_uint(&so->so_options, ~SO_NOSIGPIPE);
        error = sogetopt(so, &sopt);
        if (error)
                goto out;



Home | Main Index | Thread Index | Old Index