mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-20 16:51:37 +00:00
Sometimes we don't know the exact amount of data we would want to send to parasite via args area (e.g. -- while draining fds). Fix this, by moving the args area behind the parasite blob and mmap-ing it with the run-time calculated size. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
36 lines
528 B
Bash
36 lines
528 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
set -u
|
|
|
|
FILE=$1
|
|
NAME=$2
|
|
INC_GUARD=__${NAME}_h__
|
|
PREFIX=${NAME}_blob_offset__
|
|
BLOB=${NAME}_blob
|
|
OBJNAME=${FILE}.built-in.bin.o
|
|
BINARY=${FILE}.built-in.bin
|
|
|
|
AWK_CMD='$2 ~ /^[tTA]$/ { print "#define '$PREFIX'" $3 " 0x" $1; }'
|
|
|
|
cat << EOF
|
|
/* Autogenerated by $0, do not edit */
|
|
#ifndef $INC_GUARD
|
|
#define $INC_GUARD
|
|
|
|
EOF
|
|
|
|
nm $OBJNAME | grep "__export_" | tr . _ | awk "$AWK_CMD"
|
|
|
|
cat << EOF
|
|
|
|
static char $BLOB[] = {
|
|
EOF
|
|
|
|
hexdump -v -e '"\t" 8/1 "0x%02x, " "\n"' $BINARY
|
|
|
|
cat << EOF
|
|
};
|
|
|
|
#endif /* $INC_GUARD */
|
|
EOF
|