- client: changes to make the client work on "Debian GNU/kFreeBSD",

a hybrid system that acts like Linux at the user
    level but has a FreeBSD kernel.
    Fixes #521

svn path=/trunk/boinc/; revision=14415
This commit is contained in:
David Anderson 2007-12-19 19:29:54 +00:00
parent c3491a40d9
commit c4d1022ed8
4 changed files with 35 additions and 13 deletions

View File

@ -12354,3 +12354,14 @@ Charlie 19 Dec 07
buildcurl.sh
boinc.xcodeproj/
project.pbxproj
David 19 Dec 2007
- client: changes to make the client work on "Debian GNU/kFreeBSD",
a hybrid system that acts like Linux at the user
level but has a FreeBSD kernel.
Fixes #521
configure.ac
client/
main.C
hostinfo_unix.C

View File

@ -105,6 +105,11 @@ extern "C" {
#include <machine/cpuconf.h>
#endif
// The following is intended to be true both on Linux
// and Debian GNU/kFreeBSD (see trac #521)
//
#define LINUX_LIKE_SYSTEM defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
// functions to get name/addr of local host
// Converts a int ip address to a string representation (i.e. "66.218.71.198")
@ -132,7 +137,7 @@ int get_timezone() {
time_data = localtime( &cur_time );
// tm_gmtoff is already adjusted for daylight savings time
return time_data->tm_gmtoff;
#elif defined(linux)
#elif LINUX_LIKE_SYSTEM
return -1*(__timezone);
#elif defined(__CYGWIN32__)
return -1*(_timezone);
@ -173,7 +178,7 @@ bool HOST_INFO::host_is_running_on_batteries() {
CFRelease(list);
return(retval);
#elif defined(linux)
#elif LINUX_LIKE_SYSTEM
bool retval = false;
FILE* fapm = fopen("/proc/apm", "r");
@ -237,7 +242,7 @@ bool HOST_INFO::host_is_running_on_batteries() {
#endif
}
#ifdef linux
#if LINUX_LIKE_SYSTEM
static void parse_meminfo_linux(HOST_INFO& host) {
char buf[256];
double x;
@ -449,7 +454,7 @@ static void parse_cpuinfo_linux(HOST_INFO& host) {
strlcpy(host.p_model, model_buf, sizeof(host.p_model));
fclose(f);
}
#endif // linux
#endif // LINUX_LIKE_SYSTEM
#ifdef __APPLE__
static void get_cpu_info_maxosx(HOST_INFO& host) {
@ -520,7 +525,7 @@ int HOST_INFO::get_host_info() {
get_filesystem_info(d_total, d_free);
///////////// p_vendor, p_model, p_features /////////////////
#ifdef linux
#if LINUX_LIKE_SYSTEM
parse_cpuinfo_linux(*this);
#elif defined( __APPLE__)
int mib[2];
@ -604,7 +609,7 @@ int HOST_INFO::get_host_info() {
DosQuerySysInfo( QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulMem, sizeof(ulMem));
m_swap = ulMem;
}
#elif defined(linux)
#elif LINUX_LIKE_SYSTEM
parse_meminfo_linux(*this);
#elif defined(_SC_USEABLE_MEMORY)
// UnixWare

View File

@ -600,6 +600,8 @@ int finalize() {
int main(int argc, char** argv) {
int retval = 0;
// TODO: clean up the following
//
#ifdef _WIN32
int i, len;
char *commandLine;
@ -663,13 +665,20 @@ int main(int argc, char** argv) {
break;
}
}
#elif defined linux
#elif defined(__APPLE__)
// If the real user ID is root, we are executing as a daemon
if (getuid() == (uid_t)0) {
gstate.executing_as_daemon = true;
}
#elif defined __EMX__
#else
// non-Apple Unix
int i;
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-daemon") == 0 || strcmp(argv[i], "--daemon") == 0) {
syslog(LOG_DAEMON|LOG_INFO,
"Starting Boinc-Daemon, listening on port %d.", GUI_RPC_PORT
"Starting BOINC as daemon, listening on port %d.", GUI_RPC_PORT
);
// from <unistd.h>:
// Detach from the controlling terminal and run in the background as system daemon.
@ -679,9 +688,6 @@ int main(int argc, char** argv) {
break;
}
}
#elif defined(__APPLE__)
if (getuid() == (uid_t)0) // If the real user ID is root, we are executing as a daemon
gstate.executing_as_daemon = true;
#endif
init_core_client(argc, argv);
@ -756,7 +762,7 @@ int main(int argc, char** argv) {
"To change ownership/permission, reinstall BOINC"
#ifdef __APPLE__
" or run\n the shell script Mac_SA_Secure.sh"
#elif defined linux
#else
" or run\n the shell script secure.sh"
#endif
". (Error code %d)\n", i

View File

@ -237,7 +237,7 @@ dnl Special rules for specific targets go here: It's easier to add static libs
dnl than subtract them. If you need to remove something from the list above,
dnl please add it to the lists below...
case ${target} in
*-linux*) STATIC_LIB_LIST="${STATIC_LIB_LIST} nsl"
*-linux*|*-k*bsd*-gnu) STATIC_LIB_LIST="${STATIC_LIB_LIST} nsl"
;;
*-solaris*) STATIC_LIB_LIST="${STATIC_LIB_LIST} X* ssl crypto"
;;