This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Interprocess communication
- From: Alfredo Carrillo <alcarrillo at tec dot com dot mx>
- To: ecos-discuss at sources dot redhat dot com
- Date: Thu, 28 Feb 2002 13:12:40 -0600
- Subject: [ECOS] Interprocess communication
Hi,
I am developing a pager simulation under the Linux synthetic target. In
order to simulate the pager's face I did a GTK+ program.
To comunicate the GTK+ process whith eCos program, I am trying to
implement a shared memory segment using the UNIX IPC system calls. Below
is part of the eCos code I'm using to create the new shared memory segment.
#include <cyg/kernel/kapi.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <sys/types.h>
cyg_thread thread_s[1];
char stack[1][4096];
cyg_handle_t simple_threadA;
void simple_program(cyg_addrword_t data);
void cyg_user_start(void)
{
printf("Entering cyg_user_start()\n");
cyg_thread_create(4, simple_program, (cyg_addrword_t) 0,
"Thread A", (void *) stack[0], 4096,
&simple_threadA, &thread_s[0]);
cyg_thread_resume(simple_threadA);
}
/* This is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
{
int message = (int) data;
key_t key = 15;
int shmid_1;
printf("Beginning execution; thread %d\n", message);
if ((shmid_1 = shmget(key, 1000, 0644|IPC_CREAT)) == -1) {
perror("shmget shmid_1");
exit(1);
}
printf("Memory identifier is %d\n", shmid_1);
}
But the compiler sends this output:
*shmCr.c:39: undefined reference to `shmget'*
Does anybody know what is wrong?, or what can I do to communicate both
processes?
Thanks a lot in advance.
--
Alfredo Carrillo
alcarrillo@tec.com.mx
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss