11 * Read the PWM intervals from shared memory and calculate the light levels.
24 * We need to get the segment named
25 * SHM_KEY, created by the server.
32 if ((shmid = shmget(key, sizeof(struct pwm) * 5, 0666)) < 0) {
38 * Now we attach the segment to our data space.
40 if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
46 * Now read what the server put in the memory.
49 signals = (struct pwm *)shm;
53 printf("Interval = %d, output = %d\n", signals[i].interval, signals[i].output);
60 if (signals->interval != 0)
62 usleep(signals->interval);
64 if (signals->output == -1)
66 signals = (struct pwm *)shm;