~ubuntu-branches/debian/sid/boinc/sid

« back to all changes in this revision

Viewing changes to sched/sched_util.cpp

  • Committer: Package Import Robot
  • Author(s): Steffen Moeller
  • Date: 2011-08-08 01:36:51 UTC
  • mfrom: (6.1.11 experimental)
  • Revision ID: package-import@ubuntu.com-20110808013651-m1hs3cltiveuteyn
Tags: 6.13.1+dfsg-2
* Bringing notify patch to unstable.
* Adjusted build dependency to libjpeg-dev (Closes: #641093)
* Further improvements on stripchart.

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
}
151
151
 
152
152
static void filename_hash(const char* filename, int fanout, char* dir) {
153
 
        std::string s = md5_string((const unsigned char*)filename, strlen(filename));
154
 
        int x = strtol(s.substr(1, 7).c_str(), 0, 16);
 
153
    std::string s = md5_string((const unsigned char*)filename, strlen(filename));
 
154
    int x = strtol(s.substr(1, 7).c_str(), 0, 16);
155
155
    sprintf(dir, "%x", x % fanout);
156
156
}
157
157
 
160
160
//
161
161
int dir_hier_path(
162
162
    const char* filename, const char* root, int fanout,
163
 
        char* path, bool create
 
163
    char* path, bool create
164
164
) {
165
165
    char dir[256], dirpath[256];
166
166
    int retval;
176
176
    if (create) {
177
177
        retval = boinc_mkdir(dirpath);
178
178
        if (retval && (errno != EEXIST)) {
179
 
            fprintf(stderr, "boinc_mkdir(%s): retval %d errno %d\n", dirpath, retval, errno);
 
179
            fprintf(stderr, "boinc_mkdir(%s): %s: errno %d\n",
 
180
                dirpath, boincerror(retval), errno
 
181
            );
180
182
            return ERR_MKDIR;
181
183
        }
182
184
    }
188
190
//
189
191
int dir_hier_url(
190
192
    const char* filename, const char* root, int fanout,
191
 
        char* result
 
193
    char* result
192
194
) {
193
195
    char dir[256];
194
196
 
270
272
 
271
273
#ifdef GCL_SIMULATOR
272
274
 
273
 
void simulator_signal_handler(int signum){    
 
275
void simulator_signal_handler(int signum) {
274
276
    FILE *fsim;
275
277
    char currenttime[64];
276
278
    fsim = fopen(config.project_path("simulator/sim_time.txt"),"r");
277
279
    if(fsim){
278
280
        fscanf(fsim,"%s", currenttime);
279
 
        simtime = atof(currenttime); 
 
281
        simtime = atof(currenttime);
280
282
        fclose(fsim);
281
283
    }
282
284
    log_messages.printf(MSG_NORMAL,
291
293
void continue_simulation(const char *daemonname){
292
294
    char daemonfilelok[64];
293
295
    char daemonfile[64];
294
 
    sprintf(daemonfile, config.project_path("simulator/sim_%s.txt"),daemonname);
295
 
    sprintf(daemonfilelok, config.project_path("simulator/sim_%s.lok"),daemonname);
 
296
    sprintf(daemonfile, strcat((char*)config.project_path("simulator/"),"sim_%s.txt"),daemonname);
 
297
    sprintf(daemonfilelok, strcat((char*)config.project_path("simulator/"),"sim_%s.lok"),daemonname);
296
298
    FILE *fsimlok = fopen(daemonfilelok, "w");
297
299
    if (fsimlok){
298
300
        fclose(fsimlok);
306
308
 
307
309
#endif
308
310
 
309
 
const char *BOINC_RCSID_affa6ef1e4 = "$Id: sched_util.cpp 21181 2010-04-15 03:13:56Z davea $";
 
311
const char *BOINC_RCSID_affa6ef1e4 = "$Id: sched_util.cpp 22933 2011-01-20 21:32:00Z davea $";