All Projects → septag → Dmon

septag / Dmon

Licence: bsd-2-clause
Single header C99 portable library for monitoring directory changes.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Dmon

ModernOperatingSystems AndrewTanenbaum
My notes after reading 'Modern Operating Systems' book by Andrew Tanenbaum and Herbert Bos.
Stars: ✭ 71 (-25.26%)
Mutual labels:  filesystem, os
xv6-file-system-visualizer
Online Visualizer for xv6 File System Image
Stars: ✭ 33 (-65.26%)
Mutual labels:  filesystem, os
findlargedir
find all "blackhole" directories with a huge amount of filesystem entries in a flat structure
Stars: ✭ 15 (-84.21%)
Mutual labels:  filesystem, os
Aqeous
(Inactive, Checkout AvanaOS, Rewrite of this) This is a New Operating System (Kernel right now). Made completely from scratch, We aim to make a complete OS for Learning purpose
Stars: ✭ 23 (-75.79%)
Mutual labels:  filesystem, os
woapp
web模拟安卓操作系统,php开发,内置文件管理,电话,短信,拍照,用在树莓派上可做智能家居,视频监控,机顶盒等……
Stars: ✭ 22 (-76.84%)
Mutual labels:  filesystem, os
SimpleOS
Operating System Coded in Assembly and C
Stars: ✭ 72 (-24.21%)
Mutual labels:  filesystem, os
Fdir
⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
Stars: ✭ 777 (+717.89%)
Mutual labels:  filesystem, os
Cs Books
超过1000本的计算机经典书籍、个人笔记资料以及本人在各平台发表文章中所涉及的资源等。书籍资源包括C/C++、Java、Python、Go语言、数据结构与算法、操作系统、后端架构、计算机系统知识、数据库、计算机网络、设计模式、前端、汇编以及校招社招各种面经~
Stars: ✭ 1,215 (+1178.95%)
Mutual labels:  os
Vfsstream
vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.
Stars: ✭ 1,302 (+1270.53%)
Mutual labels:  filesystem
Os filesystem
A linux-like virtual file system by C++
Stars: ✭ 79 (-16.84%)
Mutual labels:  os
Kotlin Inline Logger
A logger facilitating lazily-evaluated log calls via Kotlin's inline classes & functions.
Stars: ✭ 77 (-18.95%)
Mutual labels:  multiplatform
Headmore
Top geek’s VNC client that runs in Linux terminal (Linux VT console, xterm, and more)
Stars: ✭ 82 (-13.68%)
Mutual labels:  os
Reactos
A free Windows-compatible Operating System
Stars: ✭ 10,216 (+10653.68%)
Mutual labels:  os
Rothko
An abstracted library for interacting with the file system, registry, etc.
Stars: ✭ 79 (-16.84%)
Mutual labels:  filesystem
Pcapplusplus
PcapPlusPlus is a multiplatform C++ library for capturing, parsing and crafting of network packets. It is designed to be efficient, powerful and easy to use. It provides C++ wrappers for the most popular packet processing engines such as libpcap, WinPcap, DPDK and PF_RING.
Stars: ✭ 1,322 (+1291.58%)
Mutual labels:  multiplatform
Chrysalisp
Parallel OS, with GUI, Terminal, OO Assembler, Class libraries, C-Script compiler, Lisp interpreter and more...
Stars: ✭ 1,205 (+1168.42%)
Mutual labels:  os
Fs extra
Expanding opportunities standard library std::fs and std::io
Stars: ✭ 95 (+0%)
Mutual labels:  filesystem
Ktf
Kernel Test Framework
Stars: ✭ 93 (-2.11%)
Mutual labels:  os
Dfc
Report file system space usage information with style (mirror repository)
Stars: ✭ 84 (-11.58%)
Mutual labels:  filesystem
One Lin3r
Gives you one-liners that aids in penetration testing operations, privilege escalation and more
Stars: ✭ 1,259 (+1225.26%)
Mutual labels:  multiplatform

dmon

@septag

dmon is a tiny C library that monitors changes in a directory. It provides a unified solution to multiple system APIs that exist for each OS. It can also monitor directories recursively.

Platforms

  • Windows: ReadDirectoryChangesW backend. Tested with Windows10 SDK + Visual Studio 2019
  • Linux: inotify backend. Tested with gcc-7.4/clang-6, ubuntu 18.04 LTS
  • MacOS: FSEvents backend. Tested with MacOS-10.14 clang 10

Usage

You just have to include the file and use it's functions. It is also compatible with C++ code. Backslashes in Windows paths are also converted to '/' for portability.

#define DMON_IMPL
#include "dmon.h"

static void watch_callback(dmon_watch_id watch_id, dmon_action action, const char* rootdir,
                           const char* filepath, const char* oldfilepath, void* user)
{
    // receive change events. type of event is stored in 'action' variable
}

int main() 
{
    dmon_init();
    dmon_watch("/path/to/directory", watch_callback, DMON_WATCHFLAGS_RECURSIVE, NULL); 
    // wait ...
    dmon_deinit();
	return 0;
}

For more information and how to customize functionality, see dmon.h

To build on linux, link with pthread: gcc test.c -lpthread -o test

To build on MacOS, link with CoreServices and CoreFoundation: clang test.c -framework CoreFoundation -framework CoreServices -lpthread -o test

License (BSD 2-clause)

Copyright 2019 Sepehr Taghdisian. All rights reserved.

https://github.com/septag/dmon

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

   1. Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.

   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].