[LTP] [PATCH] lib: add tst_read_meminfo / tst_get_avail_mem

Li Wang
2016-07-14T08:03:11Z

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