123456789_123456789_123456789_123456789_123456789_

Module: FFI::LastError

Relationships & Source Files
Defined in: ext/ffi_c/LastError.c

Overview

This module defines a couple of method to set and get errno for current thread.

Class Attribute Summary

Class Attribute Details

.error (rw, mod_func) Get({errno} value.)

[ GitHub ]

  
# File 'ext/ffi_c/LastError.c', line 147

static VALUE
get_last_error(VALUE self)
{
    return INT2NUM(thread_data_get()->td_errno);
}

.error(error) (rw, mod_func) Set({errno} value.)

[ GitHub ]

  
# File 'ext/ffi_c/LastError.c', line 173

static VALUE
set_last_error(VALUE self, VALUE error)
{
#ifdef _WIN32
    SetLastError(NUM2INT(error));
#else
    errno = NUM2INT(error);
#endif

    return Qnil;
}

.winapi_error (rw, mod_func) Get(+GetLastError()+ value. Only Windows or Cygwin.)

[ GitHub ]

  
# File 'ext/ffi_c/LastError.c', line 159

static VALUE
get_last_winapi_error(VALUE self)
{
    return INT2NUM(thread_data_get()->td_winapi_errno);
}

.error(error) (rw, mod_func) Set(+GetLastError()+ value. Only on Windows and Cygwin.)

[ GitHub ]

  
# File 'ext/ffi_c/LastError.c', line 192

static VALUE
set_last_winapi_error(VALUE self, VALUE error)
{
    SetLastError(NUM2INT(error));
    return Qnil;
}