summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authoreschrock <none@none>2007-08-06 10:39:20 -0700
committereschrock <none@none>2007-08-06 10:39:20 -0700
commita10acbd6b2fd751eb85d16ec41398d20ff8c067e (patch)
tree04302fcf4d4d4478e555f7fa1c884bdb39a236fd /usr/src
parent25851f53fe6178c0916e924acc5baae95d3c9937 (diff)
downloadillumos-joyent-a10acbd6b2fd751eb85d16ec41398d20ff8c067e.tar.gz
4687827 dumpadm should be more tolerant of a read-only /etc/dumpadm.conf
6523156 putback for fork extensions missed libproc 6581088 typo in libipmi.h 6585258 zfs_rename() erroneously returns EZFS_CROSSTARGET 6587130 sunoem LED commands don't work correctly
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/dumpadm/dconf.c25
-rw-r--r--usr/src/cmd/dumpadm/dconf.h8
-rw-r--r--usr/src/cmd/dumpadm/main.c21
-rw-r--r--usr/src/lib/libipmi/common/ipmi_sunoem.c10
-rw-r--r--usr/src/lib/libipmi/common/libipmi.h34
-rw-r--r--usr/src/lib/libproc/common/proc_names.c2
-rw-r--r--usr/src/lib/libzfs/common/libzfs_dataset.c2
7 files changed, 74 insertions, 28 deletions
diff --git a/usr/src/cmd/dumpadm/dconf.c b/usr/src/cmd/dumpadm/dconf.c
index ec287078d7..1fb9216765 100644
--- a/usr/src/cmd/dumpadm/dconf.c
+++ b/usr/src/cmd/dumpadm/dconf.c
@@ -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.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -109,6 +108,7 @@ dconf_init(dumpconf_t *dcp, int dcmode)
dcp->dc_conf_fp = NULL;
dcp->dc_conf_fd = -1;
dcp->dc_dump_fd = -1;
+ dcp->dc_readonly = B_FALSE;
}
int
@@ -116,6 +116,7 @@ dconf_open(dumpconf_t *dcp, const char *dpath, const char *fpath, int dcmode)
{
char buf[BUFSIZ];
int line;
+ const char *fpmode = "r+";
dconf_init(dcp, dcmode);
@@ -125,11 +126,19 @@ dconf_open(dumpconf_t *dcp, const char *dpath, const char *fpath, int dcmode)
}
if ((dcp->dc_conf_fd = open(fpath, O_RDWR | O_CREAT, DC_PERM)) == -1) {
- warn(gettext("failed to open %s"), fpath);
- return (-1);
+ /*
+ * Attempt to open the file read-only.
+ */
+ if ((dcp->dc_conf_fd = open(fpath, O_RDONLY)) == -1) {
+ warn(gettext("failed to open %s"), fpath);
+ return (-1);
+ }
+
+ dcp->dc_readonly = B_TRUE;
+ fpmode = "r";
}
- if ((dcp->dc_conf_fp = fdopen(dcp->dc_conf_fd, "r+")) == NULL) {
+ if ((dcp->dc_conf_fp = fdopen(dcp->dc_conf_fd, fpmode)) == NULL) {
warn(gettext("failed to open stream for %s"), fpath);
return (-1);
}
@@ -355,7 +364,7 @@ dconf_update(dumpconf_t *dcp, int checkinuse)
error = 0;
if (checkinuse && (dm_inuse(dcp->dc_device, &msg, DM_WHO_DUMP,
- &error) || error)) {
+ &error) || error)) {
if (error != 0) {
warn(gettext("failed to determine if %s is"
" in use"), dcp->dc_device);
diff --git a/usr/src/cmd/dumpadm/dconf.h b/usr/src/cmd/dumpadm/dconf.h
index b22488ec2a..ccf0943df9 100644
--- a/usr/src/cmd/dumpadm/dconf.h
+++ b/usr/src/cmd/dumpadm/dconf.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.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -46,6 +45,7 @@ typedef struct dumpconf {
FILE *dc_conf_fp; /* File pointer for config file */
int dc_conf_fd; /* File descriptor for config file */
int dc_dump_fd; /* File descriptor for dump device */
+ boolean_t dc_readonly; /* Readonly conf file */
} dumpconf_t;
/*
diff --git a/usr/src/cmd/dumpadm/main.c b/usr/src/cmd/dumpadm/main.c
index a1255a7ae6..7fa72af9c1 100644
--- a/usr/src/cmd/dumpadm/main.c
+++ b/usr/src/cmd/dumpadm/main.c
@@ -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.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -165,10 +164,16 @@ main(int argc, char *argv[])
* In override mode, we try to force an update. If this
* fails, we re-load the kernel configuration and write that
* out to the file in order to force the file in sync.
+ *
+ * We allow the file to be read-only but print a warning to the
+ * user that indicates it hasn't been updated.
*/
if (dconf_update(&dc, 0) == -1)
(void) dconf_getdev(&dc);
- if (dconf_write(&dc) == -1)
+ if (dc.dc_readonly)
+ warn(gettext("kernel settings updated, but "
+ "%s is read-only\n"), PATH_CONFIG);
+ else if (dconf_write(&dc) == -1)
return (E_ERROR);
} else if (modified) {
@@ -176,6 +181,12 @@ main(int argc, char *argv[])
* If we're modifying the configuration, then try
* to update it, and write out the file if successful.
*/
+ if (dc.dc_readonly) {
+ warn(gettext("failed to update settings: %s is "
+ "read-only\n"), PATH_CONFIG);
+ return (E_ERROR);
+ }
+
if (dconf_update(&dc, dflag) == -1 ||
dconf_write(&dc) == -1)
return (E_ERROR);
diff --git a/usr/src/lib/libipmi/common/ipmi_sunoem.c b/usr/src/lib/libipmi/common/ipmi_sunoem.c
index eae8de6bb1..2498ac5751 100644
--- a/usr/src/lib/libipmi/common/ipmi_sunoem.c
+++ b/usr/src/lib/libipmi/common/ipmi_sunoem.c
@@ -96,9 +96,10 @@ ipmi_sunoem_led_set(ipmi_handle_t *ihp, ipmi_sdr_generic_locator_t *dev,
if (check_sunoem(ihp) != 0)
return (-1);
- cmd.ic_sls_devaddr = dev->is_gl_slaveaddr;
+ cmd.ic_sls_slaveaddr = dev->is_gl_slaveaddr;
+ cmd.ic_sls_channel_msb = dev->is_gl_channel_msb;
cmd.ic_sls_type = dev->is_gl_oem;
- cmd.ic_sls_ctladdr = dev->is_gl_accessaddr;
+ cmd.ic_sls_accessaddr = dev->is_gl_accessaddr;
cmd.ic_sls_hwinfo = dev->is_gl_oem;
cmd.ic_sls_mode = mode;
@@ -114,9 +115,10 @@ ipmi_sunoem_led_get(ipmi_handle_t *ihp, ipmi_sdr_generic_locator_t *dev,
if (check_sunoem(ihp) != 0)
return (-1);
- cmd.ic_slg_devaddr = dev->is_gl_slaveaddr;
+ cmd.ic_slg_slaveaddr = dev->is_gl_slaveaddr;
+ cmd.ic_slg_channel_msb = dev->is_gl_channel_msb;
cmd.ic_slg_type = dev->is_gl_oem;
- cmd.ic_slg_ctladdr = dev->is_gl_accessaddr;
+ cmd.ic_slg_accessaddr = dev->is_gl_accessaddr;
cmd.ic_slg_hwinfo = dev->is_gl_oem;
return (ipmi_send_sunoem_led_get(ihp, &cmd, mode));
diff --git a/usr/src/lib/libipmi/common/libipmi.h b/usr/src/lib/libipmi/common/libipmi.h
index b6ce4dac78..5358463670 100644
--- a/usr/src/lib/libipmi/common/libipmi.h
+++ b/usr/src/lib/libipmi/common/libipmi.h
@@ -139,7 +139,7 @@ typedef struct ipmi_deviceid {
uint8_t __reserved:3;
uint8_t id_dev_rev:4;
#endif
-#if defined(_BIT_FIELD_LTOH)
+#if defined(_BIT_FIELDS_LTOH)
uint8_t id_firm_major:7;
uint8_t id_dev_available:1;
#else
@@ -403,9 +403,21 @@ extern int ipmi_set_sensor_reading(ipmi_handle_t *,
#define IPMI_CMD_SUNOEM_LED_SET 0x22
typedef struct ipmi_cmd_sunoem_led_set {
- uint8_t ic_sls_devaddr; /* device slave address */
+#if defined(_BIT_FIELDS_LTOH)
+ uint8_t ic_sls_channel_msb:1; /* device slave address */
+ uint8_t ic_sls_slaveaddr:7; /* (from SDR record) */
+#else
+ uint8_t ic_sls_slaveaddr:7;
+ uint8_t ic_sls_channel_msb:1;
+#endif
uint8_t ic_sls_type; /* led type */
- uint8_t ic_sls_ctladdr; /* controller address */
+#if defined(_BIT_FIELDS_LTOH)
+ uint8_t __reserved:1; /* device access address */
+ uint8_t ic_sls_accessaddr:7; /* (from SDR record) */
+#else
+ uint8_t ic_sls_accessaddr:7;
+ uint8_t __reserved:1;
+#endif
uint8_t ic_sls_hwinfo; /* OEM hardware info */
uint8_t ic_sls_mode; /* LED mode */
uint8_t ic_sls_force; /* force direct access */
@@ -413,9 +425,21 @@ typedef struct ipmi_cmd_sunoem_led_set {
} ipmi_cmd_sunoem_led_set_t;
typedef struct ipmi_cmd_sunoem_led_get {
- uint8_t ic_slg_devaddr; /* device slave address */
+#if defined(_BIT_FIELDS_LTOH)
+ uint8_t ic_slg_channel_msb:1; /* device slave address */
+ uint8_t ic_slg_slaveaddr:7; /* (from SDR record) */
+#else
+ uint8_t ic_slg_slaveaddr:7;
+ uint8_t ic_slg_channel_msb:1;
+#endif
uint8_t ic_slg_type; /* led type */
- uint8_t ic_slg_ctladdr; /* controller address */
+#if defined(_BIT_FIELDS_LTOH)
+ uint8_t __reserved:1; /* device access address */
+ uint8_t ic_slg_accessaddr:7; /* (from SDR record) */
+#else
+ uint8_t ic_slg_accessaddr:7;
+ uint8_t __reserved:1;
+#endif
uint8_t ic_slg_hwinfo; /* OEM hardware info */
uint8_t ic_slg_force; /* force direct access */
} ipmi_cmd_sunoem_led_get_t;
diff --git a/usr/src/lib/libproc/common/proc_names.c b/usr/src/lib/libproc/common/proc_names.c
index 637e5085fb..7d3904c886 100644
--- a/usr/src/lib/libproc/common/proc_names.c
+++ b/usr/src/lib/libproc/common/proc_names.c
@@ -260,7 +260,7 @@ static const char *const systable[] = {
"systeminfo", /* 139 */
"sharefs", /* 140 */
"seteuid", /* 141 */
- NULL, /* 142 */
+ "forksys", /* 142 */
"fork1", /* 143 */
"sigtimedwait", /* 144 */
"lwp_info", /* 145 */
diff --git a/usr/src/lib/libzfs/common/libzfs_dataset.c b/usr/src/lib/libzfs/common/libzfs_dataset.c
index 05c074437c..71cf382f26 100644
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c
+++ b/usr/src/lib/libzfs/common/libzfs_dataset.c
@@ -4226,7 +4226,7 @@ zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive)
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
"a child dataset already has a snapshot "
"with the new name"));
- (void) zfs_error(hdl, EZFS_CROSSTARGET, errbuf);
+ (void) zfs_error(hdl, EZFS_EXISTS, errbuf);
} else {
(void) zfs_standard_error(zhp->zfs_hdl, errno, errbuf);
}