About 50 results
Open links in new tab
  1. c - flock vs lockf on Linux - Stack Overflow

    Mar 14, 2014 · In Linux, lockf() is just a wrapper around fcntl(), while flock() locks are separate (and will only work on local filesystems, not on e.g. NFS mounts on kernels prior to 2.6.12). That is, one …

  2. fcntl, lockf, which is better to use for file locking?

    Feb 22, 2009 · Looking for information regarding the advantages and disadvantages of both fcntl and lockf for file locking. For example which is better to use for portability? I am currently coding a linux …

  3. c - How to unlock using lockf ()? - Stack Overflow

    Jul 21, 2012 · Your code is using lockf(); your title originally said flock(). You can use either of those, or fcntl() — such an embarrassment of riches — to do the locking, but you should be self-consistent.

  4. file locking - python lockf and flock behaviour - Stack Overflow

    Feb 12, 2015 · Also, if you run another python session, in another window, and use lockf () on the file and leave the file open, then you'll find the exception occurs in the first call to fcntl.lockf(), in your …

  5. What does it mean to lock file in C under linux lockf, flock and fcntl?

    Bear in mind with these three functions that they may not work well with each other. Also, flock is less portable (it's not a POSIX function) and doesn't work with files over NFS on Linux according to the …

  6. How to use "fcntl.lockf" in Python? - Stack Overflow

    Apr 7, 2023 · fcntl.lockf is a wrapper around fcntl advisory locking, a mechanism for cooperating processes to coordinate access to a file or sections of a file. It lets individual processes say "I'm …

  7. locking a file using lockf in C is not working - Stack Overflow

    Mar 5, 2015 · lockf(int fd, int function, off_t size); size argument is the number of contiguous bytes to be locked or unlocked. The section to be locked or unlocked starts at the current offset in the file and …

  8. Locking files in linux with c/c++ - Stack Overflow

    Jan 13, 2010 · Have a look at this question (with answer) about it: fcntl, lockf, which is better to use for file locking?. If you can, have a look at section 14.3 in Advanced Programming in the UNIX …

  9. python lockf: LOCK_EX works but LOCK_SH doesn't

    Mar 27, 2020 · fcntl.lockf sure looks like it should be a wrapper around POSIX lockf, but it's not. POSIX lockf doesn't even have shared locks. fcntl.lockf is a wrapper around POSIX fcntl. LOCK_SH …

  10. How to lock and unlock pid file with "fcntl ()" - Stack Overflow

    Jun 7, 2013 · As you tagged Linux, verbatim form man lockf (emphasis by me): On Linux, lockf () is just an interface on top of fcntl(2) locking. Many other systems implement lockf () in this way, but note …