According to @alk answer in the following topic:
We can develop our property flock()
function (its name could be async_flock()
). we copy in this new function the content of the origin lockf()
code and then we make the following changes in order to get an async-signal-safe function:
- replace
__fcntl
withfcntl
: necessary to make the code compile replace
__set_errno(<errno-define>)
witherrno = <errno-define>
: necessary to make the code compilereplace the call to
memset()
with appropriate assigmentsstruct fcntl = {0}
: necessary to have it become async-signal-save.