コード例 #1
0
 void WiredTigerRecoveryUnit::beingReleasedFromOperationContext() {
     LOG(2) << "WiredTigerRecoveryUnit::beingReleased";
     _currentlySquirreled = true;
     if ( !wt_keeptxnopen() ) {
         _commit();
     }
 }
コード例 #2
0
ファイル: csvmerge.cpp プロジェクト: ste69r/Biokanga
int
WriteLoci(char *pszChrom,int StartLoci,int EndLoci,tsProcParams *pParams)
{
int Len = EndLoci - StartLoci + 1;

pParams->NumMergedEls += 1;
if(Len < pParams->MinMergeLength)
	{
	pParams->NumMergedFiltUnderLen += 1;
	return(eBSFSuccess);
	}
if(Len > pParams->MaxMergeLength)
	{
	pParams->NumMergedFiltOverLen += 1;
	return(eBSFSuccess);
	}
pParams->NumMergedAccepted += 1;
pParams->RsltLineBuffOfs += sprintf(&pParams->szRsltLineBuff[pParams->RsltLineBuffOfs],"%d,\"%s\",\"%s\",\"%s\",%d,%d,%d,\"%s\",0\n",
				(pParams->NumRsltLines+=1),pParams->pszElType,pParams->pszRefSpecies,pszChrom,StartLoci,EndLoci,EndLoci - StartLoci + 1,pParams->pszRelSpecies);
if(pParams->RsltLineBuffOfs > ((sizeof(pParams->szRsltLineBuff) * 4) / 5))
	{
	CUtility::SafeWrite(pParams->hRsltsLociFile,pParams->szRsltLineBuff,pParams->RsltLineBuffOfs);
	_commit(pParams->hRsltsLociFile);
	pParams->RsltLineBuffOfs = 0;
	}
return(eBSFSuccess);
}
コード例 #3
0
ファイル: genericlogger.cpp プロジェクト: ic-hep/emi3
BOOST_FIXTURE_TEST_CASE (Common__GenericLogger_logline_cleared_after_commit, GenericLogger_TestClass)
{
    Common__GenericLogger_TestTraits::reset();
    setLogOn();
    _commit();
    BOOST_CHECK ( _logLine.str().empty() );
}
コード例 #4
0
ファイル: SendMail.cpp プロジェクト: GerHobbelt/xmail
int SysFileSync(FILE * pFile)
{
    if (fflush(pFile) || _commit(_fileno(pFile)))
        return -1;

    return 0;
}
コード例 #5
0
ファイル: KO_DIAG.CPP プロジェクト: Arun-Ghosh/odbc-driver
void _ODBCLogStop ( int pForce ) {
    StrPtr      t;
    time_t      ltime;
    
    // check if log file is being used
    if ( gLogUsage > 0 ) {
        // decrement log usage
        -- gLogUsage;
        // commit
        _commit ( gLogFile );
        
        // check if log needs to be closed
        if ( gLogUsage == 0 || pForce == 1 ) {
            // set the log start time
            time ( &ltime );
            t = ctime ( &ltime );
            _write ( gLogFile, "Log end: ", strlen ( "Log end: " ) );
            _write ( gLogFile, t, strlen ( t ) );
            _write ( gLogFile, "\n", 1 );
            //if(t!=NULL)
            //delete t;
            _close ( gLogFile );
            gLogFile = -1;
        }
    }
}
コード例 #6
0
void MobileRecoveryUnit::commitUnitOfWork() {
    invariant(_inUnitOfWork);

    RECOVERY_UNIT_TRACE() << " Unit of work commited, marked inactive.";

    _inUnitOfWork = false;
    _commit();
}
コード例 #7
0
ファイル: winunix.cpp プロジェクト: vijaykumarm108/lolibc
int fsync( int fd )
{
	if (fd > 2 )
	{
		return _commit(fd);
	}
	return 0;
}
コード例 #8
0
ファイル: filesystem.cpp プロジェクト: ShadauxCat/Sprawl
void sprawl::filesystem::File::Sync()
{
#ifdef _WIN32
	_commit(FileNo());
#else
	fsync(FileNo());
#endif
}
コード例 #9
0
ファイル: io.c プロジェクト: BackupTheBerlios/bimmerbox
int sim_fsync(int fd)
{
#ifdef WIN32
    return _commit(fd);
#else
    return fsync(fd);
#endif
}
コード例 #10
0
ファイル: genericlogger.cpp プロジェクト: ic-hep/emi3
BOOST_FIXTURE_TEST_CASE (Common__GenericLogger_no_commit_if_logoff, GenericLogger_TestClass)
{
    Common__GenericLogger_TestTraits::reset();
    BOOST_CHECK ( ! Common__GenericLogger_TestTraits::syslogCalled );
    setLogOff();
    _commit();
    BOOST_CHECK ( ! Common__GenericLogger_TestTraits::syslogCalled );
}
コード例 #11
0
ファイル: genericlogger.cpp プロジェクト: ic-hep/emi3
BOOST_FIXTURE_TEST_CASE (Common__GenericLogger_no_commit_if_empty, GenericLogger_TestClass)
{
    Common__GenericLogger_TestTraits::reset();
    _logLine.str ("");
    BOOST_CHECK ( ! Common__GenericLogger_TestTraits::syslogCalled );
    setLogOn();
    _commit();
    BOOST_CHECK ( ! Common__GenericLogger_TestTraits::syslogCalled );
}
コード例 #12
0
ファイル: open_file.c プロジェクト: CEKrause/WRFV_3.7.1
int FLUSH_FILE (int *fd)
{
#ifdef _WIN32
  _commit(*fd);
#else
  fsync(*fd);
#endif
  return 0;
}
コード例 #13
0
ファイル: stdio.c プロジェクト: miettal/armadillo420_standard
isc_result_t
isc_stdio_sync(FILE *f) {
	int r;

	r = _commit(_fileno(f));
	if (r == 0)
		return (ISC_R_SUCCESS);
	else
		return (isc__errno2result(errno));
}
コード例 #14
0
ファイル: fsync.c プロジェクト: 0xheart0/vlc
int fsync (int fd)
{
#if defined(_WIN32)
    /* WinCE can use FlushFileBuffers() but it operates on file handles */
    return _commit (fd);
#else
# warning fsync() not implemented!
    return 0;
#endif
}
コード例 #15
0
void backtrace_symbols_fd(void* const* buffer, int size, int fd) {
    std::ostringstream out;
    for (int i = 0; i < size; i++) {
        out << "[" << std::hex << reinterpret_cast<size_t>(buffer[i])
            << "]" << std::endl;
        auto s = out.str();
        write(fd, s.c_str(), s.size());
    }
    _commit(fd);
}
コード例 #16
0
ファイル: indexer.cpp プロジェクト: xbsura/tokumx
    void CollectionBase::IndexerBase::commit() {
        Lock::assertWriteLocked(_cl->_ns);

        _commit();

        // Bumping the index count "commits" this index to the set.
        // Setting _indexBuildInProgress to false prevents us from
        // rolling back the index creation in the destructor.
        _cl->_indexBuildInProgress = false;
        _cl->_nIndexes++;
    }
コード例 #17
0
bool syncFile(QFile* file) {
	if (!file->flush())
		return false;
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
	return (fsync(file->handle())==0);
#elif defined(Q_WS_WIN)
	return (_commit(file->handle())==0);
#else
	return false;
#endif
}
コード例 #18
0
ファイル: redir.cpp プロジェクト: andrik78/edc-examples
int fflush(FILE* stream)
{
	_FILE*	file = (_FILE*)stream;

	if (file == NULL)
		return EOF;

	// TODO: when we implement buffering, this will need to flush

	return _commit(file->fd) ? EOF : 0;
}
コード例 #19
0
/***
	PUBLIC
	Flush
***/
int
C_File::Flush()
{
	if( !IsOpen() ){
		return( !OK );
	}
	if( _bIs32s ){
		return( _commit( iFile ) == 0 ? OK : !OK );
	}
	return( FlushFileBuffers( hFile ) == TRUE ? OK : !OK );
}
コード例 #20
0
ファイル: backtrace.c プロジェクト: Miguel-J/eneboo-core
void
backtrace_symbols_fd(void *const *buffer, int size, int fd)
{
  char s[128];
  int i;

  for (i = 0; i < size; i++) {
    sprintf(s, "[+0x%Ix]\n", (size_t) buffer[i]);
    write(fd, s, strlen(s));
  }
  _commit(fd);
}
コード例 #21
0
ファイル: pg_test_fsync.c プロジェクト: 42penguins/postgres
static int
pg_fsync_writethrough(int fd)
{
#ifdef WIN32
	return _commit(fd);
#elif defined(F_FULLFSYNC)
	return (fcntl(fd, F_FULLFSYNC, 0) == -1) ? -1 : 0;
#else
	errno = ENOSYS;
	return -1;
#endif
}
コード例 #22
0
ファイル: npk_dev.c プロジェクト: bodguy/GameSource
NPK_RESULT npk_flush( NPK_HANDLE handle )
{
    if( handle != 0 )
    {
#ifdef NPK_PLATFORM_WINDOWS
    _commit( handle );
#else
    fsync( handle );
#endif
    }
    return NPK_SUCCESS;
}
コード例 #23
0
ファイル: futil.cpp プロジェクト: pjohansson/gromacs
int gmx_fsync(FILE *fp)
{
    int rc = 0;

#ifdef GMX_FAHCORE
    /* the fahcore defines its own os-independent fsync */
    rc = fah_fsync(fp);
#else /* GMX_FAHCORE */
    {
        int fn;

        /* get the file number */
#if defined(HAVE_FILENO)
        fn = fileno(fp);
#elif defined(HAVE__FILENO)
        fn = _fileno(fp);
#else
        fn = -1;
#endif

        /* do the actual fsync */
        if (fn >= 0)
        {
#if (defined(HAVE_FSYNC))
            rc = fsync(fn);
#elif (defined(HAVE__COMMIT))
            rc = _commit(fn);
#endif
        }
    }
#endif /* GMX_FAHCORE */

    /* We check for these error codes this way because POSIX requires them
       to be defined, and using anything other than macros is unlikely: */
#ifdef EINTR
    /* we don't want to report an error just because fsync() caught a signal.
       For our purposes, we can just ignore this. */
    if (rc && errno == EINTR)
    {
        rc = 0;
    }
#endif
#ifdef EINVAL
    /* we don't want to report an error just because we tried to fsync()
       stdout, a socket or a pipe. */
    if (rc && errno == EINVAL)
    {
        rc = 0;
    }
#endif
    return rc;
}
コード例 #24
0
ファイル: npk_dev.c プロジェクト: galek/MIngEd
NPK_RESULT npk_flush( NPK_HANDLE handle )
{
    if( handle != 0 )
    {
        if(__commit == NULL)
#ifdef NPK_PLATFORM_WINDOWS
            _commit( handle );
#else
            fsync( handle );
#endif
        else
            __commit( (void*)handle );
    }
コード例 #25
0
ファイル: kvdb.c プロジェクト: fingon/kvdb
bool kvdb_commit(kvdb k)
{
  /* Give import/export module chance to do 'stuff' */
  _kvdb_io_pre_commit(k);

  /* Push current ops to disk. */
  _commit(k);

  /* Start transaction - commit call commits changes. */
  _begin(k);

  return true;
}
コード例 #26
0
ファイル: BufferedFile.cpp プロジェクト: demonlife/infinidb
int BufferedFile::flush()
{
	int rc = fflush(m_fp);
	if( rc == 0 )
#ifdef _MSC_VER
		rc = _commit(_fileno(m_fp));
#else
		rc = fsync( fileno( m_fp ) );
#endif
	if( IDBLogger::isEnabled() )
		IDBLogger::logNoArg(m_fname, this, "flush", rc);

	return rc;
}
コード例 #27
0
ファイル: indexer.cpp プロジェクト: lucciano/mongo-1
    void NamespaceDetails::Indexer::commit() {
        Lock::assertWriteLocked(_d->_ns);

        _commit();

        // Bumping the index count "commits" this index to the set.
        // Setting _indexBuildInProgress to false prevents us from
        // rolling back the index creation in the destructor.
        _d->_indexBuildInProgress = false;
        _d->_nIndexes++;

        nsindex(_d->_ns)->update_ns(_d->_ns, _d->serialize(), _isSecondaryIndex);
        _d->resetTransient();
    }
コード例 #28
0
ファイル: mi_locking.c プロジェクト: OPSF/uClinux
int _mi_writeinfo(register MI_INFO *info, uint operation)
{
  int error,olderror;
  MYISAM_SHARE *share=info->s;
  DBUG_ENTER("_mi_writeinfo");
  DBUG_PRINT("info",("operation: %u  tot_locks: %u", operation,
		     share->tot_locks));

  error=0;
  if (share->tot_locks == 0)
  {
    olderror=my_errno;			/* Remember last error */
    if (operation)
    {					/* Two threads can't be here */
      share->state.process= share->last_process=   share->this_process;
      share->state.unique=  info->last_unique=	   info->this_unique;
      share->state.update_count= info->last_loop= ++info->this_loop;
      if ((error=mi_state_info_write(share->kfile, &share->state, 1)))
	olderror=my_errno;
#ifdef __WIN__
      if (myisam_flush)
      {
	_commit(share->kfile);
	_commit(info->dfile);
      }
#endif
    }
    if (!(operation & WRITEINFO_NO_UNLOCK) &&
	my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
		MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error)
      DBUG_RETURN(1);
    my_errno=olderror;
  }
  else if (operation)
    share->changed= 1;			/* Mark keyfile changed */
  DBUG_RETURN(error);
} /* _mi_writeinfo */
コード例 #29
0
ファイル: sb_fileio.c プロジェクト: Licenser/sysbench
int create_files(void)
{
  unsigned int       i;
  int                fd;
  char               file_name[512];
  long long          offset;

  log_text(LOG_INFO, "%d files, %ldKb each, %ldMb total", num_files,
           (long)(file_size / 1024),
           (long)((file_size * num_files) / (1024 * 1024)));
  log_text(LOG_INFO, "Creating files for the test...");
  for (i=0; i < num_files; i++) {
    snprintf(file_name, sizeof(file_name), "test_file.%d",i);
    unlink(file_name);

    fd = open(file_name, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
    if (fd < 0)
    {
      log_errno(LOG_FATAL, "Can't open file");
      return 1; 
    }

    for (offset = 0; offset < file_size; offset += file_block_size)
    {
      /* If in validation mode, fill buffer with random values
         and write checksum
      */
      if (sb_globals.validate)
        file_fill_buffer(buffer, file_block_size, offset);
                         
      if (write(fd, buffer, file_block_size) < 0)
        goto error;
    }
    
    /* fsync files to prevent cache flush from affecting test results */
#ifndef _WIN32
    fsync(fd);
#else
    _commit(fd);
#endif
    close(fd);
  }
  return 0; 

 error:
  log_errno(LOG_FATAL, "Failed to write file!");
  close(fd);
  return 1;
}
コード例 #30
0
ファイル: eif_file.c プロジェクト: jocelyn/EiffelStudio
/*
 * Flush data held in stdio buffer.
 */
void eif_file_flush(FILE *fp) {
	errno = 0;
	if (fflush(fp) != 0) {
	    esys(); /* Flush failed, raise exception */
	}
#ifdef EIF_WINDOWS
		/* On Windows, it does not write directly to disk, so we have to force it. See KB66052:
		 * http://support.microsoft.com/kb/66052
		 * We ignore bad file descriptor case, as it is most likely when calling it on one of the standard
		 * input/outputs. */
	if ((0 != _commit(fileno(fp))) && (errno != EBADF)) {
		esys();
	}
#endif
}