This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/2] add kexec_load() syscall


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
@@ -1,3 +1,8 @@
+2012-05-23  maximilian attems <max@stro.at>
+            Andreas Jaeger <aj@suse.com>
+	* sysdeps/unix/sysv/linux/syscalls.list: Add kexec_load syscall.
+	* sysdeps/unix/sysv/linux/sys/kexec.h: New file.
+
 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.
+   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.
+ */
+
+struct kexec_segment {
+	const void *buf;
+	size_t bufsz;
+	const void *mem;
+	size_t memsz;
+};
+
+__BEGIN_DECLS
+
+/* kexec interface function */
+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
-- 
1.7.10


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]