1uuid_clear(3UUID)Universally Unique Identifier Library Functionusuid_clear(3UUID)
2
3
4
6 uuid_clear, uuid_compare, uuid_copy, uuid_generate, uuid_generate_ran‐
7 dom, uuid_generate_time, uuid_is_null, uuid_parse, uuid_time,
8 uuid_unparse - universally unique identifier (UUID) operations
9
11 cc [ flag ... ] file... -luuid [ library ... ]
12 #include <uuid/uuid.h>
13
14 void uuid_clear(uuid_t uu);
15
16
17 int uuid_compare(uuid_t uu1, uuid_t uu2);
18
19
20 void uuid_copy(uuid_t dst, uuid_t src);
21
22
23 void uuid_generate(uuid_t out);
24
25
26 void uuid_generate_random(uuid_t out);
27
28
29 void uuid_generate_time(uuid_t out);
30
31
32 int uuid_is_null(uuid_t uu);
33
34
35 int uuid_parse(char *in, uuid_t uu);
36
37
38 time_t uuid_time(uuid_t uu, struct timeval *ret_tv);
39
40
41 void uuid_unparse(uuid_t uu, char *out);
42
43
45 The uuid_clear() function sets the value of the specified universally
46 unique identifier (UUID) variable uu to the NULL value.
47
48
49 The uuid_compare() function compares the two specified UUID variables
50 uu1 and uu2 to each other. It returns an integer less than, equal to,
51 or greater than zero if uu1 is found to be, respectively, lexicographi‐
52 cally less than, equal, or greater than uu2.
53
54
55 The uuid_copy() function copies the UUID variable src to dst.
56
57
58 The uuid_generate() function creates a new UUID that is generated based
59 on high-quality randomness from /dev/urandom, if available. If
60 /dev/urandom is not available, uuid_generate() calls uuid_gener‐
61 ate_time(). Because the use of this algorithm provides information
62 about when and where the UUID was generated, it could cause privacy
63 problems for some applications.
64
65
66 The uuid_generate_random() function produces a UUID with a random or
67 pseudo-randomly generated time and Ethernet MAC address that corre‐
68 sponds to a DCE version 4 UUID.
69
70
71 The uuid_generate_time() function uses the current time and the local
72 Ethernet MAC address (if available, otherwise a MAC address is fabri‐
73 cated) that corresponds to a DCE version 1 UUID. If the UUID is not
74 guaranteed to be unique, the multicast bit is set (the high-order bit
75 of octet number 10).
76
77
78 The uuid_is_null() function compares the value of the specified UUID
79 variable uu to the NULL value. If the value is equal to the NULL UUID,
80 1 is returned. Otherwise 0 is returned.
81
82
83 The uuid_parse() function converts the UUID string specified by in to
84 the internal uuid_t format. The input UUID is a string of the form
85 cefa7a9c-1dd2-11b2-8350-880020adbeef. In printf(3C) format, the string
86 is "%08x-%04x-%04x-%04x-%012x", 36 bytes plus the trailing null charac‐
87 ter. If the input string is parsed successfully, 0 is returned and the
88 UUID is stored in the location pointed to by uu. Otherwise -1 is
89 returned.
90
91
92 The uuid_time() function extracts the time at which the specified UUID
93 uu was created. Since the UUID creation time is encoded within the
94 UUID, this function can reasonably be expected to extract the creation
95 time only for UUIDs created with the uuid_generate_time() function. The
96 time at which the UUID was created, in seconds since January 1, 1970
97 GMT (the epoch), is returned (see time(2)). The time at which the UUID
98 was created, in seconds and microseconds since the epoch is also stored
99 in the location pointed to by ret_tv (see gettimeofday(3C)).
100
101
102 The uuid_unparse() function converts the specified UUID uu from the
103 internal binary format to a string of the length defined in the uuid.h
104 macro, UUID_PRINTABLE_STRING_LENGTH, which includes the trailing null
105 character. The resulting value is stored in the character string
106 pointed to by out.
107
109 See attributes(5) for descriptions of the following attributes:
110
111
112
113
114 ┌─────────────────────────────┬─────────────────────────────┐
115 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
116 ├─────────────────────────────┼─────────────────────────────┤
117 │Interface Stability │Evolving │
118 ├─────────────────────────────┼─────────────────────────────┤
119 │MT-Level │Safe │
120 └─────────────────────────────┴─────────────────────────────┘
121
123 inetd(1M), time(2), gettimeofday(3C), libuuid(3LIB), printf(3C),
124 attributes(5)
125
126
127
128SunOS 5.11 16 Jan 2006 uuid_clear(3UUID)