The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System, Second Edition

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/uuidgen.2

Version: -  FREEBSD  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  cheribsd  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1  -  FREEBSD-LIBC  -  FREEBSD8-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  3  -  10 

    1 .\" Copyright (c) 2002 Marcel Moolenaar
    2 .\" All rights reserved.
    3 .\"
    4 .\" Redistribution and use in source and binary forms, with or without
    5 .\" modification, are permitted provided that the following conditions
    6 .\" are met:
    7 .\"
    8 .\" 1. Redistributions of source code must retain the above copyright
    9 .\"    notice, this list of conditions and the following disclaimer.
   10 .\" 2. Redistributions in binary form must reproduce the above copyright
   11 .\"    notice, this list of conditions and the following disclaimer in the
   12 .\"    documentation and/or other materials provided with the distribution.
   13 .\"
   14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   24 .\"
   25 .\" $FreeBSD: stable/8/lib/libc/sys/uuidgen.2 148580 2005-07-31 03:30:48Z keramida $
   26 .\"
   27 .Dd May 26, 2002
   28 .Dt UUIDGEN 2
   29 .Os
   30 .Sh NAME
   31 .Nm uuidgen
   32 .Nd generate universally unique identifiers
   33 .Sh LIBRARY
   34 .Lb libc
   35 .Sh SYNOPSIS
   36 .In sys/uuid.h
   37 .Ft int
   38 .Fn uuidgen "struct uuid *store" "int count"
   39 .Sh DESCRIPTION
   40 The
   41 .Fn uuidgen
   42 system call generates
   43 .Fa count
   44 universally unique identifiers (UUIDs) and writes them to the buffer
   45 pointed to by
   46 .Fa store .
   47 The identifiers are generated according to the syntax and semantics of the
   48 DCE version 1 variant of universally unique identifiers.
   49 See below for a more in-depth description of the identifiers.
   50 When no IEEE 802
   51 address is available for the node field, a random multicast address is
   52 generated for each invocation of the system call.
   53 According to the algorithm of generating time-based UUIDs, this will also
   54 force a new random clock sequence, thereby increasing the likelihood for
   55 the identifier to be unique.
   56 .Pp
   57 When multiple identifiers are to be generated, the
   58 .Fn uuidgen
   59 system call will generate a set of identifiers that is dense in such a way
   60 that there is no identifier that is larger than the smallest identifier in the
   61 set and smaller than the largest identifier in the set and that is not already
   62 in the set.
   63 .Pp
   64 Universally unique identifiers, also known as globally unique identifiers
   65 (GUIDs), have a binary representation of 128-bits.
   66 The grouping and meaning of these bits is described by the following
   67 structure and its description of the fields that follow it:
   68 .Bd -literal
   69 struct uuid {
   70         uint32_t        time_low;
   71         uint16_t        time_mid;
   72         uint16_t        time_hi_and_version;
   73         uint8_t         clock_seq_hi_and_reserved;
   74         uint8_t         clock_seq_low;
   75         uint8_t         node[_UUID_NODE_LEN];
   76 };
   77 .Ed
   78 .Bl -tag -width ".Va clock_seq_hi_and_reserved"
   79 .It Va time_low
   80 The least significant 32 bits of a 60-bit timestamp.
   81 This field is stored in the native byte-order.
   82 .It Va time_mid
   83 The least significant 16 bits of the most significant 28 bits of the 60-bit
   84 timestamp.
   85 This field is stored in the native byte-order.
   86 .It Va time_hi_and_version
   87 The most significant 12 bits of the 60-bit timestamp multiplexed with a 4-bit
   88 version number.
   89 The version number is stored in the most significant 4 bits of the 16-bit
   90 field.
   91 This field is stored in the native byte-order.
   92 .It Va clock_seq_hi_and_reserved
   93 The most significant 6 bits of a 14-bit sequence number multiplexed with a
   94 2-bit variant value.
   95 Note that the width of the variant value is determined by the variant itself.
   96 Identifiers generated by the
   97 .Fn uuidgen
   98 system call have variant value 10b.
   99 the variant value is stored in the most significant bits of the field.
  100 .It Va clock_seq_low
  101 The least significant 8 bits of a 14-bit sequence number.
  102 .It Va node
  103 The 6-byte IEEE 802 (MAC) address of one of the interfaces of the node.
  104 If no such interface exists, a random multi-cast address is used instead.
  105 .El
  106 .Pp
  107 The binary representation is sensitive to byte ordering.
  108 Any multi-byte field is to be stored in the local or native byte-order and
  109 identifiers must be converted when transmitted to hosts that do not agree
  110 on the byte-order.
  111 The specification does not however document what this means in concrete
  112 terms and is otherwise beyond the scope of this system call.
  113 .Sh RETURN VALUES
  114 .Rv -std
  115 .Sh ERRORS
  116 The
  117 .Fn uuidgen
  118 system call can fail with:
  119 .Bl -tag -width Er
  120 .It Bq Er EFAULT
  121 The buffer pointed to by
  122 .Fa store
  123 could not be written to for any or all identifiers.
  124 .It Bq Er EINVAL
  125 The
  126 .Fa count
  127 argument is less than 1 or larger than the hard upper limit of 2048.
  128 .El
  129 .Sh SEE ALSO
  130 .Xr uuidgen 1 ,
  131 .Xr uuid 3
  132 .Sh STANDARDS
  133 The identifiers are represented and generated in conformance with the DCE 1.1
  134 RPC specification.
  135 The
  136 .Fn uuidgen
  137 system call is itself not part of the specification.
  138 .Sh HISTORY
  139 The
  140 .Fn uuidgen
  141 system call first appeared in
  142 .Fx 5.0 .

Cache object: eb9aa58a9a71b50b4ebe5109390f0238


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.