Logo Search packages:      
Sourcecode: pcsc-lite version File versions  Download package

INTERNAL int SYS_LockFile ( int  iHandle  ) 

Makes a non-blocking request to lock a file exclusively.

Parameters:
[in] iHandle File descriptor.
Returns:
Error code.
Return values:
0 Success.
-1 An error ocurred.

Definition at line 206 of file sys_unix.c.

{
#ifdef HAVE_FLOCK
      return flock(iHandle, LOCK_EX | LOCK_NB);
#else
      struct flock lock_s;

      lock_s.l_type = F_WRLCK;
      lock_s.l_whence = 0;
      lock_s.l_start = 0L;
      lock_s.l_len = 0L;

      return fcntl(iHandle, F_SETLK, &lock_s);
#endif
}


Generated by  Doxygen 1.6.0   Back to index