mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
LibC: Support blocking flock()
This commit is contained in:
parent
3a80b25ed6
commit
e80c0bde70
1 changed files with 2 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
|
* Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
|
||||||
|
* Copyright (c) 2022, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -16,11 +17,6 @@ int flock(int fd, int operation)
|
||||||
struct flock lock {
|
struct flock lock {
|
||||||
short(operation & 0b11), SEEK_SET, 0, 0, 0
|
short(operation & 0b11), SEEK_SET, 0, 0, 0
|
||||||
};
|
};
|
||||||
if (operation & LOCK_NB) {
|
return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock);
|
||||||
return fcntl(fd, F_SETLK, &lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Implement F_SETLKW in fcntl.
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue