[LTP] [PATCH] lib: add tst_read_meminfo / tst_get_avail_mem
Li Wang
liwang@redhat.com
Thu Jul 14 10:03:11 CEST 2016
On Wed, Jul 13, 2016 at 03:12:08PM +0200, Jan Stancek wrote:
>
> Latest idea attached.
>
> It's similar to SAFE_FILE_SCANF, but it scanfs each line and first
> matching all scanf directives wins and terminates search, otherwise
> you get non-zero ret code. For example:
>
> if (SAFE_FILE_LINES_SCANF("/proc/meminfo", "MemFree: %ld", &free))
> tst_brk(TBROK, "Could not parse MemFree");
I like this method! And I tend to think that we probably need achive two
macors for different occasions. In fact as the FILE_SCANF() do that.
FILE_LINES_SCANF() and SAFE_FILE_LINES_SCANF()
Regards,
Li Wang
More information about the ltp
mailing list