Module: FFI::LastError
- Defined in:
- ext/ffi_c/LastError.c,
ext/ffi_c/LastError.c
Overview
This module defines a couple of method to set and get errno
for current thread.
Class Method Summary collapse
-
.error ⇒ Integer
Get
errno
value. -
.error(error) ⇒ nil
Set
errno
value. -
.winapi_error ⇒ Integer
Get GetLastError() value.
-
.error(error) ⇒ nil
Set GetLastError() value.
Class Method Details
.error ⇒ Integer
Get errno
value.
147 148 149 150 151 |
# File 'ext/ffi_c/LastError.c', line 147
static VALUE
get_last_error(VALUE self)
{
return INT2NUM(thread_data_get()->td_errno);
}
|
.error(error) ⇒ nil
Set errno
value.
173 174 175 176 177 178 179 180 181 182 183 |
# 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 ⇒ Integer
Get GetLastError() value. Only Windows or Cygwin.
159 160 161 162 163 |
# 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) ⇒ nil
Set GetLastError() value. Only on Windows and Cygwin.
192 193 194 195 196 197 |
# File 'ext/ffi_c/LastError.c', line 192
static VALUE
set_last_winapi_error(VALUE self, VALUE error)
{
SetLastError(NUM2INT(error));
return Qnil;
}
|