Author: dgilmore Date: 2010-12-15 19:00:30 -0500 (Wed, 15 Dec 2010) New Revision: 3436
Modified: trunk/osprey/libhugetlbfs/hugeutils.c Log: A change ported from: git://libhugetlbfs.git.sourceforge.net/gitroot/libhugetlbfs/libhugetlbfs The licensing of this library is still LGPL 2.1 or later. Information from the libhugetlbfs git log message concerning this patch: find_mounts(): ignore non-hugetlbfs filesystems libhugetlbfs attempts to restrict its statfs calls to only hugetlbfs filesystems. Unfortunately, the sscanf pattern isn't quite correct, and libhugetlbfs ends up calling statfs on all mounted filesystems. This can be quite costly when many network filesystems are mounted. Correct the sscanf pattern. Modified: trunk/osprey/libhugetlbfs/hugeutils.c =================================================================== --- trunk/osprey/libhugetlbfs/hugeutils.c 2010-12-15 19:37:52 UTC (rev 3435) +++ trunk/osprey/libhugetlbfs/hugeutils.c 2010-12-16 00:00:30 UTC (rev 3436) @@ -225,7 +225,7 @@ int fd; char line[LINE_MAXLEN + 1]; char *eol; - int bytes, err; + int bytes, err, dummy; off_t offset; /* Have we already located a mount? */ @@ -258,9 +258,16 @@ offset = bytes - (eol + 1 - line); lseek(fd, -offset, SEEK_CUR); - err = sscanf(line, "%*s %" stringify(PATH_MAX) "s hugetlbfs ", - htlb_mount); - if ((err == 1) && (hugetlbfs_test_path(htlb_mount) == 1)) { + /* + * Match only hugetlbfs filesystems. + * Subtle: sscanf returns the number of input items matched + * and assigned. To force sscanf to match the literal + * "hugetlbfs" string we include a 'dummy' input item + * following that string. + */ + err = sscanf(line, "%*s %" stringify(PATH_MAX) "s hugetlbfs " + "%*s %d", htlb_mount, &dummy); + if ((err == 2) && (hugetlbfs_test_path(htlb_mount) == 1)) { close(fd); return htlb_mount; } ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel