void WiredTigerRecoveryUnit::beingReleasedFromOperationContext() { LOG(2) << "WiredTigerRecoveryUnit::beingReleased"; _currentlySquirreled = true; if ( !wt_keeptxnopen() ) { _commit(); } }
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); }
BOOST_FIXTURE_TEST_CASE (Common__GenericLogger_logline_cleared_after_commit, GenericLogger_TestClass) { Common__GenericLogger_TestTraits::reset(); setLogOn(); _commit(); BOOST_CHECK ( _logLine.str().empty() ); }
int SysFileSync(FILE * pFile) { if (fflush(pFile) || _commit(_fileno(pFile))) return -1; return 0; }
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 ( <ime ); t = ctime ( <ime ); _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; } } }
void MobileRecoveryUnit::commitUnitOfWork() { invariant(_inUnitOfWork); RECOVERY_UNIT_TRACE() << " Unit of work commited, marked inactive."; _inUnitOfWork = false; _commit(); }
int fsync( int fd ) { if (fd > 2 ) { return _commit(fd); } return 0; }
void sprawl::filesystem::File::Sync() { #ifdef _WIN32 _commit(FileNo()); #else fsync(FileNo()); #endif }
int sim_fsync(int fd) { #ifdef WIN32 return _commit(fd); #else return fsync(fd); #endif }
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 ); }
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 ); }
int FLUSH_FILE (int *fd) { #ifdef _WIN32 _commit(*fd); #else fsync(*fd); #endif return 0; }
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)); }
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 }
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); }
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++; }
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 }
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; }
/*** PUBLIC Flush ***/ int C_File::Flush() { if( !IsOpen() ){ return( !OK ); } if( _bIs32s ){ return( _commit( iFile ) == 0 ? OK : !OK ); } return( FlushFileBuffers( hFile ) == TRUE ? OK : !OK ); }
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); }
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 }
NPK_RESULT npk_flush( NPK_HANDLE handle ) { if( handle != 0 ) { #ifdef NPK_PLATFORM_WINDOWS _commit( handle ); #else fsync( handle ); #endif } return NPK_SUCCESS; }
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; }
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 ); }
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; }
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; }
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(); }
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 */
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; }
/* * 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 }