On 07/24/2012 02:18 PM, Caspar Zhang wrote:
> On 07/24/2012 12:02 PM, Wanlong Gao wrote:
>> On 07/24/2012 11:49 AM, Caspar Zhang wrote:
>>> On 07/24/2012 10:58 AM, Wanlong Gao wrote:
>>>> Wait for aio_write() completion.
>>>> If aio_fsync() sync the fd without the previous aio_write()
>>>> completion, it will cause Segment Fault.
>>>>
>>>> Signed-off-by: Wanlong Gao <[email protected]>
>>>> ---
>>>>    .../open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c | 9 
>>>> +++++++++
>>>>    1 file changed, 9 insertions(+)
>>>>
>>>> diff --git 
>>>> a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c 
>>>> b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c
>>>> index a9cd3bf..e15f084 100644
>>>> --- 
>>>> a/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c
>>>> +++ 
>>>> b/testcases/open_posix_testsuite/conformance/interfaces/aio_fsync/14-1.c
>>>> @@ -27,6 +27,7 @@ int main()
>>>>    #define BUF_SIZE 111
>>>>        char buf[BUF_SIZE];
>>>>        int fd;
>>>> +    int ret;
>>>>        struct aiocb aiocb_write;
>>>>        struct aiocb aiocb_fsync;
>>>>
>>>> @@ -57,6 +58,14 @@ int main()
>>>>            exit(PTS_FAIL);
>>>>        }
>>>>
>>>> +    while ((ret = aio_error(&aiocb_write) == EINPROGRESS))
>>>
>>> I think checkpatch.pl would complain here.
>>
>> Not really.
> 
> OK, I looked into checkpatch.pl code, seems it only report errors for 
> assignment in if-conditions. Now I'm OK for it. (yet splitting into two lines 
> in do..while() loop would surely make the code more clear.)
> 

Thank you, I sent V2 to split it to do{}while.

Wanlong Gao

> Caspar
> 
>> It should be assigned in while() here, can't be split to two lines.
>>
>> Thanks,
>> Wanlong Gao
>>
>>>
>>>> +        usleep(10000);
>>>> +    if (ret < 0) {
>>>> +        printf(TNAME " Error at aio_error() : %s\n", strerror(ret));
>>>> +        exit(PTS_FAIL);
>>>> +    }
>>>> +
>>>> +
>>>>        memset(&aiocb_fsync, 0, sizeof(aiocb_fsync));
>>>>        aiocb_fsync.aio_fildes = fd;
>>>>
>>>>
>>>
>>>
>>>
>>
> 
> 
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to