Avoid blocking

C

collinm

hi

in a c program, i copy often file on nfs

to see if i can see the nfs i do something like:

if((exist = stat(mnt_dir, &buf))==0){

if((fp = fopen(tmp_mnt_dir_www, "w"))!=NULL)
{
}
else
printf("problem\n");
}

my problem is: if nfs is not available, my program seem to block,
freeze a couple of second... is there a way to avoid that?


thanks
 
L

Lawrence Kirby

hi

in a c program, i copy often file on nfs

to see if i can see the nfs i do something like:

if((exist = stat(mnt_dir, &buf))==0){

if((fp = fopen(tmp_mnt_dir_www, "w"))!=NULL)
{
}
else
printf("problem\n");
}

my problem is: if nfs is not available, my program seem to block,
freeze a couple of second... is there a way to avoid that?

Not in standard C. The delay is proably the time it takes for the system
to decide that NFS isn't responding. You might be able to tune NFS on the
system but that is well beyond the scope of the C language and this
newsgroup. You may have better luck in a newsgroup relating to your system.

Lawrence
 
C

CBFalconer

collinm said:
in a c program, i copy often file on nfs
to see if i can see the nfs i do something like:

if((exist = stat(mnt_dir, &buf))==0){

if((fp = fopen(tmp_mnt_dir_www, "w"))!=NULL)
{
}
else
printf("problem\n");
}

my problem is: if nfs is not available, my program seem to block,
freeze a couple of second... is there a way to avoid that?

This is comp.lang.c, where we discuss only the standard C language,
as defined in the C90, C99 (and older K&R) standards. This means
you must either publish the source of routines you call, or call
routines defined in the standard. stat fits into neither
category. Thus if you do get a reply it is likely to be wrong,
certainly will not be reviewed by knowledgeable people, and the
whole mess is off-topic here.

You may want to try a newsgroup that handles Posix or Unix.
 
D

Dave Thompson

Not in standard C. The delay is proably the time it takes for the system
to decide that NFS isn't responding. You might be able to tune NFS on the

system but that is well beyond the scope of the C language and this
newsgroup. You may have better luck in a newsgroup relating to your system.
Or one for the problematic feature: comp.protocols.nfs .

- David.Thompson1 at worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top