Implement strerror

This commit is contained in:
topjohnwu
2024-02-24 04:02:46 -08:00
parent a4f008fde5
commit f8967e9274
5 changed files with 311 additions and 17 deletions
+2 -17
View File
@@ -36,25 +36,10 @@
#include <sys/types.h>
#include <unistd.h>
#include "private/ErrnoRestorer.h"
extern "C" int sys_getdents64(unsigned int, dirent*, unsigned int);
class ErrnoRestorer {
public:
explicit ErrnoRestorer() : saved_errno_(errno) {
}
~ErrnoRestorer() {
errno = saved_errno_;
}
void override(int new_errno) {
saved_errno_ = new_errno;
}
private:
int saved_errno_;
};
// Apportable decided to copy the data structure from this file
// and use it in their own code, but they also call into readdir.
// In order to avoid a lockup, the structure must be maintained in