man.bsd.lv manual page server

Manual Page Search Parameters

BZERO(3) Library Functions Manual BZERO(3)

bzero, explicit_bzerowrite zeroes to a byte string

library “libc”

#include <strings.h>

void
bzero(void *b, size_t len);

void
explicit_bzero(void *b, size_t len);

The () function writes len zero bytes to the string b. If len is zero, bzero() does nothing.

The () variant behaves the same, but will not be removed by a compiler's dead store optimization pass, making it useful for clearing sensitive memory such as a password.

memset(3), swab(3)

The bzero() function conforms to the X/Open System Interfaces option of the IEEE Std 1003.1-2004 (“POSIX.1”) specification. It was removed from the standard in IEEE Std 1003.1-2008 (“POSIX.1”), which recommends using memset(3) instead.

The bzero() function appeared in 4.3BSD. Its prototype existed previously in <string.h> before it was moved to <strings.h> for IEEE Std 1003.1-2001 (“POSIX.1”) compliance.

The explicit_bzero() function first appeared in OpenBSD / DragonFly 5.5.

April 11, 2019 DragonFly-5.6.1