communication between shell and and a demon 'c' program

Hello,
i have a demon 'c' program that have a dynamic table of logic registers ( 2000 variables ).
exemple of registers:
I1.34.5
M23.4.1

I want from shell acess to this table of registers.
How can i do this?

with something like for read I1.34.5:
#cat /sys/class/mySoftware/mapping/I/1/34/5
#echo 98 > /sys/class/mySoftware/mapping/I/1/34/5

There are ways to do this from the daemon:

  1. write to a known memory location in a given process - like a message queue or shared memory.
  2. write to a named pipe or to a given filename

The is nothing you can do in shell by itself; you have to seriously rewrite the daemon.

Also event method is nice. daemon is trivial and not poll anything if both: daemon + client use signals = very hw friendly.

Daemon:

sometodo()
{
   # do the client files
   :
}

trap 'sometodo' 2
while true
do
        sleep 10000
done

Daemon trap some signal ex. 2 in previous code.

Client create some own file like $$.mydata.ask:

MYPID=$$
MYNEED=I/1/34/5
MYANSWERFILE=$$.mydata.answer

Then send signal for daemon

kill -2  $DAEMONPID

Then daemon catch the signal 2 and read some directory.
There is NNN.mydata.ask files
Run those files in same process:

.  NNN.mydata.ask
echo "$(date '+%Y%m%d%H%M%S') NNN.mydata.ask" >> somelog
cat NNN.mydata.ask >> somelog
rm -f NNN.mydata.ask

Then do the ...
And write answer to the file $MYANSWERFILE.tmp
and give the answer for client which poll this file

mv $MYANSWERFILE.tmp $MYANSWERFILE

Ofcourse it's also possible that client create subprocess, give that PID number for daemon. Daemon send signal for that dummy process.
Child wait that process to end.

Client version, wait signal from daemon:

somechild &
CHILD=$!
cat <<EOF > $$.mydata.ask
MYPID=$$
MYNEED=I/1/34/5
MYANSWERFILE=$$.mydata.answer
SENDSIGNAL2PID=$CHILD
EOF

kill -2 $DAEMONPID
wait $CHILD

thanks for theses completes answers.
Of course, i can modify the c daemon program. (i am coding it)

for kshji solution, thanks for all the code. I can use it. Seems to be a bit heavy for the fs system (embedded system)?

For queue message, it seems to be a good ligth solution.
How can make a message queue between shell script and the process? And does the messages are length dynamic?

my initial idea, but doesn't know if it is possible:
From application make entrie in /proc fs : /proc/mapping
and make a virtual tree.

procfs_fs_ops mon_dossier {
.list : My_function_lister_folder(string path);
.open : My_function_openfile(string path);
.read : My_function_readfile(string path);
.write : My_function_writefile(string path);
.close : My_function_closefile(string path);
}

is it possible?

all call to a subfolder/subfile acess to the "only function"
My_function_openfile