summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys
diff options
context:
space:
mode:
authorGavin Maltby <Gavin.Maltby@Sun.COM>2009-11-19 15:28:11 +1100
committerGavin Maltby <Gavin.Maltby@Sun.COM>2009-11-19 15:28:11 +1100
commit49b225e1cfa7bbf7738d4df0a03f18e3283426eb (patch)
treefec8a2ac5f26eef93ef906b43e2642f06bcba3a6 /usr/src/uts/common/sys
parent6dea387a9f9ddc2932a4c49a09384dfdcd5a703b (diff)
downloadillumos-joyent-49b225e1cfa7bbf7738d4df0a03f18e3283426eb.tar.gz
PSARC/2009/554 door_xcreate - extended door creation interface for private doors
PSARC/2009/573 libfmevent - external subscriptions to FMA protocol events PSARC/2009/574 GPEC interface changes and additions 6893144 add door_xcreate for creating private doors with per-door thread creation control 6896220 sysevent_evc_xsubscribe and other GPEC modifications 6900975 sysevent_evc_{unbind,unsubscribe} off-by-one in subscriber list traversal 6868087 facility to allow external processes to subscribe to FMA protocol events 6896205 fmd module to forward selected protocol events for external subscription
Diffstat (limited to 'usr/src/uts/common/sys')
-rw-r--r--usr/src/uts/common/sys/door.h42
-rw-r--r--usr/src/uts/common/sys/sysevent.h123
-rw-r--r--usr/src/uts/common/sys/sysevent_impl.h6
3 files changed, 114 insertions, 57 deletions
diff --git a/usr/src/uts/common/sys/door.h b/usr/src/uts/common/sys/door.h
index e45386270d..7d04847864 100644
--- a/usr/src/uts/common/sys/door.h
+++ b/usr/src/uts/common/sys/door.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -30,12 +30,29 @@
#ifndef _SYS_DOOR_H
#define _SYS_DOOR_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
+/*
+ * Attributes associated with doors.
+ */
+
+/* Attributes originally obtained from door_create operation */
+#define DOOR_UNREF 0x01 /* Deliver an unref notification with door */
+#define DOOR_PRIVATE 0x02 /* Use a private pool of server threads */
+#define DOOR_UNREF_MULTI 0x10 /* Deliver unref notification more than once */
+#define DOOR_REFUSE_DESC 0x40 /* Do not accept descriptors from callers */
+#define DOOR_NO_CANCEL 0x80 /* No server thread cancel on client abort */
+#define DOOR_NO_DEPLETION_CB 0x100 /* No thread create callbacks on depletion */
+
+/* Attributes (additional) returned with door_info and door_desc_t data */
+#define DOOR_LOCAL 0x04 /* Descriptor is local to current process */
+#define DOOR_REVOKED 0x08 /* Door has been revoked */
+#define DOOR_IS_UNREF 0x20 /* Door is currently unreferenced */
+#define DOOR_PRIVCREATE 0x200 /* Door has a private thread creation func */
+#define DOOR_DEPLETION_CB 0x400 /* Set only during depletion callbacks */
+
#if !defined(_ASM)
#include <sys/types.h>
@@ -62,25 +79,10 @@ typedef struct __door_handle *door_handle_t; /* opaque kernel door handle */
/* Door descriptor passed to door_info to get current thread's binding */
#define DOOR_QUERY -2
-/*
- * Attributes associated with doors.
- */
-
-/* Attributes originally obtained from door_create operation */
-#define DOOR_UNREF 0x01 /* Deliver an unref notification with door */
-#define DOOR_PRIVATE 0x02 /* Use a private pool of server threads */
-#define DOOR_UNREF_MULTI 0x10 /* Deliver unref notification more than once */
-#define DOOR_REFUSE_DESC 0x40 /* Do not accept descriptors from callers */
-#define DOOR_NO_CANCEL 0x80 /* No server thread cancel on client abort */
-
-/* Attributes (additional) returned with door_info and door_desc_t data */
-#define DOOR_LOCAL 0x04 /* Descriptor is local to current process */
-#define DOOR_REVOKED 0x08 /* Door has been revoked */
-#define DOOR_IS_UNREF 0x20 /* Door is currently unreferenced */
-
/* Masks of applicable flags */
#define DOOR_CREATE_MASK (DOOR_UNREF | DOOR_PRIVATE | \
- DOOR_UNREF_MULTI | DOOR_REFUSE_DESC | DOOR_NO_CANCEL)
+ DOOR_UNREF_MULTI | DOOR_REFUSE_DESC | DOOR_NO_CANCEL | \
+ DOOR_NO_DEPLETION_CB | DOOR_PRIVCREATE)
#define DOOR_KI_CREATE_MASK (DOOR_UNREF | DOOR_UNREF_MULTI)
/* Mask of above attributes */
diff --git a/usr/src/uts/common/sys/sysevent.h b/usr/src/uts/common/sys/sysevent.h
index 0a61e41de8..44b5d069fb 100644
--- a/usr/src/uts/common/sys/sysevent.h
+++ b/usr/src/uts/common/sys/sysevent.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,16 +18,15 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SYSEVENT_H
#define _SYS_SYSEVENT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/nvpair.h>
#ifdef __cplusplus
@@ -164,18 +162,50 @@ typedef struct sysevent_value {
#define EVCH_QWAIT 0x0008 /* Wait for slot in event queue */
/*
- * Meaning of flags for subscribe/unsubscribe. Bits 0 to 7 are dedicated to
- * the consolidation private interface.
+ * Meaning of flags for subscribe. Bits 8 to 15 are dedicated to
+ * the consolidation private interface, so flags defined here are restricted
+ * to the LSB.
+ *
+ * EVCH_SUB_KEEP indicates that this subscription should persist even if
+ * this subscriber id should die unexpectedly; matching events will be
+ * queued (up to a limit) and will be delivered if/when we restart again
+ * with the same subscriber id.
+ */
+#define EVCH_SUB_KEEP 0x01
+
+/*
+ * Subscriptions may be wildcarded, but we limit the number of
+ * wildcards permitted.
+ */
+#define EVCH_WILDCARD_MAX 10
+
+/*
+ * Used in unsubscribe to indicate all subscriber ids for a channel.
*/
-#define EVCH_SUB_KEEP 0x0001
#define EVCH_ALLSUB "all_subs"
/*
* Meaning of flags parameter of channel bind function
+ *
+ * EVCH_CREAT indicates to create a channel if not already present.
+ *
+ * EVCH_HOLD_PEND indicates that events should be published to this
+ * channel even if there are no matching subscribers present; when
+ * a subscriber belatedly binds to the channel and registers their
+ * subscriptions they will receive events that predate their bind.
+ * If the channel is closed, however, with no remaining bindings then
+ * the channel is destroyed.
+ *
+ * EVCH_HOLD_PEND_INDEF is a stronger version of EVCH_HOLD_PEND -
+ * even if the channel has no remaining bindings it will not be
+ * destroyed so long as events remain unconsumed. This is suitable for
+ * use with short-lived event producers that may bind to (create) the
+ * channel and exit before the intended consumer has started.
*/
-#define EVCH_CREAT 0x0001 /* Create a channel if not present */
+#define EVCH_CREAT 0x0001
#define EVCH_HOLD_PEND 0x0002
-#define EVCH_B_FLAGS 0x0003 /* All valid bits */
+#define EVCH_HOLD_PEND_INDEF 0x0004
+#define EVCH_B_FLAGS 0x0007 /* All valid bits */
/*
* Meaning of commands of evc_control function
@@ -186,37 +216,62 @@ typedef struct sysevent_value {
#define EVCH_CMD_LAST EVCH_SET_CHAN_LEN /* Last command */
/*
- * Event channel interface definitions
+ * Shared user/kernel event channel interface definitions
*/
-int sysevent_evc_bind(const char *, evchan_t **, uint32_t);
-void sysevent_evc_unbind(evchan_t *);
-int sysevent_evc_subscribe(evchan_t *, const char *, const char *,
+extern int sysevent_evc_bind(const char *, evchan_t **, uint32_t);
+extern int sysevent_evc_unbind(evchan_t *);
+extern int sysevent_evc_subscribe(evchan_t *, const char *, const char *,
int (*)(sysevent_t *, void *), void *, uint32_t);
-void sysevent_evc_unsubscribe(evchan_t *, const char *);
-int sysevent_evc_publish(evchan_t *, const char *, const char *,
+extern int sysevent_evc_unsubscribe(evchan_t *, const char *);
+extern int sysevent_evc_publish(evchan_t *, const char *, const char *,
const char *, const char *, nvlist_t *, uint32_t);
-int sysevent_evc_control(evchan_t *, int, ...);
+extern int sysevent_evc_control(evchan_t *, int, ...);
-#ifdef _KERNEL
+#ifndef _KERNEL
+
+/*
+ * Userland-only event channel interfaces
+ */
+
+#include <door.h>
+
+typedef struct sysevent_subattr sysevent_subattr_t;
+
+extern sysevent_subattr_t *sysevent_subattr_alloc(void);
+extern void sysevent_subattr_free(sysevent_subattr_t *);
+
+extern void sysevent_subattr_thrattr(sysevent_subattr_t *, pthread_attr_t *);
+extern void sysevent_subattr_sigmask(sysevent_subattr_t *, sigset_t *);
+
+extern void sysevent_subattr_thrcreate(sysevent_subattr_t *,
+ door_xcreate_server_func_t *, void *);
+extern void sysevent_subattr_thrsetup(sysevent_subattr_t *,
+ door_xcreate_thrsetup_func_t *, void *);
+
+extern int sysevent_evc_xsubscribe(evchan_t *, const char *, const char *,
+ int (*)(sysevent_t *, void *), void *, uint32_t, sysevent_subattr_t *);
+
+#else
/*
* Kernel log_event interfaces.
*/
-int log_sysevent(sysevent_t *, int, sysevent_id_t *);
-
-sysevent_t *sysevent_alloc(char *, char *, char *, int);
-void sysevent_free(sysevent_t *);
-int sysevent_add_attr(sysevent_attr_list_t **, char *, sysevent_value_t *, int);
-void sysevent_free_attr(sysevent_attr_list_t *);
-int sysevent_attach_attributes(sysevent_t *, sysevent_attr_list_t *);
-void sysevent_detach_attributes(sysevent_t *);
-char *sysevent_get_class_name(sysevent_t *);
-char *sysevent_get_subclass_name(sysevent_t *);
-uint64_t sysevent_get_seq(sysevent_t *);
-void sysevent_get_time(sysevent_t *, hrtime_t *);
-size_t sysevent_get_size(sysevent_t *);
-char *sysevent_get_pub(sysevent_t *);
-int sysevent_get_attr_list(sysevent_t *, nvlist_t **);
+extern int log_sysevent(sysevent_t *, int, sysevent_id_t *);
+
+extern sysevent_t *sysevent_alloc(char *, char *, char *, int);
+extern void sysevent_free(sysevent_t *);
+extern int sysevent_add_attr(sysevent_attr_list_t **, char *,
+ sysevent_value_t *, int);
+extern void sysevent_free_attr(sysevent_attr_list_t *);
+extern int sysevent_attach_attributes(sysevent_t *, sysevent_attr_list_t *);
+extern void sysevent_detach_attributes(sysevent_t *);
+extern char *sysevent_get_class_name(sysevent_t *);
+extern char *sysevent_get_subclass_name(sysevent_t *);
+extern uint64_t sysevent_get_seq(sysevent_t *);
+extern void sysevent_get_time(sysevent_t *, hrtime_t *);
+extern size_t sysevent_get_size(sysevent_t *);
+extern char *sysevent_get_pub(sysevent_t *);
+extern int sysevent_get_attr_list(sysevent_t *, nvlist_t **);
#endif /* _KERNEL */
diff --git a/usr/src/uts/common/sys/sysevent_impl.h b/usr/src/uts/common/sys/sysevent_impl.h
index 11115c8f2d..215862fbdd 100644
--- a/usr/src/uts/common/sys/sysevent_impl.h
+++ b/usr/src/uts/common/sys/sysevent_impl.h
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -476,9 +476,9 @@ typedef struct {
/*
* Project private flags for sysevent_evc_subscribe. Bits 0 to 7 are reserved
- * for the consolidation private interface.
+ * for the consolidation private interface, so we must use bits 8-15 here.
*/
-#define EVCH_SUB_DUMP 0x0100
+#define EVCH_SUB_DUMP (0x01 << 8)
/*
* Permission flags