1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2014 Andrew Stormont.
.\" 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 UUID_CLEAR 3UUID "Apr 9, 2014"
.SH NAME
uuid_clear, uuid_compare, uuid_copy, uuid_generate, uuid_generate_random,
uuid_generate_time, uuid_is_null, uuid_parse, uuid_time, uuid_unparse,
uuid_unparse_lower, uuid_unparse_upper \- universally unique identifier (UUID)
operations
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-luuid\fR [ \fIlibrary \&.\|.\|.\fR ]
#include <uuid/uuid.h>
\fBvoid\fR \fBuuid_clear\fR(\fBuuid_t\fR \fIuu\fR);
.fi
.LP
.nf
\fBint\fR \fBuuid_compare\fR(\fBuuid_t\fR \fIuu1\fR, \fBuuid_t\fR \fIuu2\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_copy\fR(\fBuuid_t\fR \fIdst\fR, \fBuuid_t\fR \fIsrc\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_generate\fR(\fBuuid_t\fR \fIout\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_generate_random\fR(\fBuuid_t\fR \fIout\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_generate_time\fR(\fBuuid_t\fR \fIout\fR);
.fi
.LP
.nf
\fBint\fR \fBuuid_is_null\fR(\fBuuid_t\fR \fIuu\fR);
.fi
.LP
.nf
\fBint\fR \fBuuid_parse\fR(\fBchar *\fR\fIin\fR, \fBuuid_t\fR \fIuu\fR);
.fi
.LP
.nf
\fBtime_t\fR \fBuuid_time\fR(\fBuuid_t\fR \fIuu\fR, \fBstruct timeval *\fR\fIret_tv\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_unparse\fR(\fBuuid_t\fR \fIuu\fR, \fBchar *\fR\fIout\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_unparse_lower\fR(\fBuuid_t\fR \fIuu\fR, \fBchar *\fR\fIout\fR);
.fi
.LP
.nf
\fBvoid\fR \fBuuid_unparse_upper\fR(\fBuuid_t\fR \fIuu\fR, \fBchar *\fR\fIout\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBuuid_clear()\fR function sets the value of the specified universally
unique identifier (UUID) variable \fIuu\fR to the \fINULL\fR value.
.sp
.LP
The \fBuuid_compare()\fR function compares the two specified UUID variables
\fIuu1\fR and \fIuu2\fR to each other. It returns an integer less than, equal
to, or greater than zero if \fIuu1\fR is found to be, respectively,
lexicographically less than, equal, or greater than \fIuu2\fR.
.sp
.LP
The \fBuuid_copy()\fR function copies the UUID variable \fIsrc\fR to \fIdst\fR.
.sp
.LP
The \fBuuid_generate()\fR function creates a new UUID that is generated based
on high-quality randomness from \fB/dev/urandom\fR, if available. If
\fB/dev/urandom\fR is not available, \fBuuid_generate()\fR calls
\fBuuid_generate_time()\fR. Because the use of this algorithm provides
information about when and where the UUID was generated, it could cause privacy
problems for some applications.
.sp
.LP
The \fBuuid_generate_random()\fR function produces a UUID with a random or
pseudo-randomly generated time and Ethernet MAC address that corresponds to a
DCE version 4 UUID.
.sp
.LP
The \fBuuid_generate_time()\fR function uses the current time and the local
Ethernet MAC address (if available, otherwise a MAC address is fabricated) that
corresponds to a DCE version 1 UUID. If the UUID is not guaranteed to be
unique, the multicast bit is set (the high-order bit of octet number 10).
.sp
.LP
The \fBuuid_is_null()\fR function compares the value of the specified UUID
variable \fIuu\fR to the \fINULL\fR value. If the value is equal to the
\fINULL\fR UUID, 1 is returned. Otherwise 0 is returned.
.sp
.LP
The \fBuuid_parse()\fR function converts the UUID string specified by \fIin\fR
to the internal \fBuuid_t\fR format. The input UUID is a string of the form
\fBcefa7a9c-1dd2-11b2-8350-880020adbeef\fR. In \fBprintf\fR(3C) format, the
string is "\fB%08x-%04x-%04x-%04x-%012x\fR", 36 bytes plus the trailing null
character. If the input string is parsed successfully, \fB0\fR is returned and
the UUID is stored in the location pointed to by \fIuu\fR. Otherwise \fB-1\fR
is returned.
.sp
.LP
The \fBuuid_time()\fR function extracts the time at which the specified UUID
\fIuu\fR was created. Since the UUID creation time is encoded within the UUID,
this function can reasonably be expected to extract the creation time only for
UUIDs created with the \fBuuid_generate_time()\fR function. The time at which
the UUID was created, in seconds since January 1, 1970 GMT (the epoch), is
returned (see \fBtime\fR(2)). The time at which the UUID was created, in
seconds and microseconds since the epoch is also stored in the location pointed
to by \fBret_tv\fR (see \fBgettimeofday\fR(3C)).
.sp
.LP
The \fBuuid_unparse()\fR and \fBuuid_unparse_lower()\fR functions convert the
specified UUID \fIuu\fR from the internal binary format to a lower case string
of the length defined in the \fBuuid.h\fR macro,
\fBUUID_PRINTABLE_STRING_LENGTH\fR, which includes the trailing null character.
The resulting value is stored in the character string pointed to by \fIout\fR.
.sp
.LP
The \fBuuid_unparse_upper()\fR function converts the specified UUID \fIuu\fR
from the internal binary format to a upper case string of the length defined in
the \fBuuid.h\fR macro, \fBUUID_PRINTABLE_STRING_LENGTH\fR, which includes the
trailing null character. The resulting value is stored in the character string
pointed to by \fIout\fR.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE ATTRIBUTE VALUE
_
Interface Stability Evolving
_
MT-Level Safe
.TE
.SH SEE ALSO
.sp
.LP
\fBinetd\fR(1M), \fBtime\fR(2), \fBgettimeofday\fR(3C), \fBlibuuid\fR(3LIB),
\fBprintf\fR(3C), \fBattributes\fR(5)
|