Menu

#54 swapon02 broken in linux 2.6

System Calls
closed-invalid
Testcases (113)
5
2007-05-14
2004-10-14
wei
No

swapon02.c used 'wc -l' to get line counts of
/etc/swaps and depends on exact output format of wc,
which were different
between linux 2.6 from linux 2.4.
Suggest to replace line 281-217 in swapon02.c with

swapfile = 0;
if((fd = open("/proc/swaps", O_RDONLY)) == -1) {
printf("Failed to open /proc/swaps\n");
exit(-1);
}
while ((res = read(fd, temp, 16)) > 0) {
for (i = 0; i < res; i++)
if (temp[i] == '\n') swapfile++;
}

(Or chould increase size of temp instead of 16)

Discussion

  • Robert Williamson

    • assigned_to: nobody --> mridge
     
  • john stultz

    john stultz - 2004-11-05

    Logged In: YES
    user_id=160960

    I've seen this problem as well where swapon02 hangs the ltp
    test. Would be nice if the fix above could be considered for
    inclusion.

     
  • Subrata Modak

    Subrata Modak - 2007-05-14
    • status: open --> closed-invalid
     

Log in to post a comment.