[Mono-dev] Can anyone review this fix for FreeBSD build?

Atsushi Eno atsushi at ximian.com
Sun Nov 9 15:30:44 EST 2008


The original patch author said that it does not compile on
FreeBSD(7,amd64). Haven't asked the actual output.

Atsushi Eno

Geoff Norton wrote:
> Eno,
> 
>   Whats the testcase/rationale for this patch?
> 
> On Sun, 2008-11-09 at 23:34 +0900, Atsushi Eno wrote:
>> Atsushi Eno
>>
>>
>> Index: configure.in
>> ===================================================================
>> --- configure.in	(revision 118305)
>> +++ configure.in	(working copy)
>> @@ -2054,6 +2054,37 @@
>>  	unset fpu
>>  fi
>>
>> +case $host_os in
>> +darwin* | *bsd* )
>> +	AC_MSG_CHECKING(if sysctl.h defines kinfo_proc completely)
>> +	AC_TRY_COMPILE([
>> +		#include <sys/types.h>
>> +		#include <sys/sysctl.h>
>> +	], [
>> +		struct kinfo_proc kp;
>> +	],
>> +		AC_MSG_RESULT(yes)
>> +		AC_DEFINE(SYSCTL_H_DEFINES_KINFO_PROC, 1, [sysctl.h has complete
>> definition of struct kinfo_proc])
>> +	,
>> +		AC_MSG_RESULT(no)
>> +
>> +		AC_MSG_CHECKING(if struct kinfo_proc has member kp_proc)
>> +		AC_TRY_COMPILE([
>> +			#include <sys/types.h>
>> +			#include <sys/user.h>
>> +		], [
>> +			struct kinfo_proc kp;
>> +			kp.kp_proc;
>> +		],
>> +			AC_MSG_RESULT(yes)
>> +		,
>> +			AC_MSG_RESULT(no)
>> +			AC_DEFINE(KINFO_PROC_HAS_NO_KP_PROC, 1, [struct kinfo_proc has no
>> member kp_proc])
>> +		)
>> +	)
>> +	;;
>> +esac
>> +
>>  if test ${TARGET} = unknown; then
>>  	CPPFLAGS="$CPPFLAGS -DNO_PORT"
>>  	AC_MSG_WARN("mono has not been ported to $host: some things may not
>> work.")
>> Index: mono/utils/mono-proclib.c
>> ===================================================================
>> --- mono/utils/mono-proclib.c	(revision 118305)
>> +++ mono/utils/mono-proclib.c	(working copy)
>> @@ -17,6 +17,9 @@
>>  #include <sys/types.h>
>>  #include <sys/sysctl.h>
>>  #include <sys/proc.h>
>> +# if !defined SYSCTL_H_DEFINES_KINFO_PROC
>> +#include <sys/user.h>
>> +# endif
>>  #define USE_SYSCTL 1
>>  #endif
>>
>> @@ -54,8 +57,13 @@
>>  	}
>>  	res = data_len/sizeof (struct kinfo_proc);
>>  	buf = g_realloc (buf, res * sizeof (void*));
>> +# if !defined KINFO_PROC_HAS_NO_KP_PROC
>>  	for (i = 0; i < res; ++i)
>>  		buf [i] = GINT_TO_POINTER (processes [i].kp_proc.p_pid);
>> +# else
>> +	for (i = 0; i < res; ++i)
>> +		buf [i] = GINT_TO_POINTER (processes [i].ki_pid);
>> +# endif
>>  	free (processes);
>>  	if (size)
>>  		*size = res;
>> @@ -162,7 +170,11 @@
>>  	if (res < 0 || data_len != sizeof (struct kinfo_proc)) {
>>  		return buf;
>>  	}
>> +# if !defined KINFO_PROC_HAS_NO_KP_PROC
>>  	strncpy (buf, processi.kp_proc.p_comm, len - 1);
>> +# else
>> +	strncpy (buf, processi.ki_comm, len - 1);
>> +# endif
>>  	return buf;
>>  #else
>>  	char fname [128];
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 



More information about the Mono-devel-list mailing list