diff options
author | Mattias Andrée <maandree@kth.se> | 2018-11-03 12:21:57 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-11-03 12:21:57 +0100 |
commit | 46caf26f0047bd91abd480928eba9744a9324135 (patch) | |
tree | 8798520cd735eb5d3fc10e8846ce1a465f6ac382 | |
parent | Remove FREE and CLOSE, and add symlinks for upcoming man pages (diff) | |
download | libsimple-46caf26f0047bd91abd480928eba9744a9324135.tar.gz libsimple-46caf26f0047bd91abd480928eba9744a9324135.tar.bz2 libsimple-46caf26f0047bd91abd480928eba9744a9324135.tar.xz |
More man pages
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | man/libsimple_encalloc.3 | 152 | ||||
-rw-r--r-- | man/libsimple_enmalloc.3 | 148 | ||||
-rw-r--r-- | man/libsimple_mallocz.3 | 186 | ||||
-rw-r--r-- | man/libsimple_pvalloc.3 | 169 | ||||
-rw-r--r-- | man/libsimple_pvallocz.3 | 171 | ||||
-rw-r--r-- | man/libsimple_valloc.3 | 168 | ||||
-rw-r--r-- | man/libsimple_vallocz.3 | 171 | ||||
-rw-r--r-- | man/libsimple_vcallocn.3 | 228 | ||||
-rw-r--r-- | man/libsimple_vmallocn.3 | 228 | ||||
-rw-r--r-- | man/libsimple_vmalloczn.3 | 236 | ||||
-rw-r--r-- | man/libsimple_vpvallocn.3 | 225 | ||||
-rw-r--r-- | man/libsimple_vpvalloczn.3 | 228 | ||||
-rw-r--r-- | man/libsimple_vvallocn.3 | 224 | ||||
-rw-r--r-- | man/libsimple_vvalloczn.3 | 228 |
14 files changed, 2762 insertions, 0 deletions
diff --git a/man/libsimple_encalloc.3 b/man/libsimple_encalloc.3 new file mode 100644 index 0000000..49c1758 --- /dev/null +++ b/man/libsimple_encalloc.3 @@ -0,0 +1,152 @@ +.TH LIBSIMPLE_ENCALLOC 3 2018-11-03 libsimple +.SH NAME +libsimple_encalloc \- allocate initialised memory or die +.SH SYNOPSIS +.nf +#include <libsimple.h> + +void *libsimple_encalloc(int \fIstatus\fP, size_t \fIn\fP, size_t \fIm\fP); +static inline void *libsimple_ecalloc(size_t \fIn\fP, size_t \fIm\fP); + +#ifndef encalloc +# define encalloc libsimple_encalloc +#endif +#ifndef ecalloc +# define ecalloc libsimple_ecalloc +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_encalloc () +and +.BR libsimple_ecalloc () +functions are wrappers for the +.BR calloc (3) +function, they allocate +.I n*m +zero-initialised bytes to the heap and return a +pointer with an alignment of +.I alignof(max_align_t) +to the allocated memory. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_encalloc () +and +.BR libsimple_ecalloc () +functions will terminate the process if the memory +cannot be allocated (or if +.I n +or +.I m +is 0 and +.BR calloc (3) +returns +.B NULL +when it is used to allocate 0 bytes), by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_encalloc () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_ecalloc () +function is used. +.PP +The +.BR libsimple_encalloc () +and +.BR libsimple_ecalloc () +functions behaviour is unspecified if +.I n +or +.I m +is 0. +.SH RETURN VALUE +The +.BR libsimple_encalloc () +and +.BR libsimple_ecalloc () +functions return a pointer to the allocated memory +upon success completion; otherwise the process is terminated. +.SH ERRORS +The +.BR libsimple_encalloc () +and +.BR libsimple_ecalloc () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_encalloc (), +.br +.BR libsimple_ecalloc () +T} Thread safety MT-Safe env +T{ +.BR libsimple_encalloc (), +.br +.BR libsimple_ecalloc () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_encalloc (), +.br +.BR libsimple_ecalloc () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3), +.BR calloc (3) diff --git a/man/libsimple_enmalloc.3 b/man/libsimple_enmalloc.3 new file mode 100644 index 0000000..de4ab76 --- /dev/null +++ b/man/libsimple_enmalloc.3 @@ -0,0 +1,148 @@ +.TH LIBSIMPLE_ENMALLOC 3 2018-11-03 libsimple +.SH NAME +libsimple_enmalloc \- allocate memory or die +.SH SYNOPSIS +.nf +#include <libsimple.h> + +void *libsimple_enmalloc(int \fIstatus\fP, size_t \fIn\fP); +static inline void *libsimple_emalloc(size_t \fIn\fP); + +#ifndef enmalloc +# define enmalloc libsimple_enmalloc +#endif +#ifndef emalloc +# define emalloc libsimple_emalloc +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_enmalloc () +and +.BR libsimple_emalloc () +functions are wrappers for the +.BR malloc (3) +function, they allocate +.I n +uninitialised bytes to the heap and return a +pointer with an alignment of +.I alignof(max_align_t) +to the allocated memory. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enmalloc () +and +.BR libsimple_emalloc () +functions will terminate the process if the memory +cannot be allocated (or if +.I n +is 0 and +.BR malloc (3) +returns +.B NULL +when it is used to allocate 0 bytes), by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enmalloc () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_emalloc () +function is used. +.PP +The +.BR libsimple_enmalloc () +and +.BR libsimple_emalloc () +functions behaviour is unspecified if +.I n +is 0. +.SH RETURN VALUE +The +.BR libsimple_enmalloc () +and +.BR libsimple_emalloc () +functions return a pointer to the allocated memory +upon success completion; otherwise the process is terminated. +.SH ERRORS +The +.BR libsimple_enmalloc () +and +.BR libsimple_emalloc () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_enmalloc (), +.br +.BR libsimple_emalloc () +T} Thread safety MT-Safe env +T{ +.BR libsimple_enmalloc (), +.br +.BR libsimple_emalloc () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_enmalloc (), +.br +.BR libsimple_emalloc () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3), +.BR malloc (3) diff --git a/man/libsimple_mallocz.3 b/man/libsimple_mallocz.3 new file mode 100644 index 0000000..010b8ca --- /dev/null +++ b/man/libsimple_mallocz.3 @@ -0,0 +1,186 @@ +.TH LIBSIMPLE_MALLOCZ 3 2018-11-03 libsimple +.SH NAME +libsimple_mallocz \- allocate optionally initialised memory +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_mallocz(int \fIclear\fP, size_t \fIn\fP); +static inline void *libsimple_enmallocz(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP); +static inline void *libsimple_emallocz(int \fIclear\fP, size_t \fIn\fP); + +#ifndef mallocz +# define mallocz libsimple_mallocz +#endif +#ifndef enmallocz +# define enmallocz libsimple_enmallocz +#endif +#ifndef emallocz +# define emallocz libsimple_emallocz +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_mallocz (), +.BR libsimple_enmallocz (), +and +.BR libsimple_emallocz () +functions are wrappers for the +.BR malloc (3) +and +.BR calloc (3) +functions, they allocate +.I n +bytes to the heap and return a pointer with an +alignment of +.I alignof(max_align_t) +to the allocated memory. The memory will be +initialised with zeroes if +.I clear +is a non-zero value. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enmallocz () +and +.BR libsimple_emallocz () +functions will terminate the process if the memory +cannot be allocated (or if +.I n +is 0 and +.BR malloc (3) +and +.BR calloc (3) +returns +.B NULL +when it is used to allocate 0 bytes), by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enmallocz () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_emallocz () +function is used. +.PP +The +.BR libsimple_enmallocz () +and +.BR libsimple_emallocz () +functions behaviour is unspecified if +.I n +is 0. +.SH RETURN VALUE +The +.BR libsimple_mallocz (), +.BR libsimple_enmallocz (), +and +.BR libsimple_emallocz () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_mallocz () +function return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_enmallocz () +and +.BR libsimple_emallocz () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_mallocz () +function will fail for the reasons specified for the +.BR malloc (3) +and +.BR calloc (3) +functions. +.PP +The +.BR libsimple_enmallocz () +and +.BR libsimple_emallocz () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_mallocz (), +.br +.BR libsimple_enmallocz (), +.br +.BR libsimple_emallocz () +T} Thread safety MT-Safe env +T{ +.BR libsimple_mallocz (), +.br +.BR libsimple_enmallocz (), +.br +.BR libsimple_emallocz () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_mallocz (), +.br +.BR libsimple_enmallocz (), +.br +.BR libsimple_emallocz () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3), +.BR malloc (3), +.BR calloc (3) diff --git a/man/libsimple_pvalloc.3 b/man/libsimple_pvalloc.3 new file mode 100644 index 0000000..3278526 --- /dev/null +++ b/man/libsimple_pvalloc.3 @@ -0,0 +1,169 @@ +.TH LIBSIMPLE_PVALLOC 3 2018-11-03 libsimple +.SH NAME +libsimple_pvalloc \- allocate memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_pvalloc(size_t \fIn\fP); +static inline void *libsimple_enpvalloc(int \fIstatus\fP, size_t \fIn\fP); +static inline void *libsimple_epvalloc(size_t \fIn\fP); + +#ifndef pvalloc +# define pvalloc libsimple_pvalloc +#endif +#ifndef enpvalloc +# define enpvalloc libsimple_enpvalloc +#endif +#ifndef epvalloc +# define epvalloc libsimple_epvalloc +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_pvalloc (), +.BR libsimple_enpvalloc (), +and +.BR libsimple_epvalloc () +functions allocate +.I n +uninitialised bytes, rounded up to the next multiple of +the page size, to the heap and return a pointer with an +alignment of the page size to the allocated memory. +The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enpvalloc () +and +.BR libsimple_epvalloc () +functions will terminate the process if the memory +cannot be allocated of if the user tries to allocate +0 bytes, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enpvalloc () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_epvalloc () +function is used. +.PP +The +.BR libsimple_enpvalloc () +and +.BR libsimple_epvalloc () +functions behaviour is unspecified if +.I n +is 0. +.SH RETURN VALUE +The +.BR libsimple_pvalloc (), +.BR libsimple_enpvalloc (), +and +.BR libsimple_epvalloc () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_pvalloc () +function return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_enpvalloc () +and +.BR libsimple_epvalloc () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_pvalloc () +function will fail if: +.TP +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_enpvalloc () +and +.BR libsimple_epvalloc () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_pvalloc (), +.br +.BR libsimple_enpvalloc (), +.br +.BR libsimple_epvalloc () +T} Thread safety MT-Safe env +T{ +.BR libsimple_pvalloc (), +.br +.BR libsimple_enpvalloc (), +.br +.BR libsimple_epvalloc () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_pvalloc (), +.br +.BR libsimple_enpvalloc (), +.br +.BR libsimple_epvalloc () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_pvallocz.3 b/man/libsimple_pvallocz.3 new file mode 100644 index 0000000..5342278 --- /dev/null +++ b/man/libsimple_pvallocz.3 @@ -0,0 +1,171 @@ +.TH LIBSIMPLE_PVALLOCZ 3 2018-11-03 libsimple +.SH NAME +libsimple_pvallocz \- allocate optionally initialised memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_pvallocz(int \fIclear\fP, size_t \fIn\fP); +static inline void *libsimple_enpvallocz(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP); +static inline void *libsimple_epvallocz(int \fIclear\fP, size_t \fIn\fP); + +#ifndef pvallocz +# define pvallocz libsimple_pvallocz +#endif +#ifndef enpvallocz +# define enpvallocz libsimple_enpvallocz +#endif +#ifndef epvallocz +# define epvallocz libsimple_epvallocz +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_pvallocz (), +.BR libsimple_enpvallocz (), +and +.BR libsimple_epvallocz () +functions allocate +.I n +bytes, rounded up to the next multiple of the page size, +to the heap and return a pointer with an alignment of +the page size to the allocated memory. The memory will be +initialised with zeroes if +.I clear +is a non-zero value. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enpvallocz () +and +.BR libsimple_epvallocz () +functions will terminate the process if the memory +cannot be allocated of if the user tries to allocate +0 bytes, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enpvallocz () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_epvallocz () +function is used. +.PP +The +.BR libsimple_enpvallocz () +and +.BR libsimple_epvallocz () +functions behaviour is unspecified if +.I n +is 0. +.SH RETURN VALUE +The +.BR libsimple_pvallocz (), +.BR libsimple_enpvallocz (), +and +.BR libsimple_epvallocz () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_pvallocz () +function return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_enpvallocz () +and +.BR libsimple_epvallocz () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_pvallocz () +function will fail if: +.TP +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_enpvallocz () +and +.BR libsimple_epvallocz () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_pvallocz (), +.br +.BR libsimple_enpvallocz (), +.br +.BR libsimple_epvallocz () +T} Thread safety MT-Safe env +T{ +.BR libsimple_pvallocz (), +.br +.BR libsimple_enpvallocz (), +.br +.BR libsimple_epvallocz () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_pvallocz (), +.br +.BR libsimple_enpvallocz (), +.br +.BR libsimple_epvallocz () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_valloc.3 b/man/libsimple_valloc.3 new file mode 100644 index 0000000..e89546f --- /dev/null +++ b/man/libsimple_valloc.3 @@ -0,0 +1,168 @@ +.TH LIBSIMPLE_VALLOC 3 2018-11-03 libsimple +.SH NAME +libsimple_valloc \- allocate memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_valloc(size_t \fIn\fP); +static inline void *libsimple_envalloc(int \fIstatus\fP, size_t \fIn\fP); +static inline void *libsimple_evalloc(size_t \fIn\fP); + +#ifndef valloc +# define valloc libsimple_valloc +#endif +#ifndef envalloc +# define envalloc libsimple_envalloc +#endif +#ifndef evalloc +# define evalloc libsimple_evalloc +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_valloc (), +.BR libsimple_envalloc (), +and +.BR libsimple_evalloc () +functions allocate +.I n +uninitialised bytes to the heap and return a +pointer with an alignment of the page size +to the allocated memory. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_envalloc () +and +.BR libsimple_evalloc () +functions will terminate the process if the memory +cannot be allocated of if the user tries to allocate +0 bytes, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_envalloc () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_evalloc () +function is used. +.PP +The +.BR libsimple_envalloc () +and +.BR libsimple_evalloc () +functions behaviour is unspecified if +.I n +is 0. +.SH RETURN VALUE +The +.BR libsimple_valloc (), +.BR libsimple_envalloc (), +and +.BR libsimple_evalloc () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_valloc () +function return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envalloc () +and +.BR libsimple_evalloc () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_valloc () +function will fail if: +.TP +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_envalloc () +and +.BR libsimple_evalloc () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_valloc (), +.br +.BR libsimple_envalloc (), +.br +.BR libsimple_evalloc () +T} Thread safety MT-Safe env +T{ +.BR libsimple_valloc (), +.br +.BR libsimple_envalloc (), +.br +.BR libsimple_evalloc () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_valloc (), +.br +.BR libsimple_envalloc (), +.br +.BR libsimple_evalloc () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_vallocz.3 b/man/libsimple_vallocz.3 new file mode 100644 index 0000000..221d79b --- /dev/null +++ b/man/libsimple_vallocz.3 @@ -0,0 +1,171 @@ +.TH LIBSIMPLE_VALLOCZ 3 2018-11-03 libsimple +.SH NAME +libsimple_vallocz \- allocate optionally initialised memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vallocz(int \fIclear\fP, size_t \fIn\fP); +static inline void *libsimple_envallocz(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP); +static inline void *libsimple_evallocz(int \fIclear\fP, size_t \fIn\fP); + +#ifndef vallocz +# define vallocz libsimple_vallocz +#endif +#ifndef envallocz +# define envallocz libsimple_envallocz +#endif +#ifndef evallocz +# define evallocz libsimple_evallocz +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_vallocz (), +.BR libsimple_envallocz (), +and +.BR libsimple_evallocz () +functions allocate +.I n +bytes to the heap and return a pointer with an +alignment of the page size +to the allocated memory. The memory will be +initialised with zeroes if +.I clear +is a non-zero value. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_envallocz () +and +.BR libsimple_evallocz () +functions will terminate the process if the memory +cannot be allocated of if the user tries to allocate +0 bytes, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_envallocz () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_evallocz () +function is used. +.PP +The +.BR libsimple_envallocz () +and +.BR libsimple_evallocz () +functions behaviour is unspecified if +.I n +is 0. +.SH RETURN VALUE +The +.BR libsimple_vallocz (), +.BR libsimple_envallocz (), +and +.BR libsimple_evallocz () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vallocz () +function return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envallocz () +and +.BR libsimple_evallocz () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vallocz () +function will fail if: +.TP +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_envallocz () +and +.BR libsimple_evallocz () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vallocz (), +.br +.BR libsimple_envallocz (), +.br +.BR libsimple_evallocz () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vallocz (), +.br +.BR libsimple_envallocz (), +.br +.BR libsimple_evallocz () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vallocz (), +.br +.BR libsimple_envallocz (), +.br +.BR libsimple_evallocz () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_vcallocn.3 b/man/libsimple_vcallocn.3 new file mode 100644 index 0000000..5deb7e5 --- /dev/null +++ b/man/libsimple_vcallocn.3 @@ -0,0 +1,228 @@ +.TH LIBSIMPLE_VCALLOCN 3 2018-11-03 libsimple +.SH NAME +libsimple_vcallocn \- allocate memory +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vcallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_envcallocn(int \fIstatus\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evcallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_callocn(size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_encallocn(int \fIstatus\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_ecallocn(size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vcallocn +# define vcallocn libsimple_vcallocn +#endif +#ifndef envcallocn +# define envcallocn libsimple_envcallocn +#endif +#ifndef evcallocn +# define evcallocn libsimple_evcallocn +#endif +#ifndef callocn +# define callocn libsimple_callocn +#endif +#ifndef encallocn +# define encallocn libsimple_encallocn +#endif +#ifndef ecallocn +# define ecallocn libsimple_ecallocn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_callocn (), +.BR libsimple_encallocn (), +and +.BR libsimple_ecallocn () +functions are wrappers for the +.BR calloc (3) +function, they allocate +.I N +zero-initialised bytes to the heap and return a +pointer with an alignment of +.I alignof(max_align_t) +to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_encallocn () +and +.BR libsimple_ecallocn () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_encallocn () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_ecallocn () +function is used. +.PP +The +.BR libsimple_vcallocn (), +.BR libsimple_envcallocn (), +and +.BR libsimple_evcallocn () +functions are versions of the +.BR libsimple_callocn (), +.BR libsimple_encallocn (), +and +.BR libsimple_ecallocn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vcallocn (), +.BR libsimple_envcallocn (), +.BR libsimple_evcallocn (), +.BR libsimple_callocn (), +.BR libsimple_encallocn (), +and +.BR libsimple_ecallocn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vcallocn () +and +.BR libsimple_callocn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envcallocn (), +.BR libsimple_evcallocn (), +.BR libsimple_encallocn (), +and +.BR libsimple_ecallocn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vcallocn (), +.BR libsimple_callocn () +function will fail for the reasons specified for the +.BR calloc (3) +function, and if: +.TP +.B EINVAL +.I n +is 0. +.PP +The +.BR libsimple_envcallocn (), +.BR libsimple_evcallocn (), +.BR libsimple_encallocn (), +and +.BR libsimple_ecallocn () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vcallocn (), +.br +.BR libsimple_envcallocn (), +.br +.BR libsimple_evcallocn (), +.br +.BR libsimple_callocn (), +.br +.BR libsimple_encallocn (), +.br +.BR libsimple_ecallocn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vcallocn (), +.br +.BR libsimple_envcallocn (), +.br +.BR libsimple_evcallocn (), +.br +.BR libsimple_callocn (), +.br +.BR libsimple_encallocn (), +.br +.BR libsimple_ecallocn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vcallocn (), +.br +.BR libsimple_envcallocn (), +.br +.BR libsimple_evcallocn (), +.br +.BR libsimple_callocn (), +.br +.BR libsimple_encallocn (), +.br +.BR libsimple_ecallocn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3), +.BR calloc (3) diff --git a/man/libsimple_vmallocn.3 b/man/libsimple_vmallocn.3 new file mode 100644 index 0000000..5ed3b0c --- /dev/null +++ b/man/libsimple_vmallocn.3 @@ -0,0 +1,228 @@ +.TH LIBSIMPLE_VMALLOCN 3 2018-11-03 libsimple +.SH NAME +libsimple_vmallocn \- allocate memory +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vmallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_envmallocn(int \fIstatus\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evmallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_mallocn(size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_enmallocn(int \fIstatus\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_emallocn(size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vmallocn +# define vmallocn libsimple_vmallocn +#endif +#ifndef envmallocn +# define envmallocn libsimple_envmallocn +#endif +#ifndef evmallocn +# define evmallocn libsimple_evmallocn +#endif +#ifndef mallocn +# define mallocn libsimple_mallocn +#endif +#ifndef enmallocn +# define enmallocn libsimple_enmallocn +#endif +#ifndef emallocn +# define emallocn libsimple_emallocn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_mallocn (), +.BR libsimple_enmallocn (), +and +.BR libsimple_emallocn () +functions are wrappers for the +.BR malloc (3) +function, they allocate +.I N +uninitialised bytes to the heap and return a +pointer with an alignment of +.I alignof(max_align_t) +to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enmallocn () +and +.BR libsimple_emallocn () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enmallocn () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_emallocn () +function is used. +.PP +The +.BR libsimple_vmallocn (), +.BR libsimple_envmallocn (), +and +.BR libsimple_evmallocn () +functions are versions of the +.BR libsimple_mallocn (), +.BR libsimple_enmallocn (), +and +.BR libsimple_emallocn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vmallocn (), +.BR libsimple_envmallocn (), +.BR libsimple_evmallocn (), +.BR libsimple_mallocn (), +.BR libsimple_enmallocn (), +and +.BR libsimple_emallocn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vmallocn () +and +.BR libsimple_mallocn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envmallocn (), +.BR libsimple_evmallocn (), +.BR libsimple_enmallocn (), +and +.BR libsimple_emallocn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vmallocn (), +.BR libsimple_mallocn () +function will fail for the reasons specified for the +.BR malloc (3) +function, and if: +.TP +.B EINVAL +.I n +is 0. +.PP +The +.BR libsimple_envmallocn (), +.BR libsimple_evmallocn (), +.BR libsimple_enmallocn (), +and +.BR libsimple_emallocn () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vmallocn (), +.br +.BR libsimple_envmallocn (), +.br +.BR libsimple_evmallocn (), +.br +.BR libsimple_mallocn (), +.br +.BR libsimple_enmallocn (), +.br +.BR libsimple_emallocn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vmallocn (), +.br +.BR libsimple_envmallocn (), +.br +.BR libsimple_evmallocn (), +.br +.BR libsimple_mallocn (), +.br +.BR libsimple_enmallocn (), +.br +.BR libsimple_emallocn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vmallocn (), +.br +.BR libsimple_envmallocn (), +.br +.BR libsimple_evmallocn (), +.br +.BR libsimple_mallocn (), +.br +.BR libsimple_enmallocn (), +.br +.BR libsimple_emallocn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3), +.BR malloc (3) diff --git a/man/libsimple_vmalloczn.3 b/man/libsimple_vmalloczn.3 new file mode 100644 index 0000000..ae0f309 --- /dev/null +++ b/man/libsimple_vmalloczn.3 @@ -0,0 +1,236 @@ +.TH LIBSIMPLE_VMALLOCZN 3 2018-11-03 libsimple +.SH NAME +libsimple_vmalloczn \- allocate optionally initialised memory +.SH SYNOPSIS +.nf +#include <libsimple.h> + +void *libsimple_vmalloczn(int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +void *libsimple_envmalloczn(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evmalloczn(int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_malloczn(int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_enmalloczn(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_emalloczn(int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vmalloczn +# define vmalloczn libsimple_vmalloczn +#endif +#ifndef envmalloczn +# define envmalloczn libsimple_envmalloczn +#endif +#ifndef evmalloczn +# define evmalloczn libsimple_evmalloczn +#endif +#ifndef malloczn +# define malloczn libsimple_malloczn +#endif +#ifndef enmalloczn +# define enmalloczn libsimple_enmalloczn +#endif +#ifndef emalloczn +# define emalloczn libsimple_emalloczn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_malloczn (), +.BR libsimple_enmalloczn (), +and +.BR libsimple_emalloczn () +functions are wrappers for the +.BR malloc (3) +and +.BR calloc (3) +functions, they allocate +.I N +bytes to the heap and return a pointer with an +alignment of +.I alignof(max_align_t) +to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The memory will be initialised +with zeroes if +.I clear +is a non-zero value. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enmallocz () +and +.BR libsimple_emallocz () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enmallocz () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_emallocz () +function is used. +.PP +The +.BR libsimple_vmalloczn (), +.BR libsimple_envmalloczn (), +and +.BR libsimple_evmalloczn () +functions are versions of the +.BR libsimple_malloczn (), +.BR libsimple_enmalloczn (), +and +.BR libsimple_emalloczn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vmalloczn (), +.BR libsimple_envmalloczn (), +.BR libsimple_evmalloczn (), +.BR libsimple_malloczn (), +.BR libsimple_enmalloczn (), +and +.BR libsimple_emalloczn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vmalloczn () +and +.BR libsimple_malloczn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envmalloczn (), +.BR libsimple_evmalloczn (), +.BR libsimple_enmalloczn (), +and +.BR libsimple_emalloczn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vmalloczn (), +.BR libsimple_malloczn () +function will fail for the reasons specified for the +.BR malloc (3) +and +.BR calloc (3) +functions, and if: +.TP +.B EINVAL +.I n +is 0. +.PP +The +.BR libsimple_envmallocz (), +.BR libsimple_evmallocz (), +.BR libsimple_enmallocz (), +and +.BR libsimple_emallocz () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vmalloczn (), +.br +.BR libsimple_envmalloczn (), +.br +.BR libsimple_evmalloczn (), +.br +.BR libsimple_malloczn (), +.br +.BR libsimple_enmalloczn (), +.br +.BR libsimple_emalloczn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vmalloczn (), +.br +.BR libsimple_envmalloczn (), +.br +.BR libsimple_evmalloczn (), +.br +.BR libsimple_malloczn (), +.br +.BR libsimple_enmalloczn (), +.br +.BR libsimple_emalloczn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vmalloczn (), +.br +.BR libsimple_envmalloczn (), +.br +.BR libsimple_evmalloczn (), +.br +.BR libsimple_malloczn (), +.br +.BR libsimple_enmalloczn (), +.br +.BR libsimple_emalloczn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3), +.BR malloc (3), +.BR calloc (3) diff --git a/man/libsimple_vpvallocn.3 b/man/libsimple_vpvallocn.3 new file mode 100644 index 0000000..95aee66 --- /dev/null +++ b/man/libsimple_vpvallocn.3 @@ -0,0 +1,225 @@ +.TH LIBSIMPLE_VPVALLOCN 3 2018-11-03 libsimple +.SH NAME +libsimple_vpvallocn \- allocate memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vpvallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_envpvallocn(int \fIstatus\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evpvallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_pvallocn(size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_enpvallocn(int \fIstatus\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_epvallocn(size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vpvallocn +# define vpvallocn libsimple_vpvallocn +#endif +#ifndef envpvallocn +# define envpvallocn libsimple_envpvallocn +#endif +#ifndef evpvallocn +# define evpvallocn libsimple_evpvallocn +#endif +#ifndef pvallocn +# define pvallocn libsimple_pvallocn +#endif +#ifndef enpvallocn +# define enpvallocn libsimple_enpvallocn +#endif +#ifndef epvallocn +# define epvallocn libsimple_epvallocn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_pvallocn (), +.BR libsimple_enpvallocn (), +and +.BR libsimple_epvallocn () +functions allocate +.I N +uninitialised bytes, rounded up to the next multiple +of the page size, to the heap and return a +pointer with an alignment of the page size +to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enpvallocn () +and +.BR libsimple_epvallocn () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enpvallocn () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_epvallocn () +function is used. +.PP +The +.BR libsimple_vpvallocn (), +.BR libsimple_envpvallocn (), +and +.BR libsimple_evpvallocn () +functions are versions of the +.BR libsimple_pvallocn (), +.BR libsimple_enpvallocn (), +and +.BR libsimple_epvallocn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vpvallocn (), +.BR libsimple_envpvallocn (), +.BR libsimple_evpvallocn (), +.BR libsimple_pvallocn (), +.BR libsimple_enpvallocn (), +and +.BR libsimple_epvallocn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vpvallocn () +and +.BR libsimple_pvallocn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envpvallocn (), +.BR libsimple_evpvallocn (), +.BR libsimple_enpvallocn (), +and +.BR libsimple_epvallocn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vpvallocn (), +.BR libsimple_pvallocn () +function will fail if: +.TP +.B EINVAL +.I n +is 0. +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_envpvallocn (), +.BR libsimple_evpvallocn (), +.BR libsimple_enpvallocn (), +and +.BR libsimple_epvallocn () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vpvallocn (), +.br +.BR libsimple_envpvallocn (), +.br +.BR libsimple_evpvallocn (), +.br +.BR libsimple_pvallocn (), +.br +.BR libsimple_enpvallocn (), +.br +.BR libsimple_epvallocn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vpvallocn (), +.br +.BR libsimple_envpvallocn (), +.br +.BR libsimple_evpvallocn (), +.br +.BR libsimple_pvallocn (), +.br +.BR libsimple_enpvallocn (), +.br +.BR libsimple_epvallocn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vpvallocn (), +.br +.BR libsimple_envpvallocn (), +.br +.BR libsimple_evpvallocn (), +.br +.BR libsimple_pvallocn (), +.br +.BR libsimple_enpvallocn (), +.br +.BR libsimple_epvallocn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_vpvalloczn.3 b/man/libsimple_vpvalloczn.3 new file mode 100644 index 0000000..ca2479b --- /dev/null +++ b/man/libsimple_vpvalloczn.3 @@ -0,0 +1,228 @@ +.TH LIBSIMPLE_VPVALLOCZN 3 2018-11-03 libsimple +.SH NAME +libsimple_vpvalloczn \- allocate optionally initialised memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vpvalloczn(int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_envpvalloczn(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evpvalloczn(int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_pvalloczn(int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_enpvalloczn(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_epvalloczn(int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vpvalloczn +# define vpvalloczn libsimple_vpvalloczn +#endif +#ifndef envpvalloczn +# define envpvalloczn libsimple_envpvalloczn +#endif +#ifndef evpvalloczn +# define evpvalloczn libsimple_evpvalloczn +#endif +#ifndef pvalloczn +# define pvalloczn libsimple_pvalloczn +#endif +#ifndef enpvalloczn +# define enpvalloczn libsimple_enpvalloczn +#endif +#ifndef epvalloczn +# define epvalloczn libsimple_epvalloczn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_pvalloczn (), +.BR libsimple_enpvalloczn (), +and +.BR libsimple_epvalloczn () +functions allocate +.I N +bytes, rounded up to the next multiple of the page size, +to the heap and return a pointer with an alignment of +the page size to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The memory will be initialised +with zeroes if +.I clear +is a non-zero value. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_enpvallocz () +and +.BR libsimple_epvallocz () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_enpvallocz () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_epvallocz () +function is used. +.PP +The +.BR libsimple_vpvalloczn (), +.BR libsimple_envpvalloczn (), +and +.BR libsimple_evpvalloczn () +functions are versions of the +.BR libsimple_pvalloczn (), +.BR libsimple_enpvalloczn (), +and +.BR libsimple_epvalloczn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vpvalloczn (), +.BR libsimple_envpvalloczn (), +.BR libsimple_evpvalloczn (), +.BR libsimple_pvalloczn (), +.BR libsimple_enpvalloczn (), +and +.BR libsimple_epvalloczn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vpvalloczn () +and +.BR libsimple_pvalloczn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envpvalloczn (), +.BR libsimple_evpvalloczn (), +.BR libsimple_enpvalloczn (), +and +.BR libsimple_epvalloczn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vpvalloczn (), +.BR libsimple_pvalloczn () +function will fail if: +.TP +.B EINVAL +.I n +is 0. +.TP +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_envpvallocz (), +.BR libsimple_evpvallocz (), +.BR libsimple_enpvallocz (), +and +.BR libsimple_epvallocz () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vpvalloczn (), +.br +.BR libsimple_envpvalloczn (), +.br +.BR libsimple_evpvalloczn (), +.br +.BR libsimple_pvalloczn (), +.br +.BR libsimple_enpvalloczn (), +.br +.BR libsimple_epvalloczn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vpvalloczn (), +.br +.BR libsimple_envpvalloczn (), +.br +.BR libsimple_evpvalloczn (), +.br +.BR libsimple_pvalloczn (), +.br +.BR libsimple_enpvalloczn (), +.br +.BR libsimple_epvalloczn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vpvalloczn (), +.br +.BR libsimple_envpvalloczn (), +.br +.BR libsimple_evpvalloczn (), +.br +.BR libsimple_pvalloczn (), +.br +.BR libsimple_enpvalloczn (), +.br +.BR libsimple_epvalloczn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_vvallocn.3 b/man/libsimple_vvallocn.3 new file mode 100644 index 0000000..cd22673 --- /dev/null +++ b/man/libsimple_vvallocn.3 @@ -0,0 +1,224 @@ +.TH LIBSIMPLE_VVALLOCN 3 2018-11-03 libsimple +.SH NAME +libsimple_vvallocn \- allocate memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vvallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_envvallocn(int \fIstatus\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evvallocn(size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_vallocn(size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_envallocn(int \fIstatus\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_evallocn(size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vvallocn +# define vvallocn libsimple_vvallocn +#endif +#ifndef envvallocn +# define envvallocn libsimple_envvallocn +#endif +#ifndef evvallocn +# define evvallocn libsimple_evvallocn +#endif +#ifndef vallocn +# define vallocn libsimple_vallocn +#endif +#ifndef envallocn +# define envallocn libsimple_envallocn +#endif +#ifndef evallocn +# define evallocn libsimple_evallocn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_vallocn (), +.BR libsimple_envallocn (), +and +.BR libsimple_evallocn () +functions allocate +.I N +uninitialised bytes to the heap and return a +pointer with an alignment of the page size +to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_envallocn () +and +.BR libsimple_evallocn () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_envallocn () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_evallocn () +function is used. +.PP +The +.BR libsimple_vvallocn (), +.BR libsimple_envvallocn (), +and +.BR libsimple_evvallocn () +functions are versions of the +.BR libsimple_vallocn (), +.BR libsimple_envallocn (), +and +.BR libsimple_evallocn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vvallocn (), +.BR libsimple_envvallocn (), +.BR libsimple_evvallocn (), +.BR libsimple_vallocn (), +.BR libsimple_envallocn (), +and +.BR libsimple_evallocn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vvallocn () +and +.BR libsimple_vallocn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envvallocn (), +.BR libsimple_evvallocn (), +.BR libsimple_envallocn (), +and +.BR libsimple_evallocn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vvallocn (), +.BR libsimple_vallocn () +function will fail if: +.TP +.B EINVAL +.I n +is 0. +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_envvallocn (), +.BR libsimple_evvallocn (), +.BR libsimple_envallocn (), +and +.BR libsimple_evallocn () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vvallocn (), +.br +.BR libsimple_envvallocn (), +.br +.BR libsimple_evvallocn (), +.br +.BR libsimple_vallocn (), +.br +.BR libsimple_envallocn (), +.br +.BR libsimple_evallocn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vvallocn (), +.br +.BR libsimple_envvallocn (), +.br +.BR libsimple_evvallocn (), +.br +.BR libsimple_vallocn (), +.br +.BR libsimple_envallocn (), +.br +.BR libsimple_evallocn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vvallocn (), +.br +.BR libsimple_envvallocn (), +.br +.BR libsimple_evvallocn (), +.br +.BR libsimple_vallocn (), +.br +.BR libsimple_envallocn (), +.br +.BR libsimple_evallocn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvalloczn (3) diff --git a/man/libsimple_vvalloczn.3 b/man/libsimple_vvalloczn.3 new file mode 100644 index 0000000..916003e --- /dev/null +++ b/man/libsimple_vvalloczn.3 @@ -0,0 +1,228 @@ +.TH LIBSIMPLE_VVALLOCZN 3 2018-11-03 libsimple +.SH NAME +libsimple_vvalloczn \- allocate optionally initialised memory with page size alignment +.SH SYNOPSIS +.nf +#include <libsimple.h> + +static inline void *libsimple_vvalloczn(int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_envvalloczn(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_evvalloczn(int \fIclear\fP, size_t \fIn\fP, va_list \fIap\fP); +static inline void *libsimple_valloczn(int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_envalloczn(int \fIstatus\fP, int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); +static inline void *libsimple_evalloczn(int \fIclear\fP, size_t \fIn\fP, ..., /* (size_t)0 */); + +#ifndef vvalloczn +# define vvalloczn libsimple_vvalloczn +#endif +#ifndef envvalloczn +# define envvalloczn libsimple_envvalloczn +#endif +#ifndef evvalloczn +# define evvalloczn libsimple_evvalloczn +#endif +#ifndef valloczn +# define valloczn libsimple_valloczn +#endif +#ifndef envalloczn +# define envalloczn libsimple_envalloczn +#endif +#ifndef evalloczn +# define evalloczn libsimple_evalloczn +#endif +.fi +.PP +Link with +.IR \-lsimple . +.SH DESCRIPTION +The +.BR libsimple_valloczn (), +.BR libsimple_envalloczn (), +and +.BR libsimple_evalloczn () +functions allocate +.I N +bytes to the heap and return a pointer with an +alignment of the page size +to the allocated memory, where +.I N +is the product of +.I n +and all following arguments (which should have the type +.BR size_t ) +up to the first 0; +.I n +must not be 0. The memory will be initialised +with zeroes if +.I clear +is a non-zero value. The function +.BR free (3) +shall be called with the returned pointer as +input when the allocated memory is no longer needed. +.PP +The +.BR libsimple_envallocz () +and +.BR libsimple_evallocz () +functions will terminate the process if the memory +cannot be allocated, by calling the +.BR libsimple_enprintf () +and +.BR libsimple_eprintf () +functions, respectively. +On failure, the process's exit value will be +.I status +if the +.BR libsimple_envallocz () +function is used or +.IR libsimple_default_failure_exit (3) +if the +.BR libsimple_evallocz () +function is used. +.PP +The +.BR libsimple_vvalloczn (), +.BR libsimple_envvalloczn (), +and +.BR libsimple_evvalloczn () +functions are versions of the +.BR libsimple_valloczn (), +.BR libsimple_envalloczn (), +and +.BR libsimple_evalloczn (), +respectively, that use +.B va_list +instead of variadic arguments. +.SH RETURN VALUE +The +.BR libsimple_vvalloczn (), +.BR libsimple_envvalloczn (), +.BR libsimple_evvalloczn (), +.BR libsimple_valloczn (), +.BR libsimple_envalloczn (), +and +.BR libsimple_evalloczn () +functions return a pointer to the allocated memory +upon success completion; otherwise the +.BR libsimple_vvalloczn () +and +.BR libsimple_valloczn () +functions return +.B NULL +and set +.I errno +it indicate the error, and the +.BR libsimple_envvalloczn (), +.BR libsimple_evvalloczn (), +.BR libsimple_envalloczn (), +and +.BR libsimple_evalloczn () +functions terminated the process. +.SH ERRORS +The +.BR libsimple_vvalloczn (), +.BR libsimple_valloczn () +function will fail if: +.TP +.B EINVAL +.I n +is 0. +.TP +.B ENOMEM +Enough memory could not be allocated. +.PP +The +.BR libsimple_envvallocz (), +.BR libsimple_evvallocz (), +.BR libsimple_envallocz (), +and +.BR libsimple_evallocz () +functions will terminate the process on failure. +.SH ATTRIBUTES +For an explanation of the terms used in this section, see +.BR attributes (7). +.TS +allbox; +lb lb lb +l l l. +Interface Attribute Value +T{ +.BR libsimple_vvalloczn (), +.br +.BR libsimple_envvalloczn (), +.br +.BR libsimple_evvalloczn (), +.br +.BR libsimple_valloczn (), +.br +.BR libsimple_envalloczn (), +.br +.BR libsimple_evalloczn () +T} Thread safety MT-Safe env +T{ +.BR libsimple_vvalloczn (), +.br +.BR libsimple_envvalloczn (), +.br +.BR libsimple_evvalloczn (), +.br +.BR libsimple_valloczn (), +.br +.BR libsimple_envalloczn (), +.br +.BR libsimple_evalloczn () +T} Async-signal safety AS-Safe +T{ +.BR libsimple_vvalloczn (), +.br +.BR libsimple_envvalloczn (), +.br +.BR libsimple_evvalloczn (), +.br +.BR libsimple_valloczn (), +.br +.BR libsimple_envalloczn (), +.br +.BR libsimple_evalloczn () +T} Async-cancel safety AC-Safe +.TE +.SH EXAMPLES +None. +.SH APPLICATION USAGE +None. +.SH RATIONALE +None. +.SH FUTURE DIRECTIONS +None. +.SH NOTES +None, +.SH BUGS +None. +.SH SEE ALSO +.BR libsimple_enmalloc (3), +.BR libsimple_mallocz (3), +.BR libsimple_vmallocn (3), +.BR libsimple_vmalloczn (3), +.BR libsimple_encalloc (3), +.BR libsimple_vcallocn (3), +.BR libsimple_enrealloc (3), +.BR libsimple_vreallocn (3), +.BR libsimple_vmemalignn (3), +.BR libsimple_vmemalignzn (3), +.BR libsimple_enmemalign (3), +.BR libsimple_memalignz (3), +.BR libsimple_enposix_memalign (3), +.BR libsimple_posix_memalignz (3), +.BR libsimple_vposix_memalignn (3), +.BR libsimple_vposix_memalignzn (3), +.BR libsimple_enaligned_alloc (3), +.BR libsimple_aligned_allocz (3), +.BR libsimple_valigned_allocn (3), +.BR libsimple_valigned_alloczn (3), +.BR libsimple_pvalloc (3), +.BR libsimple_pvallocz (3), +.BR libsimple_vpvallocn (3), +.BR libsimple_vpvalloczn (3), +.BR libsimple_valloc (3), +.BR libsimple_vallocz (3), +.BR libsimple_vvallocn (3) |