[PATCH 1/2] add kexec_load() syscall

Andreas Jaeger aj@suse.com
Wed May 23 10:33:00 GMT 2012


On 05/23/2012 12:04 PM, maximilian attems wrote:
> Sucessfully built tested on x86_64 and call is available
> thanks to input from Andreas Jaeger<aj@suse.com>
>
> Motivation is to axe the syscall maze in kexec-tools itself and
> have this syscall supported in glibc for installers or other
> interested projects (kexecboot, ..).
> ---
>   ChangeLog                             |    5 ++++
>   sysdeps/unix/sysv/linux/sys/kexec.h   |   48 +++++++++++++++++++++++++++++++++
>   sysdeps/unix/sysv/linux/syscalls.list |    1 +
>   3 files changed, 54 insertions(+)
>   create mode 100644 sysdeps/unix/sysv/linux/sys/kexec.h
>
> diff --git a/ChangeLog b/ChangeLog
> index c487caf..60dac56 100644
> --- a/ChangeLog
> +++ b/ChangeLog

In general, don't send ChangeLog entries as patch - they won't apply 
anymore.

> @@ -1,3 +1,8 @@
> +2012-05-23  maximilian attems<max@stro.at>
> +            Andreas Jaeger<aj@suse.com>

An empty line is missing here - and I would capitalize your name ;)

> +	* sysdeps/unix/sysv/linux/syscalls.list: Add kexec_load syscall.
> +	* sysdeps/unix/sysv/linux/sys/kexec.h: New file.

You still need to install the file - add it to sysdep-headers in 
sysdeps/unix/sysv/linux/Makefile.

> +


>   2012-05-22  Roland McGrath<roland@hack.frob.com>
>
>   	* sysdeps/unix/sysv/linux/dl-vdso.h (CHECK_HASH): Macro removed.
> diff --git a/sysdeps/unix/sysv/linux/sys/kexec.h b/sysdeps/unix/sysv/linux/sys/kexec.h
> new file mode 100644
> index 0000000..041bb45
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sys/kexec.h
> @@ -0,0 +1,48 @@
> +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.

The file was added in 2012, so only mention 2012.

> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +<http://www.gnu.org/licenses/>.  */
> +
> +/* This file should define kexec structs to be used
> +   in the argument to the `kexec_load' system call.  */
> +
> +#ifndef _SYS_KEXEC_H
> +#define _SYS_KEXEC_H   1
> +
> +#include<features.h>
> +#include<sys/types.h>
> +
> +/*
> + * This structure is used to hold the arguments that are used when loading
> + * kernel binaries.
> + */

Format for comments is
/* Text.  */
with two spaces at the end.

/* This structure is used to hold the arguments that are used when
    loading kernel binaries.  */

> +
> +struct kexec_segment {
> +	const void *buf;
> +	size_t bufsz;
> +	const void *mem;
> +	size_t memsz;
> +};
> +
> +__BEGIN_DECLS
> +
> +/* kexec interface function */

Could you briefly describe the arguments, please?

> +extern long int kexec_load(void *__entry, unsigned long __nr_segments,
> +		struct kexec_segment *__segments,
> +		unsigned long __flags) __THROW;
> +
> +__END_DECLS
> +
> +#endif  /* _SYS_KEXEC_H */
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index eef6d82..e530b19 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -33,6 +33,7 @@ inotify_init1	EXTRA	inotify_init1	i:I	inotify_init1
>   inotify_rm_watch	EXTRA	inotify_rm_watch	i:ii	inotify_rm_watch
>   ioperm		-	ioperm		i:iii	ioperm
>   iopl		-	iopl		i:i	iopl
> +kexec_load	EXTRA	kexec_load	i:pipi	kexec_load
>   klogctl		EXTRA	syslog		i:isi	klogctl
>   lchown		-	lchown		i:sii	__lchown	lchown
>   madvise		-	madvise		i:pii	madvise

Thanks,
Andreas
-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
   SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
    GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126



More information about the Libc-alpha mailing list