Use flock() in the sigaction handler

倖福魔咒の 提交于 2019-12-01 06:39:05
MOHAMED

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 with fcntl: necessary to make the code compile
  • replace __set_errno(<errno-define>) with errno = <errno-define>: necessary to make the code compile

  • replace the call to memset() with appropriate assigments struct fcntl = {0}: necessary to have it become async-signal-save.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!