Use execve syscall wrapper in execve.cpp - #223186
Open
beamandala wants to merge 1 commit into
Open
Conversation
|
@llvm/pr-subscribers-libc Author: Bhavesh M (beamandala) ChangesFull diff: https://github.com/llvm/llvm-project/pull/223186.diff 2 Files Affected:
diff --git a/libc/src/unistd/linux/CMakeLists.txt b/libc/src/unistd/linux/CMakeLists.txt
index 4ea7c8a2078d8..2f97d375d5018 100644
--- a/libc/src/unistd/linux/CMakeLists.txt
+++ b/libc/src/unistd/linux/CMakeLists.txt
@@ -226,8 +226,10 @@ add_entrypoint_object(
HDRS
../execve.h
DEPENDS
- libc.include.sys_syscall
- libc.src.__support.OSUtil.osutil
+ libc.src.__support.common
+ libc.src.__support.libc_errno
+ libc.src.__support.macros.config
+ libc.src.__support.OSUtil.linux.syscall_wrappers.execve
libc.src.errno.errno
)
diff --git a/libc/src/unistd/linux/execve.cpp b/libc/src/unistd/linux/execve.cpp
index 2214b6df493bd..a8240aaf874bc 100644
--- a/libc/src/unistd/linux/execve.cpp
+++ b/libc/src/unistd/linux/execve.cpp
@@ -8,27 +8,25 @@
#include "src/unistd/execve.h"
#include "src/__support/macros/config.h"
-#include "src/unistd/environ.h"
-#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/OSUtil/linux/syscall_wrappers/execve.h"
#include "src/__support/common.h"
#include "src/__support/libc_errno.h"
-#include <sys/syscall.h> // For syscall numbers.
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, execve,
(const char *path, char *const argv[], char *const envp[])) {
- int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_execve, path, argv, envp);
- if (ret < 0) {
- libc_errno = -ret;
+ auto ret = linux_syscalls::execve(path, argv, envp);
+ if (!ret) {
+ libc_errno = ret.error();
return -1;
}
// Control will not reach here on success but have a return statement will
// keep the compilers happy.
- return ret;
+ return *ret;
}
} // namespace LIBC_NAMESPACE_DECL
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.