From 4684272897e351ed21f82a0ef84bc94194b4d538 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 1 Mar 2018 12:51:30 +0000 Subject: Add byte_zzero, openb_read --- src/libstddjb/byte_zzero.c | 35 +++++++++++++++++++++++++++++++++++ src/libstddjb/openb_read.c | 10 ++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/libstddjb/byte_zzero.c create mode 100644 src/libstddjb/openb_read.c (limited to 'src/libstddjb') diff --git a/src/libstddjb/byte_zzero.c b/src/libstddjb/byte_zzero.c new file mode 100644 index 0000000..99a5e3a --- /dev/null +++ b/src/libstddjb/byte_zzero.c @@ -0,0 +1,35 @@ +/* ISC license. */ + +#include + +#ifdef SKALIBS_HASEXPLICIT_BZERO + +#include +#include +#include +#include + +void byte_zzero (char *s, size_t n) +{ + explicit_bzero(s, n) ; +} + +#else + +#include +#include +#include + +void _byte_zzero_hook (char *, size_t) gccattr_weak ; + +gccattr_weak void _byte_zzero_hook (char *s, size_t n) +{ +} + +void byte_zzero (char *s, size_t n) +{ + memset(s, 0, n) ; + _byte_zzero_hook(s, n) ; +} + +#endif diff --git a/src/libstddjb/openb_read.c b/src/libstddjb/openb_read.c new file mode 100644 index 0000000..19ec073 --- /dev/null +++ b/src/libstddjb/openb_read.c @@ -0,0 +1,10 @@ +/* ISC license. */ + +#include +#include +#include + +int openb_read (char const *fn) +{ + return open2(fn, O_RDONLY) ; +} -- cgit v1.2.3