-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
io/Open: add TryOpen(struct open_how), Open(struct open_how)
- Loading branch information
1 parent
5b39305
commit dda85e0
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
// Copyright CM4all GmbH | ||
// author: Max Kellermann <[email protected]> | ||
|
||
#pragma once | ||
|
||
#include "FileDescriptor.hxx" | ||
|
||
/** | ||
* Reference to a file by an anchor directory (which can be an | ||
* `O_PATH` descriptor) and a path name relative to it. | ||
*/ | ||
struct FileAt { | ||
FileDescriptor directory; | ||
const char *name; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
// Copyright CM4all GmbH | ||
// author: Max Kellermann <[email protected]> | ||
|
||
#pragma once | ||
|
||
#include <fcntl.h> // for O_* | ||
#include <linux/openat2.h> // for RESOLVE_* | ||
#include <sys/syscall.h> | ||
#include <unistd.h> | ||
|
||
static inline int | ||
openat2(int dirfd, const char *pathname, | ||
const struct open_how *how, size_t size) | ||
{ | ||
return syscall(__NR_openat2, dirfd, pathname, how, size); | ||
} |