Results 1 to 2 of 2
  1. #1
    Help needed on F_NOCACHE

    Member Since
    Dec 18, 2009
    Posts
    2
    Help needed on F_NOCACHE
    Hello Everybody,

    I am Srinivasa Raghavan and new to this group.

    I am facing problem with non caching the file.
    the code looks like the below:

    main()
    {
    int fd;
    char buf[512] = {'\0'};
    fd = fopen("Sample.bin",O_RDONLY);

    fcntl(fd, F_NOCACHE, 1);
    fcntl(fd, F_RDAHEAD, 1);

    read(fd, buf, sizeof(buf));
    close(fd);

    if(buf[0] == 'x' )
    print("non-cached\n");
    else
    printf("cached\n")
    }

    the problem was, the F_NOCACHE doesn't not work properly, and all the time I get the message cached only. The firware will always update the value 'x' in sample.bin.

    the above code works if I put the entire stuff (open, fcntl, read and close) in an indefinite loop (take long time to come out) like the below.
    main()
    {
    while(1)
    {
    open...
    fcntl(.., F_NOCACHE)
    read(....
    close..

    if(buf[0] == 'x')
    break;
    }

    I am really stuck with this for a week time, I want to know the exact behaviour of F_NOCACHE, and any information will be highly appreciated.

    Thanks in advance,
    Srinivasa Raghavan

  2. #2
    Help needed on F_NOCACHE

    Member Since
    Dec 18, 2009
    Posts
    2
    Hi,

    Is there is any update on F_CACHE.

    Thanks!!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help Needed!
    By emdee in forum OS X - Operating System
    Replies: 1
    Last Post: 10-10-2012, 05:41 PM
  2. Help needed
    By O'Sidarta in forum Apple Desktops
    Replies: 4
    Last Post: 06-18-2012, 01:35 PM
  3. Help needed!!!
    By iLoveiPhone in forum iPhone Hardware and Accessories
    Replies: 4
    Last Post: 01-31-2012, 06:46 PM
  4. help needed
    By cursed in forum Switcher Hangout
    Replies: 1
    Last Post: 11-05-2010, 09:46 AM
  5. Help Needed
    By tom hansen in forum Apple Desktops
    Replies: 6
    Last Post: 08-17-2005, 03:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •