freebsd-nq/lib/libgeom
Kirk McKusick 90e29718cf Clarify when GEOM utilities exit with success or failure.
Historically, GEOM utilities (gpart(8), gstripe(8), gmirror(8),
etc) used the gctl_error() routine to report errors. If they called
gctl_error() they would exit with EXIT_FAILURE, otherwise they would
return with EXIT_SUCCESS. If they used gctl_error() to output an
informational message, for example when run with the -v (verbose)
option, they would mistakenly exit with EXIT_FAILURE. A further
limitation of the gctl_error() function was that it could only be
called once. Messages from any additional calls to gctl_error()
would be silently discarded.

To resolve these problems a new function, gctl_msg() has been added.
It can be called multiple times to output multiple messages. It
also has an additional errno argument which should be zero if it is
an informational message or an errno value (EINVAL, EBUSY, etc) if
it is an error. When done the gctl_post_messages() function should
be called to indicate that all messages have been posted. If any
of the messages had a non-zero errno, the utility will EXIT_FAILURE.
If only informational messages (with zero errno) were posted, the
utility will EXIT_SUCCESS.

Tested by:   Peter Holm
PR:          265184
MFC after:   1 week
2022-07-16 10:26:51 -07:00
..
geom_ctl.c Clarify when GEOM utilities exit with success or failure. 2022-07-16 10:26:51 -07:00
geom_getxml.c GEOM: Introduce partial confxml API 2022-03-12 11:55:52 -05:00
geom_stats.c [skip ci] correct a few SPDX license tags 2021-07-07 13:52:20 -06:00
geom_util.c
geom_xml2tree.c GEOM: Fix regression after 7f16b501e2. 2022-03-16 00:06:49 -04:00
libgeom.3
libgeom.h GEOM: Introduce partial confxml API 2022-03-12 11:55:52 -05:00
Makefile
Makefile.depend