--- condor-6.7.17/config/FREEBSD.cf Fri Aug 26 23:08:14 2005 +++ condor-6.7.17.freebsd/config/FREEBSD.cf Tue Mar 7 17:55:44 2006 @@ -3,8 +3,6 @@ #define IS_CLIPPED YES #define HAS_DYNAMIC_USER_JOBS NO -#define WANT_PVM NO -#define HAS_OPENSSL NO -#define HAS_GLOBUS NO +#define HAS_OPENSSL YES +#define HAS_GLOBUS YES #define HAS_GSI NO -#define WANT_KERBEROS NO --- condor-6.7.17/src/condor_tests/job_ckpt_getrusage-loop_std.c Thu Feb 16 03:38:37 2006 +++ condor-6.7.17.freebsd/src/condor_tests/job_ckpt_getrusage-loop_std.c Tue Mar 7 17:55:44 2006 @@ -42,7 +42,7 @@ #define getrusage __hide_getrusage #endif -#if defined(Darwin) +#if defined(Darwin) || defined(CONDOR_FREEBSD) #include #endif --- condor-6.7.17/src/condor_ckpt/shared_utils.c Thu Feb 16 03:37:00 2006 +++ condor-6.7.17.freebsd/src/condor_ckpt/shared_utils.c Tue Mar 7 17:55:44 2006 @@ -241,7 +241,7 @@ } /* return the number of bytes actually written */ -#ifdef Darwin +#if defined(Darwin) || defined(CONDOR_FREEBSD) #ifndef SYS_write #define SYS_write 4 #endif --- condor-6.7.17/src/condor_includes/condor_system.h Thu Feb 16 03:37:32 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_system.h Tue Mar 7 17:55:44 2006 @@ -73,6 +73,8 @@ # include "condor_sys_bsd.h" #elif defined(AIX) # include "condor_sys_aix.h" +#elif defined(CONDOR_FREEBSD) +# include "condor_sys_bsd.h" #else # error "condor_system.h: Don't know what Unix this is!" #endif @@ -174,7 +176,7 @@ #include #include #include -#if !defined(Darwin) +#if !defined(Darwin) && !defined(CONDOR_FREEBSD) #include #endif #include --- condor-6.7.17/src/condor_includes/condor_socket_types.h Thu Feb 16 03:37:31 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_socket_types.h Tue Mar 7 17:55:44 2006 @@ -173,6 +173,21 @@ #define SOCKET_SENDRECV_LENGTH_TYPE SOCKET_LENGTH_TYPE #define SOCKET_FLAGS_TYPE unsigned int #define SOCKET_COUNT_TYPE int +#elif defined(CONDOR_FREEBSD) + #define SOCKET_DATA_TYPE void* + #define SOCKET_LENGTH_TYPE unsigned int + #define SOCKET_ALTERNATE_LENGTH_TYPE SOCKET_LENGTH_TYPE + #define SOCKET_DATA_CONST const + #define SOCKET_MSG_CONST const + #define SOCKET_ADDR_TYPE void* + #define SOCKET_ADDR_CONST_CONNECT + #define SOCKET_ADDR_CONST_BIND + #define SOCKET_ADDR_CONST_ACCEPT + #define SOCKET_SENDRECV_TYPE int + #define SOCKET_RECVFROM_TYPE int + #define SOCKET_SENDRECV_LENGTH_TYPE SOCKET_LENGTH_TYPE + #define SOCKET_FLAGS_TYPE unsigned int + #define SOCKET_COUNT_TYPE int #else #define SOCKET_DATA_TYPE void* #define SOCKET_LENGTH_TYPE int --- condor-6.7.17/src/condor_includes/condor_sys_bsd.h Thu Feb 16 03:37:31 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_sys_bsd.h Tue Mar 7 17:55:44 2006 @@ -68,8 +68,9 @@ /* for DBL_MAX */ #include /* Darwin does not define a SYS_NMLN, but rather calls it __SYS_NAMELEN */ - +#ifndef CONDOR_FREEBSD #define SYS_NMLN _SYS_NAMELEN +#endif /**************************************** ** Condor-specific system definitions ****************************************/ --- condor-6.7.17/src/condor_includes/condor_debug.h Thu Feb 16 03:37:30 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_debug.h Tue Mar 7 17:55:44 2006 @@ -116,7 +116,7 @@ ** Important external variables in libc */ extern DLL_IMPORT_MAGIC int errno; -#if !( defined(LINUX) && defined(GLIBC) || defined(Darwin) ) +#if !( defined(LINUX) && defined(GLIBC) || defined(Darwin) || defined(CONDOR_FREEBSD) ) extern DLL_IMPORT_MAGIC int sys_nerr; extern DLL_IMPORT_MAGIC char *sys_errlist[]; #endif --- condor-6.7.17/src/condor_includes/condor_file_lock.h Thu Feb 16 03:37:30 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_file_lock.h Tue Mar 7 17:55:44 2006 @@ -71,6 +71,11 @@ #include #endif +#if defined(CONDOR_FREEBSD) +#define CONDOR_USE_FLOCK 1 +#include +#endif + #if defined(WIN32) #define CONDOR_USE_FLOCK 0 // does not matter on Win32 since we use lock_file.WIN32.c #include "fake_flock.h" --- condor-6.7.17/src/condor_includes/condor_getmnt.h Thu Feb 16 03:37:31 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_getmnt.h Tue Mar 7 17:55:44 2006 @@ -27,7 +27,7 @@ # include #endif -#if !defined(OSF1) && !defined(ULTRIX42) && !defined(ULTRIX43) && !defined(AIX32) && !defined(Solaris) && !defined(WIN32) && !defined(Darwin) +#if !defined(OSF1) && !defined(ULTRIX42) && !defined(ULTRIX43) && !defined(AIX32) && !defined(Solaris) && !defined(WIN32) && !defined(Darwin) && !defined(CONDOR_FREEBSD) # include #endif --- condor-6.7.17/src/condor_includes/condor_nfs.h Thu Feb 16 03:37:31 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_nfs.h Tue Mar 7 17:55:44 2006 @@ -39,7 +39,7 @@ #elif !defined(IRIX) # include -#if defined(Darwin) +#if defined(Darwin) || defined(CONDOR_FREEBSD) # include #endif # include --- condor-6.7.17/src/condor_includes/condor_syscall_mode.h Thu Feb 16 03:37:32 2006 +++ condor-6.7.17.freebsd/src/condor_includes/condor_syscall_mode.h Tue Mar 7 17:55:44 2006 @@ -25,7 +25,7 @@ #if defined( AIX ) # include "syscall.aix.h" -#elif defined(Solaris) || defined(Darwin) +#elif defined(Solaris) || defined(Darwin) || defined(CONDOR_FREEBSD) # include #elif defined(IRIX) # undef SYSVoffset --- condor-6.7.17/src/condor_procapi/procapi.h Thu Feb 16 03:37:47 2006 +++ condor-6.7.17.freebsd/src/condor_procapi/procapi.h Tue Mar 7 17:55:44 2006 @@ -45,7 +45,7 @@ #include // various types needed. #include // use of time() for process age. -#if (!defined(HPUX) && !defined(Darwin)) // neither of these are in hpux. +#if (!defined(HPUX) && !defined(Darwin) && !defined(CONDOR_FREEBSD)) // neither of these are in hpux. #if defined(Solaris26) || defined(Solaris27) || defined(Solaris28) || defined(Solaris29) #include // /proc stuff for Solaris 2.6, 2.7, 2.8, 2.9 @@ -53,7 +53,7 @@ #include // /proc stuff for everything else and #endif -#endif /* ! HPUX && Darwin */ +#endif /* ! HPUX && Darwin && CONDOR_FREEBSD */ #ifdef HPUX // hpux has to be different, of course. #include // used in pstat(). @@ -66,6 +66,15 @@ #include #include #include +#endif + +#ifdef CONDOR_FREEBSD +#include +#include +#include +#include +#include +#include #endif #ifdef OSF1 // this is for getting physical/available --- condor-6.7.17/src/condor_procapi/procapi.C Thu Feb 16 03:37:46 2006 +++ condor-6.7.17.freebsd/src/condor_procapi/procapi.C Tue Mar 7 17:55:44 2006 @@ -1340,6 +1340,239 @@ return PROCAPI_SUCCESS; } +#elif defined(CONDOR_FREEBSD) + + struct procstat { + char comm[MAXCOMLEN+1]; + int pid; + int ppid; + int pgid; + int sid; + int tdev_maj; + int tdev_min; + char flags[256]; + int start; + int start_mic; + int utime; + int utime_mic; + int stime; + int stime_mic; + char wchan[256]; + int euid; + int ruid; + int rgid; + int egid; + char groups[256]; + }; + +int +ProcAPI::getProcInfo( pid_t pid, piPTR& pi, int &status ) +{ + + // First, let's get the BSD task info for this stucture. This + // will tell us things like the pid, ppid, etc. + + int mib[4]; + struct kinfo_proc *kp, *kprocbuf; + size_t bufSize = 0; + + status = PROCAPI_OK; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = pid; + + if (sysctl(mib, 4, NULL, &bufSize, NULL, 0) < 0) { + status = PROCAPI_UNSPECIFIED; + + dprintf( D_FULLDEBUG, + "ProcAPI: sysctl() (pass 1) on pid %d failed with %d(%s)\n", + pid, errno, strerror(errno) ); + + return PROCAPI_FAILURE; + } + + kprocbuf = kp = (struct kinfo_proc *)malloc(bufSize); + if (kp == NULL) { + EXCEPT("ProcAPI: getProcInfo() Out of memory!\n"); + } + + if (sysctl(mib, 4, kp, &bufSize, NULL, 0) < 0) { + status = PROCAPI_UNSPECIFIED; + + dprintf( D_FULLDEBUG, + "ProcAPI: sysctl() (pass 2) on pid %d failed with %d(%s)\n", + pid, errno, strerror(errno) ); + + free(kp); + + return PROCAPI_FAILURE; + } + + FILE* fp; + char path[MAXPATHLEN]; + struct procstat prs; + sprintf(path,"/proc/%d/status",pid); + if( (fp = fopen( path, "r" )) != NULL ){ + fscanf(fp, + "%s %d %d %d %d %d,%d %s %d,%d %d,%d %d,%d %s %d %d %d,%d,%s", + prs.comm, + &prs.pid, + &prs.ppid, + &prs.pgid, + &prs.sid, + &prs.tdev_maj, + &prs.tdev_min, + prs.flags, + &prs.start, + &prs.start_mic, + &prs.utime, + &prs.utime_mic, + &prs.stime, + &prs.stime_mic, + prs.wchan, + &prs.euid, + &prs.ruid, + &prs.rgid, + &prs.egid, + prs.groups + ); + // This *could* allocate memory and make pi point to it if pi == NULL. + // It is up to the caller to get rid of it. + initpi(pi); + struct vmspace vm = (kp->kp_eproc).e_vm; + pi->imgsize = vm.vm_map.size / 1024; + pi->rssize = vm.vm_pmap.pm_stats.resident_count * getpagesize(); + pi->user_time = prs.utime; + pi->sys_time = prs.stime; + pi->creation_time = prs.start; + pi->age = secsSinceEpoch() - pi->creation_time; + pi->pid = pid; + pi->ppid = kp->kp_eproc.e_ppid; + pi->owner = kp->kp_eproc.e_pcred.p_ruid; + + long nowminf, nowmajf; + double ustime = pi->user_time + pi->sys_time; + + nowminf = 0; + nowmajf = 0; + do_usage_sampling(pi, ustime, nowmajf, nowminf); + fclose(fp); + free(kp); + return PROCAPI_SUCCESS; + } + dprintf( D_FULLDEBUG, "ProcAPI: /proc/%d/status not found!\n", pid); + free(kp); + return PROCAPI_FAILURE; + +} + +int +ProcAPI::getProcInfoRaw( pid_t pid, procInfoRaw& procRaw, int &status ) +{ + + int mib[4]; + struct kinfo_proc *kp, *kprocbuf; + size_t bufSize = 0; + + // assume success + status = PROCAPI_OK; + + // clear memory for procRaw + initProcInfoRaw(procRaw); + + // set the sample time + procRaw.sample_time = secsSinceEpoch(); + + /* Collect the data from the system */ + + // First, let's get the BSD task info for this stucture. This + // will tell us things like the pid, ppid, etc. + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = pid; + if (sysctl(mib, 4, NULL, &bufSize, NULL, 0) < 0) { + status = PROCAPI_UNSPECIFIED; + + dprintf( D_FULLDEBUG, + "ProcAPI: sysctl() (pass 1) on pid %d failed with %d(%s)\n", + pid, errno, strerror(errno) ); + + return PROCAPI_FAILURE; + } + + kprocbuf = kp = (struct kinfo_proc *)malloc(bufSize); + if (kp == NULL) { + EXCEPT("ProcAPI: getProcInfo() Out of memory!\n"); + } + + if (sysctl(mib, 4, kp, &bufSize, NULL, 0) < 0) { + status = PROCAPI_UNSPECIFIED; + + dprintf( D_FULLDEBUG, + "ProcAPI: sysctl() (pass 2) on pid %d failed with %d(%s)\n", + pid, errno, strerror(errno) ); + + free(kp); + + return PROCAPI_FAILURE; + } + FILE* fp; + char path[MAXPATHLEN]; + struct procstat prs; + sprintf(path,"/proc/%d/status",pid); + if( (fp = fopen( path, "r" )) != NULL ){ + fscanf(fp, + "%s %d %d %d %d %d,%d %s %d,%d %d,%d %d,%d %s %d %d %d,%d,%s", + prs.comm, + &prs.pid, + &prs.ppid, + &prs.pgid, + &prs.sid, + &prs.tdev_maj, + &prs.tdev_min, + prs.flags, + &prs.start, + &prs.start_mic, + &prs.utime, + &prs.utime_mic, + &prs.stime, + &prs.stime_mic, + prs.wchan, + &prs.euid, + &prs.ruid, + &prs.rgid, + &prs.egid, + prs.groups + ); + // This *could* allocate memory and make pi point to it if pi == NULL. + // It is up to the caller to get rid of it. + struct vmspace vm = (kp->kp_eproc).e_vm; + procRaw.imgsize = vm.vm_map.size / 1024; + procRaw.rssize = vm.vm_pmap.pm_stats.resident_count * getpagesize(); + procRaw.user_time_1 = prs.utime; + procRaw.user_time_2 = 0; + procRaw.sys_time_1 = prs.stime; + procRaw.sys_time_2 = 0; + procRaw.creation_time = prs.start; + procRaw.pid = pid; + procRaw.ppid = kp->kp_eproc.e_ppid; + procRaw.owner = kp->kp_eproc.e_pcred.p_ruid; + // We don't know the page faults + procRaw.majfault = 0; + procRaw.minfault = 0; + + free(kp); + + // success + return PROCAPI_SUCCESS; + } + dprintf( D_FULLDEBUG, "ProcAPI: /proc/%d/status not found!\n", pid); + free(kp); + return PROCAPI_FAILURE; +} #elif defined(WIN32) int @@ -2595,7 +2828,7 @@ to by pidList, a private data member of ProcAPI. */ -#ifndef Darwin +#if !defined(Darwin) && !defined(CONDOR_FREEBSD) int ProcAPI::buildPidList() { @@ -2707,6 +2940,68 @@ return PROCAPI_SUCCESS; } +#endif + +#ifdef CONDOR_FREEBSD +int +ProcAPI::buildPidList() { + + pidlistPTR current; + pidlistPTR temp; + + priv_state priv = set_root_priv(); + + // make a header node for the pidList: + deallocPidList(); + pidList = new pidlist; + + current = pidList; + + int mib[4]; + struct kinfo_proc *kp, *kprocbuf; + size_t origBufSize; + size_t bufSize = 0; + int nentries; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_ALL; + mib[3] = 0; + if (sysctl(mib, 3, NULL, &bufSize, NULL, 0) < 0) { + //perror("Failure calling sysctl"); + set_priv( priv ); + return PROCAPI_FAILURE; + } + + kprocbuf = kp = (struct kinfo_proc *)malloc(bufSize); + + origBufSize = bufSize; + if ( sysctl(mib, 3, kp, &bufSize, NULL, 0) < 0) { + free(kprocbuf); + set_priv( priv ); + return PROCAPI_FAILURE; + } + + nentries = bufSize / sizeof(struct kinfo_proc); + + for(int i = nentries; --i >=0; kp++) { + temp = new pidlist; + temp->pid = (pid_t) kp->kp_proc.p_pid; + temp->next = NULL; + current->next = temp; + current = temp; + } + + temp = pidList; + pidList = pidList->next; + delete temp; // remove header node. + + free(kprocbuf); + + set_priv( priv ); + + return PROCAPI_SUCCESS; +} #endif #ifdef HPUX --- condor-6.7.17/src/condor_startd.V6/Starter.C Thu Feb 16 03:38:14 2006 +++ condor-6.7.17.freebsd/src/condor_startd.V6/Starter.C Tue Mar 7 17:55:44 2006 @@ -375,7 +375,7 @@ case EACCES: needs_stat = FALSE; break; -#if defined(OSF1) || defined(Darwin) +#if defined(OSF1) || defined(Darwin) || defined(CONDOR_FREEBSD) // dux 4.0 doesn't have ENOLINK for stat(). It does // have ESTALE, which means our binaries live on a // stale NFS mount. So, we can at least EXCEPT with a --- condor-6.7.17/src/condor_sysapi/ncpus.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/ncpus.c Tue Mar 7 17:55:44 2006 @@ -38,7 +38,7 @@ #include #endif -#ifdef Darwin +#if defined(Darwin) || defined(CONDOR_FREEBSD) #include #endif @@ -185,10 +185,10 @@ #elif defined(AIX) sysapi_internal_reconfig(); return sysconf(_SC_NPROCESSORS_ONLN); -#elif defined(Darwin) - sysapi_internal_reconfig(); +#elif defined(Darwin) || defined(CONDOR_FREEBSD) int mib[2], maxproc; size_t len; + sysapi_internal_reconfig(); mib[0] = CTL_HW; mib[1] = HW_NCPU; len = sizeof(maxproc); --- condor-6.7.17/src/condor_sysapi/idle_time.C Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/idle_time.C Tue Mar 7 17:55:44 2006 @@ -234,6 +234,9 @@ #elif defined(LINUX) static char *UtmpName = "/var/run/utmp"; static char *AltUtmpName = "/var/adm/utmp"; +#elif defined(CONDOR_FREEBSD) +static char *UtmpName = "/var/run/utmp"; +static char *AltUtmpName = ""; #elif defined(Solaris28) || defined(Solaris29) #include static char *UtmpName = "/etc/utmpx"; @@ -424,7 +427,7 @@ #ifdef LINUX #include /* needed for major() below */ -#elif defined( OSF1 ) || defined(Darwin) +#elif defined( OSF1 ) || defined(Darwin) || defined(CONDOR_FREEBSD) #include #elif defined( HPUX ) #include --- condor-6.7.17/src/condor_sysapi/load_avg.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/load_avg.c Tue Mar 7 17:55:44 2006 @@ -381,10 +381,13 @@ { } -#elif defined(Darwin) +#elif defined(Darwin) || defined(CONDOR_FREEBSD) #include #include +#ifdef CONDOR_FREEBSD +#include +#endif float sysapi_load_avg_raw(void) { --- condor-6.7.17/src/condor_sysapi/free_fs_blocks.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/free_fs_blocks.c Tue Mar 7 17:55:44 2006 @@ -242,7 +242,7 @@ } #endif /* VAX && ULTRIX */ -#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(OSF1) || defined(Solaris) || defined(IRIX) || defined(Darwin) +#if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(OSF1) || defined(Solaris) || defined(IRIX) || defined(Darwin) || defined(CONDOR_FREEBSD) #include --- condor-6.7.17/src/condor_sysapi/phys_mem.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/phys_mem.c Wed Mar 8 11:05:44 2006 @@ -208,18 +208,23 @@ } // See GNATS 529. This code should now detect >= 2Gigs properly. -#elif defined(Darwin) +#elif defined(Darwin) || defined(CONDOR_FREEBSD) #include int sysapi_phys_memory_raw(void) { int megs; - uint64_t mem; + uint64_t mem = 0; size_t len = sizeof(mem); sysapi_internal_reconfig(); - if (sysctlbyname("hw.memsize", &mem, &len, NULL, 0) < 0) { +#ifdef Darwin + if (sysctlbyname("hw.memsize", &mem, &len, NULL, 0) < 0) +#elif defined(CONDOR_FREEBSD) + if (sysctlbyname("hw.physmem", &mem, &len, NULL, 0) < 0) +#endif + { dprintf(D_ALWAYS, "sysapi_phys_memory_raw(): sysctlbyname(\"hw.memsize\") " "failed: %d(%s)\n", --- condor-6.7.17/src/condor_sysapi/resource_limits.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/resource_limits.c Tue Mar 7 17:55:44 2006 @@ -112,7 +112,7 @@ dprintf( D_ALWAYS, "Setting resource limits not supported!\n" ); } -#elif defined( IRIX ) || defined( WIN32 ) || defined( AIX ) || defined( Darwin ) +#elif defined( IRIX ) || defined( WIN32 ) || defined( AIX ) || defined( Darwin ) || defined( CONDOR_FREEBSD ) void sysapi_set_resource_limits() --- condor-6.7.17/src/condor_sysapi/virt_mem.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/virt_mem.c Tue Mar 7 17:55:44 2006 @@ -256,11 +256,12 @@ } } -#elif defined(Darwin) +#elif defined(Darwin) || defined(CONDOR_FREEBSD) #include int sysapi_swap_space_raw() { - int mib[2], usermem; + int mib[2]; + unsigned int usermem; size_t len; mib[0] = CTL_HW; mib[1] = HW_USERMEM; --- condor-6.7.17/src/condor_sysapi/kernel_version.c Thu Feb 16 03:38:28 2006 +++ condor-6.7.17.freebsd/src/condor_sysapi/kernel_version.c Tue Mar 7 18:32:07 2006 @@ -106,7 +106,7 @@ _sysapi_kernel_version = strdup(buf.release); #elif defined(OSF1) _sysapi_kernel_version = strdup(buf.release); -#elif defined(Darwin) +#elif defined(Darwin) || defined(CONDOR_FREEBSD) _sysapi_kernel_version = strdup(buf.release); #elif defined(AIX) _sysapi_kernel_version = strdup(buf.release); --- condor-6.7.17/src/condor_starter.V5/NON_POSIX.C Thu Feb 16 03:38:17 2006 +++ condor-6.7.17.freebsd/src/condor_starter.V5/NON_POSIX.C Tue Mar 7 17:55:44 2006 @@ -85,7 +85,7 @@ } -#if defined(AIX) || defined(ULTRIX42) || defined(ULTRIX43) || defined(SUNOS41)|| defined(OSF1) || defined(Solaris) || defined(IRIX) || defined(Darwin) +#if defined(AIX) || defined(ULTRIX42) || defined(ULTRIX43) || defined(SUNOS41)|| defined(OSF1) || defined(Solaris) || defined(IRIX) || defined(Darwin) || defined(CONDOR_FREEBSD) /* On these systems struct stat member st_blocks is defined, and appears to be in 512 byte blocks. */ --- condor-6.7.17/src/condor_test_suite_C.V5/big.c Thu Feb 16 03:38:31 2006 +++ condor-6.7.17.freebsd/src/condor_test_suite_C.V5/big.c Tue Mar 7 17:55:44 2006 @@ -313,7 +313,7 @@ return (long)&__data_start; } -#elif defined(LINUX) || defined(Darwin) +#elif defined(LINUX) || defined(Darwin) || defined(CONDOR_FREEBSD) long data_start_addr() { --- condor-6.7.17/src/condor_test_suite_C.V5/loop.c Thu Feb 16 03:38:31 2006 +++ condor-6.7.17.freebsd/src/condor_test_suite_C.V5/loop.c Tue Mar 7 17:55:44 2006 @@ -42,7 +42,7 @@ #define getrusage __hide_getrusage #endif -#if defined(Darwin) +#if defined(Darwin) || defined(CONDOR_FREEBSD) #include #endif --- condor-6.7.17/src/condor_util_lib/get_exec_path.c Thu Feb 16 03:38:43 2006 +++ condor-6.7.17.freebsd/src/condor_util_lib/get_exec_path.c Tue Mar 7 17:55:44 2006 @@ -304,6 +304,41 @@ } #endif /* defined(Darwin) */ +#ifdef CONDOR_FREEBSD +char* +freebsd_getExecPath() +{ + int rval; + char* full_path; + char path_buf[MAXPATHLEN]; + rval = readlink( "/proc/curproc/file", path_buf, MAXPATHLEN ); + if( rval < 0 ) { + + /* + This error will occur when running a program from the valgrind + memory debugger. For this case, compiling with valgrind.h and + testing RUNNING_ON_VALGRIND can prevent this error message. But + this remedy is too much overhead for now. + */ + dprintf( D_ALWAYS,"getExecPath: " + "readlink(\"/proc/curproc/file\") failed: errno %d (%s)\n", + errno, strerror(errno) ); + return NULL; + } + if( rval == MAXPATHLEN ) { + dprintf( D_ALWAYS,"getExecPath: " + "unable to find full path from /proc/curproc/file\n" ); + return NULL; + } + /* Oddly, readlink doesn't terminate the string for you, so + we've got to handle that ourselves... */ + path_buf[rval] = '\0'; + full_path = strdup( path_buf ); + return full_path; + +} +#endif + /* Now, the public method that just invokes the right platform-specific @@ -319,6 +354,8 @@ rval= solaris_getExecPath(); #elif defined( Darwin ) rval = darwin_getExecPath(); +#elif defined( CONDOR_FREEBSD ) + rval = freebsd_getExecPath(); #elif defined( WIN32 ) rval = win32_getExecPath(); #endif --- condor-6.7.17/src/condor_util_lib/getmnt.c Thu Feb 16 03:38:43 2006 +++ condor-6.7.17.freebsd/src/condor_util_lib/getmnt.c Tue Mar 7 17:55:44 2006 @@ -41,7 +41,7 @@ /* Nothing needed on ULTRIX systems - getmnt() is native*/ -#elif defined(OSF1) || defined(Darwin) +#elif defined(OSF1) || defined(Darwin) || defined(CONDOR_FREEBSD) /* BEGIN OSF1 version - use getmntinfo() */ --- condor-6.7.17/src/condor_util_lib/setegid.c Thu Feb 16 03:38:44 2006 +++ condor-6.7.17.freebsd/src/condor_util_lib/setegid.c Tue Mar 7 17:55:44 2006 @@ -27,7 +27,7 @@ ** Compatibility routine for systems which utilize setresgid() for ** this purpose. */ -#if !defined(Darwin) +#if !defined(Darwin) && !defined(CONDOR_FREEBSD) int setegid( int egid ) { #if defined(HPUX) --- condor-6.7.17/src/condor_util_lib/seteuid.c Thu Feb 16 03:38:44 2006 +++ condor-6.7.17.freebsd/src/condor_util_lib/seteuid.c Tue Mar 7 17:55:44 2006 @@ -27,7 +27,7 @@ ** Compatibility routine for systems which utilize setresuid() for ** this purpose. */ -#if !defined(Darwin) +#if !defined(Darwin) && !defined(CONDOR_FREEBSD) int seteuid( int euid ) { return setresuid( -1, euid, -1 ); --- condor-6.7.17/src/configure.ac Thu Feb 16 08:34:50 2006 +++ condor-6.7.17.freebsd/src/configure.ac Tue Mar 7 17:55:44 2006 @@ -359,7 +359,7 @@ elif test $os = "FreeBSD" ; then _cv_arch="I386" - _cv_op_sys="FreeBSD" + _cv_op_sys="CONDOR_FREEBSD" _cv_opsys="CONDOR_FREEBSD" _cv_opsys_vers="5_3" _cv_sysname="i386_freebsd" --- condor-6.7.17/imake/ansi_cpp Fri Aug 26 23:08:50 2005 +++ condor-6.7.17.freebsd/imake/ansi_cpp Tue Mar 7 17:55:44 2006 @@ -24,7 +24,7 @@ exec /lib/cpp $* ;; xFreeBSD) - exec /usr/bin/gcc -E $* + exec /usr/local/bin/sdcpp $* ;; xDarwin) # /usr/bin/cpp is funny on this OS, I can't figure out how to tell