Derrick Stolee <stolee@xxxxxxxxx> writes: >> Also, can't we tell why we failed to acquire the lock at step #1? >> Do we only get a NULL that says "I am not telling you why, but we >> failed to lock"? > > To tell why we failed to acquire the lock, we could inspect > "errno". However, this requires whitebox knowledge of both the > lockfile API and the tempfile API to know that the last system call to > set errno was an open() or adjust_shared_perm(). That depends on your viewpoint. We can make it a part of documented API so that we keep the promise of preserving errno in the error codepath when we update these APIs and then you do not have to worry about errno being whitebox knowledge ;-).