Welcome to NYCU CSIT Mirror site
Locking: libmount Reference Manual
Locking
Locking — locking methods for utab or another libmount files
|
|
Description
Since v2.39 libmount does nto support classic mtab locking. Now all is based
on flock only.
Functions
mnt_free_lock ()
void
mnt_free_lock (struct libmnt_lock *ml
);
Deallocates mnt_lock.
mnt_lock_file ()
int
mnt_lock_file (struct libmnt_lock *ml
);
Creates a lock file.
Note that when the lock is used by mnt_update_table()
interface then libmount
uses flock()
for private library file /run/mount/utab.
Returns
0 on success or negative number in case of error (-ETIMEOUT is case
of stale lock file).
mnt_new_lock ()
struct libmnt_lock *
mnt_new_lock (const char *datafile
,
pid_t id
);
Returns
newly allocated lock handler or NULL on case of error.
mnt_unlock_file ()
void
mnt_unlock_file (struct libmnt_lock *ml
);
Unlocks the file. The function could be called independently of the
lock status (for example from exit(3)).
mnt_lock_block_signals ()
int
mnt_lock_block_signals (struct libmnt_lock *ml
,
int enable
);
Block/unblock signals when the lock is locked, the signals are not blocked
by default.
Returns
<0 on error, 0 on success.
Types and Values
struct libmnt_lock
struct libmnt_lock;
Stores information about the locked file