Esempio n. 1
0
uint64_t
FileDescriptor::size()
{
    struct stat st;
    stat_(st);
    return st.st_size;
}
Esempio n. 2
0
extern "C" int32_t Stat(const char* path, FileStatus* output)
{
    struct stat_ result;
    int ret = stat_(path, &result);

    if (ret == 0)
    {
        ConvertFileStatus(result, output);
    }

    return ret;
}
Esempio n. 3
0
    int32_t Stat(const char* path, struct FileStats* output)
    {
        struct stat_ result;
        int ret = stat_(path, &result);

        if (ret == 0)
        {
            ConvertFileStats(result, output);
        }

        return ret; // TODO: errno conversion
    }
Esempio n. 4
0
extern "C" int32_t SystemNative_Stat(const char* path, FileStatus* output)
{
    struct stat_ result;
    int ret;
    while (CheckInterrupted(ret = stat_(path, &result)));

    if (ret == 0)
    {
        ConvertFileStatus(result, output);
    }

    return ret;
}
Esempio n. 5
0
// CoreCLR expects the "2" suffixes on these: they should be cleaned up in our
// next coordinated System.Native changes
int32_t SystemNative_Stat2(const char* path, FileStatus* output)
{
    struct stat_ result;
    int ret;
    while ((ret = stat_(path, &result)) < 0 && errno == EINTR);

    if (ret == 0)
    {
        ConvertFileStatus(&result, output);
    }

    return ret;
}
Esempio n. 6
0
//--------------------------------------------------------------------------
void Omu_IntRKsuite::ode_solve(double tstart, VECP y, const VECP u,
			       double tend)
{
  if (_sa)
    _neq = y->dim;
  else
    _neq = _n;
  _npar = u->dim;

  v_resize(_work, 32 * _neq);
  v_resize(_thres, _neq);
  v_resize(_u, _npar);
  v_resize(_yp, _neq);
  _y_head.dim = _neq;
  _yp_head.dim = _neq;

  v_set(_thres, _atol);

  // exclude sensitivities from error test
  if (!_serr) {
    for (int i = _n; i < (int)_thres->dim; i++)
      _thres[i] = 1e128;
  }

  v_zero(_yp);
  v_copy(u, _u);

  integer NEQ = _neq;

  // a hack to reinitialize _hnext in each simulation
  if (tstart < _tlast)
    _hnext = 0.0;
  _tlast = tstart;

  dreal TNOW = tstart;
  integer CFLAG;

  //integer METHOD = (_rtol > 5e-4)? 1: (_rtol > 5e-6)? 2: 3;
  integer METHOD = _method;
  char TASK = 'c';
  logical ERRASS = 0;
  dreal HSTART = _hnext;
  integer LENWRK = _work->dim;
  logical MESAGE = 0;

  setup_(&NEQ, &tstart, y->ve, &tend, &_rtol, _thres->ve,
	 &METHOD, &TASK, &ERRASS, &HSTART, _work->ve, &LENWRK, &MESAGE);

  while (TNOW < tend) {
    ct_(&::F, &TNOW, y->ve, _yp->ve, _work->ve, &CFLAG);
    if (CFLAG > 1)
      fprintf(stderr, "RKsuite message %d at time %g\n", CFLAG, TNOW);
    if (CFLAG > 4)
      m_error(E_CONV, "Omu_IntRKsuite::step");
  }

  integer TOTF, STPCST, STPSOK;
  dreal WASTE;
  stat_(&TOTF, &STPCST, &WASTE, &STPSOK, &HSTART);
  _hnext = HSTART;
}