New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Help needed on F_NOCACHE


Post Reply New Thread Subscribe

 
Thread Tools
srinivasanapj

 
Member Since: Dec 18, 2009
Posts: 2
srinivasanapj is on a distinguished road

srinivasanapj is offline
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
QUOTE Thanks
srinivasanapj

 
Member Since: Dec 18, 2009
Posts: 2
srinivasanapj is on a distinguished road

srinivasanapj is offline
Hi,

Is there is any update on F_CACHE.

Thanks!!!
QUOTE Thanks

Post Reply New Thread Subscribe


« Installing PHP and MySQL on Snow Leopard workstation. | Development Project Roadblocks »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
needed to install an "internet card" inside my ibook vivi77 Apple Notebooks 1 05-17-2009 06:56 PM
Network Help needed, iPhone WIFI hanging/knocking both my wired and wireless internet sdpinc Internet, Networking, and Wireless 4 01-03-2009 10:08 PM
What is needed to Vista on Mac? anewfoundsin Running Windows (or anything else) on your Mac 2 12-03-2008 02:29 AM
How much space is needed to run Windows Vista at an optimal level? seasurfer Running Windows (or anything else) on your Mac 6 12-10-2007 09:14 PM
illustrator help needed, someone please? Matthew_love84 Images, Graphic Design, and Digital Photography 8 07-09-2006 04:39 PM

All times are GMT -4. The time now is 10:35 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?