summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-07-23 12:39:31 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-07-23 12:39:31 +0000
commitc69b5d8dd030b09837cba039acde55abedd6f408 (patch)
tree14a52c73181138842cb92cd9dc6e751a295be188
parentc697085b76d32ea7025959f61179747ba7a9f921 (diff)
parentac4f20c056d4e5beb8b62e2c843802e3298be389 (diff)
downloadillumos-joyent-c69b5d8dd030b09837cba039acde55abedd6f408.tar.gz
[illumos-gate merge]
commit ac4f20c056d4e5beb8b62e2c843802e3298be389 11484 usr/src/cmd/ypcmd/ypupdated.c is unused commit 275a2dc2ef933b7b810b98855f8ee3fa0e662007 11483 usr/src/cmd/spell/malloc.c is unused commit a25df66779f8c4c58005d492d3ceac6312116360 11364 Want system event for datalink state changes 11365 Want ability to toggle etherstub link state commit 78d23b23ae6c0e2213934bf6698f8447eee94b2e 11396 ndmpd: NULL pointer errors commit c77bf7778622780cbb6cd7b4e39f428948e33280 11391 keyserv: NULL pointer errors commit b89e8170ec8d28d026b67ad7ce606c02a83398dc 11390 krb5: NULL pointer errors Conflicts: usr/src/uts/common/sys/sysevent/datalink.h usr/src/uts/common/sys/sysevent.h usr/src/uts/common/io/dls/dls_mgmt.c usr/src/uts/common/io/dls/dls_link.c
-rw-r--r--manifest1
-rw-r--r--usr/src/cmd/keyserv/chkey_common.c52
-rw-r--r--usr/src/cmd/krb5/kadmin/dbutil/kadm5_create.c2
-rw-r--r--usr/src/cmd/krb5/kadmin/dbutil/kdb5_create.c2
-rw-r--r--usr/src/cmd/krb5/kadmin/kclient/kconf.c2
-rw-r--r--usr/src/cmd/krb5/kwarn/kwarnd_proc.c4
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd_callbacks.c8
-rw-r--r--usr/src/cmd/ndmpd/ndmp/ndmpd_log.c6
-rw-r--r--usr/src/cmd/spell/malloc.c255
-rw-r--r--usr/src/cmd/ypcmd/ypupdated.c409
-rw-r--r--usr/src/man/man3lib/libsysevent.3lib15
-rw-r--r--usr/src/man/man3sysevent/Makefile5
-rw-r--r--usr/src/man/man3sysevent/sysevents.3sysevent87
-rw-r--r--usr/src/pkg/manifests/system-header.mf1
-rw-r--r--usr/src/pkg/manifests/system-library.man3sysevent.inc1
-rw-r--r--usr/src/uts/common/io/dls/dls_link.c2
-rw-r--r--usr/src/uts/common/io/dls/dls_mgmt.c4
-rw-r--r--usr/src/uts/common/sys/sysevent.h2
-rw-r--r--usr/src/uts/common/sys/sysevent/datalink.h22
19 files changed, 147 insertions, 733 deletions
diff --git a/manifest b/manifest
index cf5ce66068..bf032129e7 100644
--- a/manifest
+++ b/manifest
@@ -18095,6 +18095,7 @@ f usr/share/man/man3sysevent/sysevent_post_event.3sysevent 0444 root bin
f usr/share/man/man3sysevent/sysevent_subscribe_event.3sysevent 0444 root bin
s usr/share/man/man3sysevent/sysevent_unbind_handle.3sysevent=sysevent_bind_handle.3sysevent
s usr/share/man/man3sysevent/sysevent_unsubscribe_event.3sysevent=sysevent_subscribe_event.3sysevent
+f usr/share/man/man3sysevent/sysevents.3sysevent 0444 root bin
d usr/share/man/man3tecla 0755 root bin
s usr/share/man/man3tecla/cfc_file_start.3tecla=cpl_complete_word.3tecla
s usr/share/man/man3tecla/cfc_literal_escapes.3tecla=cpl_complete_word.3tecla
diff --git a/usr/src/cmd/keyserv/chkey_common.c b/usr/src/cmd/keyserv/chkey_common.c
index d8d6e22beb..7e77710f47 100644
--- a/usr/src/cmd/keyserv/chkey_common.c
+++ b/usr/src/cmd/keyserv/chkey_common.c
@@ -81,7 +81,8 @@ static int get_ldap_bindPassword(char **);
* will be used.
*/
static int
-get_ldap_bindDN(char **ret_bindDN) {
+get_ldap_bindDN(char **ret_bindDN)
+{
char bindDN[BUFSIZ];
char prompt[BUFSIZ];
@@ -94,7 +95,7 @@ get_ldap_bindDN(char **ret_bindDN) {
"\nThe LDAP bind DN and password are required for this update.\n"
"If you are not sure what values to enter, please contact your\n"
"LDAP administrator.\n\nPlease enter LDAP bind DN [%s]: ",
- LDAP_BINDDN_DEFAULT);
+ LDAP_BINDDN_DEFAULT);
printf(prompt);
@@ -142,9 +143,10 @@ get_ldap_bindDN(char **ret_bindDN) {
* Prompt the user for a ldap bind password.
*/
static int
-get_ldap_bindPassword(char **ret_bindPass) {
+get_ldap_bindPassword(char **ret_bindPass)
+{
- char bindPassword[BUFSIZ];
+ char bindPassword[BUFSIZ];
char prompt[BUFSIZ];
char *bindPass = NULL;
@@ -153,7 +155,7 @@ get_ldap_bindPassword(char **ret_bindPass) {
*ret_bindPass = NULL;
(void) snprintf(prompt, BUFSIZ,
- "Please enter LDAP bind password: ");
+ "Please enter LDAP bind password: ");
bindPass = getpassphrase(prompt);
@@ -171,7 +173,7 @@ get_ldap_bindPassword(char **ret_bindPass) {
* from previous entered.
*/
(void) snprintf(prompt, BUFSIZ,
- "Re-enter LDAP bind password to confirm: ");
+ "Re-enter LDAP bind password to confirm: ");
bindPass = getpassphrase(prompt);
@@ -187,13 +189,13 @@ get_ldap_bindPassword(char **ret_bindPass) {
} else {
(void) memset(bindPass, 0, strlen(bindPass));
if ((*ret_bindPass = (char *)malloc(strlen(bindPassword)+1))
- == NULL) {
+ == NULL) {
(void) memset(bindPassword, 0, BUFSIZ);
return (PROMPTGET_MEMORY_FAIL);
}
(void) strlcpy(*ret_bindPass, bindPassword,
- strlen(bindPassword)+1);
+ strlen(bindPassword)+1);
/* Clean up and erase the credential info */
(void) memset(bindPassword, 0, BUFSIZ);
@@ -239,8 +241,7 @@ is_switch_policy(struct __nsw_switchconfig *conf, char *target)
char *
first_and_only_switch_policy(char *policy,
- struct __nsw_switchconfig *default_conf,
- char *head_msg)
+ struct __nsw_switchconfig *default_conf, char *head_msg)
{
struct __nsw_switchconfig *conf;
enum __nsw_parse_err perr;
@@ -291,8 +292,7 @@ first_and_only_switch_policy(char *policy,
int
check_switch_policy(char *policy, char *target_service,
- struct __nsw_switchconfig *default_conf,
- char *head_msg, char *tail_msg)
+ struct __nsw_switchconfig *default_conf, char *head_msg, char *tail_msg)
{
struct __nsw_switchconfig *conf;
enum __nsw_parse_err perr;
@@ -464,12 +464,8 @@ static char *keyAttrs[] = {
*/
static int
-ldap_attr_mod(ns_ldap_entry_t *entry,
- char *mechname,
- char *public,
- ns_ldap_attr_t **pkeyattrs,
- char *crypt,
- ns_ldap_attr_t **ckeyattrs)
+ldap_attr_mod(ns_ldap_entry_t *entry, char *mechname, char *public,
+ ns_ldap_attr_t **pkeyattrs, char *crypt, ns_ldap_attr_t **ckeyattrs)
{
char **alist[2];
char *keys[2];
@@ -568,13 +564,8 @@ ldap_attr_mod(ns_ldap_entry_t *entry,
* user.
*/
static void
-update_ldap_attr(const char *dn,
- ns_ldap_attr_t **attrs,
- const char *passwd,
- int add,
- int update4host,
- const char *bindDN,
- const char *bindPasswd)
+update_ldap_attr(const char *dn, ns_ldap_attr_t **attrs, const char *passwd,
+ int add, int update4host, const char *bindDN, const char *bindPasswd)
{
int ldaprc;
int authstried = 0;
@@ -681,11 +672,11 @@ update_ldap_attr(const char *dn,
if (add == TRUE)
ldaprc = __ns_ldap_addAttr("publickey", dn,
(const ns_ldap_attr_t * const *)attrs,
- credp, NULL, &errorp);
+ credp, 0, &errorp);
else
ldaprc = __ns_ldap_repAttr("publickey", dn,
(const ns_ldap_attr_t * const *)attrs,
- credp, NULL, &errorp);
+ credp, 0, &errorp);
if (ldaprc == NS_LDAP_SUCCESS) {
/* clean up ns_cred_t structure in memory */
if (credp != NULL)
@@ -725,11 +716,8 @@ out:
* they are not used or an error comes up.
*/
int
-ldap_update(char *mechname,
- char *netname,
- char *public,
- char *crypt,
- char *passwd)
+ldap_update(char *mechname, char *netname, char *public, char *crypt,
+ char *passwd)
{
char *netnamecpy;
char *id;
diff --git a/usr/src/cmd/krb5/kadmin/dbutil/kadm5_create.c b/usr/src/cmd/krb5/kadmin/dbutil/kadm5_create.c
index 64381029f0..4c65b17a7f 100644
--- a/usr/src/cmd/krb5/kadmin/dbutil/kadm5_create.c
+++ b/usr/src/cmd/krb5/kadmin/dbutil/kadm5_create.c
@@ -306,7 +306,7 @@ static int add_admin_princ(void *handle, krb5_context context,
krb5_int32 normalsalttype;
ret = krb5_get_permitted_enctypes(context, &enctype);
- if (ret || *enctype == NULL) {
+ if (ret || *enctype == 0) {
com_err(progname, ret,
gettext("while getting list of permitted encryption types"));
krb5_free_principal(context, ent.principal);
diff --git a/usr/src/cmd/krb5/kadmin/dbutil/kdb5_create.c b/usr/src/cmd/krb5/kadmin/dbutil/kdb5_create.c
index c6a56541e3..2e848358ba 100644
--- a/usr/src/cmd/krb5/kadmin/dbutil/kdb5_create.c
+++ b/usr/src/cmd/krb5/kadmin/dbutil/kdb5_create.c
@@ -168,7 +168,7 @@ void kdb5_create(argc, argv)
krb5_data pwd, seed;
kdb_log_context *log_ctx;
krb5_keyblock mkey;
- krb5_data master_salt = { 0, NULL };
+ krb5_data master_salt = { 0 };
/* Solaris Kerberos */
(void) memset(&mkey, 0, sizeof (mkey));
diff --git a/usr/src/cmd/krb5/kadmin/kclient/kconf.c b/usr/src/cmd/krb5/kadmin/kclient/kconf.c
index 6bbeff2c7b..cf3ddfd158 100644
--- a/usr/src/cmd/krb5/kadmin/kclient/kconf.c
+++ b/usr/src/cmd/krb5/kadmin/kclient/kconf.c
@@ -210,7 +210,7 @@ error:
* Release profile, which will subsequently flush new profile to file.
* If this fails then at least free profile memory.
*/
- if ((code = __profile_release(profile)) != NULL)
+ if ((code = __profile_release(profile)) != 0)
__profile_abandon(profile);
return (code);
diff --git a/usr/src/cmd/krb5/kwarn/kwarnd_proc.c b/usr/src/cmd/krb5/kwarn/kwarnd_proc.c
index 2d275618bd..be4e18dd31 100644
--- a/usr/src/cmd/krb5/kwarn/kwarnd_proc.c
+++ b/usr/src/cmd/krb5/kwarn/kwarnd_proc.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* RPC server procedures for the usermode daemon kwarnd.
*/
@@ -883,7 +881,7 @@ kwarnd_check_warning_list(void)
app_krb5_user_uid(), cred_warning_list);
while (1) {
- (void) poll(NULL, NULL, 60000);
+ (void) poll(NULL, 0, 60000);
for (cw = cred_warning_list;
cw != NULL;
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_callbacks.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_callbacks.c
index 058b823685..9232b36ac0 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_callbacks.c
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_callbacks.c
@@ -10,10 +10,10 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * - Redistributions of source code must retain the above copyright
+ * - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
- * - Redistributions in binary form must reproduce the above copyright
+ * - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
@@ -859,7 +859,7 @@ ndmpd_api_find_env(void *cookie, char *name)
envp = session->ns_data.dd_env;
for (i = 0; envp && i < session->ns_data.dd_env_len; envp++, i++)
- if (strcmp(name, envp->name) == NULL)
+ if (strcmp(name, envp->name) == 0)
return (envp);
return (NULL);
@@ -1021,7 +1021,7 @@ ndmpd_api_get_name(void *cookie, ulong_t name_index)
* Parameters:
* cookie (input) - session pointer.
* block (input) -
- * TRUE block until a request has been processed or
+ * TRUE block until a request has been processed or
* until a file handler has been called.
* FALSE don't block.
*
diff --git a/usr/src/cmd/ndmpd/ndmp/ndmpd_log.c b/usr/src/cmd/ndmpd/ndmp/ndmpd_log.c
index 0447e1c792..46c0d2d331 100644
--- a/usr/src/cmd/ndmpd/ndmp/ndmpd_log.c
+++ b/usr/src/cmd/ndmpd/ndmp/ndmpd_log.c
@@ -11,10 +11,10 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * - Redistributions of source code must retain the above copyright
+ * - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
- * - Redistributions in binary form must reproduce the above copyright
+ * - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
@@ -209,7 +209,7 @@ ndmp_log_open_file(boolean_t to_stderr, boolean_t override_debug)
/* Create the debug path if it doesn't exist */
lpath = ndmpd_get_prop(NDMP_DEBUG_PATH);
- if ((lpath == NULL) || (*lpath == NULL))
+ if ((lpath == NULL) || (*lpath == '\0'))
lpath = LOG_PATH;
if (stat64(lpath, &st) < 0) {
diff --git a/usr/src/cmd/spell/malloc.c b/usr/src/cmd/spell/malloc.c
deleted file mode 100644
index b6bc273657..0000000000
--- a/usr/src/cmd/spell/malloc.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
-#ifdef debug
-#define ASSERT(p) if(!(p))botch("p");else
-botch(s)
-char *s;
-{
- printf("assertion botched: %s\n",s);
- abort();
-}
-#else
-#define ASSERT(p)
-#endif
-
-/* C storage allocator
- * circular first-fit strategy
- * works with noncontiguous, but monotonically linked, arena
- * each block is preceded by a ptr to the (pointer of)
- * the next following block
- * blocks are exact number of words long
- * aligned to the data type requirements of ALIGN
- * pointers to blocks must have BUSY bit 0
- * bit in ptr is 1 for busy, 0 for idle
- * gaps in arena are merely noted as busy blocks
- * last block of arena is empty and
- * has a pointer to first
- * idle blocks are coalesced during space search
- *
- * a different implementation may need to redefine
- * ALIGN, NALIGN, BLOCK, BUSY, INT
- * where INT is integer type to which a pointer can be cast
-*/
-#define INT int
-#define ALIGN int
-#define NALIGN 1
-#define WORD sizeof(union store)
-#define BLOCK 1024
-#define BUSY 1
-#define NULL 0
-#define testbusy(p) ((INT)(p)&BUSY)
-#define setbusy(p) (union store *)((INT)(p)|BUSY)
-#define clearbusy(p) (union store *)((INT)(p)&~BUSY)
-
-union store {
- union store *ptr;
- ALIGN dummy[NALIGN];
- int calloc; /*calloc clears an array of integers*/
-};
-
-static union store alloca; /* initial arena */
-static union store *allocb = &alloca; /*arena base*/
-static union store *allocp = &alloca; /*search ptr*/
-static union store *allocx; /*for benefit of realloc*/
-extern char *sbrk();
-
-char *
-malloc(nbytes)
-unsigned nbytes;
-{
- register union store *p, *q;
- register nw;
- register temp;
- register union store *r = 0;
-
- nw = (nbytes+WORD+WORD-1)/WORD + 1; /*need one more than asked for*/
- ASSERT(allock(allocp));
- for(; ; ) { /* done at most twice */
- p = allocp;
- if(alloca.ptr!=0) /*C can't initialize union*/
- for(temp=0; ; ) {
- if(!testbusy(p->ptr)) {
- while(!testbusy((q=p->ptr)->ptr)) {
- ASSERT(q>p);
- p->ptr = q->ptr;
- allocp = p;
- }
- if(q>=p+nw && p+nw>=p)
- goto found;
- r = p;
- }
- q = p;
- p = clearbusy(p->ptr);
- if(p <= q) {
- ASSERT(p==allocb);
- if(p != allocb)
- return(NULL);
- if(++temp>1)
- break;
- }
- }
- temp = nw;
- p = (union store *)sbrk(0);
- if (r && !testbusy(r->ptr) && r->ptr + 1 == p)
- temp -= p - r - 1;
- temp = ((temp+BLOCK/WORD)/(BLOCK/WORD))*(BLOCK/WORD);
- if(p+temp <= p)
- return(NULL);
- for(; ; ) {
- q = (union store *)sbrk(temp*WORD);
- if((INT)q != -1)
- break;
- temp -= (temp-nw+1)/2;
- if(temp <= nw)
- return(NULL);
- }
- ialloc((char *)q, (unsigned)temp*WORD);
- }
-found:
- allocp = p + nw;
- if(q>allocp) {
- allocx = allocp->ptr;
- allocp->ptr = p->ptr;
- }
- p->ptr = setbusy(allocp);
- return((char *)(p+1));
-}
-
-/* freeing strategy tuned for LIFO allocation
-*/
-free(ap)
-char *ap;
-{
- register union store *p = (union store *)ap;
-
- allocp = --p;
- ASSERT(allock(allocp));
- ASSERT(testbusy(p->ptr));
- p->ptr = clearbusy(p->ptr);
- ASSERT(p->ptr > allocp);
-}
-
-/* ialloc(q, nbytes) inserts a block that did not come
- * from malloc into the arena
- *
- * q points to new block
- * r points to last of new block
- * p points to last cell of arena before new block
- * s points to first cell of arena after new block
-*/
-ialloc(qq, nbytes)
-char *qq;
-unsigned nbytes;
-{
- register union store *p, *q, *s;
- union store *r;
-
- q = (union store *)qq;
- r = q + (nbytes/WORD) - 1;
- q->ptr = r;
- if(alloca.ptr==0) /*C can't initialize union*/
- alloca.ptr = &alloca;
- for(p=allocb; ; p=s) {
- s = clearbusy(p->ptr);
- if(s==allocb)
- break;
- ASSERT(s>p);
- if(s>r) {
- if(p<q)
- break;
- else
- ASSERT(p>r);
- }
- }
- p->ptr = q==p+1? q: setbusy(q);
- r->ptr = s==r+1? s: setbusy(s);
- if(allocb > q)
- allocb = q;
- allocp = allocb;
-}
-
-/* realloc(p, nbytes) reallocates a block obtained from malloc()
- * and freed since last call of malloc()
- * to have new size nbytes, and old content
- * returns new location, or 0 on failure
-*/
-
-char *
-realloc(pp, nbytes)
-char *pp;
-unsigned nbytes;
-{
- register union store *q;
- register union store *p = (union store *)pp;
- union store *s, *t;
- register unsigned nw;
- unsigned onw;
-
- ASSERT(allock(p-1));
- if(testbusy(p[-1].ptr))
- free((char *)p);
- onw = p[-1].ptr - p;
- q = (union store *)malloc(nbytes);
- if(q==NULL || q==p)
- return((char *)q);
- ASSERT(q<p||q>p[-1].ptr);
- s = p;
- t = q;
- nw = (nbytes+WORD-1)/WORD;
- if(nw<onw)
- onw = nw;
- while(onw--!=0)
- *t++ = *s++;
- ASSERT(clearbusy(q[-1].ptr)-q==nw);
- if(q<p && q+nw>=p)
- (q+(q+nw-p))->ptr = allocx;
- ASSERT(allock(q-1));
- return((char *)q);
-}
-
-#ifdef debug
-allock(q)
-union store *q;
-{
-#ifdef longdebug
- register union store *p, *r;
- int x;
- x = 0;
- p = allocb;
- if(alloca.ptr==0)
- return(1);
- for( ; (r=clearbusy(p->ptr)) > p; p=r) {
- if(p==q)
- x++;
- }
- return(r==allocb&(x==1|p==q));
-#else
- return(q>=allocb);
-#endif
-}
-#endif
-
diff --git a/usr/src/cmd/ypcmd/ypupdated.c b/usr/src/cmd/ypcmd/ypupdated.c
deleted file mode 100644
index 19c43e0f1b..0000000000
--- a/usr/src/cmd/ypcmd/ypupdated.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/*
- * 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.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2017 Joyent Inc
- * Copyright 2000 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-/*
- * Portions of this source code were derived from Berkeley 4.3 BSD
- * under license from the Regents of the University of California.
- */
-
-/*
- * YP update service
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/signal.h>
-#include <sys/wait.h>
-#include <rpc/rpc.h>
-#include <rpc/nettype.h>
-#include <rpcsvc/ypupd.h>
-#include <rpcsvc/ypclnt.h>
-#include <sys/debug.h>
-#include <netdir.h>
-#include <stropts.h>
-#ifdef SYSLOG
-#include <syslog.h>
-#else
-#define LOG_ERR 1
-#define openlog(a, b, c)
-#endif
-
-#ifdef DEBUG
-#define RPC_SVC_FG
-#define debug(msg) fprintf(stderr, "%s\n", msg);
-#else
-#define debug(msg) /* turn off debugging */
-#endif
-
-static char YPDIR[] = "/var/yp";
-static char UPDATEFILE[] = "/var/yp/updaters";
-#define _RPCSVC_CLOSEDOWN 120
-
-static int addr2netname();
-static void closedown();
-static void ypupdate_prog();
-static void msgout();
-static int update();
-static int insecure;
-static int _rpcpmstart; /* Started by a port monitor ? */
-static int _rpcsvcdirty; /* Still serving ? */
-
-extern unsigned int alarm();
-extern void exit();
-extern int close();
-extern long fork();
-extern int free();
-extern struct netconfig *getnetconfigent();
-extern int strcmp();
-extern int strcpy();
-extern int syslog();
-extern void *signal();
-extern int setsid();
-extern int t_getinfo();
-extern int user2netname();
-extern int _openchild();
-
-main(argc, argv)
- int argc;
- char *argv[];
-{
- pid_t pid;
- char *cmd;
- char mname[FMNAMESZ + 1];
-
- if (geteuid() != 0) {
- (void) fprintf(stderr, "must be root to run %s\n", argv[0]);
- exit(1);
- }
-
- cmd = argv[0];
- switch (argc) {
- case 0:
- cmd = "ypupdated";
- break;
- case 1:
- break;
- case 2:
- if (strcmp(argv[1], "-i") == 0) {
- insecure++;
- break;
- }
- default:
- fprintf(stderr, "%s: warning -- options ignored\n", cmd);
- break;
- }
-
- if (chdir(YPDIR) < 0) {
- fprintf(stderr, "%s: can't chdir to ", cmd);
- perror(YPDIR);
- exit(1);
- }
-
- if (!ioctl(0, I_LOOK, mname) &&
- (strcmp(mname, "sockmod") == 0 ||
- strcmp(mname, "timod") == 0)) {
- /*
- * Started from port monitor: use 0 as fd
- */
- char *netid;
- struct netconfig *nconf = NULL;
- SVCXPRT *transp;
- int pmclose;
- extern char *getenv();
-
- _rpcpmstart = 1;
- if ((netid = getenv("NLSPROVIDER")) == NULL) {
- msgout("cannot get transport name");
- }
- if ((nconf = getnetconfigent(netid)) == NULL) {
- msgout("cannot get transport info");
- }
- if (strcmp(mname, "sockmod") == 0) {
- if (ioctl(0, I_POP, 0) || ioctl(0, I_PUSH, "timod")) {
- msgout("could not get the right module");
- exit(1);
- }
- }
- pmclose = (t_getstate(0) != T_DATAXFER);
- if ((transp = svc_tli_create(0, nconf, NULL, 0, 0)) == NULL) {
- msgout("cannot create update server handle");
- exit(1);
- }
- if (!svc_reg(transp, YPU_PROG, YPU_VERS, ypupdate_prog, 0)) {
- msgout("unable to register (YPBINDPROG, YPBINDVERS).");
- exit(1);
- }
- if (nconf)
- freenetconfigent(nconf);
-
- if (pmclose) {
- (void) signal(SIGALRM, closedown);
- (void) alarm(_RPCSVC_CLOSEDOWN);
- }
- svc_run();
- exit(1);
- }
-#ifndef RPC_SVC_FG
- /*
- * Started from shell; background thyself and run
- */
- pid = fork();
-
- if (pid < 0) {
- perror("cannot fork");
- exit(1);
- }
- if (pid)
- exit(0);
- closefrom(0);
- (void) setsid();
- openlog("ypupdated", LOG_PID, LOG_DAEMON);
-#endif
- if (!svc_create(ypupdate_prog, YPU_PROG, YPU_VERS, "netpath")) {
- msgout("unable to create (YPU_PROG, YPU_VERS) for netpath.");
- exit(1);
- }
-
- svc_run();
- msgout("svc_run returned");
- exit(1);
- /* NOTREACHED */
-}
-
-static void
-ypupdate_prog(rqstp, transp)
- struct svc_req *rqstp;
- SVCXPRT *transp;
-{
- struct ypupdate_args args;
- uint_t rslt;
- uint_t op;
- char *netname;
- char namebuf[MAXNETNAMELEN+1];
- struct authunix_parms *aup;
-
- switch (rqstp->rq_proc) {
- case NULLPROC:
- svc_sendreply(transp, xdr_void, NULL);
- return;
- case YPU_CHANGE:
- op = YPOP_CHANGE;
- break;
- case YPU_DELETE:
- op = YPOP_DELETE;
- break;
- case YPU_INSERT:
- op = YPOP_INSERT;
- break;
- case YPU_STORE:
- op = YPOP_STORE;
- break;
- default:
- svcerr_noproc(transp);
- return;
- }
-#ifdef DEBUG
- fprintf(stderr, "ypupdated: request received\n");
-#endif
- switch (rqstp->rq_cred.oa_flavor) {
- case AUTH_DES:
- CTASSERT(sizeof (struct authdes_cred) <= RQCRED_SIZE);
- netname = ((struct authdes_cred *)
- rqstp->rq_clntcred)->adc_fullname.name;
- break;
- case AUTH_UNIX:
- if (insecure) {
- CTASSERT(sizeof (struct authunix_parms) <= RQCRED_SIZE);
- aup = (struct authunix_parms *)rqstp->rq_clntcred;
- if (aup->aup_uid == 0) {
- if (addr2netname(namebuf, transp) != 0) {
- fprintf(stderr,
- "addr2netname failing for %d\n",
- aup->aup_uid);
- svcerr_systemerr(transp);
- return;
- }
- } else {
- if (user2netname(namebuf, aup->aup_uid, NULL)
- != 0) {
- fprintf(stderr,
- "user2netname failing for %d\n",
- aup->aup_uid);
- svcerr_systemerr(transp);
- return;
- }
- }
- netname = namebuf;
- break;
- }
- default:
- svcerr_weakauth(transp);
- return;
- }
- memset(&args, 0, sizeof (args));
- if (!svc_getargs(transp, xdr_ypupdate_args, (char *)&args)) {
- svcerr_decode(transp);
- return;
- }
-#ifdef DEBUG
- fprintf(stderr, "netname = %s\n, map=%s\n key=%s\n",
- netname, args.mapname, args.key.yp_buf_val);
-#endif
- rslt = update(netname, args.mapname, op,
- args.key.yp_buf_len, args.key.yp_buf_val,
- args.datum.yp_buf_len, args.datum.yp_buf_val);
- if (!svc_sendreply(transp, xdr_u_int, (char *)&rslt)) {
- debug("svc_sendreply failed");
- }
- if (!svc_freeargs(transp, xdr_ypupdate_args, (char *)&args)) {
- debug("svc_freeargs failed");
- }
-}
-
-/*
- * Determine if requester is allowed to update the given map,
- * and update it if so. Returns the yp status, which is zero
- * if there is no access violation.
- */
-static
-update(requester, mapname, op, keylen, key, datalen, data)
- char *requester;
- char *mapname;
- uint_t op;
- uint_t keylen;
- char *key;
- uint_t datalen;
- char *data;
-{
- char updater[MAXMAPNAMELEN + 40];
- FILE *childargs;
- FILE *childrslt;
- int status;
- int yperrno = 0;
- int pid;
-
- sprintf(updater, "/usr/ccs/bin/make -s -f %s %s", UPDATEFILE, mapname);
-#ifdef DEBUG
- fprintf(stderr, "updater: %s\n", updater);
- fprintf(stderr, "requestor = %s, op = %d, key = %s\n",
- requester, op, key);
- fprintf(stderr, "data = %s\n", data);
-#endif
- pid = _openchild(updater, &childargs, &childrslt);
- if (pid < 0) {
- debug("openpipes failed");
- return (YPERR_YPERR);
- }
-
- /*
- * Write to child
- */
- fprintf(childargs, "%s\n", requester);
- fprintf(childargs, "%u\n", op);
- fprintf(childargs, "%u\n", keylen);
- fwrite(key, keylen, 1, childargs);
- fprintf(childargs, "\n");
- fprintf(childargs, "%u\n", datalen);
- fwrite(data, datalen, 1, childargs);
- fprintf(childargs, "\n");
- fclose(childargs);
-
- /*
- * Read from child
- */
- fscanf(childrslt, "%d", &yperrno);
- fclose(childrslt);
-
- wait(&status);
- if (!WIFEXITED(status)) {
- return (YPERR_YPERR);
- }
- return (yperrno);
-}
-
-static void
-msgout(msg)
- char *msg;
-{
- if (_rpcpmstart)
- syslog(LOG_ERR, msg);
- else
- (void) fprintf(stderr, "%s\n", msg);
-}
-
-void
-closedown()
-{
- if (_rpcsvcdirty == 0) {
- int i, openfd;
- struct t_info tinfo;
-
- if (t_getinfo(0, tinfo) || (tinfo.servtype == T_CLTS))
- exit(0);
-
- for (i = 0, openfd = 0; i < svc_max_pollfd && openfd < 2; i++)
- if (svc_pollfd[i].fd >= 0)
- openfd++;
-
- if (openfd <= 1)
- exit(0);
- }
- (void) alarm(_RPCSVC_CLOSEDOWN);
-}
-
-static int
-addr2netname(namebuf, transp)
- char *namebuf;
- SVCXPRT *transp;
-{
- struct nd_hostservlist *hostservs = NULL;
- struct netconfig *nconf;
- struct netbuf *who;
-
- who = svc_getrpccaller(transp);
- if ((who == NULL) || (who->len == 0))
- return (-1);
- if ((nconf = getnetconfigent(transp->xp_netid))
- == (struct netconfig *)NULL)
- return (-1);
- if (netdir_getbyaddr(nconf, &hostservs, who) != 0) {
- (void) freenetconfigent(nconf);
- return (-1);
- }
- if (hostservs == NULL) {
- msgout("ypupdated: netdir_getbyaddr failed\n");
- } else {
- strcpy(namebuf, hostservs->h_hostservs->h_host);
- }
- (void) freenetconfigent(nconf);
- netdir_free((char *)hostservs, ND_HOSTSERVLIST);
- return (0);
-}
diff --git a/usr/src/man/man3lib/libsysevent.3lib b/usr/src/man/man3lib/libsysevent.3lib
index 579e01b25b..4a932e5a62 100644
--- a/usr/src/man/man3lib/libsysevent.3lib
+++ b/usr/src/man/man3lib/libsysevent.3lib
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2019 Joyent, Inc.
.\" The contents of this file are subject to the terms of the 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. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH LIBSYSEVENT 3LIB "Jan 21, 2014"
+.TH LIBSYSEVENT 3LIB "July 15, 2019"
.SH NAME
libsysevent \- system event interface library
.SH SYNOPSIS
@@ -14,7 +15,6 @@ cc [ \fIflag\fR... ] \fIfile\fR... \fB-lsysevent\fR [ \fIlibrary\fR... ]
.fi
.SH DESCRIPTION
-.sp
.LP
Functions in this library extract specific identifier, publisher, and attribute
information from a system event (sysevent) handle, defined as \fBsysevent_t\fR,
@@ -23,9 +23,13 @@ delivery to the system event daemon, \fBsyseventd\fR(1M).
.sp
.LP
The \fBlibsysevent\fR interfaces do not work at all in non-global zones.
-.SH INTERFACES
.sp
.LP
+For a list of events, please see \fBsysevents\fR(3SYSEVENT). The actual
+events and their payload, unlike the library interfaces, are considered
+private to the system and subject to change at any time.
+.SH INTERFACES
+.LP
The shared object \fBlibsysevent.so.1\fR provides the public interfaces defined
below. See \fBIntro\fR(3) for additional information on shared object
interfaces.
@@ -42,11 +46,10 @@ l l .
\fBsysevent_get_subclass_name\fR \fBsysevent_get_time\fR
\fBsysevent_get_vendor_name\fR \fBsysevent_post_event\fR
\fBsysevent_subscribe_event\fR \fBsysevent_unbind_handle\fR
-\fBsysevent_unsubscribe_event\fR
+\fBsysevent_unsubscribe_event\fR
.TE
.SH FILES
-.sp
.ne 2
.na
\fB\fB/usr/lib/libsysevent.so.1\fR \fR
@@ -67,7 +70,6 @@ shared object
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -85,6 +87,5 @@ MT-Level MT-Safe
.TE
.SH SEE ALSO
-.sp
.LP
\fBsyseventd\fR(1M), \fBIntro\fR(3), \fBattributes\fR(5)
diff --git a/usr/src/man/man3sysevent/Makefile b/usr/src/man/man3sysevent/Makefile
index 4a91b84e9f..6bda6194ab 100644
--- a/usr/src/man/man3sysevent/Makefile
+++ b/usr/src/man/man3sysevent/Makefile
@@ -16,7 +16,7 @@
include $(SRC)/Makefile.master
-MANSECT= 3sysevent
+MANSECT= 3sysevent
MANFILES= sysevent_bind_handle.3sysevent \
sysevent_free.3sysevent \
@@ -24,7 +24,8 @@ MANFILES= sysevent_bind_handle.3sysevent \
sysevent_get_class_name.3sysevent \
sysevent_get_vendor_name.3sysevent \
sysevent_post_event.3sysevent \
- sysevent_subscribe_event.3sysevent
+ sysevent_subscribe_event.3sysevent \
+ sysevents.3sysevent
MANLINKS= sysevent_get_pid.3sysevent \
sysevent_get_pub_name.3sysevent \
diff --git a/usr/src/man/man3sysevent/sysevents.3sysevent b/usr/src/man/man3sysevent/sysevents.3sysevent
new file mode 100644
index 0000000000..60e6d6c973
--- /dev/null
+++ b/usr/src/man/man3sysevent/sysevents.3sysevent
@@ -0,0 +1,87 @@
+.\"
+.\" This file and its contents are supplied under the terms of the
+.\" Common Development and Distribution License ("CDDL"), version 1.0.
+.\" You may only use this file in accordance with the terms of version
+.\" 1.0 of the CDDL.
+.\"
+.\" A full copy of the text of the CDDL should have accompanied this
+.\" source. A copy of the CDDL is also available via the Internet at
+.\" http://www.illumos.org/license/CDDL.
+.\"
+.\"
+.\" Copyright 2019 Joyent, Inc.
+.\"
+.Dd July 15, 2019
+.Dt SYSEVENTS 3SYSEVENT
+.Os
+.Sh NAME
+.Nm sysevents
+.Nd list of system events generated by the platform
+.Sh SYNOPSIS
+.In sys/sysevent/eventdefs.h
+.Sh DESCRIPTION
+System events are events that are generated by the operating system to
+indicate that something has occurred that may be of interest to user
+land.
+These notifications are asynchronous from the event themselves and
+depending on the event, may be lossy.
+That is, the kernel may opt not to generate an event in the face of
+memory pressure.
+Currently, every generated event should make it to consumers.
+.Pp
+Events are broken into classes such as ZFS, FMA, PCIe, and others.
+Classes are further broken down into subclasses.
+Specific events may also have more detailed payload which is available
+as name-value pairs.
+For more information on subscribing to events, classes, and payloads,
+please see
+.Xr sysevent_subscribe_event 3SYSEVENT ,
+.Xr sysevent_get_attr_list 3SYSEVENT ,
+and
+.Xr libnvpair 3LIB .
+.Pp
+Most system events are currently logged to the FMA information log which
+can be retrieved with the
+.Ar -I
+option to the
+.Xr fmdump 1M
+command.
+.Sh EVENTS
+This section contains a list of some of the events that are generated by
+the system, but it is not exhaustive.
+The names of events are macros that the system provides.
+The payload member name is generally a macro and its corresponding type
+is provided, along with a brief description.
+Unless otherwise noted, it should be assumed that the event and its
+payload is private to the system and may change at any time.
+.Pp
+The following events belong to the class
+.Dv EC_DATALINK :
+.Bl -tag -width Dv
+.It Dv ESC_DATALINK_LINK_STATE
+This event fires any time a data link
+.Pq see Xr dladm 1M
+changes its state.
+This may occur because a physical cable was inserted or removed from a
+network adapter or because something has changed on a virtual adapter
+such as a VNIC.
+The event has the following payload:
+.Bl -tag -width Dv
+.It Dv DATALINK_EV_LINK_NAME - String
+Indicates the name of the data link that had the event.
+.It Dv DATALINK_EV_LINK_ID - int32
+Indicates the data link's logical ID that is used by the kernel.
+.It Dv DATALINK_EV_ZONE_ID - int32
+Indicates the ID of the zone that the data link belongs to.
+.El
+.El
+.Sh INTERFACE STABILITY
+While the library interface in
+.Xr libsysevent 3SYSEVENT
+is committed, unless otherwise indicated the events, classes, their
+payloads, are private and subject to change at any time.
+.Sh SEE ALSO
+.Xr libnvpair 3LIB ,
+.Xr libsysevent 3LIB ,
+.Xr sysevent_get_attr_list 3SYSEVENT ,
+.Xr sysevent_subscribe_event 3SYSEVENT
diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf
index 0525a45217..494e5dd023 100644
--- a/usr/src/pkg/manifests/system-header.mf
+++ b/usr/src/pkg/manifests/system-header.mf
@@ -1469,6 +1469,7 @@ file path=usr/include/sys/sysdc.h
file path=usr/include/sys/sysdc_impl.h
file path=usr/include/sys/sysevent.h
file path=usr/include/sys/sysevent/ap_driver.h
+file path=usr/include/sys/sysevent/datalink.h
file path=usr/include/sys/sysevent/dev.h
file path=usr/include/sys/sysevent/domain.h
file path=usr/include/sys/sysevent/dr.h
diff --git a/usr/src/pkg/manifests/system-library.man3sysevent.inc b/usr/src/pkg/manifests/system-library.man3sysevent.inc
index c6f213d539..c7a7b79fec 100644
--- a/usr/src/pkg/manifests/system-library.man3sysevent.inc
+++ b/usr/src/pkg/manifests/system-library.man3sysevent.inc
@@ -18,6 +18,7 @@ file path=usr/share/man/man3sysevent/sysevent_get_class_name.3sysevent
file path=usr/share/man/man3sysevent/sysevent_get_vendor_name.3sysevent
file path=usr/share/man/man3sysevent/sysevent_post_event.3sysevent
file path=usr/share/man/man3sysevent/sysevent_subscribe_event.3sysevent
+file path=usr/share/man/man3sysevent/sysevents.3sysevent
link path=usr/share/man/man3sysevent/sysevent_get_pid.3sysevent \
target=sysevent_get_vendor_name.3sysevent
link path=usr/share/man/man3sysevent/sysevent_get_pub_name.3sysevent \
diff --git a/usr/src/uts/common/io/dls/dls_link.c b/usr/src/uts/common/io/dls/dls_link.c
index c792251052..bde55d4dfc 100644
--- a/usr/src/uts/common/io/dls/dls_link.c
+++ b/usr/src/uts/common/io/dls/dls_link.c
@@ -659,7 +659,7 @@ drop:
static void
dls_link_notify(void *arg, mac_notify_type_t type)
{
- dls_link_t *dlp = arg;
+ dls_link_t *dlp = arg;
dls_dl_handle_t dhp;
nvlist_t *nvp;
sysevent_t *event;
diff --git a/usr/src/uts/common/io/dls/dls_mgmt.c b/usr/src/uts/common/io/dls/dls_mgmt.c
index 84860b5abb..dba205b7a2 100644
--- a/usr/src/uts/common/io/dls/dls_mgmt.c
+++ b/usr/src/uts/common/io/dls/dls_mgmt.c
@@ -1163,8 +1163,8 @@ dls_devnet_hold_tmp_by_link(dls_link_t *dlp, dls_dl_handle_t *ddhp)
}
mutex_enter(&ddp->dd_mutex);
- VERIFY(ddp->dd_ref > 0);
- if (DD_NOT_VISIBLE(ddp->dd_flags)) {
+ ASSERT(ddp->dd_ref > 0);
+ if (ddp->dd_flags & DD_CONDEMNED) {
mutex_exit(&ddp->dd_mutex);
rw_exit(&i_dls_devnet_lock);
return (ENOENT);
diff --git a/usr/src/uts/common/sys/sysevent.h b/usr/src/uts/common/sys/sysevent.h
index c2be00ad27..392b426977 100644
--- a/usr/src/uts/common/sys/sysevent.h
+++ b/usr/src/uts/common/sys/sysevent.h
@@ -73,7 +73,7 @@ extern "C" {
#define SE_KERN_PUB "kern:"
#define SUNW_KERN_PUB SUNW_VENDOR ":" SE_KERN_PUB
#define SUNW_USR_PUB SUNW_VENDOR ":" SE_USR_PUB
-#define ILLUMOS_KERN_PUB ILLUMOS_VENDOR ":" SE_KERN_PUB
+#define ILLUMOS_KERN_PUB ILLUMOS_VENDOR":"SE_KERN_PUB
/*
* Event header and attribute value limits
diff --git a/usr/src/uts/common/sys/sysevent/datalink.h b/usr/src/uts/common/sys/sysevent/datalink.h
index 592ef5bdde..90fb92679a 100644
--- a/usr/src/uts/common/sys/sysevent/datalink.h
+++ b/usr/src/uts/common/sys/sysevent/datalink.h
@@ -27,20 +27,20 @@ extern "C" {
/*
* Event schema for EC_DATALINK_LINK_STATE
*
- * Event Class - EC_DATALINK
- * Event Sub-Class - EC_DATALINK_LINK_STATE
+ * Event Class - EC_DATALINK
+ * Event Sub-Class - EC_DATALINK_LINK_STATE
*
- * Attribute Name - DATALINK_EV_LINK_NAME
- * Attribute Type - SE_DATA_TYPE_STRING
- * Attribute Value - [Name of the datalink]
+ * Attribute Name - DATALINK_EV_LINK_NAME
+ * Attribute Type - SE_DATA_TYPE_STRING
+ * Attribute Value - [Name of the datalink]
*
- * Attribute Name - DATALINK_EV_LINK_ID
- * Attribute Type - SE_DATA_TYPE_INT32
- * Attribute Value - [datalink_id_t for the device]
+ * Attribute Name - DATALINK_EV_LINK_ID
+ * Attribute Type - SE_DATA_TYPE_INT32
+ * Attribute Value - [datalink_id_t for the device]
*
- * Attribute Name - DATALINK_EV_ZONE_ID
- * Attribute Type - SE_DATA_TYPE_INT32
- * Attribute Value - [zoneid_t of the zone the datalink is in]
+ * Attribute Name - DATALINK_EV_ZONE_ID
+ * Attribute Type - SE_DATA_TYPE_INT32
+ * Attribute Value - [zoneid_t of the zone the datalink is in]
*/
#define DATALINK_EV_LINK_NAME "link"