mirror of https://github.com/BOINC/boinc.git
- Client (Win): in file_size(), use _stat64() instead of stat().
Otherwise it doesn't work for files >= 2GB - Client: TIME_STATS::trim_stats_log() wasn't working because it's called in the constructor of TIME_STATS, which is called before we've done a chdir() to the data dir. Note: for this reason, no disk access should be done in constructors of global objects. A quick scan found no instances of this. svn path=/trunk/boinc/; revision=25846
This commit is contained in:
parent
bcf10a7421
commit
f9a9c3090f
|
@ -4703,3 +4703,19 @@ Charlie 3 July 2012
|
|||
mac_build/
|
||||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
|
||||
David 3 July 2012
|
||||
- Client (Win): in file_size(), use _stat64() instead of stat().
|
||||
Otherwise it doesn't work for files >= 2GB
|
||||
- Client: TIME_STATS::trim_stats_log() wasn't working because
|
||||
it's called in the constructor of TIME_STATS,
|
||||
which is called before we've done a chdir() to the data dir.
|
||||
|
||||
Note: for this reason, no disk access should be done in constructors
|
||||
of global objects. A quick scan found no instances of this.
|
||||
|
||||
client/
|
||||
client_state.cpp
|
||||
time_stats.cpp,h
|
||||
lib/
|
||||
filesys.cpp
|
||||
|
|
|
@ -304,6 +304,7 @@ int CLIENT_STATE::init() {
|
|||
|
||||
notices.init();
|
||||
daily_xfer_history.init();
|
||||
time_stats.init();
|
||||
|
||||
detect_platforms();
|
||||
time_stats.start();
|
||||
|
|
|
@ -76,7 +76,7 @@ int get_connected_state() {
|
|||
const float ALPHA = (SECONDS_PER_DAY*10);
|
||||
//const float ALPHA = 60; // for testing
|
||||
|
||||
TIME_STATS::TIME_STATS() {
|
||||
void TIME_STATS::init() {
|
||||
last_update = 0;
|
||||
first = true;
|
||||
on_frac = 1;
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#include "miofile.h"
|
||||
#include <vector>
|
||||
|
||||
class TIME_STATS {
|
||||
struct TIME_STATS {
|
||||
bool first;
|
||||
int previous_connected_state;
|
||||
public:
|
||||
|
||||
double last_update;
|
||||
// we maintain an exponentially weighted average of these quantities:
|
||||
double on_frac;
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
void update(int suspend_reason, int gpu_suspend_reason);
|
||||
|
||||
TIME_STATS();
|
||||
void init();
|
||||
int write(MIOFILE&, bool to_server);
|
||||
int parse(XML_PARSER&);
|
||||
|
||||
|
|
|
@ -324,10 +324,15 @@ int boinc_delete_file(const char* path) {
|
|||
// get file size
|
||||
//
|
||||
int file_size(const char* path, double& size) {
|
||||
struct stat sbuf;
|
||||
int retval;
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||
struct __stat64 sbuf;
|
||||
retval = _stat64(path, &sbuf);
|
||||
#else
|
||||
struct stat sbuf;
|
||||
retval = stat(path, &sbuf);
|
||||
#endif
|
||||
if (retval) return ERR_NOT_FOUND;
|
||||
size = (double)sbuf.st_size;
|
||||
return 0;
|
||||
|
@ -335,7 +340,7 @@ int file_size(const char* path, double& size) {
|
|||
|
||||
int boinc_truncate(const char* path, double size) {
|
||||
int retval;
|
||||
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||
// the usual Windows nightmare.
|
||||
// There's another function, SetEndOfFile(),
|
||||
// that supposedly works with files over 2GB,
|
||||
|
|
Loading…
Reference in New Issue