Line
Link Here
|
0 |
-- cryopid-0.5.9.1.orig/src/Makefile |
0 |
++ cryopid-0.5.9.1/src/Makefile |
Lines 1-8
Link Here
|
1 |
# Disabling tcpcp support saves a few KB in the binary. |
1 |
# Disabling tcpcp support saves a few KB in the binary. |
2 |
USE_TCPCP=y |
2 |
USE_TCPCP=n |
3 |
USE_GTK=n |
3 |
USE_GTK=n |
4 |
|
4 |
|
5 |
ARCH=$(shell arch) |
5 |
ARCH=$(shell uname -m) |
6 |
|
6 |
|
7 |
# Test if this gcc supports stack protection (and if so, turn it off). |
7 |
# Test if this gcc supports stack protection (and if so, turn it off). |
8 |
ifeq ($(shell $(CC) -E -fno-stack-protector - < /dev/null > /dev/null 2>&1 && echo 1),1) |
8 |
ifeq ($(shell $(CC) -E -fno-stack-protector - < /dev/null > /dev/null 2>&1 && echo 1),1) |
Lines 20-25
Link Here
|
20 |
ifeq ($(ARCH), x86_64) |
20 |
ifeq ($(ARCH), x86_64) |
21 |
ARCH_OFORMAT=elf64-x86-64 |
21 |
ARCH_OFORMAT=elf64-x86-64 |
22 |
LD_FORMAT=elf_x86_64 |
22 |
LD_FORMAT=elf_x86_64 |
|
|
23 |
LIBCOMPAT=/usr/diet/lib-x86_64/libcompat.a |
23 |
USE_TCPCP=y |
24 |
USE_TCPCP=y |
24 |
USE_GTK=n |
25 |
USE_GTK=n |
25 |
endif |
26 |
endif |
Lines 39-45
Link Here
|
39 |
|
40 |
|
40 |
R_CHUNK_OBJS = cpimage_r.o cp_r_fd.o cp_r_fd_console.o cp_r_fd_file.o cp_r_fd_fifo.o cp_r_fd_socket.o cp_r_misc.o cp_r_sighand.o cp_r_vma.o cp_r_header.o arch/arch_r_objs.o fork2.o |
41 |
R_CHUNK_OBJS = cpimage_r.o cp_r_fd.o cp_r_fd_console.o cp_r_fd_file.o cp_r_fd_fifo.o cp_r_fd_socket.o cp_r_misc.o cp_r_sighand.o cp_r_vma.o cp_r_header.o arch/arch_r_objs.o fork2.o |
41 |
W_CHUNK_OBJS = cpimage_w.o cp_w_fd.o cp_w_fd_console.o cp_w_fd_file.o cp_w_fd_fifo.o cp_w_fd_socket.o cp_w_misc.o cp_w_sighand.o cp_w_vma.o cp_w_header.o arch/arch_w_objs.o list.o |
42 |
W_CHUNK_OBJS = cpimage_w.o cp_w_fd.o cp_w_fd_console.o cp_w_fd_file.o cp_w_fd_fifo.o cp_w_fd_socket.o cp_w_misc.o cp_w_sighand.o cp_w_vma.o cp_w_header.o arch/arch_w_objs.o list.o |
42 |
COMMON_OBJS = common.c arch/asmfuncs.o |
43 |
COMMON_OBJS = common.c |
43 |
STUB_TYPES = gzip # raw buffered lzo |
44 |
STUB_TYPES = gzip # raw buffered lzo |
44 |
STUBS = $(patsubst %,stub-%,$(STUB_TYPES)) |
45 |
STUBS = $(patsubst %,stub-%,$(STUB_TYPES)) |
45 |
TARGETS = freeze fork2_helper |
46 |
TARGETS = freeze fork2_helper |
Lines 46-52
Link Here
|
46 |
TARGETS = freeze fork2_helper |
47 |
TARGETS = freeze fork2_helper |
47 |
|
48 |
|
48 |
# How do we get our libc linked into the stub? |
49 |
# How do we get our libc linked into the stub? |
49 |
LIBC = -DPROVIDE_MALLOC -nostdlib -nostartfiles ../dietlibc-$(ARCH)/dietlibc.a -lgcc |
50 |
LIBC = -DPROVIDE_MALLOC -nostdlib -nostartfiles /usr/diet/lib-x86_64/libc.a $(LIBCOMPAT) -lgcc |
50 |
#LIBC = -nostdlib -nostartfiles -lc |
51 |
#LIBC = -nostdlib -nostartfiles -lc |
51 |
|
52 |
|
52 |
# Compile in tcpcp if wanted/needed |
53 |
# Compile in tcpcp if wanted/needed |
Lines 60-66
Link Here
|
60 |
R_CHUNK_OBJS += gtk_support.o |
61 |
R_CHUNK_OBJS += gtk_support.o |
61 |
DEFINES += -DUSE_GTK |
62 |
DEFINES += -DUSE_GTK |
62 |
endif |
63 |
endif |
63 |
|
64 |
DEFINES += -DFORK2HELPER=\"$(PREFIX)/lib/cryopid/fork2_helper\" |
64 |
CFLAGS += $(DEFINES) |
65 |
CFLAGS += $(DEFINES) |
65 |
|
66 |
|
66 |
# Utilities |
67 |
# Utilities |
Lines 74-80
Link Here
|
74 |
! test -h arch && rm -f arch && ln -s arch-$(ARCH) arch || true |
75 |
! test -h arch && rm -f arch && ln -s arch-$(ARCH) arch || true |
75 |
make -C arch 'CFLAGS+=$(DEFINES) $(CFLAGS_GCC_SP)' |
76 |
make -C arch 'CFLAGS+=$(DEFINES) $(CFLAGS_GCC_SP)' |
76 |
|
77 |
|
77 |
clean: |
78 |
distclean clean: |
78 |
rm -f *.o arch/*.o $(TARGETS) |
79 |
rm -f *.o arch/*.o $(TARGETS) |
79 |
rm -f arch |
80 |
rm -f arch |
80 |
|
81 |
|
Lines 95-101
Link Here
|
95 |
gtk_support.o: gtk_support.c |
96 |
gtk_support.o: gtk_support.c |
96 |
$(CC) $(CFLAGS) -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -c $< |
97 |
$(CC) $(CFLAGS) -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -c $< |
97 |
|
98 |
|
|
|
99 |
DESTDIR=/ |
100 |
PREFIX=/usr |
101 |
|
98 |
fork2_helper: fork2_helper.c |
102 |
fork2_helper: fork2_helper.c |
|
|
103 |
echo "Fork2 extra rule is executed." |
99 |
$(CC) $(CFLAGS) $< -o $@ |
104 |
$(CC) $(CFLAGS) $< -o $@ |
100 |
|
105 |
|
101 |
.PHONY: arch |
106 |
install: freeze fork2_helper |
|
|
107 |
[ -d $(DESTDIR)/$(PREFIX)/bin/ ] || mkdir -p $(DESTDIR)/$(PREFIX)/bin/ |
108 |
cp freeze $(DESTDIR)/$(PREFIX)/bin/ |
109 |
[ -d $(DESTDIR)/$(PREFIX)/lib/cryopid/ ] || mkdir -p $(DESTDIR)/$(PREFIX)/lib/cryopid/ |
110 |
cp fork2_helper $(DESTDIR)/$(PREFIX)/lib/cryopid/ |
111 |
|
112 |
.PHONY: arch clean distclean |
102 |
-- cryopid-0.5.9.1.orig/src/arch-x86_64/arch.h |
113 |
++ cryopid-0.5.9.1/src/arch-x86_64/arch.h |
Lines 1-6
Link Here
|
1 |
#ifndef _ARCH_H_ |
1 |
#ifndef _ARCH_H_ |
2 |
#define _ARCH_H_ |
2 |
#define _ARCH_H_ |
3 |
|
3 |
|
|
|
4 |
#include <asm/unistd.h> |
4 |
#include <sys/syscall.h> |
5 |
#include <sys/syscall.h> |
5 |
#include <unistd.h> |
6 |
#include <unistd.h> |
6 |
|
7 |
|
Lines 11-16
Link Here
|
11 |
#define _ARCH_NSIG_BPW 64 |
12 |
#define _ARCH_NSIG_BPW 64 |
12 |
#define _ARCH_NSIG_WORDS (_ARCH_NSIG / _ARCH_NSIG_BPW) |
13 |
#define _ARCH_NSIG_WORDS (_ARCH_NSIG / _ARCH_NSIG_BPW) |
13 |
|
14 |
|
|
|
15 |
/* import some definitions */ |
16 |
#if 1 |
17 |
#ifndef __syscall |
18 |
#define __syscall "syscall" |
19 |
#endif |
20 |
|
21 |
#ifndef __syscall_clobber |
22 |
#define __syscall_clobber "r11","rcx","memory" |
23 |
#endif |
24 |
|
25 |
#ifndef __syscall_return |
26 |
#define __syscall_return(type, res) \ |
27 |
do { \ |
28 |
if ((unsigned long)(res) >= (unsigned long)(-127)) { \ |
29 |
errno = -(res); \ |
30 |
res = -1; \ |
31 |
} \ |
32 |
return (type) (res); \ |
33 |
} while (0) |
34 |
#endif |
35 |
|
36 |
#ifndef _syscall2 |
37 |
#define _syscall2(type,name,type1,arg1,type2,arg2) \ |
38 |
type name(type1 arg1,type2 arg2) \ |
39 |
{ \ |
40 |
long __res; \ |
41 |
__asm__ volatile (__syscall \ |
42 |
: "=a" (__res) \ |
43 |
: "0" (__NR_##name),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ |
44 |
__syscall_return(type,__res); \ |
45 |
} |
46 |
#endif |
47 |
|
48 |
#endif |
49 |
|
14 |
typedef struct { |
50 |
typedef struct { |
15 |
unsigned long sig[_ARCH_NSIG_WORDS]; |
51 |
unsigned long sig[_ARCH_NSIG_WORDS]; |
16 |
} arch_sigset_t; |
52 |
} arch_sigset_t; |
17 |
-- cryopid-0.5.9.1.orig/src/arch-x86_64/stub.c |
53 |
++ cryopid-0.5.9.1/src/arch-x86_64/stub.c |
Lines 10-15
Link Here
|
10 |
#include <sys/prctl.h> |
10 |
#include <sys/prctl.h> |
11 |
#include <asm/prctl.h> |
11 |
#include <asm/prctl.h> |
12 |
#include <asm/page.h> |
12 |
#include <asm/page.h> |
|
|
13 |
#include <errno.h> |
13 |
|
14 |
|
14 |
#include "cryopid.h" |
15 |
#include "cryopid.h" |
15 |
#include "cpimage.h" |
16 |
#include "cpimage.h" |
16 |
-- cryopid-0.5.9.1.orig/src/fork2.c |
17 |
++ cryopid-0.5.9.1/src/fork2.c |
Lines 44-50
Link Here
|
44 |
{ |
44 |
{ |
45 |
char *argv[] = {"farewell", "kitty", "XXXXXXXXXX", NULL}; |
45 |
char *argv[] = {"farewell", "kitty", "XXXXXXXXXX", NULL}; |
46 |
snprintf(argv[2], 10, "%d", pid); |
46 |
snprintf(argv[2], 10, "%d", pid); |
47 |
execve("fork2_helper", argv, environ); |
47 |
#ifndef FORK2HELPER |
|
|
48 |
#define FORK2HELPER "fork2_helper" |
49 |
#endif |
50 |
execve(FORK2HELPER, argv, environ); |
51 |
#undef FORK2HELPER |
48 |
perror("execve"); |
52 |
perror("execve"); |
49 |
_exit(50); |
53 |
_exit(50); |
50 |
} |
54 |
} |
51 |
-- cryopid-0.5.9.1.orig/src/cpimage.h 2009-03-02 22:59:56.000000000 -0500 |
55 |
++ cryopid-0.5.9.1/src/cpimage.h 2009-03-02 23:00:07.000000000 -0500 |
Lines 10-16
Link Here
|
10 |
#include <signal.h> |
10 |
#include <signal.h> |
11 |
#include "list.h" |
11 |
#include "list.h" |
12 |
#include "cplayout.h" |
12 |
#include "arch/cplayout.h" |
13 |
#define IMAGE_VERSION 0x03 |
13 |
#define IMAGE_VERSION 0x03 |