diff options
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/Makefile | 1 | ||||
| -rw-r--r-- | usr/src/cmd/scsi/smp/common/smp.c | 5 | ||||
| -rw-r--r-- | usr/src/cmd/uuidgen/Makefile | 35 | ||||
| -rw-r--r-- | usr/src/cmd/uuidgen/uuidgen.c | 102 | ||||
| -rw-r--r-- | usr/src/common/xattr/xattr_common.c | 2 | ||||
| -rw-r--r-- | usr/src/man/man1/Makefile | 3 | ||||
| -rw-r--r-- | usr/src/man/man1/uuidgen.1 | 63 | ||||
| -rw-r--r-- | usr/src/man/man1m/bootadm.1m | 4 | ||||
| -rw-r--r-- | usr/src/pkg/manifests/SUNWcs.man1.inc | 1 | ||||
| -rw-r--r-- | usr/src/pkg/manifests/SUNWcs.mf | 1 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/ctype.h | 30 | ||||
| -rw-r--r-- | usr/src/uts/common/sys/kobj_lex.h | 12 | ||||
| -rw-r--r-- | usr/src/uts/intel/fcp/Makefile | 3 |
13 files changed, 235 insertions, 27 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); +} diff --git a/usr/src/common/xattr/xattr_common.c b/usr/src/common/xattr/xattr_common.c index a40cd03909..e9b511bd99 100644 --- a/usr/src/common/xattr/xattr_common.c +++ b/usr/src/common/xattr/xattr_common.c @@ -115,7 +115,7 @@ xattr_view_t attr_to_xattr_view(f_attr_t attr) { if (attr >= F_ATTR_ALL || attr < 0) - return (NULL); + return (XATTR_VIEW_INVALID); return (xattrs[attr].x_xattr_view); } diff --git a/usr/src/man/man1/Makefile b/usr/src/man/man1/Makefile index 3307298389..507dee22c6 100644 --- a/usr/src/man/man1/Makefile +++ b/usr/src/man/man1/Makefile @@ -401,7 +401,8 @@ MANFILES= acctcom.1 \ units.1 \ unix2dos.1 \ uptime.1 \ - vacation.1 \ + uuidgen.1 \ + vacation.1 \ vgrind.1 \ volcheck.1 \ volrmmount.1 \ diff --git a/usr/src/man/man1/uuidgen.1 b/usr/src/man/man1/uuidgen.1 new file mode 100644 index 0000000000..c1a3bd0787 --- /dev/null +++ b/usr/src/man/man1/uuidgen.1 @@ -0,0 +1,63 @@ +.\" +.\" 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. +.\" +.Dd Sep 13, 2015 +.Dt UUIDGEN 1 +.Os +.Sh NAME +.Nm uuidgen +.Nd command-line utility to generate UUID's +.Sh SYNOPSIS +.Nm uuidgen [-r | -t] [-o filename] +.Sh DESCRIPTION +The +.Nm +command generates and prints a Universally Unique +IDentifier (UUID). By default +.Nm +creates a new UUID based on high-quality randomness from +arc4random(3C) (DCE version 4). If the \fB-t\fR option is +provided then a time-based (DCE version 1) UUID will be +generated. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl r +Generate a UUID using +.Nm uuid_generate_random() +instead of +.Nm uuid_generate() . +This derives the new UUID from random data. +.It Fl t +Generate a UUID using +.Nm uuid_generate_time() +instead of +.Nm uuid_generate() . +This uses the current time and either the +Ethernet address (if available) or system node ID. +.It Fl o +Redirect output to +.Ar filename +instead of stdout. +.El +.Sh EXIT STATUS +.Bl -tag -width Ds +.It Dv 0 +Successful completion. +.It Dv >0 +Failure. +.El +.Sh INTERFACE STABILITY +.Sy Uncommitted . +.Sh SEE ALSO +.Xr uuid_generate 3uuid , +.Xr uuid_generate_random 3uuid , +.Xr uuid_generate_time 3uuidd diff --git a/usr/src/man/man1m/bootadm.1m b/usr/src/man/man1m/bootadm.1m index a227e23232..07c8383efd 100644 --- a/usr/src/man/man1m/bootadm.1m +++ b/usr/src/man/man1m/bootadm.1m @@ -30,12 +30,12 @@ bootadm \- manage bootability of GRUB-enabled operating system .LP .nf -\fB/sbin/bootadm\fR set-menu [\fB-R\fR \fIaltroot\fR [\fB-p\fR \fIplatform\fR]] \fIkey\fR=\fIvalue\fR +\fB/sbin/bootadm\fR set-menu [\fB-R\fR \fIaltroot\fR] \fIkey\fR=\fIvalue\fR .fi .LP .nf -\fB/sbin/bootadm\fR list-menu [\fB-R\fR \fIaltroot\fR [\fB-p\fR \fIplatform\fR]] +\fB/sbin/bootadm\fR list-menu [\fB-R\fR \fIaltroot\fR] .fi .SH DESCRIPTION diff --git a/usr/src/pkg/manifests/SUNWcs.man1.inc b/usr/src/pkg/manifests/SUNWcs.man1.inc index 06c0248b29..39248dcdf4 100644 --- a/usr/src/pkg/manifests/SUNWcs.man1.inc +++ b/usr/src/pkg/manifests/SUNWcs.man1.inc @@ -200,6 +200,7 @@ file path=usr/share/man/man1/umask.1 file path=usr/share/man/man1/uname.1 file path=usr/share/man/man1/uniq.1 file path=usr/share/man/man1/uptime.1 +file path=usr/share/man/man1/uuidgen.1 file path=usr/share/man/man1/w.1 file path=usr/share/man/man1/wait.1 file path=usr/share/man/man1/wc.1 diff --git a/usr/src/pkg/manifests/SUNWcs.mf b/usr/src/pkg/manifests/SUNWcs.mf index b691e65bff..7589be3358 100644 --- a/usr/src/pkg/manifests/SUNWcs.mf +++ b/usr/src/pkg/manifests/SUNWcs.mf @@ -845,6 +845,7 @@ file path=usr/bin/true mode=0555 file path=usr/bin/tty mode=0555 file path=usr/bin/tzselect mode=0555 file path=usr/bin/userattr mode=0555 +file path=usr/bin/uuidgen mode=0555 file path=usr/bin/vmstat mode=0555 file path=usr/bin/which mode=0555 file path=usr/bin/who mode=0555 diff --git a/usr/src/uts/common/sys/ctype.h b/usr/src/uts/common/sys/ctype.h index a4370a7406..51ea781c44 100644 --- a/usr/src/uts/common/sys/ctype.h +++ b/usr/src/uts/common/sys/ctype.h @@ -22,13 +22,13 @@ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2015 PALO, Richard. All rights reserved. */ #ifndef _SYS_CTYPE_H #define _SYS_CTYPE_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #ifdef __cplusplus @@ -57,55 +57,65 @@ extern "C" { (ISALPHA(_c) || \ ISDIGIT(_c)) +#define ISPRINT(_c) \ + ((_c) >= ' ' && (_c) <= '~') + #define ISSPACE(_c) \ ((_c) == ' ' || \ (_c) == '\t' || \ (_c) == '\r' || \ (_c) == '\n') -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ isdigit(char c) { return (ISDIGIT(c)); } #pragma inline(isdigit) -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ isxdigit(char c) { return (ISXDIGIT(c)); } -#pragma inline(isdigit) +#pragma inline(isxdigit) -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ islower(char c) { return (ISLOWER(c)); } #pragma inline(islower) -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ isupper(char c) { return (ISUPPER(c)); } #pragma inline(isupper) -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ isalpha(char c) { return (ISALPHA(c)); } #pragma inline(isalpha) -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ isalnum(char c) { return (ISALNUM(c)); } #pragma inline(isalnum) -static boolean_t +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ +isprint(char c) +{ + return (ISPRINT(c)); +} +#pragma inline(isprint) + +static __GNU_INLINE boolean_t /* LINTED E_STATIC_UNUSED */ isspace(char c) { return (ISSPACE(c)); diff --git a/usr/src/uts/common/sys/kobj_lex.h b/usr/src/uts/common/sys/kobj_lex.h index 27f77be335..ca6ef40f6a 100644 --- a/usr/src/uts/common/sys/kobj_lex.h +++ b/usr/src/uts/common/sys/kobj_lex.h @@ -22,12 +22,14 @@ /* * Copyright 2005 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. + * + * Copyright 2015 PALO, Richard. All rights reserved. */ #ifndef _SYS_KOBJ_LEX_H #define _SYS_KOBJ_LEX_H -#pragma ident "%Z%%M% %I% %E% SMI" +#include <sys/ctype.h> #ifdef __cplusplus extern "C" { @@ -48,14 +50,6 @@ extern "C" { #define isnewline(ch) ((ch) == '\n' || (ch) == '\r' || (ch) == '\f') -#define isdigit(ch) ((ch) >= '0' && (ch) <= '9') - -#define isxdigit(ch) (isdigit(ch) || ((ch) >= 'a' && (ch) <= 'f') || \ - ((ch) >= 'A' && (ch) <= 'F')) - -#define isalpha(ch) (((ch) >= 'a' && (ch) <= 'z') || \ - ((ch) >= 'A' && (ch) <= 'Z')) - #define isalphanum(ch) (isalpha(ch) || isdigit(ch)) #define isnamechar(ch) (isalphanum(ch) || (ch) == '_' || (ch) == '-') diff --git a/usr/src/uts/intel/fcp/Makefile b/usr/src/uts/intel/fcp/Makefile index 8bfcc253c4..9f22448393 100644 --- a/usr/src/uts/intel/fcp/Makefile +++ b/usr/src/uts/intel/fcp/Makefile @@ -63,11 +63,10 @@ LDFLAGS += -dy -Nmisc/fctl -Nmisc/scsi # LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON -LINTTAGS += -erroff=E_STATIC_UNUSED +LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-switch -CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-uninitialized # |
