[PATCH] Add test for mincore syscall
Fei, Jie/费 杰
feij.fnst at cn.fujitsu.com
Wed Jan 27 03:03:59 UTC 2016
On 01/27/2016 04:54 AM, Mike Frysinger wrote:
> On 26 Jan 2016 13:51, Fei Jie wrote:
>> --- /dev/null
>> +++ b/tests/mincore.c
>> @@ -0,0 +1,43 @@
>> +#include "tests.h"
> files should have a comment header at the top with a license & description.
>
>> +int main()
> should be (void)
>
>> + int PAGESIZE = getpagesize();
> don't use upper caps for this var name
>
>> + int global_len = PAGESIZE*2;
> spaces around the *
>
>> + char *buf;
>> + buf = (char*)malloc(global_len);
> the cast is pointless (so delete it), and just merge the two statements.
>
>> + if( MAP_FAILED == (global_pointer = (char *)mmap(NULL,global_len,\
>> + PROT_READ|PROT_WRITE|PROT_EXEC,MAP_SHARED,file_desc,0)) ) {
> please do not inline assignments into if statements. do the assignment,
> then do the if statement checking its value.
>
> drop the \ too.
>
> the leading spacing is wrong ... should be:
> if (...
>
>> + unsigned char* global_vec = NULL;
>> + global_vec = malloc( (global_len+PAGESIZE-1) / PAGESIZE );
>> + if ((res =mincore(global_pointer, global_len, global_vec)) == -1) {
> lots of whitespace errors here too
> -mike
Thanks for your comments! I've modified the patch to v2.
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>
>
> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel
--
Thanks!
Fei Jie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160127/f8714851/attachment.html>
More information about the Strace-devel
mailing list