Re: freepages in proc doesn't work right.

Rogier Wolff (R.E.Wolff@BitWizard.nl)
Mon, 21 Jul 1997 18:25:50 +0200 (MET DST)


Russell Coker - mailing lists account wrote:
>
> >Noticed this in 2.0.30:
>
> >The command to set the "freepages" file in /proc/sys/vm used to work like
> >thus:
>
> >echo 100 150 200 > /proc/sys/vm/freepages
>
> >Now, what you get is something like:
>
>
> >200 96 128
>
> >where 96 and 128 are the originals.
>
> >I don't know when this changed, but the problem seems
> >to be that it doesn't like spaces in the input.

Ah.. This looks as if YOUR echo command is writing the three commandline
arguments in different "write" calles to the file.

something like:

for (i=1;i<argc;i++) {
write (1,argv[i],strlen (argv[i]);
if (i < argc -1 ) write (1, " ",1);

My tcsh and bash internals and the /bin/echo command on my Red Hat 4.2
system all do it in one go.....

i.e. something like
buf[0] = '\0';
for (i=1;i<argc;i++) {
strcat (buf,argv[i]);
if (i < argc -1 ) strcat (buf," ");
write (1,buf, strlen (buf));

(see: the second code snippet is longer..... :-)

Roger.