2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2003-03-08 00:09:40 +00:00
|
|
|
|
2003-07-02 02:02:18 +00:00
|
|
|
#ifndef SCHED_UTIL_H
|
|
|
|
#define SCHED_UTIL_H
|
2003-03-08 00:09:40 +00:00
|
|
|
|
|
|
|
// "average credit" uses an exponential decay so that recent
|
|
|
|
// activity is weighted more heavily.
|
2004-04-07 06:51:42 +00:00
|
|
|
// CREDIT_HALF_LIFE is the "half-life" period:
|
2003-08-12 20:58:24 +00:00
|
|
|
// the average decreases by 1/2 if idle for this period.
|
|
|
|
//
|
2003-03-08 00:09:40 +00:00
|
|
|
#define SECONDS_IN_DAY (3600*24)
|
2004-04-07 06:51:42 +00:00
|
|
|
#define CREDIT_HALF_LIFE (SECONDS_IN_DAY*7)
|
2003-03-08 00:09:40 +00:00
|
|
|
|
2003-06-20 01:31:03 +00:00
|
|
|
extern void write_pid_file(const char* filename);
|
2003-06-11 23:36:40 +00:00
|
|
|
extern void set_debug_level(int);
|
2004-05-03 19:30:01 +00:00
|
|
|
extern void check_stop_daemons();
|
|
|
|
extern bool check_stop_sched();
|
2003-12-31 23:09:21 +00:00
|
|
|
extern void install_stop_signal_handler();
|
2004-09-13 18:05:54 +00:00
|
|
|
extern int try_fopen(char* path, FILE*& f, char* mode);
|
2004-12-06 22:41:19 +00:00
|
|
|
extern void get_log_path(char*, char*);
|
2003-03-08 00:09:40 +00:00
|
|
|
|
2005-01-08 06:54:03 +00:00
|
|
|
// convert filename to path in a hierarchical directory system
|
|
|
|
//
|
|
|
|
extern int dir_hier_path(
|
|
|
|
const char* filename, const char* root, int fanout, bool new_hash,
|
|
|
|
char* result, bool create=false
|
|
|
|
);
|
|
|
|
|
|
|
|
// convert filename to URL in a hierarchical directory system
|
|
|
|
//
|
|
|
|
extern int dir_hier_url(
|
|
|
|
const char* filename, const char* root, int fanout, bool new_hash,
|
|
|
|
char* result
|
|
|
|
);
|
|
|
|
|
2003-03-08 00:09:40 +00:00
|
|
|
#endif
|