clsync
Loading...
Searching...
No Matches
mon_gio.c File Reference
#include "common.h"
#include "error.h"
#include "sync.h"
#include "indexes.h"
#include "privileged.h"
#include <pthread.h>
#include <gio/gio.h>
#include "mon_gio.h"
Include dependency graph for mon_gio.c:

Go to the source code of this file.

Data Structures

struct  filemondata
 
struct  event
 

Macros

#define INFINITETIME   (3600 * 24 * 365 * 10) /* ~10 years */
 

Typedefs

typedef struct filemondata filemondata_t
 
typedef struct event event_t
 

Functions

static void event_free (event_t *ev)
 
static int event_push (char *path, gulong handle_id, GFileMonitorEvent event, eventobjtype_t objtype_event, eventobjtype_t objtype_old, eventobjtype_t objtype_new)
 
static event_tevent_pop ()
 
static void dir_gotevent (GFileMonitor *filemon, GFile *file, GFile *file_other, GFileMonitorEvent event, gpointer arg)
 
int gio_add_watch_dir (ctx_t *ctx_p, indexes_t *indexes_p, const char *const accpath)
 
void * g_iteration_stop (void *_timeout_p)
 
static int gio_wait_now (ctx_t *ctx_p, struct indexes *indexes_p, struct timeval *tv_p)
 
int gio_wait (ctx_t *ctx_p, struct indexes *indexes_p, struct timeval *tv_p)
 
int gio_handle (ctx_t *ctx_p, indexes_t *indexes_p)
 
void free_filemondat (void *_fmdat)
 
int gio_init (ctx_t *ctx_p)
 
int gio_deinit (ctx_t *ctx_p)
 

Variables

GHashTable * mondirs_ht
 
pthread_spinlock_t queue_lock
 
pthread_mutex_t gio_mutex_prefetcher = PTHREAD_MUTEX_INITIALIZER
 
pthread_cond_t gio_cond_gotevent = PTHREAD_COND_INITIALIZER
 
event_tqueue = NULL
 
int queue_length
 
int queue_alloc
 
int cancel_g_iteration_stop
 
pthread_t thread_g_iteration_stop
 
GMainLoop * gio_loop = NULL
 

Macro Definition Documentation

◆ INFINITETIME

#define INFINITETIME   (3600 * 24 * 365 * 10) /* ~10 years */

Typedef Documentation

◆ event_t

typedef struct event event_t

Definition at line 49 of file mon_gio.c.

◆ filemondata_t

typedef struct filemondata filemondata_t

Definition at line 39 of file mon_gio.c.

Function Documentation

◆ dir_gotevent()

static void dir_gotevent ( GFileMonitor * filemon,
GFile * file,
GFile * file_other,
GFileMonitorEvent event,
gpointer arg )
static

Definition at line 101 of file mon_gio.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ event_free()

static void event_free ( event_t * ev)
inlinestatic

Definition at line 59 of file mon_gio.c.

Here is the caller graph for this function:

◆ event_pop()

static event_t * event_pop ( )
inlinestatic

Definition at line 89 of file mon_gio.c.

Here is the caller graph for this function:

◆ event_push()

static int event_push ( char * path,
gulong handle_id,
GFileMonitorEvent event,
eventobjtype_t objtype_event,
eventobjtype_t objtype_old,
eventobjtype_t objtype_new )
inlinestatic

Definition at line 65 of file mon_gio.c.

Here is the caller graph for this function:

◆ free_filemondat()

void free_filemondat ( void * _fmdat)

Definition at line 355 of file mon_gio.c.

Here is the caller graph for this function:

◆ g_iteration_stop()

void * g_iteration_stop ( void * _timeout_p)

Definition at line 207 of file mon_gio.c.

Here is the caller graph for this function:

◆ gio_add_watch_dir()

int gio_add_watch_dir ( ctx_t * ctx_p,
indexes_t * indexes_p,
const char *const accpath )

Definition at line 180 of file mon_gio.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gio_deinit()

int gio_deinit ( ctx_t * ctx_p)

Definition at line 380 of file mon_gio.c.

Here is the caller graph for this function:

◆ gio_handle()

int gio_handle ( ctx_t * ctx_p,
indexes_t * indexes_p )

Definition at line 309 of file mon_gio.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gio_init()

int gio_init ( ctx_t * ctx_p)

Definition at line 366 of file mon_gio.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gio_wait()

int gio_wait ( ctx_t * ctx_p,
struct indexes * indexes_p,
struct timeval * tv_p )

Definition at line 297 of file mon_gio.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gio_wait_now()

static int gio_wait_now ( ctx_t * ctx_p,
struct indexes * indexes_p,
struct timeval * tv_p )
inlinestatic

Definition at line 247 of file mon_gio.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cancel_g_iteration_stop

int cancel_g_iteration_stop

Definition at line 205 of file mon_gio.c.

◆ gio_cond_gotevent

pthread_cond_t gio_cond_gotevent = PTHREAD_COND_INITIALIZER

Definition at line 54 of file mon_gio.c.

◆ gio_loop

GMainLoop* gio_loop = NULL

Definition at line 365 of file mon_gio.c.

◆ gio_mutex_prefetcher

pthread_mutex_t gio_mutex_prefetcher = PTHREAD_MUTEX_INITIALIZER

Definition at line 53 of file mon_gio.c.

◆ mondirs_ht

GHashTable* mondirs_ht

Definition at line 51 of file mon_gio.c.

◆ queue

event_t* queue = NULL

Definition at line 55 of file mon_gio.c.

◆ queue_alloc

int queue_alloc

Definition at line 57 of file mon_gio.c.

◆ queue_length

int queue_length

Definition at line 56 of file mon_gio.c.

◆ queue_lock

pthread_spinlock_t queue_lock

Definition at line 52 of file mon_gio.c.

◆ thread_g_iteration_stop

pthread_t thread_g_iteration_stop

Definition at line 206 of file mon_gio.c.