Add sethostname(2).
Not very useful, but helps building stuff like toybox out of the box. Change-Id: I110e39030452bd093a84278e019c5752d293718d
This commit is contained in:
		@@ -313,6 +313,8 @@ int __set_tid_address:set_tid_address(int*)  all
 | 
			
		||||
int setfsgid(gid_t)  all
 | 
			
		||||
int setfsuid(uid_t)  all
 | 
			
		||||
 | 
			
		||||
int sethostname(const char*, size_t)  all
 | 
			
		||||
 | 
			
		||||
pid_t wait4(pid_t, int*, int, struct rusage*)  all
 | 
			
		||||
int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*)  all
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								libc/arch-arm/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								libc/arch-arm/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(sethostname)
 | 
			
		||||
    mov     ip, r7
 | 
			
		||||
    ldr     r7, =__NR_sethostname
 | 
			
		||||
    swi     #0
 | 
			
		||||
    mov     r7, ip
 | 
			
		||||
    cmn     r0, #(MAX_ERRNO + 1)
 | 
			
		||||
    bxls    lr
 | 
			
		||||
    neg     r0, r0
 | 
			
		||||
    b       __set_errno_internal
 | 
			
		||||
END(sethostname)
 | 
			
		||||
							
								
								
									
										14
									
								
								libc/arch-arm64/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								libc/arch-arm64/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(sethostname)
 | 
			
		||||
    mov     x8, __NR_sethostname
 | 
			
		||||
    svc     #0
 | 
			
		||||
 | 
			
		||||
    cmn     x0, #(MAX_ERRNO + 1)
 | 
			
		||||
    cneg    x0, x0, hi
 | 
			
		||||
    b.hi    __set_errno_internal
 | 
			
		||||
 | 
			
		||||
    ret
 | 
			
		||||
END(sethostname)
 | 
			
		||||
							
								
								
									
										19
									
								
								libc/arch-mips/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								libc/arch-mips/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(sethostname)
 | 
			
		||||
    .set noreorder
 | 
			
		||||
    .cpload t9
 | 
			
		||||
    li v0, __NR_sethostname
 | 
			
		||||
    syscall
 | 
			
		||||
    bnez a3, 1f
 | 
			
		||||
    move a0, v0
 | 
			
		||||
    j ra
 | 
			
		||||
    nop
 | 
			
		||||
1:
 | 
			
		||||
    la t9,__set_errno_internal
 | 
			
		||||
    j t9
 | 
			
		||||
    nop
 | 
			
		||||
    .set reorder
 | 
			
		||||
END(sethostname)
 | 
			
		||||
							
								
								
									
										25
									
								
								libc/arch-mips64/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								libc/arch-mips64/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(sethostname)
 | 
			
		||||
    .set push
 | 
			
		||||
    .set noreorder
 | 
			
		||||
    li v0, __NR_sethostname
 | 
			
		||||
    syscall
 | 
			
		||||
    bnez a3, 1f
 | 
			
		||||
    move a0, v0
 | 
			
		||||
    j ra
 | 
			
		||||
    nop
 | 
			
		||||
1:
 | 
			
		||||
    move t0, ra
 | 
			
		||||
    bal     2f
 | 
			
		||||
    nop
 | 
			
		||||
2:
 | 
			
		||||
    .cpsetup ra, t1, 2b
 | 
			
		||||
    LA t9,__set_errno_internal
 | 
			
		||||
    .cpreturn
 | 
			
		||||
    j t9
 | 
			
		||||
    move ra, t0
 | 
			
		||||
    .set pop
 | 
			
		||||
END(sethostname)
 | 
			
		||||
							
								
								
									
										26
									
								
								libc/arch-x86/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								libc/arch-x86/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(sethostname)
 | 
			
		||||
    pushl   %ebx
 | 
			
		||||
    .cfi_def_cfa_offset 8
 | 
			
		||||
    .cfi_rel_offset ebx, 0
 | 
			
		||||
    pushl   %ecx
 | 
			
		||||
    .cfi_adjust_cfa_offset 4
 | 
			
		||||
    .cfi_rel_offset ecx, 0
 | 
			
		||||
    mov     12(%esp), %ebx
 | 
			
		||||
    mov     16(%esp), %ecx
 | 
			
		||||
    movl    $__NR_sethostname, %eax
 | 
			
		||||
    int     $0x80
 | 
			
		||||
    cmpl    $-MAX_ERRNO, %eax
 | 
			
		||||
    jb      1f
 | 
			
		||||
    negl    %eax
 | 
			
		||||
    pushl   %eax
 | 
			
		||||
    call    __set_errno_internal
 | 
			
		||||
    addl    $4, %esp
 | 
			
		||||
1:
 | 
			
		||||
    popl    %ecx
 | 
			
		||||
    popl    %ebx
 | 
			
		||||
    ret
 | 
			
		||||
END(sethostname)
 | 
			
		||||
							
								
								
									
										15
									
								
								libc/arch-x86_64/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								libc/arch-x86_64/syscalls/sethostname.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
/* Generated by gensyscalls.py. Do not edit. */
 | 
			
		||||
 | 
			
		||||
#include <private/bionic_asm.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(sethostname)
 | 
			
		||||
    movl    $__NR_sethostname, %eax
 | 
			
		||||
    syscall
 | 
			
		||||
    cmpq    $-MAX_ERRNO, %rax
 | 
			
		||||
    jb      1f
 | 
			
		||||
    negl    %eax
 | 
			
		||||
    movl    %eax, %edi
 | 
			
		||||
    call    __set_errno_internal
 | 
			
		||||
1:
 | 
			
		||||
    ret
 | 
			
		||||
END(sethostname)
 | 
			
		||||
@@ -183,7 +183,8 @@ extern unsigned int alarm(unsigned int);
 | 
			
		||||
extern unsigned int sleep(unsigned int);
 | 
			
		||||
extern int usleep(useconds_t);
 | 
			
		||||
 | 
			
		||||
extern int gethostname(char *, size_t);
 | 
			
		||||
int gethostname(char*, size_t);
 | 
			
		||||
int sethostname(const char*, size_t);
 | 
			
		||||
 | 
			
		||||
extern void *__brk(void *);
 | 
			
		||||
extern int brk(void *);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user