FreeBSD Bugzilla – Attachment 198043 Details for
Bug 232185
change userland bzero, bcopy and bcmp to regular mem* builtins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
world-bfunc.diff (text/plain), 7.31 KB, created by
Mateusz Guzik
on 2018-10-11 20:26:31 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Mateusz Guzik
Created:
2018-10-11 20:26:31 UTC
Size:
7.31 KB
patch
obsolete
>diff --git a/include/strings.h b/include/strings.h >index 9df19e4ce9c..6c4c05afdc3 100644 >--- a/include/strings.h >+++ b/include/strings.h >@@ -42,8 +42,11 @@ typedef __size_t size_t; > __BEGIN_DECLS > #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 > int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ >+#define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) > void bcopy(const void *, void *, size_t); /* LEGACY */ >+#define bcopy(from, to, len) __builtin_memmove((to), (from), (len)) > void bzero(void *, size_t); /* LEGACY */ >+#define bzero(buf, len) __builtin_memset((buf), 0, (len)) > #endif > #if __BSD_VISIBLE > void explicit_bzero(void *, size_t); >diff --git a/lib/libc/amd64/string/bcopy.S b/lib/libc/amd64/string/bcopy.S >index 9446e75b805..671eb93cce1 100644 >--- a/lib/libc/amd64/string/bcopy.S >+++ b/lib/libc/amd64/string/bcopy.S >@@ -53,6 +53,7 @@ ENTRY(bcopy) > #if defined(MEMCOPY) || defined(MEMMOVE) > movq %rdi,%rax /* return dst */ > #else >+ jmp 1 > xchgq %rdi,%rsi > #endif > movq %rdx,%rcx >diff --git a/lib/libc/string/bcmp.c b/lib/libc/string/bcmp.c >index 96cd49039ee..fc75385df67 100644 >--- a/lib/libc/string/bcmp.c >+++ b/lib/libc/string/bcmp.c >@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); > * bcmp -- vax cmpc3 instruction > */ > int >-bcmp(const void *b1, const void *b2, size_t length) >+(bcmp)(const void *b1, const void *b2, size_t length) > { > char *p1, *p2; > >diff --git a/lib/libc/string/bcopy.c b/lib/libc/string/bcopy.c >index 141416d0afe..542452c3ea0 100644 >--- a/lib/libc/string/bcopy.c >+++ b/lib/libc/string/bcopy.c >@@ -68,7 +68,7 @@ memmove > #include <strings.h> > > void >-bcopy(const void *src0, void *dst0, size_t length) >+(bcopy)(const void *src0, void *dst0, size_t length) > #endif > { > char *dst = dst0; >diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c >index 7d9909a7608..15da5bd783e 100644 >--- a/lib/libc/string/memset.c >+++ b/lib/libc/string/memset.c >@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); > #define WIDEVAL 0 > > void >-bzero(void *dst0, size_t length) >+(bzero)(void *dst0, size_t length) > #else > #include <string.h> > >@@ -62,7 +62,7 @@ bzero(void *dst0, size_t length) > #define WIDEVAL c > > void * >-memset(void *dst0, int c0, size_t length) >+(memset)(void *dst0, int c0, size_t length) > #endif > { > size_t t; >diff --git a/libexec/bootpd/Makefile b/libexec/bootpd/Makefile >index 6f02477d466..ceae04b26d2 100644 >--- a/libexec/bootpd/Makefile >+++ b/libexec/bootpd/Makefile >@@ -3,7 +3,7 @@ > > PROG= bootpd > CFLAGS+= -DETC_ETHERS >-CFLAGS+= -DSYSLOG -DDEBUG -DVEND_CMU >+CFLAGS+= -DSYSLOG -DDEBUG -DVEND_CMU -DUSE_BFUNCS > > WARNS?= 2 > >diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c >index fe9cefa3de4..5ec5904019f 100644 >--- a/libexec/bootpd/bootpd.c >+++ b/libexec/bootpd/bootpd.c >@@ -79,6 +79,8 @@ __FBSDID("$FreeBSD$"); > # define bcopy(a,b,c) memcpy(b,a,c) > # define bzero(p,l) memset(p,0,l) > # define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > #include "bootp.h" >diff --git a/libexec/bootpd/bootpgw/Makefile b/libexec/bootpd/bootpgw/Makefile >index b7adadf3d51..a94c16d6ea3 100644 >--- a/libexec/bootpd/bootpgw/Makefile >+++ b/libexec/bootpd/bootpgw/Makefile >@@ -6,7 +6,7 @@ MAN= > SRCS= bootpgw.c getif.c hwaddr.c report.c rtmsg.c > > SRCDIR= ${.CURDIR}/.. >-CFLAGS+=-I${SRCDIR} >+CFLAGS+=-I${SRCDIR} -DUSE_BFUNCS > .PATH: ${SRCDIR} > > .include <bsd.prog.mk> >diff --git a/libexec/bootpd/bootpgw/bootpgw.c b/libexec/bootpd/bootpgw/bootpgw.c >index 16bb66b2d29..cf426826157 100644 >--- a/libexec/bootpd/bootpgw/bootpgw.c >+++ b/libexec/bootpd/bootpgw/bootpgw.c >@@ -72,6 +72,8 @@ __FBSDID("$FreeBSD$"); > # define bcopy(a,b,c) memcpy(b,a,c) > # define bzero(p,l) memset(p,0,l) > # define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > #include "bootp.h" >diff --git a/libexec/bootpd/dumptab.c b/libexec/bootpd/dumptab.c >index 43e94ec4cef..0c5f5664bf5 100644 >--- a/libexec/bootpd/dumptab.c >+++ b/libexec/bootpd/dumptab.c >@@ -19,6 +19,8 @@ > #define bcopy(a,b,c) memcpy(b,a,c) > #define bzero(p,l) memset(p,0,l) > #define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > #include "bootp.h" >diff --git a/libexec/bootpd/hash.c b/libexec/bootpd/hash.c >index 64f49d3b957..4479d9a67cf 100644 >--- a/libexec/bootpd/hash.c >+++ b/libexec/bootpd/hash.c >@@ -44,6 +44,8 @@ SOFTWARE. > #define bcopy(a,b,c) memcpy(b,a,c) > #define bzero(p,l) memset(p,0,l) > #define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > #include "hash.h" >diff --git a/libexec/bootpd/hwaddr.c b/libexec/bootpd/hwaddr.c >index ff996157b91..c023159c20b 100644 >--- a/libexec/bootpd/hwaddr.c >+++ b/libexec/bootpd/hwaddr.c >@@ -44,6 +44,8 @@ > #define bcopy(a,b,c) memcpy(b,a,c) > #define bzero(p,l) memset(p,0,l) > #define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > #ifndef ATF_INUSE /* Not defined on some systems (i.e. Linux) */ >diff --git a/libexec/bootpd/lookup.c b/libexec/bootpd/lookup.c >index 54b3f62242f..cd2b9444078 100644 >--- a/libexec/bootpd/lookup.c >+++ b/libexec/bootpd/lookup.c >@@ -23,6 +23,8 @@ extern int ether_hostton(); > #include <memory.h> > /* Yes, memcpy is OK here (no overlapped copies). */ > #define bcopy(a,b,c) memcpy(b,a,c) >+#else >+#include <strings.h> > #endif > > #include "bootp.h" >diff --git a/libexec/bootpd/tools/bootpef/Makefile b/libexec/bootpd/tools/bootpef/Makefile >index 9436561d4a6..5941c0a7fbd 100644 >--- a/libexec/bootpd/tools/bootpef/Makefile >+++ b/libexec/bootpd/tools/bootpef/Makefile >@@ -7,7 +7,7 @@ SRCS= bootpef.c dovend.c readfile.c hash.c dumptab.c lookup.c \ > hwaddr.c report.c tzone.c rtmsg.c > > SRCDIR= ${.CURDIR}/../.. >-CFLAGS+=-I${SRCDIR} >+CFLAGS+=-I${SRCDIR} -DUSE_BFUNCS > .PATH: ${SRCDIR} > > .include <bsd.prog.mk> >diff --git a/libexec/bootpd/tools/bootpef/bootpef.c b/libexec/bootpd/tools/bootpef/bootpef.c >index 04089c87b56..bbe1fbfb3bb 100644 >--- a/libexec/bootpd/tools/bootpef/bootpef.c >+++ b/libexec/bootpd/tools/bootpef/bootpef.c >@@ -61,6 +61,8 @@ SOFTWARE. > #define bcopy(a,b,c) memcpy(b,a,c) > #define bzero(p,l) memset(p,0,l) > #define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > #include "bootp.h" >diff --git a/libexec/bootpd/tools/bootptest/Makefile b/libexec/bootpd/tools/bootptest/Makefile >index fae5127eebb..778fecc691b 100644 >--- a/libexec/bootpd/tools/bootptest/Makefile >+++ b/libexec/bootpd/tools/bootptest/Makefile >@@ -6,7 +6,7 @@ MAN= bootptest.8 > SRCS= bootptest.c getether.c getif.c print-bootp.c report.c > > SRCDIR= ${.CURDIR}/../.. >-CFLAGS+=-I${SRCDIR} >+CFLAGS+=-I${SRCDIR} -DUSE_BFUNCS > .PATH: ${SRCDIR} > > .include <bsd.prog.mk> >diff --git a/libexec/bootpd/tools/bootptest/bootptest.h b/libexec/bootpd/tools/bootptest/bootptest.h >index 2df35dea7ff..68d5eafd143 100644 >--- a/libexec/bootpd/tools/bootptest/bootptest.h >+++ b/libexec/bootpd/tools/bootptest/bootptest.h >@@ -12,6 +12,8 @@ > #define bcopy(a,b,c) memcpy(b,a,c) > #define bzero(p,l) memset(p,0,l) > #define bcmp(a,b,c) memcmp(a,b,c) >+#else >+#include <strings.h> > #endif > > extern int vflag; /* verbose flag */ >diff --git a/stand/i386/libi386/pxe.c b/stand/i386/libi386/pxe.c >index 17c831cdd22..fdc40f7bd14 100644 >--- a/stand/i386/libi386/pxe.c >+++ b/stand/i386/libi386/pxe.c >@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); > #include "btxv86.h" > #include "pxe.h" > >+#undef bcmp >+ > /* > * Allocate the PXE buffers statically instead of sticking grimy fingers into > * BTX's private data area. The scratch buffer is used to send information to
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 232185
: 198043