Hi Osama
On Thu, 2026-01-29 at 22:35 +0100, Osama Abdelkader via busybox wrote:
> On Sun, Nov 23, 2025 at 03:19:58AM +0200, Osama Abdelkader wrote:
> > Add a simple uuidgen utility that generates RFC 4122 compliant
> > UUIDs (version 4, random). Uses the existing generate_uuid()
> > function from libbb.
> >
> > Features:
> > - Generates standard format UUIDs: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
> > - RFC 4122 version 4 compliant
> > - Minimal implementation (~1.1 kb)
> > - NOFORK applet for efficiency
> >
> > Signed-off-by: Osama Abdelkader <[email protected]>
> > ---
> > util-linux/uuidgen.c | 47 ++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 47 insertions(+)
> > create mode 100644 util-linux/uuidgen.c
> >
> > diff --git a/util-linux/uuidgen.c b/util-linux/uuidgen.c
> > new file mode 100644
> > index 000000000..6c5fb6903
> > --- /dev/null
> > +++ b/util-linux/uuidgen.c
> > @@ -0,0 +1,47 @@
> > +/* vi: set sw=4 ts=4: */
> > +/*
> > + * Mini uuidgen implementation for busybox
> > + *
> > + * Licensed under GPLv2 or later, see file LICENSE in this source tree.
> > + */
> > +//config:config UUIDGEN
> > +//config: bool "uuidgen (1.1 kb)"
> > +//config: default y
> > +//config: help
> > +//config: Generate a UUID (Universally Unique Identifier) in RFC 4122
> > format.
> > +
> > +//applet:IF_UUIDGEN(APPLET_NOFORK(uuidgen, uuidgen, BB_DIR_USR_BIN,
> > BB_SUID_DROP, uuidgen))
> > +
> > +//kbuild:lib-$(CONFIG_UUIDGEN) += uuidgen.o
> > +
> > +//usage:#define uuidgen_trivial_usage
> > +//usage: ""
> > +//usage:#define uuidgen_full_usage "\n\n"
> > +//usage: "Generate a UUID (Universally Unique Identifier)"
> > +
> > +#include "libbb.h"
> > +
> > +/* This is a NOFORK applet. Be very careful! */
> > +
> > +int uuidgen_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
> > +int uuidgen_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
> > +{
> > + uint8_t uuid[16];
> > +
> > + if (argv[1]) {
> > + bb_show_usage();
> > + }
> > +
> > + generate_uuid(uuid);
> > +
> > + /* Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx */
> > +
> > printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
> > + uuid[0], uuid[1], uuid[2], uuid[3],
> > + uuid[4], uuid[5],
> > + uuid[6], uuid[7],
> > + uuid[8], uuid[9],
> > + uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
> > +
> > + return fflush_all();
> > +}
> > +
> > --
> > 2.43.0
> >
> ping.
>
This is my version of the from my (endless) didn't send list
Only the main code
int uuidgen_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uuidgen_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
struct volume_id id;
char uuid[37];
generate_uuid(uuid);
volume_id_set_uuid(&id, uuid, UUID_DCE);
printf("%s\n", id.uuid);
return 0;
}
I didn't check the size.
You can take this
Ulli
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox