[CRIU] [PATCH 06/78] scm: Define __memcpy
Cyrill Gorcunov
gorcunov at openvz.org
Mon Nov 7 08:35:51 PST 2016
From: Pavel Emelyanov <xemul at virtuozzo.com>
Depending on the code using it, memcpy will be different.
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/pie/util-fd.c | 2 ++
include/common/scm-code.c | 10 +++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/criu/pie/util-fd.c b/criu/pie/util-fd.c
index c9813602213f..8e4b596a967a 100644
--- a/criu/pie/util-fd.c
+++ b/criu/pie/util-fd.c
@@ -16,6 +16,8 @@
# define __sys(foo) foo
#endif
+#define __memcpy builtin_memcpy
+
#include "util-pie.h"
#include "fcntl.h"
diff --git a/include/common/scm-code.c b/include/common/scm-code.c
index 5884f6974561..c7dcebb44f33 100644
--- a/include/common/scm-code.c
+++ b/include/common/scm-code.c
@@ -2,6 +2,10 @@
#error "The __sys macro is required"
#endif
+#ifndef __memcpy
+#error "The __memcpy macro is required"
+#endif
+
static void scm_fdset_init_chunk(struct scm_fdset *fdset, int nr_fds, bool with_flags)
{
struct cmsghdr *cmsg;
@@ -50,7 +54,7 @@ int send_fds(int sock, struct sockaddr_un *saddr, int len,
for (i = 0; i < nr_fds; i += min_fd) {
min_fd = min(CR_SCM_MAX_FD, nr_fds - i);
scm_fdset_init_chunk(&fdset, min_fd, with_flags);
- builtin_memcpy(cmsg_data, &fds[i], sizeof(int) * min_fd);
+ __memcpy(cmsg_data, &fds[i], sizeof(int) * min_fd);
if (with_flags) {
int j;
@@ -141,9 +145,9 @@ int recv_fds(int sock, int *fds, int nr_fds, struct fd_opts *opts)
if (unlikely(min_fd <= 0))
return -1;
- builtin_memcpy(&fds[i], cmsg_data, sizeof(int) * min_fd);
+ __memcpy(&fds[i], cmsg_data, sizeof(int) * min_fd);
if (opts)
- builtin_memcpy(opts + i, fdset.opts, sizeof(struct fd_opts) * min_fd);
+ __memcpy(opts + i, fdset.opts, sizeof(struct fd_opts) * min_fd);
}
return 0;
--
2.7.4
More information about the CRIU
mailing list