Class: Mountfd::Native::Handle

Inherits:
Object
  • Object
show all
Defined in:
ext/mountfd/mountfd.c

Instance Method Summary collapse

Instance Method Details

#closeObject



82
83
84
85
86
87
88
89
90
91
92
93
# File 'ext/mountfd/mountfd.c', line 82

static VALUE handle_close(VALUE self)
{
    mountfd_handle *handle;
    int fd;
    TypedData_Get_Struct(self, mountfd_handle, &handle_type, handle);
    if (handle->fd >= 0) {
        fd = handle->fd;
        handle->fd = -1;
        if (mountfd_close(fd) < 0) rb_sys_fail("close");
    }
    return Qnil;
}

#closed?Boolean

Returns:

  • (Boolean)


95
96
97
98
99
100
# File 'ext/mountfd/mountfd.c', line 95

static VALUE handle_closed(VALUE self)
{
    mountfd_handle *handle;
    TypedData_Get_Struct(self, mountfd_handle, &handle_type, handle);
    return handle->fd < 0 ? Qtrue : Qfalse;
}

#filenoObject



77
78
79
80
# File 'ext/mountfd/mountfd.c', line 77

static VALUE handle_fileno(VALUE self)
{
    return INT2NUM(get_handle(self)->fd);
}