mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-26 11:49:19 +00:00
linux.
This commit is contained in:
parent
bc491d8d58
commit
8553e63936
@ -37,6 +37,7 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
@ -52,12 +53,13 @@ namespace {
|
||||
|
||||
class xattr_file final : public native::file {
|
||||
public:
|
||||
xattr_file(const std::string &path, int fd, bool readonly): file(path), _fd(fd), _readonly(readonly);
|
||||
xattr_file(const std::string &path, int fd, bool readonly): file(path), _fd(fd), _readonly(readonly)
|
||||
{}
|
||||
~xattr_file();
|
||||
|
||||
|
||||
virtual tool_return<size_t> read(void *out_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> write(void *in_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> write(const void *in_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> get_mark() override;
|
||||
virtual tool_return<size_t> set_mark(ssize_t new_mark) override;
|
||||
virtual tool_return<size_t> get_eof() override;
|
||||
@ -104,7 +106,6 @@ namespace {
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
tool_return<size_t> xattr_file::write(const void *in_buffer, size_t count) {
|
||||
if (_readonly) return MacOS::wrPermErr;
|
||||
|
||||
@ -199,10 +200,10 @@ namespace native {
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(path_name.c_str(), &st) < 0)
|
||||
if (::stat(path_name.c_str(), &st) < 0)
|
||||
return macos_error_from_errno();
|
||||
|
||||
fi.create_date = unix_to_mac(st.st_birthtime);
|
||||
fi.create_date = unix_to_mac(st.st_ctime);
|
||||
fi.modify_date = unix_to_mac(st.st_mtime);
|
||||
fi.backup_date = 0;
|
||||
|
||||
|
@ -100,7 +100,7 @@ tool_return<size_t> fd_file::read(void *buffer, size_t count) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
tool_return<size_t> fd_file::write(void *buffer, size_t count) {
|
||||
tool_return<size_t> fd_file::write(const void *buffer, size_t count) {
|
||||
|
||||
|
||||
if (_interactive || text) {
|
||||
@ -186,7 +186,7 @@ tool_return<size_t> empty_file::read(void *out_buffer, size_t count) {
|
||||
if (count == 0) return 0;
|
||||
return 0; // eofErr handled elsewhere.
|
||||
}
|
||||
tool_return<size_t> empty_file::write(void *in_buffer, size_t count) {
|
||||
tool_return<size_t> empty_file::write(const void *in_buffer, size_t count) {
|
||||
return MacOS::wrPermErr;
|
||||
}
|
||||
tool_return<size_t> empty_file::seek(ssize_t position, int whence) {
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
|
||||
virtual ~file() = default;
|
||||
virtual tool_return<size_t> read(void *out_buffer, size_t count) = 0;
|
||||
virtual tool_return<size_t> write(void *in_buffer, size_t count) = 0;
|
||||
virtual tool_return<size_t> write(const void *in_buffer, size_t count) = 0;
|
||||
virtual tool_return<size_t> seek(ssize_t position, int whence);
|
||||
virtual tool_return<size_t> get_mark() = 0;
|
||||
virtual tool_return<size_t> set_mark(ssize_t new_mark) = 0;
|
||||
@ -49,7 +49,7 @@ public:
|
||||
virtual ~fd_file();
|
||||
|
||||
virtual tool_return<size_t> read(void *out_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> write(void *in_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> write(const void *in_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> seek(ssize_t position, int whence) override;
|
||||
virtual tool_return<size_t> get_mark() override;
|
||||
virtual tool_return<size_t> set_mark(ssize_t new_mark) override;
|
||||
@ -69,7 +69,7 @@ public:
|
||||
empty_file(const std::string &s) : file(s) {}
|
||||
|
||||
virtual tool_return<size_t> read(void *out_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> write(void *in_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> write(const void *in_buffer, size_t count) override;
|
||||
virtual tool_return<size_t> seek(ssize_t position, int whence) override;
|
||||
virtual tool_return<size_t> get_mark() override;
|
||||
virtual tool_return<size_t> set_mark(ssize_t new_mark) override;
|
||||
|
Loading…
Reference in New Issue
Block a user