Skip to content

Instantly share code, notes, and snippets.

View jaypeche's full-sized avatar
:octocat:
Gentoo nightly build

jay jaypeche

:octocat:
Gentoo nightly build
View GitHub Profile
@jaypeche
jaypeche / stdin
Created December 10, 2014 17:04
stdin
Portage 2.2.14 (python 3.3.5-final-0, default/linux/amd64/13.0/desktop/gnome/systemd, gcc-4.8.3, glibc-2.19-r1, 3.16.5-gentoo x86_64)
=================================================================
System uname: Linux-3.16.5-gentoo-x86_64-Intel-R-_Pentium-R-_4_CPU_3.00GHz-with-gentoo-2.2
KiB Mem: 1537056 total, 29716 free
KiB Swap: 3156768 total, 1876264 free
Timestamp of tree: Wed, 10 Dec 2014 01:45:01 +0000
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash: 4.2_p53
dev-java/java-config: 2.2.0
dev-lang/perl: 5.18.2-r2
/*
* This program (which doesn't works as expected because of inotify), is a sample use of inotify,
* which get's notifications from a recursive directory
*/
#define __KERNEL_STRICT_NAMES
#define _GNU_SOURCE
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
@jaypeche
jaypeche / clamav-realtime.c
Created December 15, 2014 14:19
clamav-realtime 0.0.3 with --help
/* This is clamav-realtime sources build with gcc-4.7.3
* Version 0.0.3 - 15 dec 2014
* Written by Jérôme PECHE(c), jaypeche@gmail.com
* Distributed under the terms of General Public License GPLv3
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@jaypeche
jaypeche / inotify_simple.c
Created December 17, 2014 12:35
inotify basic example
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/inotify.h>
#include <limits.h>
#define MAX_EVENTS 1024 /*Max. number of events to process at one go*/
#define LEN_NAME 16 /*Assuming that the length of the filename won't exceed 16 bytes*/
#define EVENT_SIZE ( sizeof (struct inotify_event) ) /*size of one event*/
@jaypeche
jaypeche / inotify_subdir.c
Created December 17, 2014 12:36
inotify watching subdirs
/* Using Inotify to monitor the sub-dirs under the specifiied dir*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/inotify.h>
#include <dirent.h>
#include <limits.h>
@jaypeche
jaypeche / fanotify-example.c
Created December 20, 2014 10:48
fanotify example
/*
* File: fanotify-example.c
* Date: Fri Nov 15 14:55:49 2013
* Author: Aleksander Morgado <aleksander@lanedo.com>
*
* A simple tester of fanotify in the Linux kernel.
*
* This program is released in the Public Domain.
*
* Compile with:
#include <stdio.h>
#include <signal.h>
#include <syslog.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define DAEMON_NAME "simpledaemon"
/* demo_inotify.c
Demonstrate the use of the inotify API.
Usage: demo_inotify pathname...
The program monitors each of the files specified on the command line for all
possible file events.
This program is Linux-specific. The inotify API is available in Linux 2.6.13
@jaypeche
jaypeche / clamav-realtime.c
Created January 5, 2015 11:47
Functionnal scan engine
/* This is clamav-realtime sources build with gcc-4.7.3
* Version 0.0.1 - 12 nov 2013
* Written by Jérôme PECHE(c), jaypeche@gmail.com
* Distributed under the terms of General Public License GPLv3
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* This is clamav-realtime sources build with gcc-4.7.3
* Version 0.0.1 - 12 nov 2013
* Distributed under the terms of General Public License GPLv3
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>