Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - PPS notification group problem: Page 1 of 2 (2 Items)
   
PPS notification group problem  
I have tried using a PPS notification group and they do not seem to work as expected.  I created the following file:

/pps/crank/test

Then use this code:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/pps.h>

int main()
{
    char noid[16], buf[256];
    int notify_fd, fd1;
    int nread;

    notify_fd = open("/pps/.notify", O_RDONLY);
    read(notify_fd, &noid[0], sizeof(noid));
    noid[strlen(noid)-1] = 0;
    printf("Open Notify fd: <%s>\n", noid);

    sprintf(buf, "/pps/crank/test?notify=%s:id", noid);
    fd1 = open(buf, O_RDONLY);
    printf("Open: %s\n", buf);

    memset(buf, 0, sizeof(buf));
    while((nread=read(notify_fd, &buf, sizeof(buf))) >= 0) {
        if (nread) {
            printf("Notify (%d): %s\n", nread, buf);
        }       
        memset(buf, 0, sizeof(buf));
    }   
    printf("Done: %d\n", nread);
    return 0;
}

So a notification group is used to monitor the "id" attribute of the test object.  Then I write to the object:
    echo "id::1" >> /pps/crank/test
Now I see the above "Notify" message as I expect.
Now write to the object again but with a different attribute:
  echo "abc::1" >> /pps/crank/test
Now I still see the above "Notify" message.  However I did not change the "id" value so why does read return like I did?


Thanks,
Brian