qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] linux-user: syscall: Add SO_LINGER for setsocko


From: Chen Gang
Subject: Re: [Qemu-devel] [PATCH] linux-user: syscall: Add SO_LINGER for setsockopt
Date: Fri, 8 Jan 2016 17:45:59 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

On 2016年01月08日 16:38, Laurent Vivier wrote:
> 
>> +            if (!lock_user_struct(VERIFY_READ, tlg, optval_addr, 1)) {
>> +                return -TARGET_EFAULT;
>> +            }
>> +            __get_user(lg.l_onoff, &tlg->l_onoff);
>> +            __get_user(lg.l_linger, &tlg->l_linger);
>> +            unlock_user_struct(tlg, optval_addr, 0);
> 
> You can't unlock the structure you're going to use.
> 

OK, thanks.


>> +            return get_errno(setsockopt(sockfd, SOL_SOCKET, optname,
>> +                             &lg, sizeof(lg)));
> 
> Why do you use "SOL_SOCKET" instead of "level" ?
> 

At present, level is TARGET_SOL_SOCKET, but we need SOL_SOCKET.


>> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
>> index 9d3c537..5a4d565 100644
>> --- a/linux-user/syscall_defs.h
>> +++ b/linux-user/syscall_defs.h
>> @@ -165,6 +165,11 @@ struct target_ip_mreq_source {
>>      uint32_t imr_sourceaddr;
>>  };
>>  
>> +struct target_linger {
>> +    int l_onoff;        /* Linger active                */
>> +    int l_linger;       /* How long to linger for       */
>> +};
>> +
> 
> Must be "abi_int" to force good alignment for the target.
> 

OK, thanks.


-- 
Chen Gang (陈刚)

Open, share, and attitude like air, water, and life which God blessed



reply via email to

[Prev in Thread] Current Thread [Next in Thread]