Hi Biff,
the way I'm using Shared Memory I don't need to worry about synchronization, 1st app will write to it and 2nd will read, also have a lock variable (also available from shmem area) that I will use when updating data.
I wanted to use only one application for the all process but I have this problem:
Getting data from GPS module requires that my main process loops to fetch serial port data and parse it to save the converted data into internal structures. To implement the http interface I used some code that will create a tcp/ip socket and that is where I get my problem, the socket will lock the process and wait for requests and it will only unlock when it gets a request! My 1st idea was to use a thread, but really don't know if it's possible just with C in Linux, so decided to go trough my school stuff and found this Shared Memory objects stuff and decided to give it a try.
I based my tcp/ip code on this (just an example - instead of fetching directories I will get my gps data from shmem area):
http://www.cs.utah.edu/~swalton/listings/sockets/programs/part2/chap6/html-ls-server.c
Using FIFOs will also lock my process right ?
Also though to use fork to get a parent / child process but I don't think that they will share the same memory zone! I'm a bit rusty with this old school techniques, lol .... windowz development let's your brain in really bad shape! :P
I followed Razvan tip and it worked under normal compilation:
>gcc gpsparser.c -o gpsparser /usr/lib/librt.a
and also
>gcc -static gpsparser.c -o gpsparser /usr/lib/librt.a
But using diet will fail
>diet gcc gpsparser.c -o gpsparser /usr/lib/librt.a
Will ask for dietlibc help, at least I'm now able to do it statically and test both apps.
Thanks guys!
Regards,
Nelson.