Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: maximilian attems <max <at> stro.at>
Subject: [PATCH v3] add kexec_load() syscall
Newsgroups: gmane.comp.lib.glibc.alpha
Date: Wednesday 23rd May 2012 10:56:57 UTC (over 5 years ago)
Sucessfully built tested on x86_64 and call is available
thanks to input from Andreas Jaeger 

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:
2012-05-23  maximilian attems 
            Andreas Jaeger 

       * sysdeps/unix/sysv/linux/syscalls.list: Add kexec_load syscall.
       * sysdeps/unix/sysv/linux/sys/kexec.h: New file.
       * sysdeps/unix/sysv/linux/Makefile: Add kexec.h.
---
 sysdeps/unix/sysv/linux/Makefile      |    2 +-
 sysdeps/unix/sysv/linux/sys/kexec.h   |   50
+++++++++++++++++++++++++++++++++
 sysdeps/unix/sysv/linux/syscalls.list |    1 +
 3 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 sysdeps/unix/sysv/linux/sys/kexec.h

diff --git a/sysdeps/unix/sysv/linux/Makefile
b/sysdeps/unix/sysv/linux/Makefile
index 70fd137..8155aba 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -36,7 +36,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
 		  bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
 		  sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
 		  bits/signalfd.h bits/timerfd.h bits/epoll.h \
-		  bits/socket_type.h bits/syscall.h
+		  bits/socket_type.h bits/syscall.h sys/kexec.h
 
 tests += tst-clone
 
diff --git a/sysdeps/unix/sysv/linux/sys/kexec.h
b/sysdeps/unix/sysv/linux/sys/kexec.h
new file mode 100644
index 0000000..1f1d89d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sys/kexec.h
@@ -0,0 +1,50 @@
+/* Copyright (C) 2012 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 
+#include 
+
+/* 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 
+   __entry - memory location of the new kimage
+   __nr_segments - number of kexec_segments
+   __segments - segments to be read
+   __flags - kexec flags  */
+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
 
CD: 12ms