libc: add swapon and swapoff syscalls
Change-Id: Ie79dc8e3f2ff1cd427dd6d95e3850920c4b407b0 Signed-off-by: Rom Lemarchand <romlem@google.com>
This commit is contained in:
parent
7d624e9aff
commit
d206b560e7
@ -201,6 +201,8 @@ int removexattr(const char *, const char *) 1
|
||||
int lremovexattr(const char *, const char *) 1
|
||||
int __statfs64:statfs64(const char *, size_t, struct statfs *) 1
|
||||
long unshare(unsigned long) 1
|
||||
int swapon(const char *, int) 1
|
||||
int swapoff(const char *) 1
|
||||
|
||||
# time
|
||||
int pause () 1
|
||||
|
@ -126,6 +126,8 @@ syscall_src += arch-arm/syscalls/removexattr.S
|
||||
syscall_src += arch-arm/syscalls/lremovexattr.S
|
||||
syscall_src += arch-arm/syscalls/__statfs64.S
|
||||
syscall_src += arch-arm/syscalls/unshare.S
|
||||
syscall_src += arch-arm/syscalls/swapon.S
|
||||
syscall_src += arch-arm/syscalls/swapoff.S
|
||||
syscall_src += arch-arm/syscalls/pause.S
|
||||
syscall_src += arch-arm/syscalls/gettimeofday.S
|
||||
syscall_src += arch-arm/syscalls/settimeofday.S
|
||||
|
15
libc/arch-arm/syscalls/swapoff.S
Normal file
15
libc/arch-arm/syscalls/swapoff.S
Normal file
@ -0,0 +1,15 @@
|
||||
/* autogenerated by gensyscalls.py */
|
||||
#include <asm/unistd.h>
|
||||
#include <linux/err.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(swapoff)
|
||||
mov ip, r7
|
||||
ldr r7, =__NR_swapoff
|
||||
swi #0
|
||||
mov r7, ip
|
||||
cmn r0, #(MAX_ERRNO + 1)
|
||||
bxls lr
|
||||
neg r0, r0
|
||||
b __set_errno
|
||||
END(swapoff)
|
15
libc/arch-arm/syscalls/swapon.S
Normal file
15
libc/arch-arm/syscalls/swapon.S
Normal file
@ -0,0 +1,15 @@
|
||||
/* autogenerated by gensyscalls.py */
|
||||
#include <asm/unistd.h>
|
||||
#include <linux/err.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(swapon)
|
||||
mov ip, r7
|
||||
ldr r7, =__NR_swapon
|
||||
swi #0
|
||||
mov r7, ip
|
||||
cmn r0, #(MAX_ERRNO + 1)
|
||||
bxls lr
|
||||
neg r0, r0
|
||||
b __set_errno
|
||||
END(swapon)
|
@ -129,6 +129,8 @@ syscall_src += arch-mips/syscalls/removexattr.S
|
||||
syscall_src += arch-mips/syscalls/lremovexattr.S
|
||||
syscall_src += arch-mips/syscalls/__statfs64.S
|
||||
syscall_src += arch-mips/syscalls/unshare.S
|
||||
syscall_src += arch-mips/syscalls/swapon.S
|
||||
syscall_src += arch-mips/syscalls/swapoff.S
|
||||
syscall_src += arch-mips/syscalls/pause.S
|
||||
syscall_src += arch-mips/syscalls/gettimeofday.S
|
||||
syscall_src += arch-mips/syscalls/settimeofday.S
|
||||
|
22
libc/arch-mips/syscalls/swapoff.S
Normal file
22
libc/arch-mips/syscalls/swapoff.S
Normal file
@ -0,0 +1,22 @@
|
||||
/* autogenerated by gensyscalls.py */
|
||||
#include <asm/unistd.h>
|
||||
.text
|
||||
.globl swapoff
|
||||
.align 4
|
||||
.ent swapoff
|
||||
|
||||
swapoff:
|
||||
.set noreorder
|
||||
.cpload $t9
|
||||
li $v0, __NR_swapoff
|
||||
syscall
|
||||
bnez $a3, 1f
|
||||
move $a0, $v0
|
||||
j $ra
|
||||
nop
|
||||
1:
|
||||
la $t9,__set_errno
|
||||
j $t9
|
||||
nop
|
||||
.set reorder
|
||||
.end swapoff
|
22
libc/arch-mips/syscalls/swapon.S
Normal file
22
libc/arch-mips/syscalls/swapon.S
Normal file
@ -0,0 +1,22 @@
|
||||
/* autogenerated by gensyscalls.py */
|
||||
#include <asm/unistd.h>
|
||||
.text
|
||||
.globl swapon
|
||||
.align 4
|
||||
.ent swapon
|
||||
|
||||
swapon:
|
||||
.set noreorder
|
||||
.cpload $t9
|
||||
li $v0, __NR_swapon
|
||||
syscall
|
||||
bnez $a3, 1f
|
||||
move $a0, $v0
|
||||
j $ra
|
||||
nop
|
||||
1:
|
||||
la $t9,__set_errno
|
||||
j $t9
|
||||
nop
|
||||
.set reorder
|
||||
.end swapon
|
@ -130,6 +130,8 @@ syscall_src += arch-x86/syscalls/removexattr.S
|
||||
syscall_src += arch-x86/syscalls/lremovexattr.S
|
||||
syscall_src += arch-x86/syscalls/__statfs64.S
|
||||
syscall_src += arch-x86/syscalls/unshare.S
|
||||
syscall_src += arch-x86/syscalls/swapon.S
|
||||
syscall_src += arch-x86/syscalls/swapoff.S
|
||||
syscall_src += arch-x86/syscalls/pause.S
|
||||
syscall_src += arch-x86/syscalls/gettimeofday.S
|
||||
syscall_src += arch-x86/syscalls/settimeofday.S
|
||||
|
21
libc/arch-x86/syscalls/swapoff.S
Normal file
21
libc/arch-x86/syscalls/swapoff.S
Normal file
@ -0,0 +1,21 @@
|
||||
/* autogenerated by gensyscalls.py */
|
||||
#include <linux/err.h>
|
||||
#include <machine/asm.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
ENTRY(swapoff)
|
||||
pushl %ebx
|
||||
mov 8(%esp), %ebx
|
||||
movl $__NR_swapoff, %eax
|
||||
int $0x80
|
||||
cmpl $-MAX_ERRNO, %eax
|
||||
jb 1f
|
||||
negl %eax
|
||||
pushl %eax
|
||||
call __set_errno
|
||||
addl $4, %esp
|
||||
orl $-1, %eax
|
||||
1:
|
||||
popl %ebx
|
||||
ret
|
||||
END(swapoff)
|
24
libc/arch-x86/syscalls/swapon.S
Normal file
24
libc/arch-x86/syscalls/swapon.S
Normal file
@ -0,0 +1,24 @@
|
||||
/* autogenerated by gensyscalls.py */
|
||||
#include <linux/err.h>
|
||||
#include <machine/asm.h>
|
||||
#include <asm/unistd.h>
|
||||
|
||||
ENTRY(swapon)
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
mov 12(%esp), %ebx
|
||||
mov 16(%esp), %ecx
|
||||
movl $__NR_swapon, %eax
|
||||
int $0x80
|
||||
cmpl $-MAX_ERRNO, %eax
|
||||
jb 1f
|
||||
negl %eax
|
||||
pushl %eax
|
||||
call __set_errno
|
||||
addl $4, %esp
|
||||
orl $-1, %eax
|
||||
1:
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
END(swapon)
|
41
libc/include/sys/swap.h
Normal file
41
libc/include/sys/swap.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SWAP_H_
|
||||
#define _SYS_SWAP_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern int swapon(const char *, int) __attribute__((__nonnull__(1)));
|
||||
extern int swapoff(const char *) __attribute__((__nonnull__(1)));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_SWAP_H_ */
|
Loading…
Reference in New Issue
Block a user