summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rwxr-xr-xconfigure1
-rw-r--r--doc/libstddjb/djbunix.html6
-rw-r--r--doc/upgrade.html3
-rw-r--r--package/deps.mak5
-rw-r--r--src/include/skalibs/bytestr.h1
-rw-r--r--src/include/skalibs/djbunix.h1
-rw-r--r--src/libstddjb/byte_zzero.c35
-rw-r--r--src/libstddjb/openb_read.c10
-rw-r--r--src/sysdeps/tryexplicit_bzero.c30
10 files changed, 89 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index c8832b9..05bfb32 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ In 2.6.4.0
----------
- Bugfixes.
- - New function: execvep_loose()
+ - New functions: execvep_loose(), byte_zzero(), openb_read()
In 2.6.3.1
diff --git a/configure b/configure
index d6213c4..f785a63 100755
--- a/configure
+++ b/configure
@@ -541,6 +541,7 @@ EOF
choose cl itimer ITIMER 'setitimer()'
choose cl namespaces NAMESPACES 'namespaces'
choose cl nsgetparent NSGETPARENT 'NS_GET_PARENT'
+ choose cl explicit_bzero EXPLICIT_BZERO 'explicit_bzero()'
echo '#endif' >> $sysdeps/sysdeps.h
fi
diff --git a/doc/libstddjb/djbunix.html b/doc/libstddjb/djbunix.html
index 05515aa..1507bcd 100644
--- a/doc/libstddjb/djbunix.html
+++ b/doc/libstddjb/djbunix.html
@@ -261,6 +261,12 @@ Returns a valid fd number if it succeeds, or -1 (and sets errno) if it fails.
</p>
<p>
+<code> int openb_read (char const *file) </code> <br />
+Opens <em>file</em> in read-only, blocking mode.
+Returns a valid fd number if it succeeds, or -1 (and sets errno) if it fails.
+</p>
+
+<p>
<code> int open_readb (char const *file) </code> <br />
Opens <em>file</em> in read-only, blocking mode.
Returns a valid fd number if it succeeds, or -1 (and sets errno) if it fails.
diff --git a/doc/upgrade.html b/doc/upgrade.html
index 7f95df7..18a8656 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -19,7 +19,8 @@
<h2> in 2.6.4.0 </h2>
<ul>
- <li> New function: <a href="libstddjb/djbunix.html">execvep_loose()</a>. </li>
+ <li> New functions: <a href="libstddjb/djbunix.html">execvep_loose()</a>,
+<tt>byte_zzero()</tt> </li>
</ul>
<h2> in 2.6.3.1 </h2>
diff --git a/package/deps.mak b/package/deps.mak
index ea62f01..7c8e154 100644
--- a/package/deps.mak
+++ b/package/deps.mak
@@ -22,7 +22,6 @@ src/include/skalibs/djbunix.h: src/include/skalibs/env.h src/include/skalibs/env
src/include/skalibs/env.h: src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h
src/include/skalibs/envalloc.h: src/include/skalibs/genalloc.h
src/include/skalibs/environ.h: src/include/skalibs/posixplz.h
-src/include/skalibs/error.h: src/include/skalibs/gccattributes.h
src/include/skalibs/fmtscan.h: src/include/skalibs/gccattributes.h
src/include/skalibs/genalloc.h: src/include/skalibs/functypes.h src/include/skalibs/stralloc.h
src/include/skalibs/genqdyn.h: src/include/skalibs/stralloc.h
@@ -31,7 +30,6 @@ src/include/skalibs/gensetdyn.h: src/include/skalibs/functypes.h src/include/ska
src/include/skalibs/getpeereid.h: src/include/skalibs/posixplz.h
src/include/skalibs/iobuffer.h: src/include/skalibs/buffer.h src/include/skalibs/djbunix.h
src/include/skalibs/iopause.h: src/include/skalibs/tai.h
-src/include/skalibs/ip46.h: src/include/skalibs/fmtscan.h src/include/skalibs/socket.h
src/include/skalibs/kolbak.h: src/include/skalibs/unixmessage.h
src/include/skalibs/lolstdio.h: src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/strerr2.h
src/include/skalibs/mininetstring.h: src/include/skalibs/stralloc.h
@@ -53,7 +51,6 @@ src/include/skalibs/strerr2.h: src/include/skalibs/strerr.h
src/include/skalibs/tai.h: src/include/skalibs/gccattributes.h src/include/skalibs/uint64.h
src/include/skalibs/textclient.h: src/include/skalibs/allreadwrite.h src/include/skalibs/tai.h src/include/skalibs/textmessage.h
src/include/skalibs/textmessage.h: src/include/skalibs/allreadwrite.h src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/gccattributes.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h
-src/include/skalibs/types.h: src/include/skalibs/uint16.h src/include/skalibs/uint32.h src/include/skalibs/uint64.h
src/include/skalibs/unix-timed.h: src/include/skalibs/bufalloc.h src/include/skalibs/buffer.h src/include/skalibs/functypes.h src/include/skalibs/stralloc.h src/include/skalibs/tai.h
src/include/skalibs/unix-transactional.h: src/include/skalibs/stralloc.h src/include/skalibs/uint64.h
src/include/skalibs/unixconnection.h: src/include/skalibs/unixmessage.h
@@ -248,6 +245,7 @@ src/libstddjb/byte_count.o src/libstddjb/byte_count.lo: src/libstddjb/byte_count
src/libstddjb/byte_in.o src/libstddjb/byte_in.lo: src/libstddjb/byte_in.c src/include/skalibs/bytestr.h
src/libstddjb/byte_rchr.o src/libstddjb/byte_rchr.lo: src/libstddjb/byte_rchr.c src/include/skalibs/bytestr.h
src/libstddjb/byte_search.o src/libstddjb/byte_search.lo: src/libstddjb/byte_search.c src/include/skalibs/bytestr.h src/include/skalibs/posixplz.h
+src/libstddjb/byte_zzero.o src/libstddjb/byte_zzero.lo: src/libstddjb/byte_zzero.c src/include/skalibs/bytestr.h src/include/skalibs/gccattributes.h src/include/skalibs/nonposix.h src/include/skalibs/sysdeps.h
src/libstddjb/case_lowerb.o src/libstddjb/case_lowerb.lo: src/libstddjb/case_lowerb.c src/include/skalibs/bytestr.h
src/libstddjb/case_lowers.o src/libstddjb/case_lowers.lo: src/libstddjb/case_lowers.c src/include/skalibs/bytestr.h
src/libstddjb/case_startb.o src/libstddjb/case_startb.lo: src/libstddjb/case_startb.c src/include/skalibs/bytestr.h
@@ -437,6 +435,7 @@ src/libstddjb/open_read.o src/libstddjb/open_read.lo: src/libstddjb/open_read.c
src/libstddjb/open_readb.o src/libstddjb/open_readb.lo: src/libstddjb/open_readb.c src/include/skalibs/djbunix.h
src/libstddjb/open_trunc.o src/libstddjb/open_trunc.lo: src/libstddjb/open_trunc.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h
src/libstddjb/open_write.o src/libstddjb/open_write.lo: src/libstddjb/open_write.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h
+src/libstddjb/openb_read.o src/libstddjb/openb_read.lo: src/libstddjb/openb_read.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h
src/libstddjb/openreadfileclose.o src/libstddjb/openreadfileclose.lo: src/libstddjb/openreadfileclose.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h src/include/skalibs/stralloc.h
src/libstddjb/openreadnclose.o src/libstddjb/openreadnclose.lo: src/libstddjb/openreadnclose.c src/include/skalibs/allreadwrite.h src/include/skalibs/djbunix.h
src/libstddjb/openslurpclose.o src/libstddjb/openslurpclose.lo: src/libstddjb/openslurpclose.c src/include/skalibs/djbunix.h src/include/skalibs/stralloc.h
diff --git a/src/include/skalibs/bytestr.h b/src/include/skalibs/bytestr.h
index 3a5c95e..b20a34d 100644
--- a/src/include/skalibs/bytestr.h
+++ b/src/include/skalibs/bytestr.h
@@ -31,6 +31,7 @@ extern size_t byte_in (char const *, size_t, char const *, size_t) gccattr_pure
#define byte_equal(s, n, t) (!memcmp(s, (t), n))
extern size_t byte_count (char const *, size_t, char) gccattr_pure ;
extern size_t byte_search (char const *, size_t, char const *, size_t) ;
+extern void byte_zzero (char *, size_t) ;
#define str_diffb(a, n, b) strncmp(a, (b), n)
extern size_t str_chr (char const *, int) gccattr_pure ;
diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h
index 6e2adcc..d3edc97 100644
--- a/src/include/skalibs/djbunix.h
+++ b/src/include/skalibs/djbunix.h
@@ -44,6 +44,7 @@ extern void lock_unx (int) ;
extern int open2 (char const *, unsigned int) ;
extern int open3 (char const *, unsigned int, unsigned int) ;
extern int open_read (char const *) ;
+extern int openb_read (char const *) ;
extern int open_readb (char const *) ;
extern int open_excl (char const *) ;
extern int open_append (char const *) ;
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 <skalibs/sysdeps.h>
+
+#ifdef SKALIBS_HASEXPLICIT_BZERO
+
+#include <skalibs/nonposix.h>
+#include <string.h>
+#include <strings.h>
+#include <skalibs/bytestr.h>
+
+void byte_zzero (char *s, size_t n)
+{
+ explicit_bzero(s, n) ;
+}
+
+#else
+
+#include <string.h>
+#include <skalibs/gccattributes.h>
+#include <skalibs/bytestr.h>
+
+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 <skalibs/nonposix.h>
+#include <fcntl.h>
+#include <skalibs/djbunix.h>
+
+int openb_read (char const *fn)
+{
+ return open2(fn, O_RDONLY) ;
+}
diff --git a/src/sysdeps/tryexplicit_bzero.c b/src/sysdeps/tryexplicit_bzero.c
new file mode 100644
index 0000000..869c578
--- /dev/null
+++ b/src/sysdeps/tryexplicit_bzero.c
@@ -0,0 +1,30 @@
+/* ISC license. */
+
+#undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
+
+#ifndef __EXTENSIONS__
+#define __EXTENSIONS__
+#endif
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#ifndef _BSD_SOURCE
+#define _BSD_SOURCE
+#endif
+#ifndef _NETBSD_SOURCE
+#define _NETBSD_SOURCE
+#endif
+#ifndef _INCOMPLETE_XOPEN_C063
+#define _INCOMPLETE_XOPEN_C063
+#endif
+
+#include <string.h>
+#include <strings.h>
+
+int main (void)
+{
+ char blah[4] ;
+ explicit_bzero(blah, 4) ;
+ return 0 ;
+}