AuroraRuntime/Source/IO/FS/Watcher.Linux.hpp
J Reece Wilson 3defb1bb14 [+] Linux Watcher
[*] 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
2022-04-10 16:40:49 +01:00

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};
};
}