uuidgen()

generate universally unique identifiers 

Function


SYNOPSIS

#include <sys/uuid.h>

int uuidgen(struct uuid *store, int count);


DESCRIPTION

The uuidgen() system call generates count universally unique identifiers (UUIDs) and writes them to the buffer pointed to by store. The identifiers are generated by calls to the Win32 function UuidCreate() in rpcrt4.dll which no longer uses the older DCE 1.1 formula of the UuidCreateSequential() function, but still populates the same struct uuid.

Universally unique identifiers, also known as globally unique identifiers (GUIDs), have a binary representation of 128-bits. The grouping of these bits is described by the following structure, while any meanings are purely historical:

struct uuid {
	uint32_t	time_low;
	uint16_t	time_mid;
	uint16_t	time_hi_and_version;
	uint8_t		clock_seq_hi_and_reserved;
	uint8_t		clock_seq_low;
	uint8_t		node[_UUID_NODE_LEN];
};

The binary representation is sensitive to byte ordering. Any multi-byte field is to be stored in the local or native byte-order and identifiers must be converted when transmitted to hosts that do not agree on the byte-order. The specification does not however document what this means in concrete terms and is otherwise beyond the scope of this system call.


RETURN VALUES

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.


CONFORMANCE

The UUID functions conform to the DCE 1.1 RPC specification.


MULTITHREAD SAFETY LEVEL

Safe.


PORTING ISSUES

Linux defines uuid_generate*() functions in <uuid/uuid.h> and libuuid. Porting to PTC MKS Toolkit will require conditional code similar to that needed to port to a BSD UNIX variant.


PORTABILITY

FreeBSD 5 and up. Windows Server 2012. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
uuidgen

Functions:
uuidgen()


PTC MKS Toolkit 10.3 Documentation Build 39.