mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-12-25 22:11:08 +00:00
111 lines
3 KiB
Groff
111 lines
3 KiB
Groff
.\"-
|
|
.\" Copyright (c) 2015 Universitetet i Oslo
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. The name of the author may not be used to endorse or promote
|
|
.\" products derived from this software without specific prior written
|
|
.\" permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.Dd December 15, 2015
|
|
.Dt cryb_memset_s 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm cryb_memset_s
|
|
.Nd safely fill a buffer
|
|
.Sh LIBRARY
|
|
.Lb libcryb-core
|
|
.Sh SYNOPSIS
|
|
.In cryb/memset_s.h
|
|
.Ft void *
|
|
.Fn cryb_memset_s "void *d" "size_t dsz" "int ch" "size_t n"
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Nm cryb_memset_s
|
|
function overwrites the first
|
|
.Va n
|
|
bytes of the buffer pointed to by
|
|
.Va d ,
|
|
of size
|
|
.Va dsz ,
|
|
with copies of the least-significant byte of
|
|
.Va ch .
|
|
If
|
|
.Va n
|
|
is greater than
|
|
.Va dsz ,
|
|
only
|
|
.Va dsz
|
|
bytes are overwritten, and an error is returned.
|
|
.Sh RETURN VALUES
|
|
The
|
|
.Nm
|
|
function returns zero if successful and a non-zero error code if an
|
|
error occurred.
|
|
.Sh ERRORS
|
|
.Bl -tag -width Er
|
|
.It Bq Er EINVAL
|
|
The
|
|
.Va d
|
|
argument was
|
|
.Dv NULL .
|
|
.It Bq Er ERANGE
|
|
Either or both of the
|
|
.Va dsz
|
|
and
|
|
.Va n
|
|
arguments were greater than
|
|
.Dv SIZE_MAX .
|
|
.It Bq Er EOVERFLOW
|
|
The
|
|
.Va n
|
|
argument was greater than the
|
|
.Va dsz
|
|
argument.
|
|
.El
|
|
.Sh IMPLEMENTATION NOTES
|
|
If the
|
|
.Dv HAVE_MEMSET_S
|
|
preprocessor macro is defined to 0 or undefined, the
|
|
.In cryb/memset_s.h
|
|
header provides a
|
|
.Fn memset_s
|
|
macro as an alias to
|
|
.Fn cryb_memset_s .
|
|
.Pp
|
|
The argument and return types for
|
|
.Nm
|
|
differ from those of its C11 equivalent, as it is expected to be used
|
|
in environments in which
|
|
.Vt rsize_t
|
|
and
|
|
.Dv RSIZE_MAX
|
|
are not defined.
|
|
.Sh SEE ALSO
|
|
.Xr cryb_memcpy_s 3 ,
|
|
.Xr memset 3
|
|
.Sh AUTHORS
|
|
The
|
|
.Fn cryb_memset_s
|
|
function and this manual page were written for the University of Oslo
|
|
by
|
|
.An Dag-Erling Sm\(/orgrav Aq Mt d.e.smorgrav@usit.uio.no .
|