@@ -195,6 +195,22 @@ mounts.
195195around only a file descriptor without having to keep the path around
196196to be able to unlink the file/directory.
197197
198+ ### Unlinking via two file descriptors
199+
200+ ` unlinkat2(dir_fd, name, inode_fd) ` : taking one file descriptor
201+ for the directory to remove a file in, and another one referring
202+ to the inode of the filename to remove. This call should only
203+ succeed if the specified filename still refers to the specified
204+ inode.
205+
206+ ** Use-Case:** code that operates on a well-know path that might be
207+ shared by multiple programs that jointly manage it might want to
208+ safely remove a filename under the guarantee it still refers to
209+ the expected inode. As a specific example, consider lock files,
210+ that should be cleaned up only if they still refer to the assumed
211+ owner's instance, but leave the file in place if another process
212+ already took over the filename.
213+
198214### ` AT_EMPTY_PATH ` support for ` openat() ` and ` openat2() `
199215
200216To get an operable version of an ` O_PATH ` file descriptors, it is
@@ -323,22 +339,6 @@ disk I/O. Consider implementation of a naive web browser which is
323339pointed to ` file://dev/zero ` , not expecting an endless amount of
324340data to read.
325341
326- ### Unlinking via two file descriptors
327-
328- ` unlinkat3(dir_fd, name, inode_fd) ` : taking one file descriptor
329- for the directory to remove a file in, and another one referring
330- to the inode of the filename to remove. This call should only
331- succeed if the specified filename still refers to the specified
332- inode.
333-
334- ** Use-Case:** code that operates on a well-know path that might be
335- shared by multiple programs that jointly manage it might want to
336- safely remove a filename under the guarantee it still refers to
337- the expected inode. As a specific example, consider lock files,
338- that should be cleaned up only if they still refer to the assumed
339- owner's instance, but leave the file in place if another process
340- already took over the filename.
341-
342342### Determining if a mount point belongs to the current user
343343
344344Ability to determine if a mount point belongs to the current user
0 commit comments