[Mono-dev] Patch for Processes.c on Mac OSX

Tom Philpot tom.philpot at logos.com
Wed Dec 2 12:10:37 EST 2009


Rodrigo,

Thanks for the feedback. Here¹s an updated patch.

Again, this is X11 MIT Licensed.

Tom


On 12/2/09 4:30 AM, "Rodrigo Kumpera" <kumpera at gmail.com> wrote:

> The overall patch looks good, but some small changes must be done before the
> patch can be committed:
> 
> 
> @@ -1489,8 +1489,73 @@
>  }
>  #endif /* UNUSED_CODE */
>  
> +#ifdef PLATFORM_MACOSX
> +#include <sys/sysctl.h>
> +#include <sys/proc.h>
> +
> Move header declarations to the top of the file. It doesn't matter we have
> other
> place with this, let's not make it worse.
> 
> 
> +  if (err == 0) {
> +   result = g_malloc (proclength);
> +   if (result == NULL) {
> +    err = ENOMEM;
> +   }
> +  }
> No need to guard against allocation failure with g_malloc as glib asserts on
> failure.
> 
> The same applies to the loop around allocation failure.
> 
> 
> + free (result);
> + result = NULL;
> + *needed = j * sizeof(guint32);
> You must use g_free paired with g_malloc.
> 
> I believe the code in process_open_compare is not optimal for OSX as it wastes
> time following the
> 
> linux path. Please rework it to be something saner:
> 
> 
> #if defined(PLATFORM_MACOSX)
> ...
> 
> #elif defined (PLATFORM_SOLARIS)
> #else
> ...
> #endif
> 
> 
> 
> Thanks for the patch,
> 
> Rodrigo
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091202/8d603ecd/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: processes-patch_fixed.txt
Type: application/octet-stream
Size: 3709 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091202/8d603ecd/attachment-0001.obj 


More information about the Mono-devel-list mailing list