From 3ab93b732dfe58e12d453f38cf4f424478c4d4bf Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 27 Jan 2024 18:12:58 +0100 Subject: Fix man pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- man3/MAX.3libsimple | 6 +----- man3/MAX3.3libsimple | 6 +----- man3/MIN.3libsimple | 6 +----- man3/MIN3.3libsimple | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) (limited to 'man3') diff --git a/man3/MAX.3libsimple b/man3/MAX.3libsimple index ac374d0..a8ff50e 100644 --- a/man3/MAX.3libsimple +++ b/man3/MAX.3libsimple @@ -39,11 +39,7 @@ The macro returns to the greater value. .SH ERRORS -The -.BR libsimple_close () -function fail for the reasons specified for the -.BR close (3) -function. +None. .SH EXAMPLES None. diff --git a/man3/MAX3.3libsimple b/man3/MAX3.3libsimple index d0171f8..a578033 100644 --- a/man3/MAX3.3libsimple +++ b/man3/MAX3.3libsimple @@ -42,11 +42,7 @@ The macro returns to the greatest of value. .SH ERRORS -The -.BR libsimple_close () -function fail for the reasons specified for the -.BR close (3) -function. +None. .SH EXAMPLES None. diff --git a/man3/MIN.3libsimple b/man3/MIN.3libsimple index 552b334..e54a867 100644 --- a/man3/MIN.3libsimple +++ b/man3/MIN.3libsimple @@ -39,11 +39,7 @@ The macro returns to the lesser value. .SH ERRORS -The -.BR libsimple_close () -function fail for the reasons specified for the -.BR close (3) -function. +None. .SH EXAMPLES None. diff --git a/man3/MIN3.3libsimple b/man3/MIN3.3libsimple index 19eeae9..0c257c5 100644 --- a/man3/MIN3.3libsimple +++ b/man3/MIN3.3libsimple @@ -42,11 +42,7 @@ The macro returns to the smallest of value. .SH ERRORS -The -.BR libsimple_close () -function fail for the reasons specified for the -.BR close (3) -function. +None. .SH EXAMPLES None. -- cgit v1.2.3-70-g09d2 From d055dfe7bbdbcbc7fbd521168b4dc728e004dcd1 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 27 Jan 2024 19:05:28 +0100 Subject: Add libsimple_close_range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 1 + close_range.c | 142 +++++++++++++++++++++++++++++++++++++++++++ libsimple.h | 14 +++++ man0/libsimple.h.0 | 3 + man3/libsimple_close.3 | 3 +- man3/libsimple_close_range.3 | 74 ++++++++++++++++++++++ 6 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 close_range.c create mode 100644 man3/libsimple_close_range.3 (limited to 'man3') diff --git a/Makefile b/Makefile index 63843ae..4783e37 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,7 @@ OBJ =\ bindex_r.o\ callocn.o\ close.o\ + close_range.o\ cmptimespec.o\ cmptimeval.o\ difftimespec.o\ diff --git a/close_range.c b/close_range.c new file mode 100644 index 0000000..540eba0 --- /dev/null +++ b/close_range.c @@ -0,0 +1,142 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" +#ifndef TEST + +#ifdef __linux__ +# include +#endif + + +static int +uintpcmp(const void *av, const void *bv) +{ + const unsigned int *ap = av; + const unsigned int *bp = bv; + const unsigned int a = *ap; + const unsigned int b = *bp; + return a < b ? -1 : a > b; +} + +static unsigned int * +list_fds(unsigned int min, unsigned int max, size_t *count) +{ + DIR *dir; + int ignore_fd; + unsigned int *ret = NULL, *new; + size_t size = 0; + struct dirent *f; + unsigned long int fd; + char *end; + + *count = 0; + + dir = opendir("/dev/fd"); + if (!dir) + return NULL; + ignore_fd = dirfd(dir); + + errno = 0; + while ((f = readdir(dir))) { + if (!isdigit(f->d_name[0])) + continue; + fd = strtoul(f->d_name, &end, 10); + if ((int)fd == ignore_fd || (unsigned int)fd < min || (unsigned int)fd > max) + continue; + if (*end || fd > INT_MAX || (!fd && errno)) + continue; + if (*count == size) { + size += 16; + new = realloc(ret, size * sizeof(*ret)); + if (!new) + goto fail; + ret = new; + } + ret[(*count)++] = (unsigned int)fd; + } + + if (errno) { + fail: + closedir(dir); + fail_closed: + free(ret); + return NULL; + } + + if (closedir(dir)) + goto fail_closed; + + return ret; +} + +int +libsimple_close_range(unsigned int first, unsigned int last, unsigned int *next) /* TODO test */ +{ + int saved_errno; + + *next = first; + + if (first > last) { + errno = EINVAL; + return -1; + } + + if (first > INT_MAX) + return 0; + if (last > INT_MAX) + last = INT_MAX; + + saved_errno = errno; + +#if defined(__linux__) && defined(__NR_close_range) + if (!syscall(__NR_close_range, first, last, 0)) + return 0; + else if (errno != ENOSYS) + return -1; +#endif + + if (last - first > 100) { /* TODO best limit should be researched */ + unsigned int *fds; + size_t n, i; + fds = list_fds(first, last, &n); + if (!fds) + goto fallback; + qsort(fds, n, sizeof(*fds), uintpcmp); + for (i = 0; i < n; i++) { + if (close((int)fds[i]) && errno != EBADF) { + if (i + 1 < n) + *next = fds[i + 1]; + else + *next = fds[i] + (fds[i] < LIBSIMPLE_CLOSE_RANGE_MAX); + free(fds); + return -1; + } + } + free(fds); + goto out; + } + +fallback: + do { + if (close((int)first) && errno != EBADF) { + *next = first + (first < LIBSIMPLE_CLOSE_RANGE_MAX); + return -1; + } + } while (first++ < last); + +out: + *next = last + (last < LIBSIMPLE_CLOSE_RANGE_MAX); + errno = saved_errno; + return 0; +} + + +#else +#include "test.h" + +int +main(void) +{ + return 0; +} + +#endif diff --git a/libsimple.h b/libsimple.h index f4238cb..9cc0f8f 100644 --- a/libsimple.h +++ b/libsimple.h @@ -190,6 +190,20 @@ libsimple_close(int *fdp__) } +/** + * Close a range of file descriptors + * + * @param first The lowest file descriptor to close + * @param last The highest file descriptor to close + * @param next Output parameter for the potentially first unclosed file descriptor; may be `NULL` + * @return 0 on successful completion, -1 on failure + * @throws EINVAL If `first > last` + * @throws Any error for close(3) except EBADF + */ +int libsimple_close_range(unsigned int first, unsigned int last, unsigned int *next); +#define LIBSIMPLE_CLOSE_RANGE_MAX (~0U) + + /** * Remove an item from a list, keeping the list ordered * diff --git a/man0/libsimple.h.0 b/man0/libsimple.h.0 index 36e4f71..1f92855 100644 --- a/man0/libsimple.h.0 +++ b/man0/libsimple.h.0 @@ -159,6 +159,9 @@ Flexible allocation of memory suitable for allocating arrays. .BR libsimple_close (3) Close a file and set to stored file descriptor number to mark it file as closed. .TP +.BR libsimple_close_range (3) +Close a range of file descriptors. +.TP .BR libsimple_default_failure_exit (3) Default exit value on failure. .TP diff --git a/man3/libsimple_close.3 b/man3/libsimple_close.3 index 7050899..017318c 100644 --- a/man3/libsimple_close.3 +++ b/man3/libsimple_close.3 @@ -57,4 +57,5 @@ None. None. .SH SEE ALSO -.BR close (3) +.BR close (3), +.BR libsimple_close_range (3) diff --git a/man3/libsimple_close_range.3 b/man3/libsimple_close_range.3 new file mode 100644 index 0000000..891ac3f --- /dev/null +++ b/man3/libsimple_close_range.3 @@ -0,0 +1,74 @@ +.TH LIBSIMPLE_CLOSE 3 libsimple +.SH NAME +libsimple_close_range \- close a range of file descriptors + +.SH SYNOPSIS +.nf +#include + +#define LIBSIMPLE_CLOSE_RANGE_MAX (~0U) + +int libsimple_close_range(unsigned int first, unsigned int last, unsigned int *next); +.fi +.PP +Link with +.IR \-lsimple . + +.SH DESCRIPTION +The +.BR libsimple_close_range () +function closes all file descriptors in the +range inclusive range +.RI [ *first ", " last ]. +.PP +Unless +.I next +is, +.IR NULL , +the first potentially unclosed file descriptor +will be written to +.I *next . + +.SH RETURN VALUE +The +.BR libsimple_close_range () +function returns 0 upon successful completion; +otherwise \-1 is returned (potentially partially +successful). + +.SH ERRORS +The +.BR libsimple_close_range () +function fail for the reasons specified for the +.BR close (3) +function except +.BR EBADF , +or if +.TP +.B EINVAL +.I first +is greater than +.IR last . + +.SH EXAMPLES +None. + +.SH APPLICATION USAGE +None. + +.SH RATIONALE +None. + +.SH FUTURE DIRECTIONS +None. + +.SH NOTES +None. + +.SH BUGS +None. + +.SH SEE ALSO +.BR close_range (2), +.BR close (3), +.BR libsimple_close (3) -- cgit v1.2.3-70-g09d2 From 6153c38a1104b5e3c44f3c516456a35834e5ac0d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 28 Jan 2024 07:45:19 +0100 Subject: Fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- man3/libsimple_aligned_realloc.3 | 2 +- man3/libsimple_aligned_reallocarray.3 | 2 +- man3/libsimple_aligned_reallocarrayf.3 | 2 +- man3/libsimple_aligned_reallocf.3 | 2 +- man3/libsimple_reallocarray.3 | 2 +- man3/libsimple_reallocarrayf.3 | 2 +- man3/libsimple_reallocf.3 | 2 +- man3/libsimple_valigned_reallocfn.3 | 2 +- man3/libsimple_valigned_reallocn.3 | 2 +- man3/libsimple_vreallocfn.3 | 2 +- man3/libsimple_vreallocn.3 | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'man3') diff --git a/man3/libsimple_aligned_realloc.3 b/man3/libsimple_aligned_realloc.3 index 0e176b9..244ad8f 100644 --- a/man3/libsimple_aligned_realloc.3 +++ b/man3/libsimple_aligned_realloc.3 @@ -44,7 +44,7 @@ same content as but truncated to .I n bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_aligned_reallocarray.3 b/man3/libsimple_aligned_reallocarray.3 index c4cc765..b2f1361 100644 --- a/man3/libsimple_aligned_reallocarray.3 +++ b/man3/libsimple_aligned_reallocarray.3 @@ -46,7 +46,7 @@ same content as but truncated to .I n*m bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_aligned_reallocarrayf.3 b/man3/libsimple_aligned_reallocarrayf.3 index 46a4057..22a08a3 100644 --- a/man3/libsimple_aligned_reallocarrayf.3 +++ b/man3/libsimple_aligned_reallocarrayf.3 @@ -31,7 +31,7 @@ same content as but truncated to .I n*m bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_aligned_reallocf.3 b/man3/libsimple_aligned_reallocf.3 index 4ad9fcc..edd52c8 100644 --- a/man3/libsimple_aligned_reallocf.3 +++ b/man3/libsimple_aligned_reallocf.3 @@ -31,7 +31,7 @@ same content as but truncated to .I n bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_reallocarray.3 b/man3/libsimple_reallocarray.3 index 5626e63..44d1dfa 100644 --- a/man3/libsimple_reallocarray.3 +++ b/man3/libsimple_reallocarray.3 @@ -48,7 +48,7 @@ same content as but truncated to .I n*m bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_reallocarrayf.3 b/man3/libsimple_reallocarrayf.3 index f0d3104..e10793b 100644 --- a/man3/libsimple_reallocarrayf.3 +++ b/man3/libsimple_reallocarrayf.3 @@ -33,7 +33,7 @@ same content as but truncated to .I n*m bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_reallocf.3 b/man3/libsimple_reallocf.3 index d3b7523..55e6aad 100644 --- a/man3/libsimple_reallocf.3 +++ b/man3/libsimple_reallocf.3 @@ -33,7 +33,7 @@ same content as but truncated to .I n bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_valigned_reallocfn.3 b/man3/libsimple_valigned_reallocfn.3 index 2afa6c2..b9ac02c 100644 --- a/man3/libsimple_valigned_reallocfn.3 +++ b/man3/libsimple_valigned_reallocfn.3 @@ -43,7 +43,7 @@ same content as but truncated to .I N bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_valigned_reallocn.3 b/man3/libsimple_valigned_reallocn.3 index 607684b..847af93 100644 --- a/man3/libsimple_valigned_reallocn.3 +++ b/man3/libsimple_valigned_reallocn.3 @@ -64,7 +64,7 @@ same content as but truncated to .I N bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_vreallocfn.3 b/man3/libsimple_vreallocfn.3 index e0e75e0..ad588c2 100644 --- a/man3/libsimple_vreallocfn.3 +++ b/man3/libsimple_vreallocfn.3 @@ -45,7 +45,7 @@ same content as but truncated to .I N bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr diff --git a/man3/libsimple_vreallocn.3 b/man3/libsimple_vreallocn.3 index f1a8fad..cedcef9 100644 --- a/man3/libsimple_vreallocn.3 +++ b/man3/libsimple_vreallocn.3 @@ -64,7 +64,7 @@ same content as but truncated to .I N bytes if it is smaller or with the new bytes -unitialised if it is larger. If a new pointer +uninitialised if it is larger. If a new pointer is returned, rather than .IR ptr , .I ptr -- cgit v1.2.3-70-g09d2 From 3adb84e43ad41e200beea4d3f09c4632024748fd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 29 Jun 2024 16:46:08 +0200 Subject: Add (libsimple_)_[v]e[n]printf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 4 ++ libsimple/printf.h | 143 +++++++++++++++++++++++++++++++++++++++++++- man3/libsimple__enprintf.3 | 1 + man3/libsimple__eprintf.3 | 1 + man3/libsimple__venprintf.3 | 1 + man3/libsimple__veprintf.3 | 1 + man3/libsimple_vweprintf.3 | 85 ++++++++++++++++++++++++-- 7 files changed, 230 insertions(+), 6 deletions(-) create mode 120000 man3/libsimple__enprintf.3 create mode 120000 man3/libsimple__eprintf.3 create mode 120000 man3/libsimple__venprintf.3 create mode 120000 man3/libsimple__veprintf.3 (limited to 'man3') diff --git a/Makefile b/Makefile index c1f2dbc..e1401b8 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,10 @@ HDR =\ common.h OBJ =\ + _enprintf.o\ + _eprintf.o\ + _venprintf.o\ + _veprintf.o\ abs.o\ abspath.o\ aligned_allocn.o\ diff --git a/libsimple/printf.h b/libsimple/printf.h index d27a380..b6a0959 100644 --- a/libsimple/printf.h +++ b/libsimple/printf.h @@ -2,7 +2,8 @@ /** - * Exit value for `libsimple_eprintf` + * Exit value for `libsimple_eprintf` and + * `libsimple__eprintf` * * Default value is 1 */ @@ -239,6 +240,40 @@ libsimple_venprintf(int status__, const char *fmt__, va_list ap__) #endif +/** + * Version of `vprintf` for printing error message; + * it prints to standard error (rather than standard + * output) and, unless `fmt` starts with "usage: " + * and unless `argv0` (global `char *`), prefixes + * the output with `"%s: ", argv0`; additionally, if + * `fmt` ends with ':', the output is suffixed with + * `" %s\n", strerror(errno)`, if `fmt` ends with + * neither ':' nor '\n', the outpt is suffixed with + * `\n` + * + * This function will exit the process without + * calling clean-up functions registered with + * atexit(3) + * + * NB! This function uses `strerror` which is not + * thread-safe + * + * @param status Exit value for the process + * @param fmt The format string + * @param ap The format argument + */ +LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2), __format__(__printf__, 2, 0)))) +inline LIBSIMPLE_NORETURN void +libsimple__venprintf(int status__, const char *fmt__, va_list ap__) +{ + libsimple_vweprintf(fmt__, ap__); + _exit(status__); +} +#ifndef _venprintf +# define _venprintf libsimple__venprintf +#endif + + /** * Version of `vprintf` for printing error message; * it prints to standard error (rather than standard @@ -273,6 +308,42 @@ libsimple_enprintf(int status__, const char *fmt__, ...) #endif +/** + * Version of `vprintf` for printing error message; + * it prints to standard error (rather than standard + * output) and, unless `fmt` starts with "usage: " + * and unless `argv0` (global `char *`), prefixes + * the output with `"%s: ", argv0`; additionally, if + * `fmt` ends with ':', the output is suffixed with + * `" %s\n", strerror(errno)`, if `fmt` ends with + * neither ':' nor '\n', the outpt is suffixed with + * `\n` + * + * This function will exit the process without + * calling clean-up functions registered with + * atexit(3) + * + * NB! This function uses `strerror` which is not + * thread-safe + * + * @param status Exit value for the process + * @param fmt The format string + * @param ... The format argument + */ +LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(2), __format__(__printf__, 2, 3)))) +inline LIBSIMPLE_NORETURN void +libsimple__enprintf(int status__, const char *fmt__, ...) +{ + va_list ap__; + va_start(ap__, fmt__); + libsimple__venprintf(status__, fmt__, ap__); + va_end(ap__); +} +#ifndef _enprintf +# define _enprintf libsimple__enprintf +#endif + + /** * Version of `vprintf` for printing error message; * it prints to standard error (rather than standard @@ -305,6 +376,40 @@ libsimple_veprintf(const char *fmt__, va_list ap__) #endif +/** + * Version of `vprintf` for printing error message; + * it prints to standard error (rather than standard + * output) and, unless `fmt` starts with "usage: " + * and unless `argv0` (global `char *`), prefixes + * the output with `"%s: ", argv0`; additionally, if + * `fmt` ends with ':', the output is suffixed with + * `" %s\n", strerror(errno)`, if `fmt` ends with + * neither ':' nor '\n', the outpt is suffixed with + * `\n` + * + * This function will exit the process with the + * value `libsimple_default_failure_exit` without + * calling clean-up functions registered with + * atexit(3) + * + * NB! This function uses `strerror` which is not + * thread-safe + * + * @param fmt The format string + * @param ap The format argument + */ +LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __format__(__printf__, 1, 0)))) +inline LIBSIMPLE_NORETURN void +libsimple__veprintf(const char *fmt__, va_list ap__) +{ + libsimple_vweprintf(fmt__, ap__); + _exit(libsimple_default_failure_exit); +} +#ifndef _veprintf +# define _veprintf libsimple__veprintf +#endif + + /** * Version of `vprintf` for printing error message; * it prints to standard error (rather than standard @@ -337,3 +442,39 @@ libsimple_eprintf(const char *fmt__, ...) #ifndef eprintf # define eprintf libsimple_eprintf #endif + + +/** + * Version of `vprintf` for printing error message; + * it prints to standard error (rather than standard + * output) and, unless `fmt` starts with "usage: " + * and unless `argv0` (global `char *`), prefixes + * the output with `"%s: ", argv0`; additionally, if + * `fmt` ends with ':', the output is suffixed with + * `" %s\n", strerror(errno)`, if `fmt` ends with + * neither ':' nor '\n', the outpt is suffixed with + * `\n` + * + * This function will exit the process with the + * value `libsimple_default_failure_exit` without + * calling clean-up functions registered with + * atexit(3) + * + * NB! This function uses `strerror` which is not + * thread-safe + * + * @param fmt The format string + * @param ... The format argument + */ +LIBSIMPLE_GCC_ONLY__(__attribute__((__nonnull__(1), __format__(__printf__, 1, 2)))) +inline LIBSIMPLE_NORETURN void +libsimple__eprintf(const char *fmt__, ...) +{ + va_list ap__; + va_start(ap__, fmt__); + libsimple__veprintf(fmt__, ap__); + va_end(ap__); +} +#ifndef _eprintf +# define _eprintf libsimple__eprintf +#endif diff --git a/man3/libsimple__enprintf.3 b/man3/libsimple__enprintf.3 new file mode 120000 index 0000000..3d2d430 --- /dev/null +++ b/man3/libsimple__enprintf.3 @@ -0,0 +1 @@ +libsimple_enprintf.3 \ No newline at end of file diff --git a/man3/libsimple__eprintf.3 b/man3/libsimple__eprintf.3 new file mode 120000 index 0000000..07276cb --- /dev/null +++ b/man3/libsimple__eprintf.3 @@ -0,0 +1 @@ +libsimple_eprintf.3 \ No newline at end of file diff --git a/man3/libsimple__venprintf.3 b/man3/libsimple__venprintf.3 new file mode 120000 index 0000000..574bdd9 --- /dev/null +++ b/man3/libsimple__venprintf.3 @@ -0,0 +1 @@ +libsimple_venprintf.3 \ No newline at end of file diff --git a/man3/libsimple__veprintf.3 b/man3/libsimple__veprintf.3 new file mode 120000 index 0000000..3a87c2d --- /dev/null +++ b/man3/libsimple__veprintf.3 @@ -0,0 +1 @@ +libsimple_veprintf.3 \ No newline at end of file diff --git a/man3/libsimple_vweprintf.3 b/man3/libsimple_vweprintf.3 index b40799d..bd11957 100644 --- a/man3/libsimple_vweprintf.3 +++ b/man3/libsimple_vweprintf.3 @@ -16,6 +16,10 @@ inline void libsimple_venprintf(int \fIstatus\fP, const char *\fIfmt\fP, va_list inline void libsimple_enprintf(int \fIstatus\fP, const char *\fIfmt\fP, ...); inline void libsimple_veprintf(const char *\fIfmt\fP, va_list \fIap\fP); inline void libsimple_eprintf(const char *\fIfmt\fP, ...); +inline void libsimple__venprintf(int \fIstatus\fP, const char *\fIfmt\fP, va_list \fIap\fP); +inline void libsimple__enprintf(int \fIstatus\fP, const char *\fIfmt\fP, ...); +inline void libsimple__veprintf(const char *\fIfmt\fP, va_list \fIap\fP); +inline void libsimple__eprintf(const char *\fIfmt\fP, ...); #ifndef vweprintf # define vweprintf libsimple_vweprintf @@ -35,6 +39,18 @@ inline void libsimple_eprintf(const char *\fIfmt\fP, ...); #ifndef eprintf # define eprintf libsimple_eprintf #endif +#ifndef _venprintf +# define _venprintf libsimple__venprintf +#endif +#ifndef _enprintf +# define _enprintf libsimple__enprintf +#endif +#ifndef _veprintf +# define _veprintf libsimple__veprintf +#endif +#ifndef _eprintf +# define _eprintf libsimple__eprintf +#endif .fi .PP Link with @@ -102,6 +118,19 @@ the exit value of the process will be .IR status . .PP The +.BR libsimple__venprintf () +and +.BR libsimple__enprintf () +functions are versions of the +.BR libsimple_vweprintf () +and +.BR libsimple_weprintf () +functions that terminate the process by calling +.BR _exit (3), +the exit value of the process will be +.IR status . +.PP +The .BR libsimple_veprintf () and .BR libsimple_eprintf () @@ -116,13 +145,31 @@ the exit value of the process will be which is 1 by default. .PP The +.BR libsimple__veprintf () +and +.BR libsimple__eprintf () +functions are versions of the +.BR libsimple_vweprintf () +and +.BR libsimple_weprintf () +functions that terminate the process by calling +.BR _exit (3), +the exit value of the process will be +.IR libsimple_default_failure_exit (3), +which is 1 by default. +.PP +The .BR libsimple_vweprintf (), .BR libsimple_weprintf (), .BR libsimple_venprintf (), .BR libsimple_enprintf (), .BR libsimple_veprintf (), +.BR libsimple_eprintf (), +.BR libsimple__venprintf (), +.BR libsimple__enprintf (), +.BR libsimple__veprintf (), and -.BR libsimple_eprintf () +.BR libsimple__eprintf () functions call .I libsimple_eprintf_preprint unless it is @@ -146,8 +193,12 @@ may have a different value from when the .BR libsimple_venprintf (), .BR libsimple_enprintf (), .BR libsimple_veprintf (), +.BR libsimple_eprintf (), +.BR libsimple__venprintf (), +.BR libsimple__enprintf (), +.BR libsimple__veprintf (), or -.BR libsimple_eprintf () +.BR libsimple__eprintf () function called when .I libsimple_eprintf_preprint or @@ -179,7 +230,15 @@ T{ .br .BR libsimple_veprintf (), .br -.BR libsimple_eprintf () +.BR libsimple_eprintf (), +.br +.BR libsimple__venprintf (), +.br +.BR libsimple__enprintf (), +.br +.BR libsimple__veprintf (), +.br +.BR libsimple__eprintf () T} Thread safety MT-Unsafe race:strerror T{ .BR libsimple_vweprintf (), @@ -192,7 +251,15 @@ T{ .br .BR libsimple_veprintf (), .br -.BR libsimple_eprintf () +.BR libsimple_eprintf (), +.br +.BR libsimple__venprintf (), +.br +.BR libsimple__enprintf (), +.br +.BR libsimple__veprintf (), +.br +.BR libsimple__eprintf () T} Async-signal safety AS-Safe T{ .BR libsimple_vweprintf (), @@ -205,7 +272,15 @@ T{ .br .BR libsimple_veprintf (), .br -.BR libsimple_eprintf () +.BR libsimple_eprintf (), +.br +.BR libsimple__venprintf (), +.br +.BR libsimple__enprintf (), +.br +.BR libsimple__veprintf (), +.br +.BR libsimple__eprintf () T} Async-cancel safety AC-Safe .TE -- cgit v1.2.3-70-g09d2 From 2a47a999bb86486700f47a22547bf66c39255ed9 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 1 Jul 2024 21:29:28 +0200 Subject: Add missing man pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- man3/_enprintf.3libsimple | 1 + man3/_eprintf.3libsimple | 1 + man3/_venprintf.3libsimple | 1 + man3/_veprintf.3libsimple | 1 + 4 files changed, 4 insertions(+) create mode 120000 man3/_enprintf.3libsimple create mode 120000 man3/_eprintf.3libsimple create mode 120000 man3/_venprintf.3libsimple create mode 120000 man3/_veprintf.3libsimple (limited to 'man3') diff --git a/man3/_enprintf.3libsimple b/man3/_enprintf.3libsimple new file mode 120000 index 0000000..d06df60 --- /dev/null +++ b/man3/_enprintf.3libsimple @@ -0,0 +1 @@ +enprintf.3libsimple \ No newline at end of file diff --git a/man3/_eprintf.3libsimple b/man3/_eprintf.3libsimple new file mode 120000 index 0000000..7990141 --- /dev/null +++ b/man3/_eprintf.3libsimple @@ -0,0 +1 @@ +eprintf.3libsimple \ No newline at end of file diff --git a/man3/_venprintf.3libsimple b/man3/_venprintf.3libsimple new file mode 120000 index 0000000..e007970 --- /dev/null +++ b/man3/_venprintf.3libsimple @@ -0,0 +1 @@ +venprintf.3libsimple \ No newline at end of file diff --git a/man3/_veprintf.3libsimple b/man3/_veprintf.3libsimple new file mode 120000 index 0000000..5f64b97 --- /dev/null +++ b/man3/_veprintf.3libsimple @@ -0,0 +1 @@ +veprintf.3libsimple \ No newline at end of file -- cgit v1.2.3-70-g09d2