J Reece Wilson
3defb1bb14
[*] Expand watcher API -> Breaking NT [*] Reexpand loop queue API -> Breaking NT [*] Linux CPUInfo clean up [*] Bug fix: mkdir should set execute flag... because directories are special [*] Refactor: Cleanup base64 [*] Bug fix: UNIX path normalization [*] Bug fix: missing O_CREAT flag (au auto-creates) [*] Normalize line endings
45 lines
1.1 KiB
C++
Executable File
45 lines
1.1 KiB
C++
Executable File
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Watcher.Linux.hpp
|
|
Date: 2022-4-10
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::IO::FS
|
|
{
|
|
struct LinuxWatcherHandle;
|
|
|
|
struct UnixCachedPath
|
|
{
|
|
AuString strNormalizedPath;
|
|
AuString strTheCakeIsALie;
|
|
AuSPtr<UserWatchData> userData;
|
|
int watcherWd {-1};
|
|
};
|
|
|
|
struct LinuxWatcher : IWatcher
|
|
{
|
|
~LinuxWatcher();
|
|
|
|
virtual bool AddWatch(const WatchRequest &file) override;
|
|
|
|
virtual bool RemoveByName(const AuString &path) override;
|
|
virtual bool RemoveByPrivateContext(const AuSPtr<UserWatchData> &file) override;
|
|
|
|
virtual AuSPtr<Loop::ILoopSource> AsLoopSource() override;
|
|
|
|
virtual AuList<WatchEvent> QueryUpdates() override;
|
|
|
|
bool Init();
|
|
void Deinit();
|
|
|
|
private:
|
|
AuSPtr<LinuxWatcherHandle> loopSource_;
|
|
AuThreadPrimitives::SpinLock spinlock_;
|
|
AuList<UnixCachedPath> paths_;
|
|
int inotifyHandle_ {-1};
|
|
};
|
|
|
|
} |