Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Highly rewrite POSIX semaphore. Use file descriptor...



details:   https://anonhg.NetBSD.org/src/rev/71a30e7fcdfa
branches:  trunk
changeset: 764123:71a30e7fcdfa
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Apr 11 22:31:43 2011 +0000

description:
Highly rewrite POSIX semaphore.  Use file descriptor subsystem, greatly
simplify reference counting, and fix various bugs which existed before,
e.g. some incorrect locking or mq_unlink() not checking for permissions.

Also, fixes PR/43452.

diffstat:

 sys/sys/file.h |  28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)

diffs (49 lines):

diff -r 05078e3e3127 -r 71a30e7fcdfa sys/sys/file.h
--- a/sys/sys/file.h    Mon Apr 11 22:31:42 2011 +0000
+++ b/sys/sys/file.h    Mon Apr 11 22:31:43 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.h,v 1.71 2009/12/24 19:01:12 elad Exp $   */
+/*     $NetBSD: file.h,v 1.72 2011/04/11 22:31:43 rmind Exp $  */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -109,6 +109,18 @@
        kmutex_t        f_lock;         /* lock on structure */
        int             f_flag;         /* see fcntl.h */
        u_int           f_marker;       /* traversal marker (sysctl) */
+       u_int           f_type;         /* descriptor type */
+       u_int           f_advice;       /* access pattern hint; UVM_ADV_* */
+       u_int           f_count;        /* reference count */
+       u_int           f_msgcount;     /* references from message queue */
+       u_int           f_unpcount;     /* deferred close: see uipc_usrreq.c */
+       SLIST_ENTRY(file) f_unplist;    /* deferred close: see uipc_usrreq.c */
+};
+
+/*
+ * Descriptor types.
+ */
+
 #define        DTYPE_VNODE     1               /* file */
 #define        DTYPE_SOCKET    2               /* communications endpoint */
 #define        DTYPE_PIPE      3               /* pipe */
@@ -116,15 +128,11 @@
 #define        DTYPE_MISC      5               /* misc file descriptor type */
 #define        DTYPE_CRYPTO    6               /* crypto */
 #define        DTYPE_MQUEUE    7               /* message queue */
-#define DTYPE_NAMES \
-    "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue"
-       u_int           f_type;         /* descriptor type */
-       u_int           f_advice;       /* access pattern hint; UVM_ADV_* */
-       u_int           f_count;        /* reference count */
-       u_int           f_msgcount;     /* references from message queue */
-       u_int           f_unpcount;     /* deferred close: see uipc_usrreq.c */
-       SLIST_ENTRY(file) f_unplist;    /* deferred close: see uipc_usrreq.c */
-};
+#define        DTYPE_SEM       8               /* semaphore */
+
+#define DTYPE_NAMES    \
+    "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue", \
+    "semaphore"
 
 /*
  * Flags for fo_read and fo_write and do_fileread/write/v



Home | Main Index | Thread Index | Old Index