summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-09-22 12:02:10 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-09-22 12:02:10 +0000
commit4d37e556f5bbd11cef4085f01261b3382d641a3e (patch)
tree0f7bcbf06df82231e223c1ad48ae9317aaa85c6d /usr/src/cmd
parenta6d19fc7e119bb7bcc8a1c0a9ad179bb6ab49f6f (diff)
parent25613c1d425cf3953d010bbbe294d40990b5f45e (diff)
downloadillumos-joyent-4d37e556f5bbd11cef4085f01261b3382d641a3e.tar.gz
[illumos-gate merge]
commit 25613c1d425cf3953d010bbbe294d40990b5f45e 6106 attr_to_xattr_view should return XATTR_VIEW_INVALID when encountering invalid attr commit 6b1aed11aada50610fd9f5a9e033c24ca7ee5f0c 6201 cleanup issues between sys/ctype.h and sys/kobj_lex.h when both included commit 228fe137d4532f2991e203d0fd551ac158452f94 6186 bootadm manual usage section differs from command usage output. commit 24f5a37652e188ebdcdd6da454511686935025df 6134 fix result check in smp.c commit 71d45228ba245d505c3beae1d756e775616f6d5a 4769 Want implementation of uuid command
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/Makefile1
-rw-r--r--usr/src/cmd/scsi/smp/common/smp.c5
-rw-r--r--usr/src/cmd/uuidgen/Makefile35
-rw-r--r--usr/src/cmd/uuidgen/uuidgen.c102
4 files changed, 141 insertions, 2 deletions
diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile
index 1f098842b9..5bcb40089c 100644
--- a/usr/src/cmd/Makefile
+++ b/usr/src/cmd/Makefile
@@ -432,6 +432,7 @@ COMMON_SUBDIRS= \
users \
utmp_update \
utmpd \
+ uuidgen \
valtools \
varpd \
vgrind \
diff --git a/usr/src/cmd/scsi/smp/common/smp.c b/usr/src/cmd/scsi/smp/common/smp.c
index 67155a5a5e..374049b845 100644
--- a/usr/src/cmd/scsi/smp/common/smp.c
+++ b/usr/src/cmd/scsi/smp/common/smp.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2015 PALO, Richard
*/
#include <sys/types.h>
#include <sys/scsi/generic/smp_frames.h>
@@ -180,7 +181,7 @@ smp_cmd_failed(smp_result_t result)
{
char *smp_result_str = smp_get_result(result);
- if (result == NULL) {
+ if (smp_result_str == NULL) {
fatal(-5, "Command failed: Unknown result (0x%x)",
result);
} else {
@@ -212,6 +213,7 @@ smp_cleanup()
smp_fini();
}
+/* ARGSUSED */
static void
smp_handle_report_route_info(int argc, char *argv[])
{
@@ -751,7 +753,6 @@ main(int argc, char *argv[])
(smp_report_broadcast_resp_t *)smp_resp;
smp_broadcast_descr_t *bdp = &brp->srbr_descrs[0];
uint16_t bcount, idx;
- uint8_t bctype;
bcount = brp->srbr_number_broadcast_descrs;
diff --git a/usr/src/cmd/uuidgen/Makefile b/usr/src/cmd/uuidgen/Makefile
new file mode 100644
index 0000000000..663e2dbd43
--- /dev/null
+++ b/usr/src/cmd/uuidgen/Makefile
@@ -0,0 +1,35 @@
+#
+# 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 2015 Nexenta Systems, Inc. All rights reserved.
+#
+
+PROG= uuidgen
+
+include ../Makefile.cmd
+
+CFLAGS += $(CCVERBOSE)
+LDLIBS += -luuid
+
+C99MODE = $(C99_ENABLE)
+
+.KEEP_STATE:
+
+all: $(PROG)
+
+install: all $(ROOTPROG)
+
+clean:
+
+lint: lint_PROG
+
+include ../Makefile.targ
diff --git a/usr/src/cmd/uuidgen/uuidgen.c b/usr/src/cmd/uuidgen/uuidgen.c
new file mode 100644
index 0000000000..eb7794650d
--- /dev/null
+++ b/usr/src/cmd/uuidgen/uuidgen.c
@@ -0,0 +1,102 @@
+/*
+ * 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 2015 Nexenta Systems, Inc. All rights reserved.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libgen.h>
+#include <uuid/uuid.h>
+#include <getopt.h>
+#include <locale.h>
+
+static char *progname;
+static int rflag, tflag;
+static char uu_string[UUID_PRINTABLE_STRING_LENGTH];
+
+static void
+usage(void)
+{
+ (void) fprintf(stderr, gettext(
+ "Usage: %s [-r | -t] [-o filename]\n"), progname);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ FILE *out;
+ uuid_t uu = { 0 };
+ int c;
+
+ (void) setlocale(LC_ALL, "");
+
+#if !defined(TEXT_DOMAIN)
+#define TEXT_DOMAIN "SYS_TEST"
+#endif
+ (void) textdomain(TEXT_DOMAIN);
+
+ progname = basename(argv[0]);
+ out = stdout;
+ while ((c = getopt(argc, argv, ":rto:")) != EOF) {
+ switch ((char)c) {
+ case 'r':
+ rflag++;
+ break;
+ case 't':
+ tflag++;
+ break;
+ case 'o':
+ if ((out = fopen(optarg, "w")) == NULL) {
+ (void) fprintf(stderr, gettext(
+ "%s: cannot open %s\n"),
+ progname, optarg);
+ return (1);
+ }
+ break;
+ case '?': /* fallthrough */
+ default:
+ usage();
+ }
+ }
+
+ if ((rflag && tflag) || optind != argc) {
+ usage();
+ }
+
+ if (rflag) {
+ /* DCE version 4 */
+ uuid_generate_random(uu);
+ } else if (tflag) {
+ /* DCE version 1 */
+ uuid_generate_time(uu);
+ } else {
+ uuid_generate(uu);
+ }
+
+ if (uuid_is_null(uu) != 0) {
+ (void) fprintf(stderr, gettext(
+ "%s: failed to "
+ "generate uuid\n"), progname);
+ exit(1);
+ }
+
+ uuid_unparse(uu, uu_string);
+
+ (void) fprintf(out, "%s\n", uu_string);
+
+ if (out != NULL && out != stdout)
+ (void) fclose(out);
+
+ return (0);
+}