VALUE rb_syserr_new(int n, const char *mesg) { VALUE arg; arg = mesg ? rb_str_new2(mesg) : Qnil; return rb_class_new_instance(1, &arg, get_syserr(n)); }
static VALUE make_errno_exc(const char *mesg) { int n = errno; VALUE arg; errno = 0; if (n == 0) { rb_bug("rb_sys_fail(%s) - errno == 0", mesg ? mesg : ""); } arg = mesg ? rb_str_new2(mesg) : Qnil; return rb_class_new_instance(1, &arg, get_syserr(n)); }
void rb_sys_fail(const char *mesg) { int n = errno; VALUE arg; errno = 0; if (n == 0) { rb_bug("rb_sys_fail(%s) - errno == 0", mesg ? mesg : ""); } arg = mesg ? rb_str_new2(mesg) : Qnil; rb_exc_raise(rb_class_new_instance(1, &arg, get_syserr(n))); }
void rb_syserr_fail_path_in(const char *func_name, int n, VALUE path) { VALUE args[2]; if (!path) path = Qnil; if (n == 0) { const char *s = !NIL_P(path) ? RSTRING_PTR(path) : ""; if (!func_name) func_name = "(null)"; rb_bug("rb_sys_fail_path_in(%s, %s) - errno == 0", func_name, s); } args[0] = path; args[1] = rb_str_new_cstr(func_name); rb_exc_raise(rb_class_new_instance(2, args, get_syserr(n))); }
VALUE rb_syserr_new_str(int n, VALUE arg) { return rb_class_new_instance(1, &arg, get_syserr(n)); }