diff options
Diffstat (limited to 'web/server/h2o/libh2o/deps/mruby-errno')
11 files changed, 1627 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/mruby-errno/.gitignore b/web/server/h2o/libh2o/deps/mruby-errno/.gitignore new file mode 100644 index 000000000..ceeb05b41 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/.gitignore @@ -0,0 +1 @@ +/tmp diff --git a/web/server/h2o/libh2o/deps/mruby-errno/.travis.yml b/web/server/h2o/libh2o/deps/mruby-errno/.travis.yml new file mode 100644 index 000000000..ffe227284 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/.travis.yml @@ -0,0 +1,2 @@ +script: + - "ruby run_test.rb all test" diff --git a/web/server/h2o/libh2o/deps/mruby-errno/README.md b/web/server/h2o/libh2o/deps/mruby-errno/README.md new file mode 100644 index 000000000..e3c594cb5 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/README.md @@ -0,0 +1,27 @@ +mruby-errno +=========== + +Errno module for mruby + + +## License + +Copyright (c) 2013 Internet Initiative Japan Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/web/server/h2o/libh2o/deps/mruby-errno/mrbgem.rake b/web/server/h2o/libh2o/deps/mruby-errno/mrbgem.rake new file mode 100644 index 000000000..ba3d60dae --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/mrbgem.rake @@ -0,0 +1,6 @@ +MRuby::Gem::Specification.new('mruby-errno') do |spec| + spec.license = 'MIT' + spec.authors = 'Internet Initiative Japan Inc.' + + spec.cc.include_paths << "#{build.root}/src" +end diff --git a/web/server/h2o/libh2o/deps/mruby-errno/run_test.rb b/web/server/h2o/libh2o/deps/mruby-errno/run_test.rb new file mode 100644 index 000000000..d9566a2a6 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/run_test.rb @@ -0,0 +1,26 @@ +#!/usr/bin/env ruby +# +# mrbgems test runner +# + +gemname = File.basename(File.dirname(File.expand_path __FILE__)) + +if __FILE__ == $0 + repository, dir = 'https://github.com/mruby/mruby.git', 'tmp/mruby' + build_args = ARGV + build_args = ['all', 'test'] if build_args.nil? or build_args.empty? + + Dir.mkdir 'tmp' unless File.exist?('tmp') + unless File.exist?(dir) + system "git clone #{repository} #{dir}" + end + + exit system(%Q[cd #{dir}; MRUBY_CONFIG=#{File.expand_path __FILE__} ruby minirake #{build_args.join(' ')}]) +end + +MRuby::Build.new do |conf| + toolchain :gcc + conf.gembox 'default' + + conf.gem File.expand_path(File.dirname(__FILE__)) +end diff --git a/web/server/h2o/libh2o/deps/mruby-errno/src/errno.c b/web/server/h2o/libh2o/deps/mruby-errno/src/errno.c new file mode 100644 index 000000000..3617efd45 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/src/errno.c @@ -0,0 +1,175 @@ +#include "mruby.h" +#include "mruby/array.h" +#include "mruby/class.h" +#include "mruby/hash.h" +#include "mruby/numeric.h" +#include "mruby/string.h" +#include "mruby/variable.h" +#include <errno.h> +#include <stdio.h> +#include <string.h> + +#if MRUBY_RELEASE_NO < 10000 +static struct RClass * +mrb_module_get(mrb_state *mrb, const char *name) +{ + return mrb_class_get(mrb, name); +} +#endif + +static mrb_value +mrb_sce_init(mrb_state *mrb, mrb_value self) +{ + mrb_value c, e2c, m, str; + mrb_int n; + int argc, no_errno = 0; + char buf[20]; + + argc = mrb_get_args(mrb, "o|i", &m, &n); + if (argc == 1) { + if (mrb_type(m) == MRB_TT_FIXNUM) { + n = mrb_fixnum(m); + m = mrb_nil_value(); + } else { + no_errno = 1; + } + } + if (!no_errno) { + e2c = mrb_const_get(mrb, mrb_obj_value(mrb_module_get(mrb, "Errno")), mrb_intern_lit(mrb, "Errno2class")); + c = mrb_hash_fetch(mrb, e2c, mrb_fixnum_value(n), mrb_nil_value()); + if (!mrb_nil_p(c)) { + mrb_basic_ptr(self)->c = mrb_class_ptr(c); + str = mrb_str_new_cstr(mrb, strerror(n)); + } else { + mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "errno"), mrb_fixnum_value(n)); + str = mrb_str_new_cstr(mrb, "Unknown error: "); + snprintf(buf, sizeof(buf), "%d", (int)n); + mrb_str_cat2(mrb, str, buf); + } + } else { + str = mrb_str_new_cstr(mrb, "unknown error"); + } + if (!mrb_nil_p(m)) { + mrb_str_cat2(mrb, str, " - "); + mrb_str_append(mrb, str, m); + } + mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "mesg"), str); + return self; +} + +static mrb_value +mrb_sce_errno(mrb_state *mrb, mrb_value self) +{ + struct RClass *c; + mrb_sym sym; + + c = mrb_class(mrb, self); + sym = mrb_intern_lit(mrb, "Errno"); +#if MRUBY_RELEASE_NO < 10000 + if (mrb_const_defined_at(mrb, c, sym)) { +#else + if (mrb_const_defined_at(mrb, mrb_obj_value(c), sym)) { +#endif + return mrb_const_get(mrb, mrb_obj_value(c), sym); + } else { + sym = mrb_intern_lit(mrb, "errno"); + return mrb_attr_get(mrb, self, sym); + } +} + +static mrb_value +mrb_sce_to_s(mrb_state *mrb, mrb_value self) +{ + return mrb_attr_get(mrb, self, mrb_intern_lit(mrb, "mesg")); +} + +static mrb_value +mrb_sce_sys_fail(mrb_state *mrb, mrb_value cls) +{ + struct RClass *cl, *sce; + mrb_value e, msg; + mrb_int no; + int argc; + char name[8]; + + sce = mrb_class_get(mrb, "SystemCallError"); + argc = mrb_get_args(mrb, "i|S", &no, &msg); + if (argc == 1) { + e = mrb_funcall(mrb, mrb_obj_value(sce), "new", 1, mrb_fixnum_value(no)); + } else { + e = mrb_funcall(mrb, mrb_obj_value(sce), "new", 2, msg, mrb_fixnum_value(no)); + } + if (mrb_obj_class(mrb, e) == sce) { + snprintf(name, sizeof(name), "E%03ld", (long)no); + cl = mrb_define_class_under(mrb, mrb_module_get(mrb, "Errno"), name, sce); + mrb_define_const(mrb, cl, "Errno", mrb_fixnum_value(no)); + mrb_basic_ptr(e)->c = cl; + } + mrb_exc_raise(mrb, e); + return mrb_nil_value(); /* NOTREACHED */ +} + +static mrb_value +mrb_exxx_init(mrb_state *mrb, mrb_value self) +{ + mrb_value m, no, str; + + no = mrb_const_get(mrb, mrb_obj_value(mrb_class(mrb, self)), mrb_intern_lit(mrb, "Errno")); + str = mrb_str_new_cstr(mrb, strerror(mrb_fixnum(no))); + + m = mrb_nil_value(); + mrb_get_args(mrb, "|S", &m); + if (!mrb_nil_p(m)) { + mrb_str_cat2(mrb, str, " - "); + mrb_str_append(mrb, str, m); + } + mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "mesg"), str); + return self; +} + +void +mrb_mruby_errno_gem_init(mrb_state *mrb) +{ + struct RClass *e, *eno, *sce, *ste; + mrb_value h, noerror; + + ste = mrb_class_get(mrb, "StandardError"); + + sce = mrb_define_class(mrb, "SystemCallError", ste); + mrb_define_class_method(mrb, sce, "_sys_fail", mrb_sce_sys_fail, MRB_ARGS_REQ(1)); + mrb_define_method(mrb, sce, "errno", mrb_sce_errno, MRB_ARGS_NONE()); + mrb_define_method(mrb, sce, "to_s", mrb_sce_to_s, MRB_ARGS_NONE()); + mrb_define_method(mrb, sce, "initialize", mrb_sce_init, MRB_ARGS_ARG(1, 1)); + + eno = mrb_define_module(mrb, "Errno"); + h = mrb_hash_new(mrb); + mrb_define_const(mrb, eno, "Errno2class", h); + + e = mrb_define_class_under(mrb, eno, "NOERROR", sce); + mrb_define_const(mrb, e, "Errno", mrb_fixnum_value(0)); + mrb_define_method(mrb, e, "initialize", mrb_exxx_init, MRB_ARGS_OPT(1)); + //mrb_define_method(mrb, e, "===", mrb_exxx_cmp, MRB_ARGS_REQ(1)); + noerror = mrb_obj_value(e); + +#define itsdefined(SYM) \ + do { \ + int ai = mrb_gc_arena_save(mrb); \ + e = mrb_define_class_under(mrb, eno, #SYM, sce); \ + mrb_define_const(mrb, e, "Errno", mrb_fixnum_value(SYM)); \ + mrb_define_method(mrb, e, "initialize", mrb_exxx_init, MRB_ARGS_OPT(1)); \ + mrb_hash_set(mrb, h, mrb_fixnum_value(SYM), mrb_obj_value(e)); \ + mrb_gc_arena_restore(mrb, ai); \ + } while (0) + +#define itsnotdefined(SYM) \ + do { \ + mrb_define_const(mrb, eno, #SYM, noerror); \ + } while (0) + +#include "known_errors_def.cstub" +} + +void +mrb_mruby_errno_gem_final(mrb_state *mrb) +{ +} diff --git a/web/server/h2o/libh2o/deps/mruby-errno/src/gen.rb b/web/server/h2o/libh2o/deps/mruby-errno/src/gen.rb new file mode 100755 index 000000000..12e6b302e --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/src/gen.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +Dir.chdir(File.dirname($0)) + +e = File.open("known_errors_e2c.cstub", "w") +d = File.open("known_errors_def.cstub", "w") + +IO.readlines("known_errors.def").each { |name| + next if name =~ /^#/ + name.strip! + + e.write <<CODE +#ifdef #{name} + { #{name}, NULL, }, +#endif +CODE + + d.write <<CODE +#ifdef #{name} + itsdefined(#{name}); +#else + itsnotdefined(#{name}); +#endif +CODE +} diff --git a/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors.def b/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors.def new file mode 100644 index 000000000..3cebe90a8 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors.def @@ -0,0 +1,145 @@ +EPERM +ENOENT +ESRCH +EINTR +EIO +ENXIO +E2BIG +ENOEXEC +EBADF +ECHILD +EAGAIN +ENOMEM +EACCES +EFAULT +ENOTBLK +EBUSY +EEXIST +EXDEV +ENODEV +ENOTDIR +EISDIR +EINVAL +ENFILE +EMFILE +ENOTTY +ETXTBSY +EFBIG +ENOSPC +ESPIPE +EROFS +EMLINK +EPIPE +EDOM +ERANGE +EDEADLK +ENAMETOOLONG +ENOLCK +ENOSYS +ENOTEMPTY +ELOOP +EWOULDBLOCK +ENOMSG +EIDRM +ECHRNG +EL2NSYNC +EL3HLT +EL3RST +ELNRNG +EUNATCH +ENOCSI +EL2HLT +EBADE +EBADR +EXFULL +ENOANO +EBADRQC +EBADSLT +EDEADLOCK +EBFONT +ENOSTR +ENODATA +ETIME +ENOSR +ENONET +ENOPKG +EREMOTE +ENOLINK +EADV +ESRMNT +ECOMM +EPROTO +EMULTIHOP +EDOTDOT +EBADMSG +EOVERFLOW +ENOTUNIQ +EBADFD +EREMCHG +ELIBACC +ELIBBAD +ELIBSCN +ELIBMAX +ELIBEXEC +EILSEQ +ERESTART +ESTRPIPE +EUSERS +ENOTSOCK +EDESTADDRREQ +EMSGSIZE +EPROTOTYPE +ENOPROTOOPT +EPROTONOSUPPORT +ESOCKTNOSUPPORT +EOPNOTSUPP +EPFNOSUPPORT +EAFNOSUPPORT +EADDRINUSE +EADDRNOTAVAIL +ENETDOWN +ENETUNREACH +ENETRESET +ECONNABORTED +ECONNRESET +ENOBUFS +EISCONN +ENOTCONN +ESHUTDOWN +ETOOMANYREFS +ETIMEDOUT +ECONNREFUSED +EHOSTDOWN +EHOSTUNREACH +EALREADY +EINPROGRESS +ESTALE +EUCLEAN +ENOTNAM +ENAVAIL +EISNAM +EREMOTEIO +EDQUOT +ECANCELED +EKEYEXPIRED +EKEYREJECTED +EKEYREVOKED +EMEDIUMTYPE +ENOKEY +ENOMEDIUM +ENOTRECOVERABLE +EOWNERDEAD +ERFKILL +EAUTH +EBADRPC +EDOOFUS +EFTYPE +ENEEDAUTH +ENOATTR +ENOTSUP +EPROCLIM +EPROCUNAVAIL +EPROGMISMATCH +EPROGUNAVAIL +ERPCMISMATCH +EIPSEC diff --git a/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors_def.cstub b/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors_def.cstub new file mode 100644 index 000000000..83d8670ba --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors_def.cstub @@ -0,0 +1,725 @@ +#ifdef EPERM + itsdefined(EPERM); +#else + itsnotdefined(EPERM); +#endif +#ifdef ENOENT + itsdefined(ENOENT); +#else + itsnotdefined(ENOENT); +#endif +#ifdef ESRCH + itsdefined(ESRCH); +#else + itsnotdefined(ESRCH); +#endif +#ifdef EINTR + itsdefined(EINTR); +#else + itsnotdefined(EINTR); +#endif +#ifdef EIO + itsdefined(EIO); +#else + itsnotdefined(EIO); +#endif +#ifdef ENXIO + itsdefined(ENXIO); +#else + itsnotdefined(ENXIO); +#endif +#ifdef E2BIG + itsdefined(E2BIG); +#else + itsnotdefined(E2BIG); +#endif +#ifdef ENOEXEC + itsdefined(ENOEXEC); +#else + itsnotdefined(ENOEXEC); +#endif +#ifdef EBADF + itsdefined(EBADF); +#else + itsnotdefined(EBADF); +#endif +#ifdef ECHILD + itsdefined(ECHILD); +#else + itsnotdefined(ECHILD); +#endif +#ifdef EAGAIN + itsdefined(EAGAIN); +#else + itsnotdefined(EAGAIN); +#endif +#ifdef ENOMEM + itsdefined(ENOMEM); +#else + itsnotdefined(ENOMEM); +#endif +#ifdef EACCES + itsdefined(EACCES); +#else + itsnotdefined(EACCES); +#endif +#ifdef EFAULT + itsdefined(EFAULT); +#else + itsnotdefined(EFAULT); +#endif +#ifdef ENOTBLK + itsdefined(ENOTBLK); +#else + itsnotdefined(ENOTBLK); +#endif +#ifdef EBUSY + itsdefined(EBUSY); +#else + itsnotdefined(EBUSY); +#endif +#ifdef EEXIST + itsdefined(EEXIST); +#else + itsnotdefined(EEXIST); +#endif +#ifdef EXDEV + itsdefined(EXDEV); +#else + itsnotdefined(EXDEV); +#endif +#ifdef ENODEV + itsdefined(ENODEV); +#else + itsnotdefined(ENODEV); +#endif +#ifdef ENOTDIR + itsdefined(ENOTDIR); +#else + itsnotdefined(ENOTDIR); +#endif +#ifdef EISDIR + itsdefined(EISDIR); +#else + itsnotdefined(EISDIR); +#endif +#ifdef EINVAL + itsdefined(EINVAL); +#else + itsnotdefined(EINVAL); +#endif +#ifdef ENFILE + itsdefined(ENFILE); +#else + itsnotdefined(ENFILE); +#endif +#ifdef EMFILE + itsdefined(EMFILE); +#else + itsnotdefined(EMFILE); +#endif +#ifdef ENOTTY + itsdefined(ENOTTY); +#else + itsnotdefined(ENOTTY); +#endif +#ifdef ETXTBSY + itsdefined(ETXTBSY); +#else + itsnotdefined(ETXTBSY); +#endif +#ifdef EFBIG + itsdefined(EFBIG); +#else + itsnotdefined(EFBIG); +#endif +#ifdef ENOSPC + itsdefined(ENOSPC); +#else + itsnotdefined(ENOSPC); +#endif +#ifdef ESPIPE + itsdefined(ESPIPE); +#else + itsnotdefined(ESPIPE); +#endif +#ifdef EROFS + itsdefined(EROFS); +#else + itsnotdefined(EROFS); +#endif +#ifdef EMLINK + itsdefined(EMLINK); +#else + itsnotdefined(EMLINK); +#endif +#ifdef EPIPE + itsdefined(EPIPE); +#else + itsnotdefined(EPIPE); +#endif +#ifdef EDOM + itsdefined(EDOM); +#else + itsnotdefined(EDOM); +#endif +#ifdef ERANGE + itsdefined(ERANGE); +#else + itsnotdefined(ERANGE); +#endif +#ifdef EDEADLK + itsdefined(EDEADLK); +#else + itsnotdefined(EDEADLK); +#endif +#ifdef ENAMETOOLONG + itsdefined(ENAMETOOLONG); +#else + itsnotdefined(ENAMETOOLONG); +#endif +#ifdef ENOLCK + itsdefined(ENOLCK); +#else + itsnotdefined(ENOLCK); +#endif +#ifdef ENOSYS + itsdefined(ENOSYS); +#else + itsnotdefined(ENOSYS); +#endif +#ifdef ENOTEMPTY + itsdefined(ENOTEMPTY); +#else + itsnotdefined(ENOTEMPTY); +#endif +#ifdef ELOOP + itsdefined(ELOOP); +#else + itsnotdefined(ELOOP); +#endif +#ifdef EWOULDBLOCK + itsdefined(EWOULDBLOCK); +#else + itsnotdefined(EWOULDBLOCK); +#endif +#ifdef ENOMSG + itsdefined(ENOMSG); +#else + itsnotdefined(ENOMSG); +#endif +#ifdef EIDRM + itsdefined(EIDRM); +#else + itsnotdefined(EIDRM); +#endif +#ifdef ECHRNG + itsdefined(ECHRNG); +#else + itsnotdefined(ECHRNG); +#endif +#ifdef EL2NSYNC + itsdefined(EL2NSYNC); +#else + itsnotdefined(EL2NSYNC); +#endif +#ifdef EL3HLT + itsdefined(EL3HLT); +#else + itsnotdefined(EL3HLT); +#endif +#ifdef EL3RST + itsdefined(EL3RST); +#else + itsnotdefined(EL3RST); +#endif +#ifdef ELNRNG + itsdefined(ELNRNG); +#else + itsnotdefined(ELNRNG); +#endif +#ifdef EUNATCH + itsdefined(EUNATCH); +#else + itsnotdefined(EUNATCH); +#endif +#ifdef ENOCSI + itsdefined(ENOCSI); +#else + itsnotdefined(ENOCSI); +#endif +#ifdef EL2HLT + itsdefined(EL2HLT); +#else + itsnotdefined(EL2HLT); +#endif +#ifdef EBADE + itsdefined(EBADE); +#else + itsnotdefined(EBADE); +#endif +#ifdef EBADR + itsdefined(EBADR); +#else + itsnotdefined(EBADR); +#endif +#ifdef EXFULL + itsdefined(EXFULL); +#else + itsnotdefined(EXFULL); +#endif +#ifdef ENOANO + itsdefined(ENOANO); +#else + itsnotdefined(ENOANO); +#endif +#ifdef EBADRQC + itsdefined(EBADRQC); +#else + itsnotdefined(EBADRQC); +#endif +#ifdef EBADSLT + itsdefined(EBADSLT); +#else + itsnotdefined(EBADSLT); +#endif +#ifdef EDEADLOCK + itsdefined(EDEADLOCK); +#else + itsnotdefined(EDEADLOCK); +#endif +#ifdef EBFONT + itsdefined(EBFONT); +#else + itsnotdefined(EBFONT); +#endif +#ifdef ENOSTR + itsdefined(ENOSTR); +#else + itsnotdefined(ENOSTR); +#endif +#ifdef ENODATA + itsdefined(ENODATA); +#else + itsnotdefined(ENODATA); +#endif +#ifdef ETIME + itsdefined(ETIME); +#else + itsnotdefined(ETIME); +#endif +#ifdef ENOSR + itsdefined(ENOSR); +#else + itsnotdefined(ENOSR); +#endif +#ifdef ENONET + itsdefined(ENONET); +#else + itsnotdefined(ENONET); +#endif +#ifdef ENOPKG + itsdefined(ENOPKG); +#else + itsnotdefined(ENOPKG); +#endif +#ifdef EREMOTE + itsdefined(EREMOTE); +#else + itsnotdefined(EREMOTE); +#endif +#ifdef ENOLINK + itsdefined(ENOLINK); +#else + itsnotdefined(ENOLINK); +#endif +#ifdef EADV + itsdefined(EADV); +#else + itsnotdefined(EADV); +#endif +#ifdef ESRMNT + itsdefined(ESRMNT); +#else + itsnotdefined(ESRMNT); +#endif +#ifdef ECOMM + itsdefined(ECOMM); +#else + itsnotdefined(ECOMM); +#endif +#ifdef EPROTO + itsdefined(EPROTO); +#else + itsnotdefined(EPROTO); +#endif +#ifdef EMULTIHOP + itsdefined(EMULTIHOP); +#else + itsnotdefined(EMULTIHOP); +#endif +#ifdef EDOTDOT + itsdefined(EDOTDOT); +#else + itsnotdefined(EDOTDOT); +#endif +#ifdef EBADMSG + itsdefined(EBADMSG); +#else + itsnotdefined(EBADMSG); +#endif +#ifdef EOVERFLOW + itsdefined(EOVERFLOW); +#else + itsnotdefined(EOVERFLOW); +#endif +#ifdef ENOTUNIQ + itsdefined(ENOTUNIQ); +#else + itsnotdefined(ENOTUNIQ); +#endif +#ifdef EBADFD + itsdefined(EBADFD); +#else + itsnotdefined(EBADFD); +#endif +#ifdef EREMCHG + itsdefined(EREMCHG); +#else + itsnotdefined(EREMCHG); +#endif +#ifdef ELIBACC + itsdefined(ELIBACC); +#else + itsnotdefined(ELIBACC); +#endif +#ifdef ELIBBAD + itsdefined(ELIBBAD); +#else + itsnotdefined(ELIBBAD); +#endif +#ifdef ELIBSCN + itsdefined(ELIBSCN); +#else + itsnotdefined(ELIBSCN); +#endif +#ifdef ELIBMAX + itsdefined(ELIBMAX); +#else + itsnotdefined(ELIBMAX); +#endif +#ifdef ELIBEXEC + itsdefined(ELIBEXEC); +#else + itsnotdefined(ELIBEXEC); +#endif +#ifdef EILSEQ + itsdefined(EILSEQ); +#else + itsnotdefined(EILSEQ); +#endif +#ifdef ERESTART + itsdefined(ERESTART); +#else + itsnotdefined(ERESTART); +#endif +#ifdef ESTRPIPE + itsdefined(ESTRPIPE); +#else + itsnotdefined(ESTRPIPE); +#endif +#ifdef EUSERS + itsdefined(EUSERS); +#else + itsnotdefined(EUSERS); +#endif +#ifdef ENOTSOCK + itsdefined(ENOTSOCK); +#else + itsnotdefined(ENOTSOCK); +#endif +#ifdef EDESTADDRREQ + itsdefined(EDESTADDRREQ); +#else + itsnotdefined(EDESTADDRREQ); +#endif +#ifdef EMSGSIZE + itsdefined(EMSGSIZE); +#else + itsnotdefined(EMSGSIZE); +#endif +#ifdef EPROTOTYPE + itsdefined(EPROTOTYPE); +#else + itsnotdefined(EPROTOTYPE); +#endif +#ifdef ENOPROTOOPT + itsdefined(ENOPROTOOPT); +#else + itsnotdefined(ENOPROTOOPT); +#endif +#ifdef EPROTONOSUPPORT + itsdefined(EPROTONOSUPPORT); +#else + itsnotdefined(EPROTONOSUPPORT); +#endif +#ifdef ESOCKTNOSUPPORT + itsdefined(ESOCKTNOSUPPORT); +#else + itsnotdefined(ESOCKTNOSUPPORT); +#endif +#ifdef EOPNOTSUPP + itsdefined(EOPNOTSUPP); +#else + itsnotdefined(EOPNOTSUPP); +#endif +#ifdef EPFNOSUPPORT + itsdefined(EPFNOSUPPORT); +#else + itsnotdefined(EPFNOSUPPORT); +#endif +#ifdef EAFNOSUPPORT + itsdefined(EAFNOSUPPORT); +#else + itsnotdefined(EAFNOSUPPORT); +#endif +#ifdef EADDRINUSE + itsdefined(EADDRINUSE); +#else + itsnotdefined(EADDRINUSE); +#endif +#ifdef EADDRNOTAVAIL + itsdefined(EADDRNOTAVAIL); +#else + itsnotdefined(EADDRNOTAVAIL); +#endif +#ifdef ENETDOWN + itsdefined(ENETDOWN); +#else + itsnotdefined(ENETDOWN); +#endif +#ifdef ENETUNREACH + itsdefined(ENETUNREACH); +#else + itsnotdefined(ENETUNREACH); +#endif +#ifdef ENETRESET + itsdefined(ENETRESET); +#else + itsnotdefined(ENETRESET); +#endif +#ifdef ECONNABORTED + itsdefined(ECONNABORTED); +#else + itsnotdefined(ECONNABORTED); +#endif +#ifdef ECONNRESET + itsdefined(ECONNRESET); +#else + itsnotdefined(ECONNRESET); +#endif +#ifdef ENOBUFS + itsdefined(ENOBUFS); +#else + itsnotdefined(ENOBUFS); +#endif +#ifdef EISCONN + itsdefined(EISCONN); +#else + itsnotdefined(EISCONN); +#endif +#ifdef ENOTCONN + itsdefined(ENOTCONN); +#else + itsnotdefined(ENOTCONN); +#endif +#ifdef ESHUTDOWN + itsdefined(ESHUTDOWN); +#else + itsnotdefined(ESHUTDOWN); +#endif +#ifdef ETOOMANYREFS + itsdefined(ETOOMANYREFS); +#else + itsnotdefined(ETOOMANYREFS); +#endif +#ifdef ETIMEDOUT + itsdefined(ETIMEDOUT); +#else + itsnotdefined(ETIMEDOUT); +#endif +#ifdef ECONNREFUSED + itsdefined(ECONNREFUSED); +#else + itsnotdefined(ECONNREFUSED); +#endif +#ifdef EHOSTDOWN + itsdefined(EHOSTDOWN); +#else + itsnotdefined(EHOSTDOWN); +#endif +#ifdef EHOSTUNREACH + itsdefined(EHOSTUNREACH); +#else + itsnotdefined(EHOSTUNREACH); +#endif +#ifdef EALREADY + itsdefined(EALREADY); +#else + itsnotdefined(EALREADY); +#endif +#ifdef EINPROGRESS + itsdefined(EINPROGRESS); +#else + itsnotdefined(EINPROGRESS); +#endif +#ifdef ESTALE + itsdefined(ESTALE); +#else + itsnotdefined(ESTALE); +#endif +#ifdef EUCLEAN + itsdefined(EUCLEAN); +#else + itsnotdefined(EUCLEAN); +#endif +#ifdef ENOTNAM + itsdefined(ENOTNAM); +#else + itsnotdefined(ENOTNAM); +#endif +#ifdef ENAVAIL + itsdefined(ENAVAIL); +#else + itsnotdefined(ENAVAIL); +#endif +#ifdef EISNAM + itsdefined(EISNAM); +#else + itsnotdefined(EISNAM); +#endif +#ifdef EREMOTEIO + itsdefined(EREMOTEIO); +#else + itsnotdefined(EREMOTEIO); +#endif +#ifdef EDQUOT + itsdefined(EDQUOT); +#else + itsnotdefined(EDQUOT); +#endif +#ifdef ECANCELED + itsdefined(ECANCELED); +#else + itsnotdefined(ECANCELED); +#endif +#ifdef EKEYEXPIRED + itsdefined(EKEYEXPIRED); +#else + itsnotdefined(EKEYEXPIRED); +#endif +#ifdef EKEYREJECTED + itsdefined(EKEYREJECTED); +#else + itsnotdefined(EKEYREJECTED); +#endif +#ifdef EKEYREVOKED + itsdefined(EKEYREVOKED); +#else + itsnotdefined(EKEYREVOKED); +#endif +#ifdef EMEDIUMTYPE + itsdefined(EMEDIUMTYPE); +#else + itsnotdefined(EMEDIUMTYPE); +#endif +#ifdef ENOKEY + itsdefined(ENOKEY); +#else + itsnotdefined(ENOKEY); +#endif +#ifdef ENOMEDIUM + itsdefined(ENOMEDIUM); +#else + itsnotdefined(ENOMEDIUM); +#endif +#ifdef ENOTRECOVERABLE + itsdefined(ENOTRECOVERABLE); +#else + itsnotdefined(ENOTRECOVERABLE); +#endif +#ifdef EOWNERDEAD + itsdefined(EOWNERDEAD); +#else + itsnotdefined(EOWNERDEAD); +#endif +#ifdef ERFKILL + itsdefined(ERFKILL); +#else + itsnotdefined(ERFKILL); +#endif +#ifdef EAUTH + itsdefined(EAUTH); +#else + itsnotdefined(EAUTH); +#endif +#ifdef EBADRPC + itsdefined(EBADRPC); +#else + itsnotdefined(EBADRPC); +#endif +#ifdef EDOOFUS + itsdefined(EDOOFUS); +#else + itsnotdefined(EDOOFUS); +#endif +#ifdef EFTYPE + itsdefined(EFTYPE); +#else + itsnotdefined(EFTYPE); +#endif +#ifdef ENEEDAUTH + itsdefined(ENEEDAUTH); +#else + itsnotdefined(ENEEDAUTH); +#endif +#ifdef ENOATTR + itsdefined(ENOATTR); +#else + itsnotdefined(ENOATTR); +#endif +#ifdef ENOTSUP + itsdefined(ENOTSUP); +#else + itsnotdefined(ENOTSUP); +#endif +#ifdef EPROCLIM + itsdefined(EPROCLIM); +#else + itsnotdefined(EPROCLIM); +#endif +#ifdef EPROCUNAVAIL + itsdefined(EPROCUNAVAIL); +#else + itsnotdefined(EPROCUNAVAIL); +#endif +#ifdef EPROGMISMATCH + itsdefined(EPROGMISMATCH); +#else + itsnotdefined(EPROGMISMATCH); +#endif +#ifdef EPROGUNAVAIL + itsdefined(EPROGUNAVAIL); +#else + itsnotdefined(EPROGUNAVAIL); +#endif +#ifdef ERPCMISMATCH + itsdefined(ERPCMISMATCH); +#else + itsnotdefined(ERPCMISMATCH); +#endif +#ifdef EIPSEC + itsdefined(EIPSEC); +#else + itsnotdefined(EIPSEC); +#endif diff --git a/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors_e2c.cstub b/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors_e2c.cstub new file mode 100644 index 000000000..f203c3362 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/src/known_errors_e2c.cstub @@ -0,0 +1,435 @@ +#ifdef EPERM + { EPERM, NULL, }, +#endif +#ifdef ENOENT + { ENOENT, NULL, }, +#endif +#ifdef ESRCH + { ESRCH, NULL, }, +#endif +#ifdef EINTR + { EINTR, NULL, }, +#endif +#ifdef EIO + { EIO, NULL, }, +#endif +#ifdef ENXIO + { ENXIO, NULL, }, +#endif +#ifdef E2BIG + { E2BIG, NULL, }, +#endif +#ifdef ENOEXEC + { ENOEXEC, NULL, }, +#endif +#ifdef EBADF + { EBADF, NULL, }, +#endif +#ifdef ECHILD + { ECHILD, NULL, }, +#endif +#ifdef EAGAIN + { EAGAIN, NULL, }, +#endif +#ifdef ENOMEM + { ENOMEM, NULL, }, +#endif +#ifdef EACCES + { EACCES, NULL, }, +#endif +#ifdef EFAULT + { EFAULT, NULL, }, +#endif +#ifdef ENOTBLK + { ENOTBLK, NULL, }, +#endif +#ifdef EBUSY + { EBUSY, NULL, }, +#endif +#ifdef EEXIST + { EEXIST, NULL, }, +#endif +#ifdef EXDEV + { EXDEV, NULL, }, +#endif +#ifdef ENODEV + { ENODEV, NULL, }, +#endif +#ifdef ENOTDIR + { ENOTDIR, NULL, }, +#endif +#ifdef EISDIR + { EISDIR, NULL, }, +#endif +#ifdef EINVAL + { EINVAL, NULL, }, +#endif +#ifdef ENFILE + { ENFILE, NULL, }, +#endif +#ifdef EMFILE + { EMFILE, NULL, }, +#endif +#ifdef ENOTTY + { ENOTTY, NULL, }, +#endif +#ifdef ETXTBSY + { ETXTBSY, NULL, }, +#endif +#ifdef EFBIG + { EFBIG, NULL, }, +#endif +#ifdef ENOSPC + { ENOSPC, NULL, }, +#endif +#ifdef ESPIPE + { ESPIPE, NULL, }, +#endif +#ifdef EROFS + { EROFS, NULL, }, +#endif +#ifdef EMLINK + { EMLINK, NULL, }, +#endif +#ifdef EPIPE + { EPIPE, NULL, }, +#endif +#ifdef EDOM + { EDOM, NULL, }, +#endif +#ifdef ERANGE + { ERANGE, NULL, }, +#endif +#ifdef EDEADLK + { EDEADLK, NULL, }, +#endif +#ifdef ENAMETOOLONG + { ENAMETOOLONG, NULL, }, +#endif +#ifdef ENOLCK + { ENOLCK, NULL, }, +#endif +#ifdef ENOSYS + { ENOSYS, NULL, }, +#endif +#ifdef ENOTEMPTY + { ENOTEMPTY, NULL, }, +#endif +#ifdef ELOOP + { ELOOP, NULL, }, +#endif +#ifdef EWOULDBLOCK + { EWOULDBLOCK, NULL, }, +#endif +#ifdef ENOMSG + { ENOMSG, NULL, }, +#endif +#ifdef EIDRM + { EIDRM, NULL, }, +#endif +#ifdef ECHRNG + { ECHRNG, NULL, }, +#endif +#ifdef EL2NSYNC + { EL2NSYNC, NULL, }, +#endif +#ifdef EL3HLT + { EL3HLT, NULL, }, +#endif +#ifdef EL3RST + { EL3RST, NULL, }, +#endif +#ifdef ELNRNG + { ELNRNG, NULL, }, +#endif +#ifdef EUNATCH + { EUNATCH, NULL, }, +#endif +#ifdef ENOCSI + { ENOCSI, NULL, }, +#endif +#ifdef EL2HLT + { EL2HLT, NULL, }, +#endif +#ifdef EBADE + { EBADE, NULL, }, +#endif +#ifdef EBADR + { EBADR, NULL, }, +#endif +#ifdef EXFULL + { EXFULL, NULL, }, +#endif +#ifdef ENOANO + { ENOANO, NULL, }, +#endif +#ifdef EBADRQC + { EBADRQC, NULL, }, +#endif +#ifdef EBADSLT + { EBADSLT, NULL, }, +#endif +#ifdef EDEADLOCK + { EDEADLOCK, NULL, }, +#endif +#ifdef EBFONT + { EBFONT, NULL, }, +#endif +#ifdef ENOSTR + { ENOSTR, NULL, }, +#endif +#ifdef ENODATA + { ENODATA, NULL, }, +#endif +#ifdef ETIME + { ETIME, NULL, }, +#endif +#ifdef ENOSR + { ENOSR, NULL, }, +#endif +#ifdef ENONET + { ENONET, NULL, }, +#endif +#ifdef ENOPKG + { ENOPKG, NULL, }, +#endif +#ifdef EREMOTE + { EREMOTE, NULL, }, +#endif +#ifdef ENOLINK + { ENOLINK, NULL, }, +#endif +#ifdef EADV + { EADV, NULL, }, +#endif +#ifdef ESRMNT + { ESRMNT, NULL, }, +#endif +#ifdef ECOMM + { ECOMM, NULL, }, +#endif +#ifdef EPROTO + { EPROTO, NULL, }, +#endif +#ifdef EMULTIHOP + { EMULTIHOP, NULL, }, +#endif +#ifdef EDOTDOT + { EDOTDOT, NULL, }, +#endif +#ifdef EBADMSG + { EBADMSG, NULL, }, +#endif +#ifdef EOVERFLOW + { EOVERFLOW, NULL, }, +#endif +#ifdef ENOTUNIQ + { ENOTUNIQ, NULL, }, +#endif +#ifdef EBADFD + { EBADFD, NULL, }, +#endif +#ifdef EREMCHG + { EREMCHG, NULL, }, +#endif +#ifdef ELIBACC + { ELIBACC, NULL, }, +#endif +#ifdef ELIBBAD + { ELIBBAD, NULL, }, +#endif +#ifdef ELIBSCN + { ELIBSCN, NULL, }, +#endif +#ifdef ELIBMAX + { ELIBMAX, NULL, }, +#endif +#ifdef ELIBEXEC + { ELIBEXEC, NULL, }, +#endif +#ifdef EILSEQ + { EILSEQ, NULL, }, +#endif +#ifdef ERESTART + { ERESTART, NULL, }, +#endif +#ifdef ESTRPIPE + { ESTRPIPE, NULL, }, +#endif +#ifdef EUSERS + { EUSERS, NULL, }, +#endif +#ifdef ENOTSOCK + { ENOTSOCK, NULL, }, +#endif +#ifdef EDESTADDRREQ + { EDESTADDRREQ, NULL, }, +#endif +#ifdef EMSGSIZE + { EMSGSIZE, NULL, }, +#endif +#ifdef EPROTOTYPE + { EPROTOTYPE, NULL, }, +#endif +#ifdef ENOPROTOOPT + { ENOPROTOOPT, NULL, }, +#endif +#ifdef EPROTONOSUPPORT + { EPROTONOSUPPORT, NULL, }, +#endif +#ifdef ESOCKTNOSUPPORT + { ESOCKTNOSUPPORT, NULL, }, +#endif +#ifdef EOPNOTSUPP + { EOPNOTSUPP, NULL, }, +#endif +#ifdef EPFNOSUPPORT + { EPFNOSUPPORT, NULL, }, +#endif +#ifdef EAFNOSUPPORT + { EAFNOSUPPORT, NULL, }, +#endif +#ifdef EADDRINUSE + { EADDRINUSE, NULL, }, +#endif +#ifdef EADDRNOTAVAIL + { EADDRNOTAVAIL, NULL, }, +#endif +#ifdef ENETDOWN + { ENETDOWN, NULL, }, +#endif +#ifdef ENETUNREACH + { ENETUNREACH, NULL, }, +#endif +#ifdef ENETRESET + { ENETRESET, NULL, }, +#endif +#ifdef ECONNABORTED + { ECONNABORTED, NULL, }, +#endif +#ifdef ECONNRESET + { ECONNRESET, NULL, }, +#endif +#ifdef ENOBUFS + { ENOBUFS, NULL, }, +#endif +#ifdef EISCONN + { EISCONN, NULL, }, +#endif +#ifdef ENOTCONN + { ENOTCONN, NULL, }, +#endif +#ifdef ESHUTDOWN + { ESHUTDOWN, NULL, }, +#endif +#ifdef ETOOMANYREFS + { ETOOMANYREFS, NULL, }, +#endif +#ifdef ETIMEDOUT + { ETIMEDOUT, NULL, }, +#endif +#ifdef ECONNREFUSED + { ECONNREFUSED, NULL, }, +#endif +#ifdef EHOSTDOWN + { EHOSTDOWN, NULL, }, +#endif +#ifdef EHOSTUNREACH + { EHOSTUNREACH, NULL, }, +#endif +#ifdef EALREADY + { EALREADY, NULL, }, +#endif +#ifdef EINPROGRESS + { EINPROGRESS, NULL, }, +#endif +#ifdef ESTALE + { ESTALE, NULL, }, +#endif +#ifdef EUCLEAN + { EUCLEAN, NULL, }, +#endif +#ifdef ENOTNAM + { ENOTNAM, NULL, }, +#endif +#ifdef ENAVAIL + { ENAVAIL, NULL, }, +#endif +#ifdef EISNAM + { EISNAM, NULL, }, +#endif +#ifdef EREMOTEIO + { EREMOTEIO, NULL, }, +#endif +#ifdef EDQUOT + { EDQUOT, NULL, }, +#endif +#ifdef ECANCELED + { ECANCELED, NULL, }, +#endif +#ifdef EKEYEXPIRED + { EKEYEXPIRED, NULL, }, +#endif +#ifdef EKEYREJECTED + { EKEYREJECTED, NULL, }, +#endif +#ifdef EKEYREVOKED + { EKEYREVOKED, NULL, }, +#endif +#ifdef EMEDIUMTYPE + { EMEDIUMTYPE, NULL, }, +#endif +#ifdef ENOKEY + { ENOKEY, NULL, }, +#endif +#ifdef ENOMEDIUM + { ENOMEDIUM, NULL, }, +#endif +#ifdef ENOTRECOVERABLE + { ENOTRECOVERABLE, NULL, }, +#endif +#ifdef EOWNERDEAD + { EOWNERDEAD, NULL, }, +#endif +#ifdef ERFKILL + { ERFKILL, NULL, }, +#endif +#ifdef EAUTH + { EAUTH, NULL, }, +#endif +#ifdef EBADRPC + { EBADRPC, NULL, }, +#endif +#ifdef EDOOFUS + { EDOOFUS, NULL, }, +#endif +#ifdef EFTYPE + { EFTYPE, NULL, }, +#endif +#ifdef ENEEDAUTH + { ENEEDAUTH, NULL, }, +#endif +#ifdef ENOATTR + { ENOATTR, NULL, }, +#endif +#ifdef ENOTSUP + { ENOTSUP, NULL, }, +#endif +#ifdef EPROCLIM + { EPROCLIM, NULL, }, +#endif +#ifdef EPROCUNAVAIL + { EPROCUNAVAIL, NULL, }, +#endif +#ifdef EPROGMISMATCH + { EPROGMISMATCH, NULL, }, +#endif +#ifdef EPROGUNAVAIL + { EPROGUNAVAIL, NULL, }, +#endif +#ifdef ERPCMISMATCH + { ERPCMISMATCH, NULL, }, +#endif +#ifdef EIPSEC + { EIPSEC, NULL, }, +#endif diff --git a/web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb b/web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb new file mode 100644 index 000000000..790311566 --- /dev/null +++ b/web/server/h2o/libh2o/deps/mruby-errno/test/errno.rb @@ -0,0 +1,60 @@ +assert('Errno') do + Errno.class == Module +end + +assert('SystemCallError') do + SystemCallError.class == Class +end + +assert('SystemCallError superclass') do + SystemCallError.superclass == StandardError +end + +assert('SystemCallError#initialize') do + SystemCallError.new("a").message == "unknown error - a" and + SystemCallError.new("a", 12345).message == "Unknown error: 12345 - a" and + SystemCallError.new(12345).message == "Unknown error: 12345" +end + +assert('SystemCallError#errno') do + assert_equal 1, SystemCallError.new("a", 1).errno + assert_equal 1, SystemCallError.new(1).errno + assert_equal 12345, SystemCallError.new("a", 12345).errno + assert_equal 23456, SystemCallError.new(23456).errno +end + +assert('SystemCallError#inspect') do + SystemCallError.new("a").inspect == "SystemCallError: unknown error - a" + end + +assert('Errno::NOERROR') do + Errno::NOERROR.class == Class +end + +# Is there any platform does not have EPERM? +assert('Errno::EPERM') do + Errno::EPERM.class == Class +end + +assert('Errno::EPERM superclass') do + Errno::EPERM.superclass == SystemCallError +end + +assert('Errno::EPERM::Errno') do + Errno::EPERM::Errno.is_a? Fixnum +end + +assert('Errno::EPERM#message') do + msg = Errno::EPERM.new.message + Errno::EPERM.new("a").message == "#{msg} - a" +end + +assert('Errno::EPERM#inspect 1') do + msg = Errno::EPERM.new.message + Errno::EPERM.new.inspect == "Errno::EPERM: #{msg}" +end + +assert('Errno::EPERM#inspect 2') do + msg = Errno::EPERM.new.message + Errno::EPERM.new("a").inspect == "Errno::EPERM: #{msg} - a" +end |