diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2012-10-09 12:03:52 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2012-10-09 12:03:52 +0000 |
commit | dfaf60910531fbce3a46850a1fa241087fbdff2b (patch) | |
tree | 41f335c77b1c1256c7eff6a035a74307f9245d70 /sys/lib/libsa | |
parent | f4171802e8cbc5e9e0c04c1bd14906cdf3b82abf (diff) |
Provide an explicit_bzero for standalone usage.
Diffstat (limited to 'sys/lib/libsa')
-rw-r--r-- | sys/lib/libsa/explicit_bzero.c | 16 | ||||
-rw-r--r-- | sys/lib/libsa/stand.h | 12 |
2 files changed, 21 insertions, 7 deletions
diff --git a/sys/lib/libsa/explicit_bzero.c b/sys/lib/libsa/explicit_bzero.c new file mode 100644 index 00000000000..e1669203bd0 --- /dev/null +++ b/sys/lib/libsa/explicit_bzero.c @@ -0,0 +1,16 @@ +/* $OpenBSD: explicit_bzero.c,v 1.1 2012/10/09 12:03:51 jsing Exp $ */ +/* + * Public domain. + * Written by Ted Unangst + */ + +#include <lib/libsa/stand.h> + +/* + * explicit_bzero - don't let the compiler optimize away bzero + */ +void +explicit_bzero(void *p, size_t n) +{ + bzero(p, n); +} diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h index 3d6f21e56a4..a732cbc6633 100644 --- a/sys/lib/libsa/stand.h +++ b/sys/lib/libsa/stand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stand.h,v 1.52 2011/09/20 22:26:53 miod Exp $ */ +/* $OpenBSD: stand.h,v 1.53 2012/10/09 12:03:51 jsing Exp $ */ /* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */ /*- @@ -141,6 +141,7 @@ __dead void _rtt(void) __attribute__((noreturn)); #define bzero(s,n) ((void)memset((s),0,(n))) #define bcmp(s1,s2,n) (memcmp((s2),(s1),(n))) #define bcopy(s1,s2,n) ((void)memcpy((s2),(s1),(n))) +void explicit_bzero(void *, size_t); void *memcpy(void *, const void *, size_t); int memcmp(const void *, const void *, size_t); char *strncpy(char *, const char *, size_t); @@ -169,10 +170,8 @@ void nullsys(void); int null_open(char *path, struct open_file *f); int null_close(struct open_file *f); -ssize_t null_read(struct open_file *f, void *buf, - size_t size, size_t *resid); -ssize_t null_write(struct open_file *f, void *buf, - size_t size, size_t *resid); +ssize_t null_read(struct open_file *f, void *buf, size_t size, size_t *resid); +ssize_t null_write(struct open_file *f, void *buf, size_t size, size_t *resid); off_t null_seek(struct open_file *f, off_t offset, int where); int null_stat(struct open_file *f, struct stat *sb); int null_readdir(struct open_file *f, char *name); @@ -186,7 +185,7 @@ int cnischar(void); int cnspeed(dev_t, int); u_int sleep(u_int); void usleep(u_int); -char *ctime(const time_t *); +char *ctime(const time_t *); int ioctl(int, u_long, char *); @@ -204,4 +203,3 @@ off_t olseek(int, off_t, int); int devopen(struct open_file *, const char *, char **); void machdep_start(char *, int, char *, char *, char *); time_t getsecs(void); - |