Blame gio/kqueue/kqueue-utils.h

Packit ae235b
/*******************************************************************************
Packit ae235b
  Copyright (c) 2011, 2012 Dmitry Matveev <me@dmitrymatveev.co.uk>
Packit ae235b
Packit ae235b
  Permission is hereby granted, free of charge, to any person obtaining a copy
Packit ae235b
  of this software and associated documentation files (the "Software"), to deal
Packit ae235b
  in the Software without restriction, including without limitation the rights
Packit ae235b
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Packit ae235b
  copies of the Software, and to permit persons to whom the Software is
Packit ae235b
  furnished to do so, subject to the following conditions:
Packit ae235b
Packit ae235b
  The above copyright notice and this permission notice shall be included in
Packit ae235b
  all copies or substantial portions of the Software.
Packit ae235b
Packit ae235b
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit ae235b
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit ae235b
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Packit ae235b
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Packit ae235b
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Packit ae235b
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
Packit ae235b
  THE SOFTWARE.
Packit ae235b
*******************************************************************************/
Packit ae235b
Packit ae235b
#ifndef __KQUEUE_UTILS_H
Packit ae235b
#define __KQUEUE_UTILS_H
Packit ae235b
Packit ae235b
#include <sys/types.h> /* ino_t */
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * kqueue_notification:
Packit ae235b
 * @memory: a pointer to the allocated memory
Packit ae235b
 * @kq_size: the number of used items
Packit ae235b
 * @kq_allocated: the number of allocated items
Packit ae235b
 *
Packit ae235b
 * Represents a pool of (struct kevent) objects.
Packit ae235b
 */
Packit ae235b
typedef struct {
Packit ae235b
  struct kevent *memory;
Packit ae235b
  gsize kq_size;
Packit ae235b
  gsize kq_allocated;
Packit ae235b
} kevents;
Packit ae235b
Packit ae235b
void kevents_init_sz   (kevents *kv, gsize n_initial);
Packit ae235b
void kevents_extend_sz (kevents *kv, gsize n_new);
Packit ae235b
void kevents_reduce    (kevents *kv);
Packit ae235b
void kevents_free      (kevents *kv);
Packit ae235b
Packit ae235b
Packit ae235b
gboolean _ku_read             (int fd, gpointer data, gsize size);
Packit ae235b
gboolean _ku_write            (int fd, gconstpointer data, gsize size);
Packit ae235b
Packit ae235b
void     _ku_file_information (int fd, int *is_dir, ino_t *inode);
Packit ae235b
Packit ae235b
#endif /* __KQUEUE_UTILS_H */