| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: uuidgen.2,v 1.4 2005/01/30 18:13:04 jwise Exp $ | | 1 | .\" $NetBSD: uuidgen.2,v 1.5 2019/07/24 06:11:57 riastradh Exp $ |
2 | .\" $FreeBSD: src/lib/libc/sys/uuidgen.2,v 1.7 2003/06/27 13:41:29 yar Exp $ | | 2 | .\" $FreeBSD: src/lib/libc/sys/uuidgen.2,v 1.7 2003/06/27 13:41:29 yar Exp $ |
3 | .\" Copyright (c) 2002 Marcel Moolenaar | | 3 | .\" Copyright (c) 2002 Marcel Moolenaar |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" | | 9 | .\" |
10 | .\" 1. Redistributions of source code must retain the above copyright | | 10 | .\" 1. Redistributions of source code must retain the above copyright |
11 | .\" notice, this list of conditions and the following disclaimer. | | 11 | .\" notice, this list of conditions and the following disclaimer. |
12 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 12 | .\" 2. Redistributions in binary form must reproduce the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer in the | | 13 | .\" notice, this list of conditions and the following disclaimer in the |
14 | .\" documentation and/or other materials provided with the distribution. | | 14 | .\" documentation and/or other materials provided with the distribution. |
| @@ -37,47 +37,34 @@ | | | @@ -37,47 +37,34 @@ |
37 | .Sh SYNOPSIS | | 37 | .Sh SYNOPSIS |
38 | .In sys/types.h | | 38 | .In sys/types.h |
39 | .In sys/uuid.h | | 39 | .In sys/uuid.h |
40 | .Ft int | | 40 | .Ft int |
41 | .Fn uuidgen "struct uuid *store" "int count" | | 41 | .Fn uuidgen "struct uuid *store" "int count" |
42 | .Sh DESCRIPTION | | 42 | .Sh DESCRIPTION |
43 | The | | 43 | The |
44 | .Fn uuidgen | | 44 | .Fn uuidgen |
45 | system call generates | | 45 | system call generates |
46 | .Fa count | | 46 | .Fa count |
47 | universally unique identifiers (UUIDs) and writes them to the buffer | | 47 | universally unique identifiers (UUIDs) and writes them to the buffer |
48 | pointed to by | | 48 | pointed to by |
49 | .Fa store . | | 49 | .Fa store . |
50 | The identifiers are generated according to the syntax and semantics of the | | 50 | The identifiers are randomly generated according to UUID version 4. |
51 | DCE version 1 variant of universally unique identifiers. | | | |
52 | See below for a more in-depth description of the identifiers. | | | |
53 | When no IEEE 802 | | | |
54 | address is available for the node field, a random multi-cast address is | | | |
55 | generated for each invocation of the system call. | | | |
56 | According to the algorithm of generating time-based UUIDs, this will also | | | |
57 | force a new random clock sequence, thereby increasing the likelihood for | | | |
58 | the identifier to be unique. | | | |
59 | .Pp | | | |
60 | When multiple identifiers are to be generated, the | | | |
61 | .Fn uuidgen | | | |
62 | system call will generate a set of identifiers that is dense in such a way | | | |
63 | that there is no identifier that is larger than the smallest identifier in the | | | |
64 | set and smaller than the largest identifier in the set and that is not already | | | |
65 | in the set. | | | |
66 | .Pp | | 51 | .Pp |
67 | Universally unique identifiers, also known as globally unique identifiers | | 52 | Universally unique identifiers, also known as globally unique identifiers |
68 | (GUIDs), have a binary representation of 128-bits. | | 53 | (GUIDs), have a binary representation of 128-bits. |
69 | The grouping and meaning of these bits is described by the following | | 54 | The grouping and meaning of these bits is based on historical methods |
70 | structure and its description of the fields that follow it: | | 55 | of generation from on timestamps and IEEE 802 MAC addresses, and is |
| | | 56 | described by the following structure and its description of the fields |
| | | 57 | that follow it: |
71 | .Bd -literal | | 58 | .Bd -literal |
72 | struct uuid { | | 59 | struct uuid { |
73 | uint32_t time_low; | | 60 | uint32_t time_low; |
74 | uint16_t time_mid; | | 61 | uint16_t time_mid; |
75 | uint16_t time_hi_and_version; | | 62 | uint16_t time_hi_and_version; |
76 | uint8_t clock_seq_hi_and_reserved; | | 63 | uint8_t clock_seq_hi_and_reserved; |
77 | uint8_t clock_seq_low; | | 64 | uint8_t clock_seq_low; |
78 | uint8_t node[_UUID_NODE_LEN]; | | 65 | uint8_t node[_UUID_NODE_LEN]; |
79 | }; | | 66 | }; |
80 | .Ed | | 67 | .Ed |
81 | .Bl -tag -width ".Va clock_seq_hi_and_reserved" | | 68 | .Bl -tag -width ".Va clock_seq_hi_and_reserved" |
82 | .It Va time_low | | 69 | .It Va time_low |
83 | The least significant 32 bits of a 60-bit timestamp. | | 70 | The least significant 32 bits of a 60-bit timestamp. |
| @@ -122,26 +109,39 @@ system call can fail with: | | | @@ -122,26 +109,39 @@ system call can fail with: |
122 | .Bl -tag -width Er | | 109 | .Bl -tag -width Er |
123 | .It Bq Er EFAULT | | 110 | .It Bq Er EFAULT |
124 | The buffer pointed to by | | 111 | The buffer pointed to by |
125 | .Fa store | | 112 | .Fa store |
126 | could not be written to for any or all identifiers. | | 113 | could not be written to for any or all identifiers. |
127 | .It Bq Er EINVAL | | 114 | .It Bq Er EINVAL |
128 | The | | 115 | The |
129 | .Fa count | | 116 | .Fa count |
130 | argument is less than 1 or larger than the hard upper limit of 2048. | | 117 | argument is less than 1 or larger than the hard upper limit of 2048. |
131 | .El | | 118 | .El |
132 | .Sh SEE ALSO | | 119 | .Sh SEE ALSO |
133 | .Xr uuidgen 1 , | | 120 | .Xr uuidgen 1 , |
134 | .Xr uuid 3 | | 121 | .Xr uuid 3 |
| | | 122 | .Rs |
| | | 123 | .%A P. Leach |
| | | 124 | .%A M. Mealling |
| | | 125 | .%A R. Salz |
| | | 126 | .%T A Universally Unique IDentifier (UUID) URN Namespace |
| | | 127 | .%R RFC 4122 |
| | | 128 | .%I IETF |
| | | 129 | .%D July 2005 |
| | | 130 | .Re |
135 | .Sh STANDARDS | | 131 | .Sh STANDARDS |
136 | The identifiers are represented and generated in conformance with the DCE 1.1 | | 132 | The identifiers are represented and generated in conformance with IETF |
137 | RPC specification. | | 133 | RFC 4122, based on the historic DCE 1.1 RPC specification of the Open |
| | | 134 | Software Foundation (now the Open Group). |
138 | The | | 135 | The |
139 | .Fn uuidgen | | 136 | .Fn uuidgen |
140 | system call is itself not part of the specification. | | 137 | system call is itself not part of the specification. |
141 | .Sh HISTORY | | 138 | .Sh HISTORY |
142 | The | | 139 | The |
143 | .Fn uuidgen | | 140 | .Fn uuidgen |
144 | system call first appeared in | | 141 | system call first appeared in |
145 | .Fx 5.0 | | 142 | .Fx 5.0 |
146 | and was subsequently added to | | 143 | and was subsequently added to |
147 | .Nx 2.0 . | | 144 | .Nx 2.0 . |
| | | 145 | It was changed to use version 4 UUIDs, i.e. randomly generated UUIDs, |
| | | 146 | in |
| | | 147 | .Nx 8.0 . |