#include <sys/types.h>
Go to the source code of this file.
|
| int | peer_hold_lock (struct peer *p, const char *path, short type, off_t start, off_t len) |
| | Fork a peer that holds an fcntl lock until released.
|
| |
| void | peer_release (struct peer *p) |
| | Release a held peer lock and reap the peer.
|
| |
| int | peer_try_lock (const char *path, short type, off_t start, off_t len) |
| | Probe a lock range from a forked child.
|
| |
◆ peer_hold_lock()
| int peer_hold_lock |
( |
struct peer * |
p, |
|
|
const char * |
path, |
|
|
short |
type, |
|
|
off_t |
start, |
|
|
off_t |
len |
|
) |
| |
|
extern |
Fork a peer that holds an fcntl lock until released.
F_SETLK/F_GETLK never conflict with or report the calling process's own locks, so a test that needs a genuinely contending lock forks a peer that takes it and parks.
- Parameters
-
| [out] | p | filled with the peer's pid and control pipes |
| [in] | path | file to lock |
| [in] | type | F_RDLCK or F_WRLCK |
| [in] | start | first byte of the range |
| [in] | len | range length (0 = to EOF) |
- Returns
- 0 with the lock held by the time this returns, -1 on failure
◆ peer_release()
| void peer_release |
( |
struct peer * |
p | ) |
|
|
extern |
Release a held peer lock and reap the peer.
- Parameters
-
◆ peer_try_lock()
| int peer_try_lock |
( |
const char * |
path, |
|
|
short |
type, |
|
|
off_t |
start, |
|
|
off_t |
len |
|
) |
| |
|
extern |
Probe a lock range from a forked child.
Cross-process, so it sees locks this process holds (which its own F_GETLK never would).
- Parameters
-
| [in] | path | file to probe |
| [in] | type | F_RDLCK or F_WRLCK |
| [in] | start | first byte of the range |
| [in] | len | range length (0 = to EOF) |
- Returns
- 1 if the lock was acquired (range free), 0 if it conflicted (range held by another process), -1 on a fork/open error