2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

scm: Define __memcpy

Depending on the code using it, memcpy will be different.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Pavel Emelyanov
2016-11-02 03:29:07 +03:00
parent 554d0f0ab4
commit bc102ea1bf
2 changed files with 9 additions and 3 deletions

View File

@@ -17,6 +17,8 @@
# define __sys(foo) foo
#endif
#define __memcpy builtin_memcpy
#include "util-pie.h"
#include "fcntl.h"

View File

@@ -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;