* [PATCH] Add script to, given a kernel source tree, automatically write the cr.h
@ 2009-08-04 23:43 Matt Helsley
[not found] ` <1249429388-12900-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Matt Helsley @ 2009-08-04 23:43 UTC (permalink / raw)
To: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
cr.h | 92 +++++++++++++++++++++++++++++++++++++++++++------
| 64 ++++++++++++++++++++++++++++++++++
2 files changed, 144 insertions(+), 12 deletions(-)
create mode 100755 rewrite-cr-header.sh
diff --git a/cr.h b/cr.h
index d89e113..f24b7b0 100644
--- a/cr.h
+++ b/cr.h
@@ -1,27 +1,95 @@
-#if __i386__
+/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */
+
+#define _LINUX_CHECKPOINT_H_
+/*
+ * Generic checkpoint-restart
+ *
+ * Copyright (C) 2008-2009 Oren Laadan
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of the Linux
+ * distribution for more details.
+ */
+
+#define CHECKPOINT_VERSION 1
+
+/* checkpoint user flags */
+#define CHECKPOINT_SUBTREE 0x1
+
+/* restart user flags */
+#define RESTART_TASKSELF 0x1
+#define RESTART_FROZEN 0x2
+
+
+
+
+
+
+
+
+
+
-#ifndef __NR_checkpoint
-#define __NR_checkpoint 335
-#endif
-#ifndef __NR_restart
-#define __NR_restart 336
-#endif
-#elif __s390x__
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/* alpha unsupported. */
+/* arm unsupported. */
+/* avr32 unsupported. */
+/* blackfin unsupported. */
+/* cris unsupported. */
+/* cris unsupported. */
+/* cris unsupported. */
+/* frv unsupported. */
+/* h8300 unsupported. */
+/* ia64 unsupported. */
+/* m32r unsupported. */
+/* m68k unsupported. */
+/* microblaze unsupported. */
+/* mips unsupported. */
+/* mn10300 unsupported. */
+/* parisc unsupported. */
+/* powerpc unsupported. */
+#if __s390x__
#ifndef __NR_checkpoint
#define __NR_checkpoint 332
#endif
+
#ifndef __NR_restart
-#define __NR_restart 333
+#define __NR_restart 333
#endif
-#elif __powerpc__
+/* sh unsupported. */
+/* sh unsupported. */
+/* sh unsupported. */
+/* sparc unsupported. */
+#elif __i386__
#ifndef __NR_checkpoint
-#define __NR_checkpoint 322
+#define __NR_checkpoint 338
#endif
+
#ifndef __NR_restart
-#define __NR_restart 323
+#define __NR_restart 339
#endif
+
+/* x86_64 unsupported. */
+/* x86_64 unsupported. */
+/* xtensa unsupported. */
+#else
+#error "Architecture does not have definitons for __NR_(checkpoint|restart)"
#endif
--git a/rewrite-cr-header.sh b/rewrite-cr-header.sh
new file mode 100755
index 0000000..22f92c7
--- /dev/null
+++ b/rewrite-cr-header.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Rewrite the contents of cr.h
+#
+
+KERNELSRC=../oren
+
+################################################################################
+
+[ -z "${KERNELSRC}" ] && exit -1
+mv cr.h cr.h.bak || exit -1
+
+(
+COND='#if'
+set -e
+echo '/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */'
+
+#
+# Include non-__KERNEL__ sections of include/linux/checkpoint.h using
+# cpp to expand only the directives of the kernel header.
+#
+# The first 6 lines of cpp output write some trashy #define/#undef lines
+# we don't want. Would it be better to throw everything away until we see
+# "#define _LINUX_CHECKPOINT_H_" ??
+#
+cpp -CC -P -U__KERNEL__ -undef -nostdinc -fdirectives-only ${KERNELSRC}/include/linux/checkpoint.h | tail -n '+6'
+
+find ${KERNELSRC}/arch -name 'unistd*.h' -print | sort | \
+while read UNISTDH ; do
+ REGEX='[[:space:]]*#[[:space:]]*define[[:space:]]+__NR_(checkpoint|restart)[[:space:]]+[[:digit:]]+'
+
+ [ -z "${UNISTDH}" ] && continue
+ KARCH=$(echo "${UNISTDH}" | sed -e 's|.*/arch/\([^/]\+\)/.*|\1|')
+ BITNESS=$(basename "${UNISTDH}" | sed -e 's/unistd_*\([12346]\+\)\.h/\1/')
+
+ # Map KARCH to something suitable for CPP e.g. __i386__
+ case "${KARCH}" in
+ x86) if [ "${BITNESS}" == "32" ]; then
+ CPPARCH=i386
+ else
+ CPPARCH=x86_64
+ fi
+ ;;
+ s390*) CPPARCH=s390x ;;
+ *) CPPARCH="${KARCH}" ;;
+ esac
+
+ grep -q -E "${REGEX}" ${UNISTDH} || {
+ echo '/* '"${CPPARCH}"' unsupported. */'
+ continue
+ }
+
+ echo -e "${COND} __${CPPARCH}__\\n"
+ grep -E "${REGEX}" ${UNISTDH} | \
+ sed -e 's/^[[:space:]]*#define[[:space:]]\+__NR_\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$/#ifndef __NR_\1\n#define __NR_\1 \2\n#endif\n/'
+ COND='#elif'
+done
+echo -e '#else\n#error "Architecture does not have definitons for __NR_(checkpoint|restart)"\n#endif'
+) > cr.h || {
+ mv -f cr.h.bak cr.h
+ exit -1
+}
+
+rm -f cr.h.bak
--
1.5.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Add script to, given a kernel source tree, automatically write the cr.h
[not found] ` <1249429388-12900-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-08-04 23:46 ` Matt Helsley
2009-08-04 23:49 ` Matt Helsley
1 sibling, 0 replies; 5+ messages in thread
From: Matt Helsley @ 2009-08-04 23:46 UTC (permalink / raw)
To: Matt Helsley
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
Serge Hallyn
Also for cr_tests. Should preced the CHECKPOINT_SUBTREE patch.
On Tue, Aug 04, 2009 at 04:43:08PM -0700, Matt Helsley wrote:
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
> cr.h | 92 +++++++++++++++++++++++++++++++++++++++++++------
> rewrite-cr-header.sh | 64 ++++++++++++++++++++++++++++++++++
> 2 files changed, 144 insertions(+), 12 deletions(-)
> create mode 100755 rewrite-cr-header.sh
>
> diff --git a/cr.h b/cr.h
> index d89e113..f24b7b0 100644
> --- a/cr.h
> +++ b/cr.h
> @@ -1,27 +1,95 @@
> -#if __i386__
> +/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */
> +
> +#define _LINUX_CHECKPOINT_H_
> +/*
> + * Generic checkpoint-restart
> + *
> + * Copyright (C) 2008-2009 Oren Laadan
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License. See the file COPYING in the main directory of the Linux
> + * distribution for more details.
> + */
> +
> +#define CHECKPOINT_VERSION 1
> +
> +/* checkpoint user flags */
> +#define CHECKPOINT_SUBTREE 0x1
> +
> +/* restart user flags */
> +#define RESTART_TASKSELF 0x1
> +#define RESTART_FROZEN 0x2
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
>
> -#ifndef __NR_checkpoint
> -#define __NR_checkpoint 335
> -#endif
> -#ifndef __NR_restart
> -#define __NR_restart 336
> -#endif
>
> -#elif __s390x__
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +/* alpha unsupported. */
> +/* arm unsupported. */
> +/* avr32 unsupported. */
> +/* blackfin unsupported. */
> +/* cris unsupported. */
> +/* cris unsupported. */
> +/* cris unsupported. */
> +/* frv unsupported. */
> +/* h8300 unsupported. */
> +/* ia64 unsupported. */
> +/* m32r unsupported. */
> +/* m68k unsupported. */
> +/* microblaze unsupported. */
> +/* mips unsupported. */
> +/* mn10300 unsupported. */
> +/* parisc unsupported. */
> +/* powerpc unsupported. */
> +#if __s390x__
>
> #ifndef __NR_checkpoint
> #define __NR_checkpoint 332
> #endif
> +
> #ifndef __NR_restart
> -#define __NR_restart 333
> +#define __NR_restart 333
> #endif
>
> -#elif __powerpc__
> +/* sh unsupported. */
> +/* sh unsupported. */
> +/* sh unsupported. */
> +/* sparc unsupported. */
> +#elif __i386__
>
> #ifndef __NR_checkpoint
> -#define __NR_checkpoint 322
> +#define __NR_checkpoint 338
> #endif
> +
> #ifndef __NR_restart
> -#define __NR_restart 323
> +#define __NR_restart 339
> #endif
> +
> +/* x86_64 unsupported. */
> +/* x86_64 unsupported. */
> +/* xtensa unsupported. */
> +#else
> +#error "Architecture does not have definitons for __NR_(checkpoint|restart)"
> #endif
> diff --git a/rewrite-cr-header.sh b/rewrite-cr-header.sh
> new file mode 100755
> index 0000000..22f92c7
> --- /dev/null
> +++ b/rewrite-cr-header.sh
> @@ -0,0 +1,64 @@
> +#!/bin/bash
> +#
> +# Rewrite the contents of cr.h
> +#
> +
> +KERNELSRC=../oren
> +
> +################################################################################
> +
> +[ -z "${KERNELSRC}" ] && exit -1
> +mv cr.h cr.h.bak || exit -1
> +
> +(
> +COND='#if'
> +set -e
> +echo '/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */'
> +
> +#
> +# Include non-__KERNEL__ sections of include/linux/checkpoint.h using
> +# cpp to expand only the directives of the kernel header.
> +#
> +# The first 6 lines of cpp output write some trashy #define/#undef lines
> +# we don't want. Would it be better to throw everything away until we see
> +# "#define _LINUX_CHECKPOINT_H_" ??
> +#
> +cpp -CC -P -U__KERNEL__ -undef -nostdinc -fdirectives-only ${KERNELSRC}/include/linux/checkpoint.h | tail -n '+6'
> +
> +find ${KERNELSRC}/arch -name 'unistd*.h' -print | sort | \
> +while read UNISTDH ; do
> + REGEX='[[:space:]]*#[[:space:]]*define[[:space:]]+__NR_(checkpoint|restart)[[:space:]]+[[:digit:]]+'
> +
> + [ -z "${UNISTDH}" ] && continue
> + KARCH=$(echo "${UNISTDH}" | sed -e 's|.*/arch/\([^/]\+\)/.*|\1|')
> + BITNESS=$(basename "${UNISTDH}" | sed -e 's/unistd_*\([12346]\+\)\.h/\1/')
> +
> + # Map KARCH to something suitable for CPP e.g. __i386__
> + case "${KARCH}" in
> + x86) if [ "${BITNESS}" == "32" ]; then
> + CPPARCH=i386
> + else
> + CPPARCH=x86_64
> + fi
> + ;;
> + s390*) CPPARCH=s390x ;;
> + *) CPPARCH="${KARCH}" ;;
> + esac
> +
> + grep -q -E "${REGEX}" ${UNISTDH} || {
> + echo '/* '"${CPPARCH}"' unsupported. */'
> + continue
> + }
> +
> + echo -e "${COND} __${CPPARCH}__\\n"
> + grep -E "${REGEX}" ${UNISTDH} | \
> + sed -e 's/^[[:space:]]*#define[[:space:]]\+__NR_\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$/#ifndef __NR_\1\n#define __NR_\1 \2\n#endif\n/'
> + COND='#elif'
> +done
> +echo -e '#else\n#error "Architecture does not have definitons for __NR_(checkpoint|restart)"\n#endif'
> +) > cr.h || {
> + mv -f cr.h.bak cr.h
> + exit -1
> +}
> +
> +rm -f cr.h.bak
> --
> 1.5.6.3
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add script to, given a kernel source tree, automatically write the cr.h
[not found] ` <1249429388-12900-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-04 23:46 ` Matt Helsley
@ 2009-08-04 23:49 ` Matt Helsley
[not found] ` <20090804234948.GE18261-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
1 sibling, 1 reply; 5+ messages in thread
From: Matt Helsley @ 2009-08-04 23:49 UTC (permalink / raw)
To: Oren Laadan; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Oren,
Could this script or something like it be useful for user-cr
rather than always using KERNELSRC and KERNELBUILD?
Cheers,
-Matt Helsley
On Tue, Aug 04, 2009 at 04:43:08PM -0700, Matt Helsley wrote:
> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
<snip>
> diff --git a/rewrite-cr-header.sh b/rewrite-cr-header.sh
> new file mode 100755
> index 0000000..22f92c7
> --- /dev/null
> +++ b/rewrite-cr-header.sh
> @@ -0,0 +1,64 @@
> +#!/bin/bash
> +#
> +# Rewrite the contents of cr.h
> +#
> +
> +KERNELSRC=../oren
> +
> +################################################################################
> +
> +[ -z "${KERNELSRC}" ] && exit -1
> +mv cr.h cr.h.bak || exit -1
> +
> +(
> +COND='#if'
> +set -e
> +echo '/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */'
> +
> +#
> +# Include non-__KERNEL__ sections of include/linux/checkpoint.h using
> +# cpp to expand only the directives of the kernel header.
> +#
> +# The first 6 lines of cpp output write some trashy #define/#undef lines
> +# we don't want. Would it be better to throw everything away until we see
> +# "#define _LINUX_CHECKPOINT_H_" ??
> +#
> +cpp -CC -P -U__KERNEL__ -undef -nostdinc -fdirectives-only ${KERNELSRC}/include/linux/checkpoint.h | tail -n '+6'
> +
> +find ${KERNELSRC}/arch -name 'unistd*.h' -print | sort | \
> +while read UNISTDH ; do
> + REGEX='[[:space:]]*#[[:space:]]*define[[:space:]]+__NR_(checkpoint|restart)[[:space:]]+[[:digit:]]+'
> +
> + [ -z "${UNISTDH}" ] && continue
> + KARCH=$(echo "${UNISTDH}" | sed -e 's|.*/arch/\([^/]\+\)/.*|\1|')
> + BITNESS=$(basename "${UNISTDH}" | sed -e 's/unistd_*\([12346]\+\)\.h/\1/')
> +
> + # Map KARCH to something suitable for CPP e.g. __i386__
> + case "${KARCH}" in
> + x86) if [ "${BITNESS}" == "32" ]; then
> + CPPARCH=i386
> + else
> + CPPARCH=x86_64
> + fi
> + ;;
> + s390*) CPPARCH=s390x ;;
> + *) CPPARCH="${KARCH}" ;;
> + esac
> +
> + grep -q -E "${REGEX}" ${UNISTDH} || {
> + echo '/* '"${CPPARCH}"' unsupported. */'
> + continue
> + }
> +
> + echo -e "${COND} __${CPPARCH}__\\n"
> + grep -E "${REGEX}" ${UNISTDH} | \
> + sed -e 's/^[[:space:]]*#define[[:space:]]\+__NR_\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$/#ifndef __NR_\1\n#define __NR_\1 \2\n#endif\n/'
> + COND='#elif'
> +done
> +echo -e '#else\n#error "Architecture does not have definitons for __NR_(checkpoint|restart)"\n#endif'
> +) > cr.h || {
> + mv -f cr.h.bak cr.h
> + exit -1
> +}
> +
> +rm -f cr.h.bak
> --
> 1.5.6.3
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add script to, given a kernel source tree, automatically write the cr.h
[not found] ` <20090804234948.GE18261-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
@ 2009-08-12 6:28 ` Oren Laadan
[not found] ` <4A826129.2010304-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Oren Laadan @ 2009-08-12 6:28 UTC (permalink / raw)
To: Matt Helsley; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
If I understand correctly you want to avoid needing the kernel
sources (or headers) in order to compile user-cr - so you would
suggest to auto-generate the a header file and add it as a source
file to user-cr ?
(If this doesn't make any sense -- I'll blame the hour ...)
Oren.
Matt Helsley wrote:
> Oren,
>
> Could this script or something like it be useful for user-cr
> rather than always using KERNELSRC and KERNELBUILD?
>
> Cheers,
> -Matt Helsley
> On Tue, Aug 04, 2009 at 04:43:08PM -0700, Matt Helsley wrote:
>> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>> ---
>
> <snip>
>
>> diff --git a/rewrite-cr-header.sh b/rewrite-cr-header.sh
>> new file mode 100755
>> index 0000000..22f92c7
>> --- /dev/null
>> +++ b/rewrite-cr-header.sh
>> @@ -0,0 +1,64 @@
>> +#!/bin/bash
>> +#
>> +# Rewrite the contents of cr.h
>> +#
>> +
>> +KERNELSRC=../oren
>> +
>> +################################################################################
>> +
>> +[ -z "${KERNELSRC}" ] && exit -1
>> +mv cr.h cr.h.bak || exit -1
>> +
>> +(
>> +COND='#if'
>> +set -e
>> +echo '/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */'
>> +
>> +#
>> +# Include non-__KERNEL__ sections of include/linux/checkpoint.h using
>> +# cpp to expand only the directives of the kernel header.
>> +#
>> +# The first 6 lines of cpp output write some trashy #define/#undef lines
>> +# we don't want. Would it be better to throw everything away until we see
>> +# "#define _LINUX_CHECKPOINT_H_" ??
>> +#
>> +cpp -CC -P -U__KERNEL__ -undef -nostdinc -fdirectives-only ${KERNELSRC}/include/linux/checkpoint.h | tail -n '+6'
>> +
>> +find ${KERNELSRC}/arch -name 'unistd*.h' -print | sort | \
>> +while read UNISTDH ; do
>> + REGEX='[[:space:]]*#[[:space:]]*define[[:space:]]+__NR_(checkpoint|restart)[[:space:]]+[[:digit:]]+'
>> +
>> + [ -z "${UNISTDH}" ] && continue
>> + KARCH=$(echo "${UNISTDH}" | sed -e 's|.*/arch/\([^/]\+\)/.*|\1|')
>> + BITNESS=$(basename "${UNISTDH}" | sed -e 's/unistd_*\([12346]\+\)\.h/\1/')
>> +
>> + # Map KARCH to something suitable for CPP e.g. __i386__
>> + case "${KARCH}" in
>> + x86) if [ "${BITNESS}" == "32" ]; then
>> + CPPARCH=i386
>> + else
>> + CPPARCH=x86_64
>> + fi
>> + ;;
>> + s390*) CPPARCH=s390x ;;
>> + *) CPPARCH="${KARCH}" ;;
>> + esac
>> +
>> + grep -q -E "${REGEX}" ${UNISTDH} || {
>> + echo '/* '"${CPPARCH}"' unsupported. */'
>> + continue
>> + }
>> +
>> + echo -e "${COND} __${CPPARCH}__\\n"
>> + grep -E "${REGEX}" ${UNISTDH} | \
>> + sed -e 's/^[[:space:]]*#define[[:space:]]\+__NR_\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$/#ifndef __NR_\1\n#define __NR_\1 \2\n#endif\n/'
>> + COND='#elif'
>> +done
>> +echo -e '#else\n#error "Architecture does not have definitons for __NR_(checkpoint|restart)"\n#endif'
>> +) > cr.h || {
>> + mv -f cr.h.bak cr.h
>> + exit -1
>> +}
>> +
>> +rm -f cr.h.bak
>> --
>> 1.5.6.3
>>
>>
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add script to, given a kernel source tree, automatically write the cr.h
[not found] ` <4A826129.2010304-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
@ 2009-08-12 10:31 ` Matt Helsley
0 siblings, 0 replies; 5+ messages in thread
From: Matt Helsley @ 2009-08-12 10:31 UTC (permalink / raw)
To: Oren Laadan; +Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
On Wed, Aug 12, 2009 at 02:28:57AM -0400, Oren Laadan wrote:
>
> If I understand correctly you want to avoid needing the kernel
> sources (or headers) in order to compile user-cr - so you would
> suggest to auto-generate the a header file and add it as a source
> file to user-cr ?
Yup.
Cheers,
-Matt
> (If this doesn't make any sense -- I'll blame the hour ...)
Only if I can make the same excuse ;)
>
> Oren.
>
>
> Matt Helsley wrote:
> > Oren,
> >
> > Could this script or something like it be useful for user-cr
> > rather than always using KERNELSRC and KERNELBUILD?
> >
> > Cheers,
> > -Matt Helsley
> > On Tue, Aug 04, 2009 at 04:43:08PM -0700, Matt Helsley wrote:
> >> Signed-off-by: Matt Helsley <matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> >> ---
> >
> > <snip>
> >
> >> diff --git a/rewrite-cr-header.sh b/rewrite-cr-header.sh
> >> new file mode 100755
> >> index 0000000..22f92c7
> >> --- /dev/null
> >> +++ b/rewrite-cr-header.sh
> >> @@ -0,0 +1,64 @@
> >> +#!/bin/bash
> >> +#
> >> +# Rewrite the contents of cr.h
> >> +#
> >> +
> >> +KERNELSRC=../oren
> >> +
> >> +################################################################################
> >> +
> >> +[ -z "${KERNELSRC}" ] && exit -1
> >> +mv cr.h cr.h.bak || exit -1
> >> +
> >> +(
> >> +COND='#if'
> >> +set -e
> >> +echo '/* AUTOMATICALLY GENERATED by rewrite-cr-header.sh */'
> >> +
> >> +#
> >> +# Include non-__KERNEL__ sections of include/linux/checkpoint.h using
> >> +# cpp to expand only the directives of the kernel header.
> >> +#
> >> +# The first 6 lines of cpp output write some trashy #define/#undef lines
> >> +# we don't want. Would it be better to throw everything away until we see
> >> +# "#define _LINUX_CHECKPOINT_H_" ??
> >> +#
> >> +cpp -CC -P -U__KERNEL__ -undef -nostdinc -fdirectives-only ${KERNELSRC}/include/linux/checkpoint.h | tail -n '+6'
> >> +
> >> +find ${KERNELSRC}/arch -name 'unistd*.h' -print | sort | \
> >> +while read UNISTDH ; do
> >> + REGEX='[[:space:]]*#[[:space:]]*define[[:space:]]+__NR_(checkpoint|restart)[[:space:]]+[[:digit:]]+'
> >> +
> >> + [ -z "${UNISTDH}" ] && continue
> >> + KARCH=$(echo "${UNISTDH}" | sed -e 's|.*/arch/\([^/]\+\)/.*|\1|')
> >> + BITNESS=$(basename "${UNISTDH}" | sed -e 's/unistd_*\([12346]\+\)\.h/\1/')
> >> +
> >> + # Map KARCH to something suitable for CPP e.g. __i386__
> >> + case "${KARCH}" in
> >> + x86) if [ "${BITNESS}" == "32" ]; then
> >> + CPPARCH=i386
> >> + else
> >> + CPPARCH=x86_64
> >> + fi
> >> + ;;
> >> + s390*) CPPARCH=s390x ;;
> >> + *) CPPARCH="${KARCH}" ;;
> >> + esac
> >> +
> >> + grep -q -E "${REGEX}" ${UNISTDH} || {
> >> + echo '/* '"${CPPARCH}"' unsupported. */'
> >> + continue
> >> + }
> >> +
> >> + echo -e "${COND} __${CPPARCH}__\\n"
> >> + grep -E "${REGEX}" ${UNISTDH} | \
> >> + sed -e 's/^[[:space:]]*#define[[:space:]]\+__NR_\([^[:space:]]\+\)[[:space:]]\+\([^[:space:]]\+\).*$/#ifndef __NR_\1\n#define __NR_\1 \2\n#endif\n/'
> >> + COND='#elif'
> >> +done
> >> +echo -e '#else\n#error "Architecture does not have definitons for __NR_(checkpoint|restart)"\n#endif'
> >> +) > cr.h || {
> >> + mv -f cr.h.bak cr.h
> >> + exit -1
> >> +}
> >> +
> >> +rm -f cr.h.bak
> >> --
> >> 1.5.6.3
> >>
> >>
> > _______________________________________________
> > Containers mailing list
> > Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> > https://lists.linux-foundation.org/mailman/listinfo/containers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-12 10:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-04 23:43 [PATCH] Add script to, given a kernel source tree, automatically write the cr.h Matt Helsley
[not found] ` <1249429388-12900-1-git-send-email-matthltc-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-08-04 23:46 ` Matt Helsley
2009-08-04 23:49 ` Matt Helsley
[not found] ` <20090804234948.GE18261-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2009-08-12 6:28 ` Oren Laadan
[not found] ` <4A826129.2010304-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org>
2009-08-12 10:31 ` Matt Helsley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.