Add explicit_bzero() in util/

This commit is contained in:
sin 2014-04-30 12:25:29 +01:00
parent 8f4c0f2a8e
commit 1920516abf
3 changed files with 22 additions and 9 deletions

View File

@ -5,15 +5,16 @@ include config.mk
HDR = arg.h config.def.h proc.h reboot.h util.h HDR = arg.h config.def.h proc.h reboot.h util.h
LIB = \ LIB = \
util/agetcwd.o \ util/agetcwd.o \
util/apathmax.o \ util/apathmax.o \
util/eprintf.o \ util/eprintf.o \
util/estrtol.o \ util/estrtol.o \
util/proc.o \ util/explicit_bzero.o \
util/putword.o \ util/proc.o \
util/recurse.o \ util/putword.o \
util/strlcat.o \ util/recurse.o \
util/strlcpy.o \ util/strlcat.o \
util/strlcpy.o \
util/tty.o util/tty.o
SRC = \ SRC = \

2
util.h
View File

@ -12,6 +12,8 @@ void devtotty(int, int *, int *);
void enprintf(int, const char *, ...); void enprintf(int, const char *, ...);
void eprintf(const char *, ...); void eprintf(const char *, ...);
long estrtol(const char *, int); long estrtol(const char *, int);
#undef explicit_bzero
void explicit_bzero(void *, size_t);
void putword(const char *); void putword(const char *);
void recurse(const char *, void (*)(const char *)); void recurse(const char *, void (*)(const char *));
#undef strlcat #undef strlcat

10
util/explicit_bzero.c Normal file
View File

@ -0,0 +1,10 @@
#include <string.h>
#include "../util.h"
static void *(*volatile explicit_memset)(void *, int, size_t) = memset;
void
explicit_bzero(void *b, size_t len)
{
(*explicit_memset)(b, 0, len);
}