I have two relatively big applications(processes) running in embedded Linux on ARM with 3 RAM banks (in Linux cmdline: mem=128M mem=256M@0x90000000 mem=128M@0xA0000000). One application processes user commands, between which there may be request to run ordinary Linux shell command. This is implemented as:
if((fp=popen(UserCommand, "r")) == NULL) return(errno));
fgets(ReplyString, 128, fp);
Res = pclose(fp);
The first line returns errno=12 - ENOMEM even for the simplest command like "pwd", although there is plenty of memory:
total used free shared buffers
Mem: 461472 38576 422896 0 152
Swap: 0 0 0
Total: 461472 38576 422896
As far as I understand there is more than 400MB of free space!
For the first test purpose I also cancelled the second process - ops!, the error has gone!!!
For the second test I run telnet and executed the command via it (while both processes were running) - no problem, works fine.
So, where is the catch?