UUID_CLEAR(3UUID) Universally Unique Identifier Library Functions UUID_CLEAR(3UUID)

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_upperuniversally unique identifier (UUID) operations

UUID Library (libuuid, -luuid)

#include <uuid/uuid.h>

void
uuid_clear(uuid_t uu);

int
uuid_compare(uuid_t uu1, uuid_t uu2);

void
uuid_copy(uuid_t dst, uuid_t src);

void
uuid_generate(uuid_t out);

void
uuid_generate_random(uuid_t out);

void
uuid_generate_time(uuid_t out);

int
uuid_is_null(uuid_t uu);

int
uuid_parse(char *int, uuid_t uu);

time_t
uuid_time(uuid_t uu, struct timeval *ret_tv);

void
uuid_unparse(uuid_t uu, char *out);

void
uuid_unparse_lower(uuid_t uu, char *out);

void
uuid_unparse_upper(uuid_t uu, char *out);

The () function sets the value of the specified universally unique identifier (UUID) variable uu to the NULL value.

The () function compares the two specified UUID variables uu1 and uu2 to each other. It returns an integer less than, equal to, or greater than zero if uu1 is found to be, respectively, lexicographically less than, equal, or greater than uu2.

The () function copies the UUID variable src to dst.

The () and () functions create a new UUID that is generated based on high-quality randomness utilizing the arc4random(3C) function. These correspond to a DCE version 4 UUID. On some implementations it is possible that the uuid_generate() function will fall back to generating a version 1 UUID. While in our current implementation this is not possible, applications should not assume a guaranteed format when calling the uuid_generate() function.

The () 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).

The () function compares the value of the specified UUID variable uu to the NULL value. If the value is equal to the NULL UUID, 1 is returned. Otherwise 0 is returned.

The () function converts the UUID string specified by in to the internal uuid_t format. The input UUID is a string of the form . In printf(3C) format, the string is “”, 36 bytes plus the trailing null character. If the input string is parsed successfully, 0 is returned and the UUID is stored in the location pointed to by uu. Otherwise -1 is returned.

The () function extracts the time at which the specified UUID uu 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 uuid_generate_time() function. The time at which the UUID was created, in seconds since January 1, 1970 GMT (the epoch), is returned (see time(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 ret_tv (see gettimeofday(3C)).

The () and () functions convert the specified UUID uu from the internal binary format to a lower case string of the length defined in the <uuid/uuid.h> macro, UUID_PRINTABLE_STRING_LENGTH, which includes the trailing null character. The resulting value is stored in the character string pointed to by out.

The uuid_unparse_upper function converts the specified UUID uu from the internal binary format to a upper case string of the length defined in the <uuid/uuid.h> macro, UUID_PRINTABLE_STRING_LENGTH, which includes the trailing null character. The resulting value is stored in the character string pointed to by out.

time(2), arc4random(3C), gettimeofday(3C), printf(3C), libuuid(3LIB), attributes(7)

November 30, 2021 OmniOS