星期三, 9月 29, 2010

lockf

locf function

  • arg1 = int, and must set O_RDWR,cant set O_RDONLY.
  • close fd will unlock


For example:
int lockfd = open( argv[2], O_RDWR);
ret = lockf( lockfd, F_LOCK, 0L);

// Test Lock
ret = lockf( lockfd, F_TEST, 0L);

沒有留言: