Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mrbgems/mruby-io/src/io.c

    r321 r331  
    190190}
    191191
    192 #if !defined(_WIN32) && !defined(_WIN64) && !defined(__NEWLIB__)
     192#ifndef _WIN32
    193193static int
    194194mrb_cloexec_pipe(mrb_state *mrb, int fildes[2])
     
    265265#endif
    266266
    267 #if !defined(_WIN32) && !defined(_WIN64) && !defined(__NEWLIB__)
     267#ifndef _WIN32
    268268static int
    269269option_to_fd(mrb_state *mrb, mrb_value obj, const char *key)
     
    390390
    391391      mrb_iv_set(mrb, io, mrb_intern_cstr(mrb, "@buf"), mrb_str_new_cstr(mrb, ""));
    392       mrb_iv_set(mrb, io, mrb_intern_cstr(mrb, "@pos"), mrb_fixnum_value(0));
    393392
    394393      fptr = mrb_io_alloc(mrb);
     
    444443
    445444  mrb_iv_set(mrb, io, mrb_intern_cstr(mrb, "@buf"), mrb_str_new_cstr(mrb, ""));
    446   mrb_iv_set(mrb, io, mrb_intern_cstr(mrb, "@pos"), mrb_fixnum_value(0));
    447445
    448446  fptr = (struct mrb_io *)DATA_PTR(io);
     
    488486  }
    489487
    490 #if !defined(_WIN32) && !defined(_WIN64) && !defined(__NEWLIB__)
     488#if !defined(_WIN32) && !defined(_WIN64)
    491489  if (fptr->pid != 0) {
    492490    pid_t pid;
     
    557555mrb_cloexec_open(mrb_state *mrb, const char *pathname, mrb_int flags, mrb_int mode)
    558556{
     557  mrb_value emsg;
    559558  int fd, retry = FALSE;
    560559
     
    577576      }
    578577    }
    579     mrb_sys_fail(mrb, "open");
     578
     579    emsg = mrb_format(mrb, "open %S", mrb_str_new_cstr(mrb, pathname));
     580    mrb_str_modify(mrb, mrb_str_ptr(emsg));
     581    mrb_sys_fail(mrb, RSTRING_PTR(emsg));
    580582  }
    581583
     
    620622  mrb_get_args(mrb, "i|S", &maxlen, &buf);
    621623  if (maxlen < 0) {
    622     return mrb_nil_value();
     624    mrb_raise(mrb, E_ARGUMENT_ERROR, "negative expanding string size");
     625  }
     626  else if (maxlen == 0) {
     627    return mrb_str_new(mrb, NULL, maxlen);
    623628  }
    624629
     
    626631    buf = mrb_str_new(mrb, NULL, maxlen);
    627632  }
     633
    628634  if (RSTRING_LEN(buf) != maxlen) {
    629635    buf = mrb_str_resize(mrb, buf, maxlen);
    630   }
    631 
    632   fptr = (struct mrb_io *)mrb_get_datatype(mrb, io, &mrb_io_type);
     636  } else {
     637    mrb_str_modify(mrb, RSTRING(buf));
     638  }
     639
     640  fptr = (struct mrb_io *)io_get_open_fptr(mrb, io);
     641  if (!fptr->readable) {
     642    mrb_raise(mrb, E_IO_ERROR, "not opened for reading");
     643  }
    633644  ret = read(fptr->fd, RSTRING_PTR(buf), maxlen);
    634645  switch (ret) {
     
    702713  }
    703714  length = write(fd, RSTRING_PTR(buf), RSTRING_LEN(buf));
     715  if (length == -1) {
     716    mrb_sys_fail(mrb, 0);
     717  }
    704718
    705719  return mrb_fixnum_value(length);
     
    773787}
    774788
    775 #if !defined(_WIN32) && !defined(_WIN64) && !defined(__NEWLIB__)
     789#ifndef _WIN32
    776790static mrb_value
    777791mrb_io_s_pipe(mrb_state *mrb, mrb_value klass)
     
    789803  r = mrb_obj_value(mrb_data_object_alloc(mrb, mrb_class_ptr(klass), NULL, &mrb_io_type));
    790804  mrb_iv_set(mrb, r, mrb_intern_cstr(mrb, "@buf"), mrb_str_new_cstr(mrb, ""));
    791   mrb_iv_set(mrb, r, mrb_intern_cstr(mrb, "@pos"), mrb_fixnum_value(0));
    792805  fptr_r = mrb_io_alloc(mrb);
    793806  fptr_r->fd = pipes[0];
     
    800813  w = mrb_obj_value(mrb_data_object_alloc(mrb, mrb_class_ptr(klass), NULL, &mrb_io_type));
    801814  mrb_iv_set(mrb, w, mrb_intern_cstr(mrb, "@buf"), mrb_str_new_cstr(mrb, ""));
    802   mrb_iv_set(mrb, w, mrb_intern_cstr(mrb, "@pos"), mrb_fixnum_value(0));
    803815  fptr_w = mrb_io_alloc(mrb);
    804816  fptr_w->fd = pipes[1];
     
    10721084
    10731085  mrb_include_module(mrb, io, mrb_module_get(mrb, "Enumerable")); /* 15.2.20.3 */
    1074 #if !defined(_WIN32) && !defined(_WIN64) && !defined(__NEWLIB__)
     1086#ifndef _WIN32
    10751087  mrb_define_class_method(mrb, io, "_popen",  mrb_io_s_popen,   MRB_ARGS_ANY());
    10761088  mrb_define_class_method(mrb, io, "_sysclose",  mrb_io_s_sysclose, MRB_ARGS_REQ(1));
     
    10791091  mrb_define_class_method(mrb, io, "select",  mrb_io_s_select,  MRB_ARGS_ANY());
    10801092  mrb_define_class_method(mrb, io, "sysopen", mrb_io_s_sysopen, MRB_ARGS_ANY());
    1081 #if !defined(_WIN32) && !defined(_WIN64) && !defined(__NEWLIB__)
     1093#ifndef _WIN32
    10821094  mrb_define_class_method(mrb, io, "_pipe", mrb_io_s_pipe, MRB_ARGS_NONE());
    10831095#endif
Note: See TracChangeset for help on using the changeset viewer.