/proc files missing statistics

Mark Glines mark-hostap at glines.org
Sun Jun 1 21:03:41 EDT 2003

On Sun, Jun 01, 2003 at 01:13:32PM -0700, Dave wrote:
> Indeed I am using uClibc. I looked around in the hostap source for where I
> would need to make modifications but could not locate an appropriate spot.
> Do you have any idea?

Well, the relevant function is prism2_sta_proc_read() in
hostap_ap.c, and the main bit which breaks uClibc's smaller
buffering is:
    if (off != 0) {
        *eof = 1;
        return 0;

To fix this, the function would have to properly support offsets.
However, I'm not aware of an easy way to add this (which is why
I didn't submit a patch for it a few months ago), since it would
create the possibility of race conditions when the stats change
from one read() block to the next.

Since I'm not interested in allowing the possibility of race
conditions, I work around this by using a bigger buffer in the
userspace app which reads stats, with something similar to the

	file = fopen(filename, "r");
	if (file) {
		char *stdiobuf = malloc(1024);
		if (!stdiobuf)
			return fclose(file), count;
		setbuffer(file, stdiobuf, 1024);
		/* do your reads and parsing and such here */

Of course, there still may be a race if the client can be
removed between your fopen and your parsing.  Such fun.


More information about the HostAP mailing list