Sha256: 2f2628f5e54e61c3956511b41b535bba270d046b0d6fcafda0934cbcb802bc1f

Contents?: true

Size: 1.57 KB

Versions: 20

Compression:

Stored size: 1.57 KB

Contents

#ifndef MMAP_H
#define MMAP_H

#include <ruby.h>
#include <unistd.h>

#define MM_MODIFY 1
#define MM_ORIGIN 2
#define MM_CHANGE (MM_MODIFY | 4)
#define MM_PROTECT 8

#define MM_FROZEN (1 << 0)
#define MM_FIXED (1 << 1)
#define MM_ANON (1 << 2)
#define MM_LOCK (1 << 3)
#define MM_IPC (1 << 4)
#define MM_TMP (1 << 5)

#ifndef MMAP_RETTYPE
#define MMAP_RETTYPE void *
#endif

typedef struct {
    MMAP_RETTYPE addr;
    int smode, pmode, vscope;
    int advice, flag;
    VALUE key;
    size_t len, real;
    off_t offset;
    int fd;
    char *path;
} mm_mmap;

typedef struct {
    int count;
    mm_mmap *t;
} mm_ipc;

#define GET_MMAP(obj, i_mm, t_modify)                                                                \
    Data_Get_Struct(obj, mm_ipc, i_mm);                                                              \
    if (!i_mm->t->path || i_mm->t->fd < 0 || i_mm->t->addr == NULL || i_mm->t->addr == MAP_FAILED) { \
        rb_raise(rb_eIOError, "unmapped file");                                                      \
    }                                                                                                \
    if ((t_modify & MM_MODIFY) && (i_mm->t->flag & MM_FROZEN)) {                                     \
        rb_error_frozen("mmap");                                                                     \
    }

VALUE mm_s_alloc(VALUE obj);
VALUE mm_s_new(int argc, VALUE *argv, VALUE obj);
VALUE mm_init(VALUE obj, VALUE fname);
VALUE mm_aref_m(int argc, VALUE *argv, VALUE obj);
VALUE mm_msync(int argc, VALUE *argv, VALUE obj);
VALUE mm_unmap(VALUE obj);

#endif

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
prometheus-client-mmap-0.16.2 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.16.1 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.16.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.15.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.14.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.13.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.12.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.11.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.10.0 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.10 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.9 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.8 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.7 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.6 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.5 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.4 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.3 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.2 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.1 ext/fast_mmaped_file/mmap.h
prometheus-client-mmap-0.9.1.pre.rc.2 ext/fast_mmaped_file/mmap.h