read huge informations at once as otherwise all files below
/proc/sys, not using the seq_file API at the kernel side,
will return EOF on a second read.
Signed-off-by: Werner Fink <werner@suse.de>
/*
* Read a sysctl setting
*/
+#define IOBUFSIZ (128<<10)
+static char *iobuf;
static int ReadSetting(const char *restrict const name)
{
int rc = 0;
fp = fopen(tmpname, "r");
+ if (iobuf)
+ setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
+
if (!fp) {
switch (errno) {
case ENOENT:
fp = fopen(tmpname, "w");
+ if (iobuf)
+ setvbuf(fp, iobuf, _IOFBF, IOBUFSIZ);
+
if (!fp) {
switch (errno) {
case ENOENT:
argc -= optind;
argv += optind;
+ iobuf = (char*)malloc(IOBUFSIZ); /* Allow to fail */
+
if (DisplayAllOpt)
return DisplayAll(PROC_PATH);