HTCondor Project List Archives



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-devel] Condor port onto FreeBSD



On Tue, Feb 28, 2006 at 09:46:01AM -0600, Greg Thain wrote:
> 
> Erik:
> 
> FYI:
> 
> Devaraj Das wrote:
> >Hi Greg,
> >Attached is the patch for your review.
> >Thanks
> >Devaraj.
> >
> 


Comments embedded - hopefully it's not too difficult to pick 'em
out...

First, a general comment - this port is against 6.7.13, which is
6 months old. Most of your diffs should just apply against
6.7.17, but I know the procapi code has changed some, so 
you should take a look at the current code.


************comment***************
site.def should not change, except for TOP, because it's for every
platform. As a temporary hack, it's fine, but it can't
go in that way for real. 

Not everything is this yway yet, but the goal is to 
have everything be the AND of WANT_<FEATURE> and 
HAS_<FEATURE> - site.def would turn on the 
WANT_ whatever, and the platform-specific (or, 
even better, the results in config.h) would fill in
the HAS_ values. 
************comment***************
 
> --- v6.7.13.release/config/site.def	Thu Sep  8 12:27:42 2005
> +++ v6.7.13.release.freebsd/config/site.def	Thu Feb 23 22:10:19 2006
> @@ -15,13 +15,13 @@
>  #define USE_QMGMT		YES
>  #define HAS_NEW_FORTRAN YES
>  
> -#define WANT_JAVA       YES
> -#define WANT_PVM		YES
> -#define WANT_CONDOR_G	YES
> +#define WANT_JAVA       NO
> +#define WANT_PVM		NO
> +#define WANT_CONDOR_G	NO
>  #define WANT_NETMAN	NO
> -#define WANT_GSI		YES
> +#define WANT_GSI		NO
>  #define WANT_X509       YES
> -#define WANT_KERBEROS   YES
> +#define WANT_KERBEROS   NO
>  #define WANT_MD         YES
>  #define WANT_3DES       YES
>  #define WANT_BLOWFISH   YES
> @@ -33,7 +33,7 @@
>  #define WANT_DRMAA		YES
>  #define WANT_QUILL		YES
>  
> -#define USE_GLOBUS_OPENSSL YES
> +#define USE_GLOBUS_OPENSSL NO
>  #define NEEDS_PRELINKER	NO
>  #endif  /* BeforeVendorCF */
>  
> @@ -42,7 +42,7 @@
>  /* Top should be the root of the source directory you want to use if
>  you want our top-level Makefile to build the directory tree with all
>  the soft links.  The links will point back to Top/src/... */
> -#define Top /full/path/to/your/source/workspace
> +#define Top /home/ddas/condor_v6.7.13.release
>  
>  #if MALLOC_DEBUG
>  #define CFlags -DMALLOC_DEBUG
> --- v6.7.13.release/config/FREEBSD.cf	Fri Aug 26 10:38:14 2005
> +++ v6.7.13.release.freebsd/config/FREEBSD.cf	Thu Feb 23 03:03:48 2006
> @@ -1,10 +1,12 @@
>  /* FreeBSD specfic configuration file */
>  /* Someday we'll probably need architecture in this too */
>  
> +/* #define PlatformLdFlags         -framework IOKit -framework Carbon */
> +
>  #define IS_CLIPPED              YES
>  #define HAS_DYNAMIC_USER_JOBS   NO
>  #define WANT_PVM                NO
> -#define HAS_OPENSSL             NO
> +#define HAS_OPENSSL             YES
>  #define HAS_GLOBUS              NO
>  #define HAS_GSI                 NO
>  #define	WANT_KERBEROS           NO

************comment***************
I'd really like to see the globus version of OpenSSL go in first
We haven't committed the SSL authentication code that uses pure
OpenSSL - until that goes live, I'd rather not have one UNIX
platform with an external that none of hte other ones use
************comment***************
> --- v6.7.13.release/config/externals.cf.in	Fri Oct  7 00:10:34 2005
> +++ v6.7.13.release.freebsd/config/externals.cf.in	Thu Feb 23 21:55:00 2006
> @@ -7,6 +7,7 @@
>  
>  EXT_KERBEROS_VERSION = @ext_krb5_version@
>  EXT_GLOBUS_VERSION = @ext_globus_version@
> +EXT_OPENSSL_VERSION = @ext_openssl_version@
>  EXT_GLOBUS_DATA_VERSION = @ext_globus_data_version@
>  EXT_GPT_VERSION = @ext_gpt_version@
>  EXT_GAHP_VERSION = @ext_gahp_version@
> @@ -29,7 +30,11 @@
>  
>  #if HAS_EXTERNALS
>  MAN_DIR = $(EXT_INSTALL)/$(EXT_MAN_VERSION)/man
> +#if USE_GLOBUS_OPENSSL
>  OPENSSL_DIR = $(EXT_INSTALL)/$(EXT_GLOBUS_VERSION)
> +#else
> +OPENSSL_DIR = $(EXT_INSTALL)/$(EXT_OPENSSL_VERSION)
> +#endif
>  GLOBUS_DIR = $(EXT_INSTALL)/$(EXT_GLOBUS_VERSION)
>  GAHP_DIR = $(EXT_INSTALL)/$(EXT_GAHP_VERSION)/bin
>  KERBEROS_DIR = $(EXT_INSTALL)/$(EXT_KERBEROS_VERSION)
> --- v6.7.13.release/config/config.sh.in	Tue Sep  6 14:33:17 2005
> +++ v6.7.13.release.freebsd/config/config.sh.in	Tue Feb 21 02:35:52 2006
> @@ -11,6 +11,8 @@
>  EXT_GLOBUS_VERSION=@ext_globus_version@
>  GLOBUS_FLAVOR=@globus_flavor@
>  
> +EXT_OPENSSL_VERSION=@ext_openssl_version@
> +
>  EXT_GPT_VERSION=@ext_gpt_version@
>  
>  EXT_GAHP_VERSION=@ext_gahp_version@
************comment***************

you use defined(FREEBSD) - we want to get away from that because
the preprocessor namespace is global, so this should be 
CONDOR_FREEBSD. 

************comment***************
> --- v6.7.13.release/src/condor_tests/job_ckpt_getrusage-loop_std.c	Thu Oct 21 23:55:50 2004
> +++ v6.7.13.release.freebsd/src/condor_tests/job_ckpt_getrusage-loop_std.c	Mon Feb 20 23:54:48 2006
> @@ -42,7 +42,7 @@
>  #define getrusage __hide_getrusage
>  #endif
>  
> -#if defined(Darwin)
> +#if defined(Darwin) || defined(FREEBSD)
>  #include <sys/time.h>
>  #endif
>  
> --- v6.7.13.release/src/condor_ckpt/shared_utils.c	Thu Feb 19 00:58:53 2004
> +++ v6.7.13.release.freebsd/src/condor_ckpt/shared_utils.c	Tue Feb 21 01:21:14 2006
> @@ -241,7 +241,7 @@
>  	}
>  
>  	/* return the number of bytes actually written */
> -#ifdef Darwin
> +#if defined(Darwin) || defined(FREEBSD)
>  #ifndef SYS_write
>  #define SYS_write 4
>  #endif
> --- v6.7.13.release/src/condor_includes/condor_system.h	Fri Sep  9 15:03:12 2005
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_system.h	Mon Feb 20 23:47:37 2006
> @@ -73,6 +72,8 @@
>  #	include "condor_sys_bsd.h"
>  #elif defined(AIX)
>  #	include "condor_sys_aix.h"
> +#elif defined(FREEBSD)
> +#	include "condor_sys_bsd.h"
>  #else
>  #   error "condor_system.h: Don't know what Unix this is!"
>  #endif
> @@ -174,7 +175,7 @@
>  #include <sys/time.h>
>  #include <sys/times.h>
>  #include <rpc/types.h>
> -#if !defined(Darwin)
> +#if !defined(Darwin) && !defined(FREEBSD)
>  #include <values.h>
>  #endif
>  #include <math.h>
> --- v6.7.13.release/src/condor_includes/condor_socket_types.h	Fri Jan 16 17:08:17 2004
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_socket_types.h	Thu Feb 23 04:17:03 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(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
> --- v6.7.13.release/src/condor_includes/condor_sys_bsd.h	Tue Dec  2 14:27:11 2003
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_sys_bsd.h	Mon Feb 20 23:44:19 2006
> @@ -68,8 +68,9 @@
>  /* for DBL_MAX */
>  #include <float.h>
>  /* Darwin does not define a SYS_NMLN, but rather calls it __SYS_NAMELEN */
> -
> +#ifndef FREEBSD
>  #define SYS_NMLN  _SYS_NAMELEN
> +#endif
>  /****************************************
>  ** Condor-specific system definitions
>  ****************************************/
> --- v6.7.13.release/src/condor_includes/condor_debug.h	Fri Oct  7 00:10:39 2005
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_debug.h	Mon Feb 20 22:56:04 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(FREEBSD) )
>  extern DLL_IMPORT_MAGIC int		sys_nerr;
>  extern DLL_IMPORT_MAGIC char		*sys_errlist[];
>  #endif
> --- v6.7.13.release/src/condor_includes/condor_file_lock.h	Tue Dec  2 14:27:10 2003
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_file_lock.h	Mon Feb 20 22:58:20 2006
> @@ -71,6 +71,11 @@
>  #include <sys/file.h>
>  #endif
>  
> +#if defined(FREEBSD)
> +#define CONDOR_USE_FLOCK 1 
> +#include <sys/file.h>
> +#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"
> --- v6.7.13.release/src/condor_includes/condor_getmnt.h	Tue Dec  2 14:27:10 2003
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_getmnt.h	Mon Feb 20 23:01:37 2006
> @@ -27,7 +27,7 @@
>  #	include <sys/mount.h>
>  #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(FREEBSD)
>  #	include <mntent.h>
>  #endif
>  
> --- v6.7.13.release/src/condor_includes/condor_nfs.h	Mon Mar 15 18:35:34 2004
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_nfs.h	Mon Feb 20 23:42:09 2006
> @@ -39,7 +39,7 @@
>  #elif !defined(IRIX)
>  #	include <rpc/rpc.h>
>  
> -#if defined(Darwin)
> +#if defined(Darwin) || defined(FREEBSD)
>  #       include <nfs/rpcv2.h>
>  #endif
>  #	include <nfs/nfs.h>
> --- v6.7.13.release/src/condor_includes/condor_syscall_mode.h	Tue Dec  2 14:27:12 2003
> +++ v6.7.13.release.freebsd/src/condor_includes/condor_syscall_mode.h	Mon Feb 20 23:45:05 2006
> @@ -25,7 +25,7 @@
>  
>  #if defined( AIX )
>  #	include "syscall.aix.h"
> -#elif defined(Solaris) || defined(Darwin)
> +#elif defined(Solaris) || defined(Darwin) || defined(FREEBSD)
>  #	include <sys/syscall.h>
>  #elif defined(IRIX)
>  #	undef SYSVoffset
> --- v6.7.13.release/src/condor_procapi/procapi.h	Fri Jun 24 13:58:03 2005
> +++ v6.7.13.release.freebsd/src/condor_procapi/procapi.h	Mon Feb 20 23:53:10 2006
> @@ -44,7 +44,7 @@
>  #include <sys/types.h>     // various types needed.
>  #include <time.h>          // use of time() for process age. 
>  
> -#if (!defined(HPUX) && !defined(Darwin))     // neither of these are in hpux.
> +#if (!defined(HPUX) && !defined(Darwin) && !defined(FREEBSD))     // neither of these are in hpux.
>  
>  #if defined(Solaris26) || defined(Solaris27) || defined(Solaris28) || defined(Solaris29)
>  #include <procfs.h>        // /proc stuff for Solaris 2.6, 2.7, 2.8, 2.9
> @@ -52,7 +52,7 @@
>  #include <sys/procfs.h>    // /proc stuff for everything else and
>  #endif
>  
> -#endif /* ! HPUX && Darwin */
> +#endif /* ! HPUX && Darwin && FREEBSD */
>  
>  #ifdef HPUX                // hpux has to be different, of course.
>  #include <sys/param.h>     // used in pstat().
> @@ -65,6 +65,15 @@
>  #include <mach/bootstrap.h>
>  #include <mach/mach_error.h>
>  #include <mach/mach_types.h>
> +#endif
> +
> +#ifdef FREEBSD
> +#include <sys/types.h>
> +#include <sys/sysctl.h>
> +#include <errno.h>
> +#include <sys/procfs.h>
> +#include <sys/proc.h>
> +#include <sys/user.h>
>  #endif 
>  
>  #ifdef OSF1                // this is for getting physical/available
> --- v6.7.13.release/src/condor_procapi/procapi.C	Thu Nov  3 14:14:19 2005
> +++ v6.7.13.release.freebsd/src/condor_procapi/procapi.C	Mon Feb 20 22:16:21 2006
> @@ -1004,6 +1004,133 @@
>  	return PROCAPI_SUCCESS;
>  }
>  
> +#elif defined(FREEBSD)
> +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 {
> +	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];
> +	}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;
> +
> +}
> +
>  #elif defined(WIN32)
>  
>  int
> @@ -2127,7 +2254,7 @@
>     to by pidList, a private data member of ProcAPI.  
>   */
>  
> -#ifndef Darwin
> +#if !defined(Darwin) && !defined(FREEBSD)
>  int
>  ProcAPI::buildPidList() {
>  
> @@ -2239,6 +2365,68 @@
>  	return PROCAPI_SUCCESS;
>  }
>  
> +#endif
> +
> +#ifdef 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
> --- v6.7.13.release/src/condor_startd.V6/Starter.C	Mon Jul 18 11:30:59 2005
> +++ v6.7.13.release.freebsd/src/condor_startd.V6/Starter.C	Mon Feb 20 22:28:13 2006
> @@ -364,7 +364,7 @@
>  		case EACCES:
>  			needs_stat = FALSE;
>  			break;
> -#if defined(OSF1) || defined(Darwin)
> +#if defined(OSF1) || defined(Darwin) || defined(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

************comment***************
most of this looks like it could be the same on both Darwin 
and FreeBSD....?
************comment***************
> --- v6.7.13.release/src/condor_sysapi/phys_mem.c	Wed Aug  3 10:00:16 2005
> +++ v6.7.13.release.freebsd/src/condor_sysapi/phys_mem.c	Wed Feb 22 22:50:16 2006
> @@ -210,14 +210,22 @@
>  // This will fail on machines that are more than two gigs
>  // See GNATS 529. I may fix it later, but it's not likely I'd be able to
>  // test it well, so I note it there.
> -#elif defined(Darwin)
> +#elif defined(Darwin) || defined(FREEBSD)
>  #include <sys/sysctl.h>
>  int
>  sysapi_phys_memory_raw(void)
>  {
> +#ifdef Darwin
>  	sysapi_internal_reconfig();
> -        int mib[2], physmem;
>          size_t len;   
> +        int physmem;
> +#endif
> +        int mib[2];
> +#ifdef FREEBSD
> +        size_t len = sizeof(int);
> +				unsigned int physmem;
> +        sysapi_internal_reconfig();
> +#endif
>          mib[0] = CTL_HW;     
>          mib[1] = HW_PHYSMEM;        
>          len = sizeof(physmem);   
> --- v6.7.13.release/src/condor_sysapi/ncpus.c	Wed Mar 23 13:05:47 2005
> +++ v6.7.13.release.freebsd/src/condor_sysapi/ncpus.c	Tue Feb 21 00:06:04 2006
> @@ -38,7 +38,7 @@
>  #include <sys/pstat.h>
>  #endif
>  
> -#ifdef Darwin
> +#if defined(Darwin) || defined(FREEBSD)
>  #include <sys/sysctl.h>
>  #endif
>  
> @@ -185,10 +185,15 @@
>  #elif defined(AIX)
>  	sysapi_internal_reconfig();
>  	return sysconf(_SC_NPROCESSORS_ONLN);
> -#elif defined(Darwin)
> +#elif defined(Darwin) || defined(FREEBSD)
> +#ifdef Darwin
>  	sysapi_internal_reconfig();
> +#endif
>  	int mib[2], maxproc;
>  	size_t len;
> +#ifdef FREEBSD
> +	sysapi_internal_reconfig();
> +#endif
>  	mib[0] = CTL_HW;
>  	mib[1] = HW_NCPU;
>  	len = sizeof(maxproc);
> --- v6.7.13.release/src/condor_sysapi/idle_time.C	Wed Sep 21 12:38:21 2005
> +++ v6.7.13.release.freebsd/src/condor_sysapi/idle_time.C	Wed Feb 22 23:03:39 2006
> @@ -234,6 +234,9 @@
>  #elif defined(LINUX)
>  static char *UtmpName = "/var/run/utmp";
>  static char *AltUtmpName = "/var/adm/utmp";
> +#elif defined(FREEBSD)
> +static char *UtmpName = "/var/run/utmp";
> +static char *AltUtmpName = "";
>  #elif defined(Solaris28) || defined(Solaris29)
>  #include <utmpx.h>
>  static char *UtmpName = "/etc/utmpx";
> @@ -424,7 +427,7 @@
>  
>  #ifdef LINUX
>  #include <sys/sysmacros.h>  /* needed for major() below */
> -#elif defined( OSF1 ) || defined(Darwin)
> +#elif defined( OSF1 ) || defined(Darwin) || defined(FREEBSD)
>  #include <sys/types.h>
>  #elif defined( HPUX )
>  #include <sys/sysmacros.h>
> @@ -864,9 +867,17 @@
>  	CFRelease(object);
>      return idle_time;
>  }
> -
>  #endif  /* the end of the Mac OS X code, and the  */
>  

************comment***************
maybe just get rid of this?
************comment***************
> +#if 0
> +#ifdef FREEBSD
> +void calc_idle_time_cpp(time_t * user_idle, time_t * console_idle)
> +{
> +	*user_idle = *console_idle = 10000; /*some random large number */
> +}
> +#endif
> +#endif
> +
>  /* under solaris 8 with update 6 and later, and solaris 9, use the kstat 
>  	interface to determine the console and mouse idle times. stat() on the
>  	actual kbd or mouse device no longer returns(by design according to 
> @@ -1105,7 +1116,7 @@
>  
>  	sysapi_internal_reconfig();
>  
************comment***************
Also, just a formatting change, so get rid of it
************comment***************
> -#if( !defined( WIN32 ) && !defined( Darwin ) )
> +#if( !defined( WIN32 ) && !defined( Darwin ))
>  	time_t m_i, m_c;
>  
>  	/* here calc_idle_time_cpp expects a reference, so let's give it one */
> --- v6.7.13.release/src/condor_sysapi/load_avg.c	Tue May 17 01:41:49 2005
> +++ v6.7.13.release.freebsd/src/condor_sysapi/load_avg.c	Tue Feb 21 00:03:12 2006
> @@ -381,10 +381,13 @@
>  {
>  }
>  
> -#elif defined(Darwin)
> +#elif defined(Darwin) || defined(FREEBSD)
>  
>  #include <sys/resource.h>
>  #include <sys/sysctl.h>
> +#ifdef FREEBSD
> +#include <vm/vm_param.h>
> +#endif
>  float
>  sysapi_load_avg_raw(void)
>  {
> --- v6.7.13.release/src/condor_sysapi/free_fs_blocks.c	Wed Sep 21 12:38:21 2005
> +++ v6.7.13.release.freebsd/src/condor_sysapi/free_fs_blocks.c	Tue Feb 21 00:00:11 2006
> @@ -243,7 +243,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(FREEBSD)
>  
>  #include <limits.h>
>  
> --- v6.7.13.release/src/condor_sysapi/resource_limits.c	Tue Dec  2 14:28:05 2003
> +++ v6.7.13.release.freebsd/src/condor_sysapi/resource_limits.c	Tue Feb 21 00:11:33 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( FREEBSD )
>  
>  void
>  sysapi_set_resource_limits()
> --- v6.7.13.release/src/condor_sysapi/virt_mem.c	Tue Sep 21 14:42:02 2004
> +++ v6.7.13.release.freebsd/src/condor_sysapi/virt_mem.c	Thu Feb 23 02:42:42 2006
> @@ -256,11 +256,17 @@
>  	}
>  }
>  
************comment***************

I don't htink there's any danger in
having it be unsigned on both platforms
************comment***************
> -#elif defined(Darwin)
> +#elif defined(Darwin) || defined(FREEBSD)
>  #include <sys/sysctl.h>
>  int
>  sysapi_swap_space_raw() {
> -        int mib[2], usermem;
> +        int mib[2];
> +#ifdef Darwin
> +				int usermem;
> +#endif
> +#ifdef FREEBSD
> +				unsigned int usermem;
> +#endif
>          size_t len;   
>          mib[0] = CTL_HW;     
>          mib[1] = HW_USERMEM;        
> --- v6.7.13.release/src/condor_starter.V5/NON_POSIX.C	Wed Sep 21 12:38:19 2005
> +++ v6.7.13.release.freebsd/src/condor_starter.V5/NON_POSIX.C	Mon Feb 20 22:48:53 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(FREEBSD)
>  
>  	   /*  On these systems struct stat member st_blocks is
>  	       defined, and appears to be in 512 byte blocks. */
> --- v6.7.13.release/src/condor_test_suite_C.V5/big.c	Tue Dec  2 14:28:09 2003
> +++ v6.7.13.release.freebsd/src/condor_test_suite_C.V5/big.c	Tue Feb 21 00:53:20 2006
> @@ -313,7 +313,7 @@
>  		return (long)&__data_start;
>  	}
>  
> -#elif defined(LINUX) || defined(Darwin)
> +#elif defined(LINUX) || defined(Darwin) || defined(FREEBSD)
>  	long
>  	data_start_addr()
>  	{
> --- v6.7.13.release/src/condor_test_suite_C.V5/loop.c	Tue Dec  2 14:28:11 2003
> +++ v6.7.13.release.freebsd/src/condor_test_suite_C.V5/loop.c	Tue Feb 21 00:54:01 2006
> @@ -42,7 +42,7 @@
>  #define getrusage __hide_getrusage
>  #endif
>  
> -#if defined(Darwin)
> +#if defined(Darwin) || defined(FREEBSD)
>  #include <sys/time.h>
>  #endif
>  
> --- v6.7.13.release/src/condor_util_lib/get_exec_path.c	Fri Jun 24 09:35:12 2005
> +++ v6.7.13.release.freebsd/src/condor_util_lib/get_exec_path.c	Tue Feb 21 00:57:05 2006
> @@ -304,6 +304,41 @@
>  }
>  #endif /* defined(Darwin) */
>  
> +#ifdef 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( FREEBSD )
> +	rval = freebsd_getExecPath();
>  #elif defined( WIN32 )
>  	rval = win32_getExecPath();
>  #endif
> --- v6.7.13.release/src/condor_util_lib/getmnt.c	Mon Sep 26 11:44:51 2005
> +++ v6.7.13.release.freebsd/src/condor_util_lib/getmnt.c	Tue Feb 21 00:58:18 2006
> @@ -41,7 +41,7 @@
>  
>  	/* Nothing needed on ULTRIX systems - getmnt() is native*/
>  
> -#elif defined(OSF1) || defined(Darwin)
> +#elif defined(OSF1) || defined(Darwin) || defined(FREEBSD)
>  
>  	/* BEGIN OSF1 version - use getmntinfo() */
>  
> --- v6.7.13.release/src/condor_util_lib/setegid.c	Tue Dec  2 14:28:21 2003
> +++ v6.7.13.release.freebsd/src/condor_util_lib/setegid.c	Tue Feb 21 00:59:21 2006
> @@ -27,7 +27,7 @@
>  ** Compatibility routine for systems which utilize setresgid() for
>  ** this purpose.
>  */
> -#if !defined(Darwin)
> +#if !defined(Darwin) && !defined(FREEBSD)
>  int setegid( int egid )
>  {
>  #if defined(HPUX)
> --- v6.7.13.release/src/condor_util_lib/seteuid.c	Tue Dec  2 14:28:21 2003
> +++ v6.7.13.release.freebsd/src/condor_util_lib/seteuid.c	Tue Feb 21 00:59:48 2006
> @@ -27,7 +27,7 @@
>  ** Compatibility routine for systems which utilize setresuid() for
>  ** this purpose.
>  */
> -#if !defined(Darwin)
> +#if !defined(Darwin) && !defined(FREEBSD)
>  int seteuid( int euid )
>  {
>  	return setresuid( -1, euid, -1 );
> --- v6.7.13.release/src/condor_imake	Thu May 12 17:14:01 2005
> +++ v6.7.13.release.freebsd/src/condor_imake	Tue Feb  7 01:19:57 2006
> @@ -49,7 +49,8 @@
>  fi
>  
************comment***************
put this in ansi_cpp, not in condor_imake
************comment***************
>  # use our supplied script to figure out which cpp to call on what architecture
> -IMAKECPP="$IMAKEROOT/ansi_cpp"
> +#IMAKECPP="$IMAKEROOT/ansi_cpp"
> +IMAKECPP=/usr/local/bin/sdcpp
>  export IMAKECPP
>  
>  # end of USE_OLD_IMAKE
************comment***************

Like I said earlier, use CONDOR_FREEBSD and 
I'd rather not add the openssl external yet

************comment***************
> --- v6.7.13.release/src/configure.ac	Sun Nov  6 16:57:40 2005
> +++ v6.7.13.release.freebsd/src/configure.ac	Wed Feb 22 22:13:08 2006
> @@ -330,7 +330,7 @@
>  
>  elif test $os = "FreeBSD" ; then
>    _cv_arch="I386"
> -  _cv_op_sys="FreeBSD"
> +  _cv_op_sys="FREEBSD"
>    _cv_opsys="CONDOR_FREEBSD"
>    _cv_opsys_vers="5_3"
>    _cv_sysname="i386_freebsd"
> @@ -1373,6 +1373,8 @@
>  CONDOR_EXTERNAL_VERSION([pcre],[5.0])
>  
>  CONDOR_EXTERNAL_VERSION([postgresql],[8.0.2])
> +
> +CONDOR_EXTERNAL_VERSION([openssl],[0.9.8])
>  
>  # GCB only matters and works if we have GNU ld...
>  if test x$_cv_ld_is_gnu = xyes; then
> --- v6.7.13.release/src/Imakefile	Fri Oct  7 00:10:35 2005
> +++ v6.7.13.release.freebsd/src/Imakefile	Thu Feb 23 22:06:57 2006
> @@ -383,7 +383,11 @@
>  #if HAVE_EXT_GCB
>  ext_target(EXT_GCB_VERSION,$(NULL))
>  #endif
> -
> +#if HAS_OPENSSL
> +#if !USE_GLOBUS_OPENSSL
> +ext_target(EXT_OPENSSL_VERSION,$(NULL))
> +#endif
> +#endif
>  ext_target(EXT_POSTGRESQL_VERSION,$(NULL))
>  
>  clean::
> --- v6.7.13.release/externals/bundles/openssl/0.9.8/build_openssl-0.9.8	Thu Feb 23 22:11:22 2006
> +++ v6.7.13.release.freebsd/externals/bundles/openssl/0.9.8/build_openssl-0.9.8	Wed Feb 22 01:56:01 2006
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +############# build_openssl-0.9.8
> +
> +cd $PACKAGE_NAME
> +sh config no-threads no-krb5 no-asm --prefix=$PACKAGE_INSTALL_DIR
> +make
> +if [ $? -ne 0 ]
> +then
> +    echo "make failed"
> +    exit 1
> +fi
> +
> +make build-shared
> +if [ $? -ne 0 ]
> +then
> +    echo "make build-shared failed"
> +    exit 1
> +fi
> +
> +make install
> +if [ $? -ne 0 ]
> +then
> +    echo "install failed"
> +    exit 3
> +fi
> +
> +exit 0
> +
> +############# end of build_openssl-0.9.8