Compare commits
	
		
			27 Commits
		
	
	
		
			android-4.
			...
			ics-mr1-re
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					3d11bf0f3f | ||
| 
						 | 
					e8e1efeafb | ||
| 
						 | 
					43828aa3a7 | ||
| 
						 | 
					f44de270bb | ||
| 
						 | 
					ecd0e95a02 | ||
| 
						 | 
					caf08f71b8 | ||
| 
						 | 
					94963af28e | ||
| 
						 | 
					132b3adfcc | ||
| 
						 | 
					bba5c314b2 | ||
| 
						 | 
					a89c28b091 | ||
| 
						 | 
					0d9f87a3b7 | ||
| 
						 | 
					d717f5170f | ||
| 
						 | 
					b0641d4a44 | ||
| 
						 | 
					df331f5f9b | ||
| 
						 | 
					487b613e57 | ||
| 
						 | 
					bf8f6bb820 | ||
| 
						 | 
					cd17f88010 | ||
| 
						 | 
					c902908999 | ||
| 
						 | 
					0c7245213d | ||
| 
						 | 
					d98f3e9f71 | ||
| 
						 | 
					6e47ab1345 | ||
| 
						 | 
					ae25dc08c1 | ||
| 
						 | 
					6ce10804d5 | ||
| 
						 | 
					81a6894b0a | ||
| 
						 | 
					94387eae69 | ||
| 
						 | 
					918ad3ecfd | ||
| 
						 | 
					fd3fc8bd27 | 
@@ -251,6 +251,7 @@ int     init_module(void *, unsigned long, const char *)  128
 | 
			
		||||
int     delete_module(const char*, unsigned int)   129
 | 
			
		||||
int     klogctl:syslog(int, char *, int)   103
 | 
			
		||||
int     sysinfo(struct sysinfo *)  116
 | 
			
		||||
int     personality(unsigned long)  136
 | 
			
		||||
 | 
			
		||||
# futex
 | 
			
		||||
int	futex(void *, int, int, void *, void *, int) 240
 | 
			
		||||
 
 | 
			
		||||
@@ -37,16 +37,10 @@
 | 
			
		||||
	.eabi_attribute 26, 2
 | 
			
		||||
	.eabi_attribute 30, 4
 | 
			
		||||
	.eabi_attribute 18, 4
 | 
			
		||||
	.code	16
 | 
			
		||||
	.section	.text.atexit,"ax",%progbits
 | 
			
		||||
	.align	2
 | 
			
		||||
	.global	atexit
 | 
			
		||||
	.hidden	atexit
 | 
			
		||||
	.code	16
 | 
			
		||||
	.thumb_func
 | 
			
		||||
	.type	atexit, %function
 | 
			
		||||
atexit:
 | 
			
		||||
	.fnstart
 | 
			
		||||
ENTRY(atexit)
 | 
			
		||||
.LFB0:
 | 
			
		||||
	.save	{r4, lr}
 | 
			
		||||
	push	{r4, lr}
 | 
			
		||||
@@ -64,6 +58,5 @@ atexit:
 | 
			
		||||
.L3:
 | 
			
		||||
	.word	__dso_handle-(.LPIC0+4)
 | 
			
		||||
.LFE0:
 | 
			
		||||
	.fnend
 | 
			
		||||
	.size	atexit, .-atexit
 | 
			
		||||
END(atexit)
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -34,16 +34,11 @@
 | 
			
		||||
        .text
 | 
			
		||||
        .fpu    neon
 | 
			
		||||
 | 
			
		||||
        .global memcpy
 | 
			
		||||
        .type memcpy, %function
 | 
			
		||||
        .align 4
 | 
			
		||||
 | 
			
		||||
/* a prefetch distance of 4 cache-lines works best experimentally */
 | 
			
		||||
#define CACHE_LINE_SIZE     64
 | 
			
		||||
#define PREFETCH_DISTANCE   (CACHE_LINE_SIZE*4)
 | 
			
		||||
 | 
			
		||||
memcpy:
 | 
			
		||||
        .fnstart
 | 
			
		||||
ENTRY(memcpy)
 | 
			
		||||
        .save       {r0, lr}
 | 
			
		||||
        stmfd       sp!, {r0, lr}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -28,13 +28,10 @@
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <machine/cpu-features.h>
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
 | 
			
		||||
	.text
 | 
			
		||||
 | 
			
		||||
	.global strcmp
 | 
			
		||||
	.type strcmp, %function
 | 
			
		||||
	.align 4
 | 
			
		||||
 | 
			
		||||
#ifdef __ARMEB__
 | 
			
		||||
#define SHFT2LSB lsl
 | 
			
		||||
#define SHFT2LSBEQ lsleq
 | 
			
		||||
@@ -54,8 +51,7 @@
 | 
			
		||||
#define magic1(REG) REG
 | 
			
		||||
#define magic2(REG) REG, lsl #7
 | 
			
		||||
 | 
			
		||||
strcmp:
 | 
			
		||||
	.fnstart
 | 
			
		||||
ENTRY(strcmp)
 | 
			
		||||
	PLD(r0, #0)
 | 
			
		||||
	PLD(r1, #0)
 | 
			
		||||
	eor	r2, r0, r1
 | 
			
		||||
@@ -136,7 +132,6 @@ strcmp:
 | 
			
		||||
#endif
 | 
			
		||||
	ldr	r4, [sp], #4
 | 
			
		||||
	bx	lr
 | 
			
		||||
	.fnend
 | 
			
		||||
 | 
			
		||||
.Lstrcmp_unaligned:
 | 
			
		||||
	wp1 .req r0
 | 
			
		||||
@@ -319,3 +314,4 @@ strcmp:
 | 
			
		||||
	ldr	r4, [sp], #4
 | 
			
		||||
	ldr	r5, [sp], #4
 | 
			
		||||
	bx	lr
 | 
			
		||||
END(strcmp)
 | 
			
		||||
 
 | 
			
		||||
@@ -169,6 +169,7 @@ syscall_src += arch-arm/syscalls/init_module.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/delete_module.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/klogctl.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/sysinfo.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/personality.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/futex.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/epoll_create.S
 | 
			
		||||
syscall_src += arch-arm/syscalls/epoll_ctl.S
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								libc/arch-arm/syscalls/personality.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								libc/arch-arm/syscalls/personality.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <machine/asm.h>
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
ENTRY(personality)
 | 
			
		||||
    .save   {r4, r7}
 | 
			
		||||
    stmfd   sp!, {r4, r7}
 | 
			
		||||
    ldr     r7, =__NR_personality
 | 
			
		||||
    swi     #0
 | 
			
		||||
    ldmfd   sp!, {r4, r7}
 | 
			
		||||
    movs    r0, r0
 | 
			
		||||
    bxpl    lr
 | 
			
		||||
    b       __set_syscall_errno
 | 
			
		||||
END(personality)
 | 
			
		||||
@@ -158,6 +158,7 @@ syscall_src += arch-sh/syscalls/init_module.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/delete_module.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/klogctl.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/sysinfo.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/personality.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/futex.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/epoll_create.S
 | 
			
		||||
syscall_src += arch-sh/syscalls/epoll_ctl.S
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										32
									
								
								libc/arch-sh/syscalls/personality.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								libc/arch-sh/syscalls/personality.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
    .text
 | 
			
		||||
    .type personality, @function
 | 
			
		||||
    .globl personality
 | 
			
		||||
    .align 4
 | 
			
		||||
 | 
			
		||||
personality:
 | 
			
		||||
 | 
			
		||||
    /* invoke trap */
 | 
			
		||||
    mov.l   0f, r3  /* trap num */
 | 
			
		||||
    trapa   #(1 + 0x10)
 | 
			
		||||
 | 
			
		||||
    /* check return value */
 | 
			
		||||
    cmp/pz  r0
 | 
			
		||||
    bt      __NR_personality_end
 | 
			
		||||
 | 
			
		||||
    /* keep error number */
 | 
			
		||||
    sts.l   pr, @-r15
 | 
			
		||||
    mov.l   1f, r1
 | 
			
		||||
    jsr     @r1
 | 
			
		||||
    mov     r0, r4
 | 
			
		||||
    lds.l   @r15+, pr
 | 
			
		||||
 | 
			
		||||
__NR_personality_end:
 | 
			
		||||
    rts
 | 
			
		||||
    nop
 | 
			
		||||
 | 
			
		||||
    .align  2
 | 
			
		||||
0:  .long   __NR_personality
 | 
			
		||||
1:  .long   __set_syscall_errno
 | 
			
		||||
@@ -172,6 +172,7 @@ syscall_src += arch-x86/syscalls/init_module.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/delete_module.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/klogctl.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/sysinfo.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/personality.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/futex.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/epoll_create.S
 | 
			
		||||
syscall_src += arch-x86/syscalls/epoll_ctl.S
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								libc/arch-x86/syscalls/personality.S
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								libc/arch-x86/syscalls/personality.S
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
/* autogenerated by gensyscalls.py */
 | 
			
		||||
#include <sys/linux-syscalls.h>
 | 
			
		||||
 | 
			
		||||
    .text
 | 
			
		||||
    .type personality, @function
 | 
			
		||||
    .globl personality
 | 
			
		||||
    .align 4
 | 
			
		||||
 | 
			
		||||
personality:
 | 
			
		||||
    pushl   %ebx
 | 
			
		||||
    mov     8(%esp), %ebx
 | 
			
		||||
    movl    $__NR_personality, %eax
 | 
			
		||||
    int     $0x80
 | 
			
		||||
    cmpl    $-129, %eax
 | 
			
		||||
    jb      1f
 | 
			
		||||
    negl    %eax
 | 
			
		||||
    pushl   %eax
 | 
			
		||||
    call    __set_errno
 | 
			
		||||
    addl    $4, %esp
 | 
			
		||||
    orl     $-1, %eax
 | 
			
		||||
1:
 | 
			
		||||
    popl    %ebx
 | 
			
		||||
    ret
 | 
			
		||||
@@ -132,6 +132,7 @@
 | 
			
		||||
#define __NR_delete_module                (__NR_SYSCALL_BASE + 129)
 | 
			
		||||
#define __NR_syslog                       (__NR_SYSCALL_BASE + 103)
 | 
			
		||||
#define __NR_sysinfo                      (__NR_SYSCALL_BASE + 116)
 | 
			
		||||
#define __NR_personality                  (__NR_SYSCALL_BASE + 136)
 | 
			
		||||
#define __NR_futex                        (__NR_SYSCALL_BASE + 240)
 | 
			
		||||
#define __NR_poll                         (__NR_SYSCALL_BASE + 168)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -199,6 +199,7 @@ int              init_module (void *, unsigned long, const char *);
 | 
			
		||||
int              delete_module (const char*, unsigned int);
 | 
			
		||||
int              klogctl (int, char *, int);
 | 
			
		||||
int              sysinfo (struct sysinfo *);
 | 
			
		||||
int              personality (unsigned long);
 | 
			
		||||
int              futex (void *, int, int, void *, void *, int);
 | 
			
		||||
int              epoll_create (int size);
 | 
			
		||||
int              epoll_ctl (int epfd, int op, int fd, struct epoll_event *event);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										86
									
								
								libc/include/sys/personality.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								libc/include/sys/personality.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (C) 2012 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_PERSONALITY_H_
 | 
			
		||||
#define _SYS_PERSONALITY_H_
 | 
			
		||||
 | 
			
		||||
__BEGIN_DECLS
 | 
			
		||||
 | 
			
		||||
/* constants taken from linux-3.0.4/include/linux/personality.h */
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
        UNAME26 =               0x0020000,
 | 
			
		||||
        ADDR_NO_RANDOMIZE =     0x0040000,
 | 
			
		||||
        FDPIC_FUNCPTRS =        0x0080000,
 | 
			
		||||
        MMAP_PAGE_ZERO =        0x0100000,
 | 
			
		||||
        ADDR_COMPAT_LAYOUT =    0x0200000,
 | 
			
		||||
        READ_IMPLIES_EXEC =     0x0400000,
 | 
			
		||||
        ADDR_LIMIT_32BIT =      0x0800000,
 | 
			
		||||
        SHORT_INODE =           0x1000000,
 | 
			
		||||
        WHOLE_SECONDS =         0x2000000,
 | 
			
		||||
        STICKY_TIMEOUTS =       0x4000000,
 | 
			
		||||
        ADDR_LIMIT_3GB =        0x8000000,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC  | \
 | 
			
		||||
                            ADDR_NO_RANDOMIZE  | \
 | 
			
		||||
                            ADDR_COMPAT_LAYOUT | \
 | 
			
		||||
                            MMAP_PAGE_ZERO)
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
        PER_LINUX =             0x0000,
 | 
			
		||||
        PER_LINUX_32BIT =       0x0000 | ADDR_LIMIT_32BIT,
 | 
			
		||||
        PER_LINUX_FDPIC =       0x0000 | FDPIC_FUNCPTRS,
 | 
			
		||||
        PER_SVR4 =              0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
 | 
			
		||||
        PER_SVR3 =              0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
 | 
			
		||||
        PER_SCOSVR3 =           0x0003 | STICKY_TIMEOUTS |
 | 
			
		||||
                                         WHOLE_SECONDS | SHORT_INODE,
 | 
			
		||||
        PER_OSR5 =              0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
 | 
			
		||||
        PER_WYSEV386 =          0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
 | 
			
		||||
        PER_ISCR4 =             0x0005 | STICKY_TIMEOUTS,
 | 
			
		||||
        PER_BSD =               0x0006,
 | 
			
		||||
        PER_SUNOS =             0x0006 | STICKY_TIMEOUTS,
 | 
			
		||||
        PER_XENIX =             0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
 | 
			
		||||
        PER_LINUX32 =           0x0008,
 | 
			
		||||
        PER_LINUX32_3GB =       0x0008 | ADDR_LIMIT_3GB,
 | 
			
		||||
        PER_IRIX32 =            0x0009 | STICKY_TIMEOUTS,
 | 
			
		||||
        PER_IRIXN32 =           0x000a | STICKY_TIMEOUTS,
 | 
			
		||||
        PER_IRIX64 =            0x000b | STICKY_TIMEOUTS,
 | 
			
		||||
        PER_RISCOS =            0x000c,
 | 
			
		||||
        PER_SOLARIS =           0x000d | STICKY_TIMEOUTS,
 | 
			
		||||
        PER_UW7 =               0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
 | 
			
		||||
        PER_OSF4 =              0x000f,
 | 
			
		||||
        PER_HPUX =              0x0010,
 | 
			
		||||
        PER_MASK =              0x00ff,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern int personality (unsigned long persona);
 | 
			
		||||
 | 
			
		||||
__END_DECLS
 | 
			
		||||
 | 
			
		||||
#endif /* _SYS_PERSONALITY_H_ */
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
#ifndef __SOC2030_H__
 | 
			
		||||
#define __SOC2030_H__
 | 
			
		||||
 | 
			
		||||
#include <linux/ioctl.h>  
 | 
			
		||||
#include <linux/ioctl.h>
 | 
			
		||||
 | 
			
		||||
#define SOC2030_IOCTL_SET_MODE _IOWR('o', 1, struct soc2030_mode)
 | 
			
		||||
#define SOC2030_IOCTL_GET_STATUS _IOC(_IOC_READ, 'o', 2, 10)
 | 
			
		||||
@@ -22,10 +22,11 @@
 | 
			
		||||
#define SOC2030_IOCTL_SET_EFFECT _IOWR('o', 6, unsigned int)
 | 
			
		||||
#define SOC2030_IOCTL_SET_WHITEBALANCE _IOWR('o', 7, unsigned int)
 | 
			
		||||
#define SOC2030_IOCTL_SET_EXP_COMP _IOWR('o', 8, int)
 | 
			
		||||
#define SOC2030_IOCTL_SET_LOCK _IOWR('o', 9, struct soc2030_lock)
 | 
			
		||||
 | 
			
		||||
#define SOC2030_POLL_WAITMS 50
 | 
			
		||||
#define SOC2030_MAX_RETRIES 3
 | 
			
		||||
#define SOC2030_POLL_RETRIES 5
 | 
			
		||||
#define SOC2030_POLL_RETRIES 7
 | 
			
		||||
 | 
			
		||||
#define SOC2030_MAX_PRIVATE_SIZE 1024
 | 
			
		||||
#define SOC2030_MAX_NUM_MODES 6
 | 
			
		||||
@@ -45,8 +46,21 @@ enum {
 | 
			
		||||
 WRITE_VAR_DATA,
 | 
			
		||||
 POLL_VAR_DATA,
 | 
			
		||||
 DELAY_MS,
 | 
			
		||||
 WRITE_REG_VAR1,
 | 
			
		||||
 WRITE_REG_VAR2,
 | 
			
		||||
 WRITE_REG_VAR3,
 | 
			
		||||
 WRITE_REG_VAR4,
 | 
			
		||||
 READ_REG_VAR1,
 | 
			
		||||
 READ_REG_VAR2,
 | 
			
		||||
 READ_REG_VAR3,
 | 
			
		||||
 READ_REG_VAR4,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define REG_VAR1 (READ_REG_VAR1 - READ_REG_VAR1)
 | 
			
		||||
#define REG_VAR2 (READ_REG_VAR2 - READ_REG_VAR1)
 | 
			
		||||
#define REG_VAR3 (READ_REG_VAR3 - READ_REG_VAR1)
 | 
			
		||||
#define REG_VAR4 (READ_REG_VAR4 - READ_REG_VAR1)
 | 
			
		||||
 | 
			
		||||
enum {
 | 
			
		||||
 EFFECT_NONE,
 | 
			
		||||
 EFFECT_BW,
 | 
			
		||||
@@ -74,6 +88,14 @@ struct soc2030_regs {
 | 
			
		||||
 __u16 val;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct soc2030_lock {
 | 
			
		||||
        __u8 aelock;
 | 
			
		||||
        __u8 aerelock;
 | 
			
		||||
        __u8 awblock;
 | 
			
		||||
        __u8 awbrelock;
 | 
			
		||||
        __u8 previewactive;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct soc2030_mode {
 | 
			
		||||
 int xres;
 | 
			
		||||
 int yres;
 | 
			
		||||
@@ -82,5 +104,3 @@ struct soc2030_mode {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -228,129 +228,145 @@ enum omapdss_buffer_type {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 OMAP_DSS_BUFTYPE_TILER_PAGE,
 | 
			
		||||
};
 | 
			
		||||
struct dss2_ovl_info {
 | 
			
		||||
 struct dss2_ovl_cfg cfg;
 | 
			
		||||
enum omapdss_buffer_addressing_type {
 | 
			
		||||
 OMAP_DSS_BUFADDR_DIRECT,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 OMAP_DSS_BUFADDR_BYTYPE,
 | 
			
		||||
 OMAP_DSS_BUFADDR_ION,
 | 
			
		||||
 OMAP_DSS_BUFADDR_GRALLOC,
 | 
			
		||||
 OMAP_DSS_BUFADDR_OVL_IX,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 OMAP_DSS_BUFADDR_LAYER_IX,
 | 
			
		||||
 OMAP_DSS_BUFADDR_FB,
 | 
			
		||||
};
 | 
			
		||||
struct dss2_ovl_info {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct dss2_ovl_cfg cfg;
 | 
			
		||||
 enum omapdss_buffer_addressing_type addressing;
 | 
			
		||||
 union {
 | 
			
		||||
 struct {
 | 
			
		||||
 void *address;
 | 
			
		||||
 __u16 ba_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u16 uv_type;
 | 
			
		||||
 void *address;
 | 
			
		||||
 void *uv_address;
 | 
			
		||||
 };
 | 
			
		||||
 struct {
 | 
			
		||||
 __u32 ba;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 enum omapdss_buffer_type ba_type;
 | 
			
		||||
 enum omapdss_buffer_type uv_type;
 | 
			
		||||
 };
 | 
			
		||||
 struct {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 ba;
 | 
			
		||||
 __u32 uv;
 | 
			
		||||
 };
 | 
			
		||||
 };
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct dss2_mgr_info {
 | 
			
		||||
 __u32 ix;
 | 
			
		||||
 __u32 default_color;
 | 
			
		||||
 enum omap_dss_trans_key_type trans_key_type;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 enum omap_dss_trans_key_type trans_key_type;
 | 
			
		||||
 __u32 trans_key;
 | 
			
		||||
 struct omap_dss_cpr_coefs cpr_coefs;
 | 
			
		||||
 __u8 trans_enabled;
 | 
			
		||||
 __u8 interlaced;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u8 interlaced;
 | 
			
		||||
 __u8 alpha_blending;
 | 
			
		||||
 __u8 cpr_enabled;
 | 
			
		||||
 __u8 swap_rb;
 | 
			
		||||
} __attribute__ ((aligned(4)));
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
} __attribute__ ((aligned(4)));
 | 
			
		||||
enum dsscomp_setup_mode {
 | 
			
		||||
 DSSCOMP_SETUP_MODE_APPLY = (1 << 0),
 | 
			
		||||
 DSSCOMP_SETUP_MODE_DISPLAY = (1 << 1),
 | 
			
		||||
 DSSCOMP_SETUP_MODE_CAPTURE = (1 << 2),
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 DSSCOMP_SETUP_MODE_CAPTURE = (1 << 2),
 | 
			
		||||
 DSSCOMP_SETUP_APPLY = DSSCOMP_SETUP_MODE_APPLY,
 | 
			
		||||
 DSSCOMP_SETUP_DISPLAY =
 | 
			
		||||
 DSSCOMP_SETUP_MODE_APPLY | DSSCOMP_SETUP_MODE_DISPLAY,
 | 
			
		||||
 DSSCOMP_SETUP_CAPTURE =
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 DSSCOMP_SETUP_CAPTURE =
 | 
			
		||||
 DSSCOMP_SETUP_MODE_APPLY | DSSCOMP_SETUP_MODE_CAPTURE,
 | 
			
		||||
 DSSCOMP_SETUP_DISPLAY_CAPTURE =
 | 
			
		||||
 DSSCOMP_SETUP_DISPLAY | DSSCOMP_SETUP_CAPTURE,
 | 
			
		||||
};
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_setup_mgr_data {
 | 
			
		||||
 __u32 sync_id;
 | 
			
		||||
 struct dss2_rect_t win;
 | 
			
		||||
 enum dsscomp_setup_mode mode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 enum dsscomp_setup_mode mode;
 | 
			
		||||
 __u16 num_ovls;
 | 
			
		||||
 __u16 get_sync_obj;
 | 
			
		||||
 struct dss2_mgr_info mgr;
 | 
			
		||||
 struct dss2_ovl_info ovls[0];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct dss2_ovl_info ovls[0];
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_check_ovl_data {
 | 
			
		||||
 enum dsscomp_setup_mode mode;
 | 
			
		||||
 struct dss2_mgr_info mgr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct dss2_mgr_info mgr;
 | 
			
		||||
 struct dss2_ovl_info ovl;
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_setup_dispc_data {
 | 
			
		||||
 __u32 sync_id;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 sync_id;
 | 
			
		||||
 enum dsscomp_setup_mode mode;
 | 
			
		||||
 __u16 num_ovls;
 | 
			
		||||
 __u16 num_mgrs;
 | 
			
		||||
 __u16 get_sync_obj;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u16 get_sync_obj;
 | 
			
		||||
 struct dss2_mgr_info mgrs[3];
 | 
			
		||||
 struct dss2_ovl_info ovls[5];
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_wb_copy_data {
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
struct dsscomp_wb_copy_data {
 | 
			
		||||
 struct dss2_ovl_info ovl, wb;
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_display_info {
 | 
			
		||||
 __u32 ix;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 ix;
 | 
			
		||||
 __u32 overlays_available;
 | 
			
		||||
 __u32 overlays_owned;
 | 
			
		||||
 enum omap_channel channel;
 | 
			
		||||
 enum omap_dss_display_state state;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 enum omap_dss_display_state state;
 | 
			
		||||
 __u8 enabled;
 | 
			
		||||
 struct omap_video_timings timings;
 | 
			
		||||
 struct s3d_disp_info s3d_info;
 | 
			
		||||
 struct dss2_mgr_info mgr;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct dss2_mgr_info mgr;
 | 
			
		||||
 __u16 width_in_mm;
 | 
			
		||||
 __u16 height_in_mm;
 | 
			
		||||
 __u32 modedb_len;
 | 
			
		||||
 struct dsscomp_videomode modedb[];
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct dsscomp_videomode modedb[];
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_setup_display_data {
 | 
			
		||||
 __u32 ix;
 | 
			
		||||
 struct dsscomp_videomode mode;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 struct dsscomp_videomode mode;
 | 
			
		||||
};
 | 
			
		||||
enum dsscomp_wait_phase {
 | 
			
		||||
 DSSCOMP_WAIT_PROGRAMMED = 1,
 | 
			
		||||
 DSSCOMP_WAIT_DISPLAYED,
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 DSSCOMP_WAIT_DISPLAYED,
 | 
			
		||||
 DSSCOMP_WAIT_RELEASED,
 | 
			
		||||
};
 | 
			
		||||
struct dsscomp_wait_data {
 | 
			
		||||
 __u32 timeout_us;
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
 __u32 timeout_us;
 | 
			
		||||
 enum dsscomp_wait_phase phase;
 | 
			
		||||
};
 | 
			
		||||
#define DSSCOMP_SETUP_MGR _IOW('O', 128, struct dsscomp_setup_mgr_data)
 | 
			
		||||
#define DSSCOMP_CHECK_OVL _IOWR('O', 129, struct dsscomp_check_ovl_data)
 | 
			
		||||
#define DSSCIOC_SETUP_MGR _IOW('O', 128, struct dsscomp_setup_mgr_data)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DSSCOMP_WB_COPY _IOW('O', 130, struct dsscomp_wb_copy_data)
 | 
			
		||||
#define DSSCOMP_QUERY_DISPLAY _IOWR('O', 131, struct dsscomp_display_info)
 | 
			
		||||
#define DSSCOMP_WAIT _IOW('O', 132, struct dsscomp_wait_data)
 | 
			
		||||
#define DSSCOMP_SETUP_DISPC _IOW('O', 133, struct dsscomp_setup_dispc_data)
 | 
			
		||||
#define DSSCIOC_CHECK_OVL _IOWR('O', 129, struct dsscomp_check_ovl_data)
 | 
			
		||||
#define DSSCIOC_WB_COPY _IOW('O', 130, struct dsscomp_wb_copy_data)
 | 
			
		||||
#define DSSCIOC_QUERY_DISPLAY _IOWR('O', 131, struct dsscomp_display_info)
 | 
			
		||||
#define DSSCIOC_WAIT _IOW('O', 132, struct dsscomp_wait_data)
 | 
			
		||||
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 | 
			
		||||
#define DSSCOMP_SETUP_DISPLAY _IOW('O', 134, struct dsscomp_setup_display_data)
 | 
			
		||||
#define DSSCIOC_SETUP_DISPC _IOW('O', 133, struct dsscomp_setup_dispc_data)
 | 
			
		||||
#define DSSCIOC_SETUP_DISPLAY _IOW('O', 134, struct dsscomp_setup_display_data)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -99,6 +99,7 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $");
 | 
			
		||||
#include <arpa/inet.h>
 | 
			
		||||
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <netdb.h>
 | 
			
		||||
#ifdef ANDROID_CHANGES
 | 
			
		||||
#include "resolv_private.h"
 | 
			
		||||
@@ -109,6 +110,7 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $");
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <time.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
#include <isc/eventlib.h>
 | 
			
		||||
@@ -117,6 +119,8 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $");
 | 
			
		||||
#  include <resolv_cache.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "logd.h"
 | 
			
		||||
 | 
			
		||||
#ifndef DE_CONST
 | 
			
		||||
#define DE_CONST(c,v)   v = ((c) ? \
 | 
			
		||||
    strchr((const void *)(c), *(const char *)(const void *)(c)) : NULL)
 | 
			
		||||
@@ -130,6 +134,7 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $");
 | 
			
		||||
#include "res_private.h"
 | 
			
		||||
 | 
			
		||||
#define EXT(res) ((res)->_u._ext)
 | 
			
		||||
#define DBG 0
 | 
			
		||||
 | 
			
		||||
static const int highestFD = FD_SETSIZE - 1;
 | 
			
		||||
 | 
			
		||||
@@ -152,7 +157,10 @@ static int		pselect(int, void *, void *, void *,
 | 
			
		||||
				const sigset_t *);
 | 
			
		||||
#endif
 | 
			
		||||
void res_pquery(const res_state, const u_char *, int, FILE *);
 | 
			
		||||
 | 
			
		||||
static int connect_with_timeout(int sock, const struct sockaddr *nsap,
 | 
			
		||||
			socklen_t salen, int sec);
 | 
			
		||||
static int retrying_select(const int sock, fd_set *readset, fd_set *writeset,
 | 
			
		||||
			const struct timespec *finish);
 | 
			
		||||
 | 
			
		||||
/* BIONIC-BEGIN: implement source port randomization */
 | 
			
		||||
typedef union {
 | 
			
		||||
@@ -521,16 +529,23 @@ res_nsend(res_state statp,
 | 
			
		||||
 | 
			
		||||
		Dprint(((statp->options & RES_DEBUG) &&
 | 
			
		||||
			getnameinfo(nsap, (socklen_t)nsaplen, abuf, sizeof(abuf),
 | 
			
		||||
				    NULL, 0, niflags) == 0),
 | 
			
		||||
		       (stdout, ";; Querying server (# %d) address = %s\n",
 | 
			
		||||
			ns + 1, abuf));
 | 
			
		||||
				NULL, 0, niflags) == 0),
 | 
			
		||||
				(stdout, ";; Querying server (# %d) address = %s\n",
 | 
			
		||||
				ns + 1, abuf));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		if (v_circuit) {
 | 
			
		||||
			/* Use VC; at most one attempt per server. */
 | 
			
		||||
			try = statp->retry;
 | 
			
		||||
 | 
			
		||||
			n = send_vc(statp, buf, buflen, ans, anssiz, &terrno,
 | 
			
		||||
				    ns);
 | 
			
		||||
 | 
			
		||||
			if (DBG) {
 | 
			
		||||
				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
					"used send_vc %d\n", n);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (n < 0)
 | 
			
		||||
				goto fail;
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
@@ -538,12 +553,26 @@ res_nsend(res_state statp,
 | 
			
		||||
			resplen = n;
 | 
			
		||||
		} else {
 | 
			
		||||
			/* Use datagrams. */
 | 
			
		||||
			if (DBG) {
 | 
			
		||||
				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
					"using send_dg\n");
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			n = send_dg(statp, buf, buflen, ans, anssiz, &terrno,
 | 
			
		||||
				    ns, &v_circuit, &gotsomewhere);
 | 
			
		||||
			if (DBG) {
 | 
			
		||||
				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
					"used send_dg %d\n",n);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (n < 0)
 | 
			
		||||
				goto fail;
 | 
			
		||||
			if (n == 0)
 | 
			
		||||
				goto next_ns;
 | 
			
		||||
			if (DBG) {
 | 
			
		||||
				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
					"time=%d, %d\n",time(NULL), time(NULL)%2);
 | 
			
		||||
			}
 | 
			
		||||
			if (v_circuit)
 | 
			
		||||
				goto same_ns;
 | 
			
		||||
			resplen = n;
 | 
			
		||||
@@ -668,6 +697,23 @@ get_nsaddr(statp, n)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int get_timeout(const res_state statp, const int ns)
 | 
			
		||||
{
 | 
			
		||||
	int timeout = (statp->retrans << ns);
 | 
			
		||||
	if (ns > 0) {
 | 
			
		||||
		timeout /= statp->nscount;
 | 
			
		||||
	}
 | 
			
		||||
	if (timeout <= 0) {
 | 
			
		||||
		timeout = 1;
 | 
			
		||||
	}
 | 
			
		||||
	if (DBG) {
 | 
			
		||||
		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
			"using timeout of %d sec\n", timeout);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return timeout;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
send_vc(res_state statp,
 | 
			
		||||
	const u_char *buf, int buflen, u_char *ans, int anssiz,
 | 
			
		||||
@@ -683,6 +729,10 @@ send_vc(res_state statp,
 | 
			
		||||
	u_char *cp;
 | 
			
		||||
	void *tmp;
 | 
			
		||||
 | 
			
		||||
	if (DBG) {
 | 
			
		||||
		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", "using send_vc\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	nsap = get_nsaddr(statp, (size_t)ns);
 | 
			
		||||
	nsaplen = get_salen(nsap);
 | 
			
		||||
 | 
			
		||||
@@ -735,7 +785,8 @@ send_vc(res_state statp,
 | 
			
		||||
			res_nclose(statp);
 | 
			
		||||
			return (0);
 | 
			
		||||
		}
 | 
			
		||||
		if (connect(statp->_vcsock, nsap, (socklen_t)nsaplen) < 0) {
 | 
			
		||||
		if (connect_with_timeout(statp->_vcsock, nsap, (socklen_t)nsaplen,
 | 
			
		||||
				get_timeout(statp, ns)) < 0) {
 | 
			
		||||
			*terrno = errno;
 | 
			
		||||
			Aerror(statp, stderr, "connect/vc", errno, nsap,
 | 
			
		||||
			    nsaplen);
 | 
			
		||||
@@ -859,6 +910,111 @@ send_vc(res_state statp,
 | 
			
		||||
	return (resplen);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* return -1 on error (errno set), 0 on success */
 | 
			
		||||
static int
 | 
			
		||||
connect_with_timeout(int sock, const struct sockaddr *nsap, socklen_t salen, int sec)
 | 
			
		||||
{
 | 
			
		||||
	int res, origflags;
 | 
			
		||||
	fd_set rset, wset;
 | 
			
		||||
	struct timespec now, timeout, finish;
 | 
			
		||||
 | 
			
		||||
	origflags = fcntl(sock, F_GETFL, 0);
 | 
			
		||||
	fcntl(sock, F_SETFL, origflags | O_NONBLOCK);
 | 
			
		||||
 | 
			
		||||
	res = connect(sock, nsap, salen);
 | 
			
		||||
	if (res < 0 && errno != EINPROGRESS) {
 | 
			
		||||
                res = -1;
 | 
			
		||||
                goto done;
 | 
			
		||||
	}
 | 
			
		||||
	if (res != 0) {
 | 
			
		||||
		now = evNowTime();
 | 
			
		||||
		timeout = evConsTime((long)sec, 0L);
 | 
			
		||||
		finish = evAddTime(now, timeout);
 | 
			
		||||
		if (DBG) {
 | 
			
		||||
			__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
				"  %d send_vc\n", sock);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		res = retrying_select(sock, &rset, &wset, &finish);
 | 
			
		||||
		if (res <= 0) {
 | 
			
		||||
                        res = -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
done:
 | 
			
		||||
	fcntl(sock, F_SETFL, origflags);
 | 
			
		||||
	if (DBG) {
 | 
			
		||||
		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
			"  %d connect_with_timeout returning %s\n", sock, res);
 | 
			
		||||
	}
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
retrying_select(const int sock, fd_set *readset, fd_set *writeset, const struct timespec *finish)
 | 
			
		||||
{
 | 
			
		||||
	struct timespec now, timeout;
 | 
			
		||||
	int n, error;
 | 
			
		||||
	socklen_t len;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
retry:
 | 
			
		||||
	if (DBG) {
 | 
			
		||||
		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", "  %d retying_select\n", sock);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	now = evNowTime();
 | 
			
		||||
	if (readset) {
 | 
			
		||||
		FD_ZERO(readset);
 | 
			
		||||
		FD_SET(sock, readset);
 | 
			
		||||
	}
 | 
			
		||||
	if (writeset) {
 | 
			
		||||
		FD_ZERO(writeset);
 | 
			
		||||
		FD_SET(sock, writeset);
 | 
			
		||||
	}
 | 
			
		||||
	if (evCmpTime(*finish, now) > 0)
 | 
			
		||||
		timeout = evSubTime(*finish, now);
 | 
			
		||||
	else
 | 
			
		||||
		timeout = evConsTime(0L, 0L);
 | 
			
		||||
 | 
			
		||||
	n = pselect(sock + 1, readset, writeset, NULL, &timeout, NULL);
 | 
			
		||||
	if (n == 0) {
 | 
			
		||||
		if (DBG) {
 | 
			
		||||
			__libc_android_log_print(ANDROID_LOG_DEBUG, " libc",
 | 
			
		||||
				"  %d retrying_select timeout\n", sock);
 | 
			
		||||
		}
 | 
			
		||||
		errno = ETIMEDOUT;
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	if (n < 0) {
 | 
			
		||||
		if (errno == EINTR)
 | 
			
		||||
			goto retry;
 | 
			
		||||
		if (DBG) {
 | 
			
		||||
			__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
				"  %d retrying_select got error %d\n",sock, n);
 | 
			
		||||
		}
 | 
			
		||||
		return n;
 | 
			
		||||
	}
 | 
			
		||||
	if ((readset && FD_ISSET(sock, readset)) || (writeset && FD_ISSET(sock, writeset))) {
 | 
			
		||||
		len = sizeof(error);
 | 
			
		||||
		if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &len) < 0 || error) {
 | 
			
		||||
			errno = error;
 | 
			
		||||
			if (DBG) {
 | 
			
		||||
				__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
					"  %d retrying_select dot error2 %d\n", sock, errno);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (DBG) {
 | 
			
		||||
		__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
 | 
			
		||||
			"  %d retrying_select returning %d for %d\n",sock, n);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
send_dg(res_state statp,
 | 
			
		||||
	const u_char *buf, int buflen, u_char *ans, int anssiz,
 | 
			
		||||
@@ -944,33 +1100,19 @@ send_dg(res_state statp,
 | 
			
		||||
	/*
 | 
			
		||||
	 * Wait for reply.
 | 
			
		||||
	 */
 | 
			
		||||
	seconds = (statp->retrans << ns);
 | 
			
		||||
	if (ns > 0)
 | 
			
		||||
		seconds /= statp->nscount;
 | 
			
		||||
	if (seconds <= 0)
 | 
			
		||||
		seconds = 1;
 | 
			
		||||
	seconds = get_timeout(statp, ns);
 | 
			
		||||
	now = evNowTime();
 | 
			
		||||
	timeout = evConsTime((long)seconds, 0L);
 | 
			
		||||
	finish = evAddTime(now, timeout);
 | 
			
		||||
	goto nonow;
 | 
			
		||||
 wait:
 | 
			
		||||
	now = evNowTime();
 | 
			
		||||
 nonow:
 | 
			
		||||
	FD_ZERO(&dsmask);
 | 
			
		||||
	FD_SET(s, &dsmask);
 | 
			
		||||
	if (evCmpTime(finish, now) > 0)
 | 
			
		||||
		timeout = evSubTime(finish, now);
 | 
			
		||||
	else
 | 
			
		||||
		timeout = evConsTime(0L, 0L);
 | 
			
		||||
	n = pselect(s + 1, &dsmask, NULL, NULL, &timeout, NULL);
 | 
			
		||||
retry:
 | 
			
		||||
	n = retrying_select(s, &dsmask, NULL, &finish);
 | 
			
		||||
 | 
			
		||||
	if (n == 0) {
 | 
			
		||||
		Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n"));
 | 
			
		||||
		*gotsomewhere = 1;
 | 
			
		||||
		return (0);
 | 
			
		||||
	}
 | 
			
		||||
	if (n < 0) {
 | 
			
		||||
		if (errno == EINTR)
 | 
			
		||||
			goto wait;
 | 
			
		||||
		Perror(statp, stderr, "select", errno);
 | 
			
		||||
		res_nclose(statp);
 | 
			
		||||
		return (0);
 | 
			
		||||
@@ -1006,7 +1148,7 @@ send_dg(res_state statp,
 | 
			
		||||
			(statp->pfcode & RES_PRF_REPLY),
 | 
			
		||||
			(stdout, ";; old answer:\n"),
 | 
			
		||||
			ans, (resplen > anssiz) ? anssiz : resplen);
 | 
			
		||||
		goto wait;
 | 
			
		||||
		goto retry;
 | 
			
		||||
	}
 | 
			
		||||
	if (!(statp->options & RES_INSECURE1) &&
 | 
			
		||||
	    !res_ourserver_p(statp, (struct sockaddr *)(void *)&from)) {
 | 
			
		||||
@@ -1019,7 +1161,7 @@ send_dg(res_state statp,
 | 
			
		||||
			(statp->pfcode & RES_PRF_REPLY),
 | 
			
		||||
			(stdout, ";; not our server:\n"),
 | 
			
		||||
			ans, (resplen > anssiz) ? anssiz : resplen);
 | 
			
		||||
		goto wait;
 | 
			
		||||
		goto retry;
 | 
			
		||||
	}
 | 
			
		||||
#ifdef RES_USE_EDNS0
 | 
			
		||||
	if (anhp->rcode == FORMERR && (statp->options & RES_USE_EDNS0) != 0U) {
 | 
			
		||||
@@ -1049,7 +1191,7 @@ send_dg(res_state statp,
 | 
			
		||||
			(statp->pfcode & RES_PRF_REPLY),
 | 
			
		||||
			(stdout, ";; wrong query name:\n"),
 | 
			
		||||
			ans, (resplen > anssiz) ? anssiz : resplen);
 | 
			
		||||
		goto wait;
 | 
			
		||||
		goto retry;;
 | 
			
		||||
	}
 | 
			
		||||
	if (anhp->rcode == SERVFAIL ||
 | 
			
		||||
	    anhp->rcode == NOTIMP ||
 | 
			
		||||
 
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1 +1 @@
 | 
			
		||||
2011l
 | 
			
		||||
2011n
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user