[CRIU] [PATCH 2/2] test: Drop legacy directory

Cyrill Gorcunov gorcunov at openvz.org
Wed Jul 25 06:06:39 EDT 2012


All things are already in zdtm, not need to carry it.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile                             |    6 +-
 test/legacy/Makefile                 |   37 -----
 test/legacy/test-counter.c           |   21 ---
 test/legacy/test-pipe-async.c        |   71 ----------
 test/legacy/test-pthreads.c          |  239 ----------------------------------
 test/legacy/test-rnd-from-file.c     |   44 ------
 test/legacy/test-shmem-async.c       |   55 --------
 test/legacy/test-shmem-three-async.c |   76 -----------
 test/legacy/test-sigaction.c         |   53 --------
 test/legacy/test-unixsocket.c        |  151 ---------------------
 10 files changed, 1 insertions(+), 752 deletions(-)
 delete mode 100644 test/legacy/Makefile
 delete mode 100644 test/legacy/test-counter.c
 delete mode 100644 test/legacy/test-pipe-async.c
 delete mode 100644 test/legacy/test-pthreads.c
 delete mode 100644 test/legacy/test-rnd-from-file.c
 delete mode 100644 test/legacy/test-shmem-async.c
 delete mode 100644 test/legacy/test-shmem-three-async.c
 delete mode 100644 test/legacy/test-sigaction.c
 delete mode 100644 test/legacy/test-unixsocket.c

diff --git a/Makefile b/Makefile
index 46d0db7..e4476cb 100644
--- a/Makefile
+++ b/Makefile
@@ -72,7 +72,7 @@ MAKEFLAGS	+= --no-print-directory
 include Makefile.syscall
 include Makefile.pie
 
-.PHONY: all test-legacy zdtm test rebuild clean distclean tags cscope	\
+.PHONY: all zdtm test rebuild clean distclean tags cscope	\
 	docs help pie protobuf
 
 all: protobuf pie
@@ -103,9 +103,6 @@ $(PROGRAM): $(OBJS) $(SYS-OBJ) $(PROTOBUF-LIB)
 	$(E) "  LINK    " $@
 	$(Q) $(CC) $(CFLAGS) $^ $(LIBS) -o $@
 
-test-legacy: all
-	$(Q) $(MAKE) -C test/legacy all
-
 zdtm: all
 	$(Q) $(MAKE) -C test/zdtm all
 
@@ -129,7 +126,6 @@ clean: cleanpie cleansyscall
 	$(Q) $(RM) -f ./$(PROGRAM)
 	$(Q) $(RM) -rf ./test/dump/
 	$(Q) $(MAKE) -C protobuf/ clean
-	$(Q) $(MAKE) -C test/legacy clean
 	$(Q) $(MAKE) -C test/zdtm cleandep
 	$(Q) $(MAKE) -C test/zdtm clean
 	$(Q) $(MAKE) -C test/zdtm cleanout
diff --git a/test/legacy/Makefile b/test/legacy/Makefile
deleted file mode 100644
index 1acb733..0000000
--- a/test/legacy/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
--include ../../Makefile.inc
-
-SRCS	+= test-counter.c
-SRCS	+= test-rnd-from-file.c
-SRCS	+= test-shmem-async.c
-SRCS	+= test-shmem-three-async.c
-SRCS	+= test-pipe-async.c
-SRCS	+= test-sigaction.c
-SRCS	+= test-unixsocket.c
-
-SRCS-TH	+= test-pthreads.c
-OBJS-TH += $(patsubst %.c,%.o,$(SRCS-TH))
-PROGS-TH:= $(patsubst %.c,%,$(SRCS-TH))
-
-OBJS	:= $(patsubst %.c,%.o,$(SRCS))
-PROGS	:= $(patsubst %.c,%,$(SRCS))
-
-all: $(PROGS) $(PROGS-TH)
-
-$(PROGS-TH): $(OBJS-TH)
-	$(E) "  LINK    " $@
-	$(Q) $(CC) $@.o -lpthread -o $@
-
-$(PROGS): $(OBJS)
-	$(E) "  LINK    " $@
-	$(Q) $(CC) $@.o -o $@
-
-%.o: %.c
-	$(E) "  CC      " $@
-	$(Q) $(CC) -c $(CFLAGS) $< -o $@
-
-clean:
-	$(Q) $(RM) -f ./*.o
-	$(Q) $(RM) -f ./$(PROGS)
-	$(Q) $(RM) -f ./$(PROGS-TH)
-	$(Q) $(RM) -f ./f1-file
-.PHONY: clean
diff --git a/test/legacy/test-counter.c b/test/legacy/test-counter.c
deleted file mode 100644
index 546a000..0000000
--- a/test/legacy/test-counter.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <sys/types.h>
-
-int main(int argc, char *argv[])
-{
-	int counter = 0;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	while (1) {
-		printf("Pid: %10d Counter: %10d\n",
-		       getpid(), counter++);
-		sleep(3);
-	}
-
-	return 0;
-}
diff --git a/test/legacy/test-pipe-async.c b/test/legacy/test-pipe-async.c
deleted file mode 100644
index 0a33912..0000000
--- a/test/legacy/test-pipe-async.c
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-
-#include <sched.h>
-
-int main(int argc, char *argv[])
-{
-	int pipefd1[2];
-	int pipefd2[2];
-	pid_t pid;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	if (pipe(pipefd1)) {
-		perror("Can't create pipe1");
-		return -1;
-	}
-
-	pid = fork();
-	if (pid == -1) {
-		printf("fork failed\n");
-		return 1;
-	} else if (pid == 0) {
-		long buf;
-
-		if (pipe(pipefd2)) {
-			perror("Can't create pipe2");
-			return -1;
-		}
-
-		pid = fork();
-		if (pid == -1) {
-			printf("fork failed\n");
-			return 1;
-		} else if (pid == 0) {
-			while (1) {
-				long buf;
-				read(pipefd1[0], &buf, sizeof(buf));
-				printf("pipe2-r: %08lx\n", buf);
-				sleep(1);
-			}
-		}
-
-		while (1) {
-			read(pipefd1[0], &buf, sizeof(buf));
-			printf("pipe1-r: %08lx\n", buf);
-			printf("pipe2-w: %08lx\n", buf);
-			write(pipefd2[1], &buf, sizeof(buf));
-			sleep(1);
-		}
-	} else {
-		long buf = 0;
-		while (1) {
-			printf("pipe1-w: %08lx\n", buf);
-			write(pipefd1[1], &buf, sizeof(buf));
-			sleep(1);
-			buf++;
-		}
-	}
-
-	return 0;
-}
diff --git a/test/legacy/test-pthreads.c b/test/legacy/test-pthreads.c
deleted file mode 100644
index 253e1d1..0000000
--- a/test/legacy/test-pthreads.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * A simple testee program with threads
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <pthread.h>
-
-#define __NR_arch_prctl		158
-
-#define ARCH_SET_GS 0x1001
-#define ARCH_SET_FS 0x1002
-#define ARCH_GET_FS 0x1003
-#define ARCH_GET_GS 0x1004
-
-static long syscall2(int nr, unsigned long arg0, unsigned long arg1)
-{
-	long ret;
-	asm volatile(
-		"movl %1, %%eax		\t\n"
-		"movq %2, %%rdi		\t\n"
-		"movq %3, %%rsi		\t\n"
-		"syscall		\t\n"
-		"movq %%rax, %0		\t\n"
-		: "=r"(ret)
-		: "g" ((int)nr), "g" (arg0), "g" (arg1)
-		: "rax", "rdi", "rsi", "memory");
-	return ret;
-}
-
-static long sys_arch_prctl(int code, void *addr)
-{
-	return syscall2(__NR_arch_prctl, code, (unsigned long)addr);
-}
-
-static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
-static int counter;
-static int thread_counter = 1;
-
-static __thread int tls_data;
-
-static void pr_fsgs_base(char *name)
-{
-	unsigned long fsgs_base = -1ul;
-	int ret;
-
-	ret = sys_arch_prctl(ARCH_GET_FS, &fsgs_base);
-
-	printf("%8d (%15s): (%2d) fsgs_base %8lx\n",
-	       getpid(), name, ret, fsgs_base);
-
-	ret = sys_arch_prctl(ARCH_GET_GS, &fsgs_base);
-
-	printf("%8d (%15s): (%2d) fsgs_base %8lx\n",
-	       getpid(), name, ret, fsgs_base);
-}
-
-static void *ff1(void *arg)
-{
-	void *map_unreadable = mmap(NULL, 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-	pid_t pid;
-	(void)map_unreadable;
-
-	tls_data = thread_counter++;
-
-	pr_fsgs_base("thr3");
-
-	pid = fork();
-	if (pid < 0)
-		exit(1);
-	else if (pid == 0) {
-		while (1) {
-			pthread_mutex_lock(&mtx);
-
-			counter++;
-			printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-			       getpid(), "thr3-ch", counter, tls_data);
-
-			pthread_mutex_unlock(&mtx);
-			sleep(5);
-		}
-	}
-
-	while (1) {
-		pthread_mutex_lock(&mtx);
-
-		counter++;
-		printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-		       getpid(), "thr3", counter, tls_data);
-
-		pthread_mutex_unlock(&mtx);
-		sleep(5);
-	}
-
-	return NULL;
-}
-
-static void *f1(void *arg)
-{
-	const char name[] = "f1-file";
-	pthread_t th;
-	pid_t pid;
-	int fd;
-	void *map_unreadable = mmap(NULL, 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-	(void)map_unreadable;
-
-	unlink(name);
-	fd = open(name, O_CREAT, 0644);
-	if (fd >= 0)
-		write(fd, name, sizeof(name));
-
-	if (pthread_create(&th, NULL, &ff1, NULL))
-		perror("Cant create thread");
-
-	tls_data = thread_counter++;
-
-	pr_fsgs_base("thr1");
-
-	pid = fork();
-	if (pid < 0)
-		exit(1);
-	else if (pid == 0) {
-		while (1) {
-			pthread_mutex_lock(&mtx);
-
-			counter++;
-			printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-				getpid(), "thr1-ch", counter, tls_data);
-
-			pthread_mutex_unlock(&mtx);
-			sleep(2);
-		}
-	}
-
-	while (1) {
-		pthread_mutex_lock(&mtx);
-
-		counter++;
-		printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-		       getpid(), "thr1", counter, tls_data);
-
-		pthread_mutex_unlock(&mtx);
-		sleep(2);
-	}
-
-	return NULL;
-}
-
-static void *f2(void *arg)
-{
-	void *map_unreadable = mmap(NULL, 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-	pid_t pid;
-	(void)map_unreadable;
-
-	tls_data = thread_counter++;
-
-	pr_fsgs_base("thr2");
-
-	pid = fork();
-	if (pid < 0)
-		exit(1);
-	else if (pid == 0) {
-		while (1) {
-			pthread_mutex_lock(&mtx);
-
-			counter--;
-			printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-			       getpid(), "thr2-ch", counter, tls_data);
-
-			pthread_mutex_unlock(&mtx);
-			sleep(3);
-		}
-	}
-
-	while (1) {
-		pthread_mutex_lock(&mtx);
-
-		counter--;
-		printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-		       getpid(), "thr2", counter, tls_data);
-
-		pthread_mutex_unlock(&mtx);
-		sleep(3);
-	}
-
-	return NULL;
-}
-
-int main(int argc, char *argv[])
-{
-	pthread_t th1, th2;
-	int rc1, rc2;
-	pid_t pid;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	tls_data = thread_counter++;
-
-	pr_fsgs_base("main");
-
-	printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-	       getpid(), "main", counter, tls_data);
-
-	rc1 = pthread_create(&th1, NULL, &f1, NULL);
-	rc2 = pthread_create(&th2, NULL, &f2, NULL);
-
-	if (rc1 | rc2)
-		exit(1);
-
-	pid = fork();
-	if (pid < 0)
-		exit(1);
-	else if (pid == 0) {
-		while (1) {
-			printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-			       getpid(), "main-child", counter, tls_data);
-			sleep(2);
-		}
-	}
-
-	while (1) {
-		printf("%8d (%15s): Counter value: %4d tls_data = %4d\n",
-		       getpid(), "main", counter, tls_data);
-		sleep(2);
-	}
-
-	pthread_join(th1, NULL);
-	pthread_join(th2, NULL);
-
-	exit(0);
-}
diff --git a/test/legacy/test-rnd-from-file.c b/test/legacy/test-rnd-from-file.c
deleted file mode 100644
index 1ad9cf2..0000000
--- a/test/legacy/test-rnd-from-file.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-int main(int argc, char *argv[])
-{
-	const char fname_rnd[] = "random-data.o"; /* so make clean drops it */
-	const int limit = 10;
-	int counter, fd, rnd;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	unlink((char *)fname_rnd);
-
-	fd = open(fname_rnd, O_RDWR | O_CREAT | O_EXCL, 0644);
-	if (fd < 0) {
-		perror("Can't open file");
-		return fd;
-	}
-
-	counter = 0;
-	while (counter++ < limit) {
-		rnd = rand();
-		write(fd, &rnd, sizeof(rnd));
-	}
-
-	counter = 0;
-	while (1) {
-		lseek(fd, 0, SEEK_SET);
-		while (counter++ < limit) {
-			read(fd, &rnd, sizeof(rnd));
-			printf("Pid: %10d Rnd: %10d\n",
-			       getpid(), rnd);
-			sleep(3);
-		}
-	}
-
-	return 0;
-}
diff --git a/test/legacy/test-shmem-async.c b/test/legacy/test-shmem-async.c
deleted file mode 100644
index 6ea1d3f..0000000
--- a/test/legacy/test-shmem-async.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-
-#include <sched.h>
-
-static void *map;
-
-int main(int argc, char *argv[])
-{
-	pid_t pid;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	map = mmap(NULL, 1024, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
-	if (map	== MAP_FAILED) {
-		printf("%6d: mmap failed\n", getpid());
-		return 0;
-	}
-
-	memset(map, '-', 21);
-	((char *)map)[21] = 0;
-
-	printf("%6d: Initial  shmem pattern '%s'\n", getpid(), (char *)map);
-
-	pid = fork();
-	if (pid == -1) {
-		printf("fork failed\n");
-		return 1;
-	}
-
-	if (pid == 0) {
-		int cnt = 0;
-		while(1) {
-			printf("%6d: Observed shmem pattern '%s'\n", getpid(), (char *)map);
-			sprintf(map, "shared-mem-%010d", cnt++);
-			sleep(1);
-		}
-	} else {
-		while(1) {
-			printf("%6d: Observed shmem pattern '%s'\n", getpid(), (char *)map);
-			sleep(3);
-		}
-	}
-
-	return 0;
-}
diff --git a/test/legacy/test-shmem-three-async.c b/test/legacy/test-shmem-three-async.c
deleted file mode 100644
index a89ec4b..0000000
--- a/test/legacy/test-shmem-three-async.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-
-#include <sched.h>
-
-static void *map1;
-static void *map2;
-
-int main(int argc, char *argv[])
-{
-	pid_t pid;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	map1 = mmap(NULL, 1024, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
-	map2 = mmap(NULL, 1024, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
-	if (map1 == MAP_FAILED || map2 == MAP_FAILED) {
-		printf("%6d: mmap failed\n", getpid());
-		return 0;
-	}
-
-	memset(map1, '-', 22);
-	((char *)map1)[22] = 0;
-
-	memset(map2, '+', 22);
-	((char *)map1)[22] = 0;
-
-	printf("%6d: Initial  shmem1 pattern '%s'\n", getpid(), (char *)map1);
-
-	pid = fork();
-	if (pid == -1) {
-		printf("fork1 failed\n");
-		return 1;
-	} else if (pid == 0) {
-		int cnt = 0;
-
-		pid = fork();
-		if (pid == -1) {
-			printf("fork2 failed\n");
-			exit(1);
-		} else if (pid == 0) {
-			int num = 0;
-			while(1) {
-				printf("%6d: Observed shmem2 pattern '%s'\n", getpid(), (char *)map2);
-				sprintf(map2, "shared-mem2-%010d", num);
-				sleep(1);
-				num += 2;
-			}
-		}
-
-		cnt = -1;
-		while(1) {
-			cnt += 2;
-			printf("%6d: Observed shmem1 pattern '%s'\n", getpid(), (char *)map1);
-			sprintf(map1, "shared-mem1-%010d", cnt);
-			sleep(1);
-		}
-	} else {
-		while(1) {
-			printf("%6d: Observed shmem1 pattern '%s'\n", getpid(), (char *)map1);
-			printf("%6d: Observed shmem2 pattern '%s'\n", getpid(), (char *)map2);
-			sleep(1);
-		}
-	}
-
-	return 0;
-}
diff --git a/test/legacy/test-sigaction.c b/test/legacy/test-sigaction.c
deleted file mode 100644
index 7b074d3..0000000
--- a/test/legacy/test-sigaction.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <signal.h>
-
-static void forked_handler(int sig)
-{
-	printf("%d: %s\n", getpid(), __func__);
-}
-
-static void primary_handler(int sig)
-{
-	printf("%d: %s\n", getpid(), __func__);
-}
-
-int main(int argc, char *argv[])
-{
-	struct sigaction act;
-	int pid;
-
-	printf("%s pid %d\n", argv[0], getpid());
-
-	pid = fork();
-	if (pid < 0) {
-		exit(-1);
-	} else if (pid == 0) {
-		act.sa_handler	= forked_handler;
-		act.sa_flags	= 0;
-		sigemptyset(&act.sa_mask);
-		sigaction(SIGTSTP, &act, 0);
-
-		while (1) {
-			kill(getppid(), SIGTSTP);
-			kill(getpid(), SIGTSTP);
-			sleep(1);
-		}
-
-	} else {
-		act.sa_handler	= primary_handler;
-		act.sa_flags	= 0;
-		sigemptyset(&act.sa_mask);
-		sigaction(SIGTSTP, &act, 0);
-
-		while (1) {
-			sleep(1);
-		}
-	}
-
-	return 0;
-}
diff --git a/test/legacy/test-unixsocket.c b/test/legacy/test-unixsocket.c
deleted file mode 100644
index e20bfc1..0000000
--- a/test/legacy/test-unixsocket.c
+++ /dev/null
@@ -1,151 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-
-#define SK_NAME_BOUND		"test-socket-bound"
-#define SK_NAME_CONN		"test-socket-conn"
-#define SK_NAME_BOUND_CONN	"test-socket-bound-conn"
-
-#define SK_DATA_PAIR		"data-packet-pair"
-#define SK_DATA_BOUND		"data-packet-bound"
-#define SK_DATA_CONN		"data-packet-conn"
-#define SK_DATA_BOUND_CONN	"data-packet-bound-conn"
-
-int main(void)
-{
-	struct sockaddr_un name_bound;
-	struct sockaddr_un name_conn;
-	struct sockaddr_un name_bound_conn;
-	int stream_sock[2];
-	int sk_dgram_bound_client;
-	int sk_dgram_bound_server;
-	int sk_dgram_conn_client;
-	int sk_dgram_conn_server;
-	int sk_dgram_bound_conn;
-	char buf[64];
-	int ret;
-
-	if (socketpair(AF_UNIX, SOCK_STREAM, 0, stream_sock) == -1) {
-		perror("socketpair");
-		exit(1);
-	}
-
-	sk_dgram_bound_client	= socket(AF_UNIX, SOCK_DGRAM, 0);
-	sk_dgram_bound_server	= socket(AF_UNIX, SOCK_DGRAM, 0);
-	sk_dgram_conn_client	= socket(AF_UNIX, SOCK_DGRAM, 0);
-	sk_dgram_conn_server	= socket(AF_UNIX, SOCK_DGRAM, 0);
-	sk_dgram_bound_conn	= socket(AF_UNIX, SOCK_DGRAM, 0);
-
-	if (sk_dgram_conn_server < 0	||
-	    sk_dgram_bound_server < 0	||
-	    sk_dgram_conn_client < 0	||
-	    sk_dgram_conn_server < 0	||
-	    sk_dgram_bound_conn < 0) {
-		perror("socket");
-		exit(1);
-	}
-
-	unlink(SK_NAME_BOUND);
-	unlink(SK_NAME_CONN);
-	unlink(SK_NAME_BOUND_CONN);
-
-	printf("sk_dgram_bound_client: %d\n"
-	       "sk_dgram_bound_server: %d\n"
-	       "sk_dgram_conn_client:  %d\n"
-	       "sk_dgram_conn_server:  %d\n"
-	       "sk_dgram_bound_conn:  %d\n",
-		sk_dgram_bound_client,
-		sk_dgram_bound_server,
-		sk_dgram_conn_client,
-		sk_dgram_conn_server,
-		sk_dgram_bound_conn);
-
-	name_bound.sun_family = AF_UNIX;
-	strcpy(name_bound.sun_path, SK_NAME_BOUND);
-
-	name_conn.sun_family = AF_UNIX;
-	strcpy(name_conn.sun_path, SK_NAME_CONN);
-
-	name_bound_conn.sun_family = AF_UNIX;
-	strcpy(name_bound_conn.sun_path, SK_NAME_BOUND_CONN);
-
-	ret = bind(sk_dgram_bound_server, &name_bound, sizeof(name_bound));
-	if (ret) {
-		perror("bind");
-		exit(1);
-	}
-
-	ret = bind(sk_dgram_conn_server, &name_conn, sizeof(name_conn));
-	if (ret) {
-		perror("bind");
-		exit(1);
-	}
-
-	ret = bind(sk_dgram_bound_conn, &name_bound_conn, sizeof(name_bound_conn));
-	if (ret) {
-		perror("bind");
-		exit(1);
-	}
-
-	ret = connect(sk_dgram_conn_client, &name_conn, sizeof(name_conn));
-	if (ret) {
-		perror("connect");
-		exit(1);
-	}
-
-	ret = connect(sk_dgram_bound_conn, &name_bound_conn, sizeof(name_bound_conn));
-	if (ret) {
-		perror("connect");
-		exit(1);
-	}
-
-	/* first packets */
-
-	write(stream_sock[0], SK_DATA_PAIR, sizeof(SK_DATA_PAIR));
-
-	sendto(sk_dgram_bound_client, SK_DATA_BOUND, sizeof(SK_DATA_BOUND), 0,
-	       &name_bound, sizeof(name_bound));
-
-	write(sk_dgram_conn_client, SK_DATA_CONN, sizeof(SK_DATA_CONN));
-
-	write(sk_dgram_bound_conn, SK_DATA_BOUND_CONN, sizeof(SK_DATA_BOUND_CONN));
-
-	while (1) {
-
-		read(stream_sock[1], &buf, sizeof(buf));
-		printf("stream            : '%s'\n", buf);
-
-		read(sk_dgram_bound_server, &buf, sizeof(buf));
-		printf("dgram-bound       : '%s'\n", buf);
-
-		read(sk_dgram_conn_server, &buf, sizeof(buf));
-		printf("dgram-conn        : '%s'\n", buf);
-
-		read(sk_dgram_bound_conn, &buf, sizeof(buf));
-		printf("dgram-bound-conn  : '%s'\n", buf);
-
-		/*
-		 * checkpoint should be done here,
-		 * we don't support queued data yet.
-		 */
-		printf("pause\n");
-		sleep(10);
-
-		write(stream_sock[0], SK_DATA_PAIR, sizeof(SK_DATA_PAIR));
-
-		sendto(sk_dgram_bound_client, SK_DATA_BOUND, sizeof(SK_DATA_BOUND), 0,
-		       &name_bound, sizeof(name_bound));
-
-		write(sk_dgram_conn_client, SK_DATA_CONN, sizeof(SK_DATA_CONN));
-
-		write(sk_dgram_bound_conn, SK_DATA_BOUND_CONN, sizeof(SK_DATA_BOUND_CONN));
-	}
-
-	return 0;
-}
-- 
1.7.7.6



More information about the CRIU mailing list