mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: add KexecFileLoad on linux/{amd64,ppc64x,s390x}
Add a wrapper for the kexec_file_load syscall on the architectures that implement it (amd64, ppc64x, s390x). See http://man7.org/linux/man-pages/man2/kexec_file_load.2.html Change-Id: Ie29f871902176610a6ba7ed0a7bcc95c10eb172b Reviewed-on: https://go-review.googlesource.com/c/140037 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
8469e31483
commit
f81de40a84
@@ -160,3 +160,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
}
|
||||
return poll(&fds[0], len(fds), timeout)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
cmdlineLen := len(cmdline)
|
||||
if cmdlineLen > 0 {
|
||||
// Account for the additional NULL byte added by
|
||||
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||
// syscall expects a NULL-terminated string.
|
||||
cmdlineLen++
|
||||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user