lkml.org 
[lkml]   [2014]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 13/14] perf tests: Add test for caching dso file descriptors
Date
On Tue, 27 May 2014 09:54:36 +0200, Jiri Olsa wrote:
> On Tue, May 27, 2014 at 10:36:44AM +0900, Namhyung Kim wrote:
>> On Thu, 15 May 2014 19:23:34 +0200, Jiri Olsa wrote:
>> > Adding test that setup test_dso_data__fd_limit and test
>> > dso data file descriptors are cached appropriately.
>>
>> [SNIP]
>> > +static long open_files_cnt(void)
>> > +{
>> > + char path[PATH_MAX];
>> > + struct dirent *dent;
>> > + DIR *dir;
>> > + long nr = 0;
>> > + int n;
>> > +
>> > + n = scnprintf(path, PATH_MAX, "%s/self/fd", procfs__mountpoint());
>> > + TEST_ASSERT_VAL("couldn't get fd path", n < PATH_MAX);
>>
>> Looks like an unnecessary check since the scnprintf() cannot return more
>> than (or equal to) PATH_MAX.
>
> once it's equal it's bad.. as the man says:
> "return value of size or more means that the output was truncated"

Did you see "sn"printf?

Thanks,
Namhyung


\
 
 \ /
  Last update: 2014-05-29 02:21    [W:0.071 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site