Debug­ging lang/mono – 2nd round

Today I had again some ener­gy to look at why mono fails to build on FreeB­SD-cur­rent.

I decid­ed to do a debug-build of mono. This did not work ini­tial­ly, I had to pro­duce some patch­es. 🙁

Does this mean nobody is doing debug builds of mono on FreeB­SD?

I have to say, this expe­ri­ence with lang/mono is com­plete­ly unsat­is­fy­ing.

Ok, bot­tom line, either the debug build seems to pre­vent a race con­di­tion in most cas­es (I had a lot less lock­ups for each of the two builds I did).

What­ev­er it is, I do not care ATM (if the con­fig­ure stuff is look­ing at the archi­tec­ture of the sys­tem, it may be the case that the i386-portbld-freebsdX does not enable some impor­tant stuff which would be enabled when run with i486-portbld-freebsdX or bet­ter). Here are the patch­es I used in case some­one is inter­est­ed (warn­ing, copy&paste con­vert­ed tabs to spaces, you also have to apply the map.c (a gen­er­at­ed file… maybe a touch of the right file would allow to apply this patch in the nor­mal patch stage) relat­ed stuff when the build fails, else there is some pars­er error in mono):

--- mcs/class/Mono.Posix/Mono.Unix/UnixProcess.cs.orig       2010-01-29 11:34:00.592323482 +0100
+++ mcs/class/Mono.Posix/Mono.Unix/UnixProcess.cs    2010-01-29 11:34:18.540607357 +0100
@@ -57,7 +57,7 @@ namespace Mono.Unix {
 int r = Native.Syscall.waitpid (pid, out status,
 Native.WaitOptions.WNOHANG | Native.WaitOptions.WUNTRACED);
 UnixMarshal.ThrowExceptionForLastErrorIf (r);
-                       return r;
+                       return status;

 public int ExitCode {

--- mono/io-layer/processes.c.orig    2010-01-29 11:36:08.904331535 +0100
+++ mono/io-layer/processes.c 2010-01-29 11:42:21.819159544 +0100
@@ -160,7 +160,7 @@ static gboolean waitfor_pid (gpointer te
 ret = waitpid (process->id, &status, WNOHANG);
 } while (errno == EINTR);

-       if (ret <= 0) {
+       if (ret == 0 || (ret < 0 && errno != ECHILD)) {
 /* Process not ready for wait */
 #ifdef DEBUG
 g_message ("%s: Process %d not ready for waiting for: %s",
@@ -169,6 +169,17 @@ static gboolean waitfor_pid (gpointer te

 return (FALSE);
+       if (ret < 0 && errno == ECHILD) {
+#ifdef DEBUG
+               g_message ("%s: Process %d does not exist (anymore)", __func__,
+                          process->id);
+               /* Faking the return status. I do not know if it is correct
+                * to assume a successful exit.
+                */
+               status = 0;
+       }

 #ifdef DEBUG
 g_message ("%s: Process %d finished", __func__, ret);

--- mono/metadata/mempool.c.orig      2010-01-29 11:58:16.871052861 +0100
+++ mono/metadata/mempool.c   2010-01-29 12:30:45.143367454 +0100
@@ -212,12 +212,14 @@ mono_backtrace (int size)

         EnterCriticalSection (&mempool_tracing_lock);
         g_print ("Allocating %d bytes\n", size);
         symbols = backtrace (array, BACKTRACE_DEPTH);
         names = backtrace_symbols (array, symbols);
         for (i = 1; i < symbols; ++i) {
                 g_print ("\t%s\n", names [i]);
         free (names);
         LeaveCriticalSection (&mempool_tracing_lock);

--- mono/metadata/metadata.c.orig     2010-01-29 11:59:38.552316989 +0100
+++ mono/metadata/metadata.c  2010-01-29 12:00:43.957337476 +0100
@@ -3673,12 +3673,16 @@ mono_backtrace (int limit)
         void *array[limit];
         char **names;
         int i;
         backtrace (array, limit);
         names = backtrace_symbols (array, limit);
         for (i =0; i < limit; ++i) {
                 g_print ("\t%s\n", names [i]);
         g_free (names);
+       g_print ("No backtrace available.\n");

--- support/map.c.orig        2010-01-29 12:05:22.374653708 +0100
+++ support/map.c 2010-01-29 12:10:29.024412452 +0100
@@ -216,7 +216,7 @@
 #define _cnm_dump(to_t, from) do {} while (0)
 #endif /* def _CNM_DUMP */

-#ifdef DEBUG
+#if defined(DEBUG) && !defined(__FreeBSD__)
 #define _cnm_return_val_if_overflow(to_t,from,val)  G_STMT_START {   \
         int     uns = _cnm_integral_type_is_unsigned (to_t);             \
         gint64  min = (gint64)  _cnm_integral_type_min (to_t);           \
Send to Kin­dle

Video4Linux sup­port in FreeB­SD

Yes­ter­day I com­mit­ted the v4l sup­port into the lin­ux­u­la­tor (in 9-cur­rent). Part of this was the import of the v4l head­er from lin­ux. We have the per­mis­sion to use it, it is not licensed via GPL. This means we can use it in FreeB­SD native dri­vers, and they are even allowed to be com­piled into GENERIC (but I doubt we have a dri­ver which could pro­vide the v4l inter­face in GENERIC).

The code I com­mit­ted is “just” the glue-code which allows to use FreeB­SD native devices which pro­vide a v4l inter­face (e.g. multimedia/pwcbsd) from lin­ux pro­grams.

If some­one is will­ing to write the glue-code for the v4l2 inter­face please con­tact me. We have the per­mis­sion to use the v4l2 head­er too, we just need some­one doing the cod­ing.

In a sim­i­lar way, if some­one is will­ing to add v4l2 inter­face sup­port to FreeB­SD native dri­vers (I do not know any FreeB­SD dri­ver which pro­vides a v4l2 inter­face) , just tell me and I import the v4l2 head­er into FreeB­SD.

And if some­one wants to add v4l sup­port to FreeB­SD native dri­vers but does not know where to start, feel free to con­tact me too.

Regard­ing the code which is in FreeB­SD ATM: it is not com­plete­ly fin­ished yet (some clip­ping relat­ed stuff is being worked on), but the not fin­ished part can not even be test­ed, as we do not know about a FreeB­SD device which pro­vides this func­tion­al­i­ty.

There is no MFC planned yet, but the more suc­cess sto­ries and test sce­nar­ios are being told about on the emu­la­tion or mul­ti­me­dia mail­inglists, the more like­ly I will do a MFC soon­er than lat­er.

Send to Kin­dle

No phone @Work since a week…

Since a week we (7−10 peo­ple) can not make or receive phone calls with the phones at work. Luck­i­ly this is only the remote-half of the team which works for this client, the onsite peo­ple do not have this prob­lem.

As bad as this is from the client-relations side of view, I have to say this makes it qui­et and relax­ing here ATM… We get requests via EMail or our ticket-system (or a cowork­er pro­vides some info on the mobiles) and we can han­dle them with­out much dis­tur­bance.

Before you think bad about the com­pa­ny I work for… we are just a sub­con­trac­tor, the phone lines are not han­dled by us (but I was told that the issue is now looked at by the big boss).

The run­ning gag of the week is mak­ing the error-noise of the phone.

Send to Kin­dle

I fore­see nice improve­ments in the soundsys­tem

Ariffs changes two months ago to reduce the laten­cy in the soundsys­tem also pre­pared the way for mul­ti­chan­nel sup­port and Yuriy added mul­ti­chan­nel record­ing to the emu10kx dri­ver (there are some bugs ATM and it is only a proof of con­cept to play around with it until we get real mul­ti­chan­nel sup­port in the gener­ic sound code). Ryan tries to get some time (let’s cross fin­gers!) to con­vert a dri­ver (prob­a­bly the emu10kx dri­ver) to use the new mix­er infra­struc­ture before he has to con­cen­trate on his stud­ies again.

This looks like we could get some very nice stuff this year.

Send to Kin­dle

Native RealPlay­er for FreeB­SD

Some days ago I got approval from Real, I’m allowed to blog about the native FreeB­SD RealPlay­er. Now I get time to blog about it.

Ok, there’s not much to say about it so far. Some peo­ple in the FreeB­SD com­mu­ni­ty (among them 2 com­mit­ters, guess who is one of them…) are help­ing Real to get it up and run­ning on FreeB­SD. The FreeB­SD build machine is set­up and some build logs are already gen­er­at­ed. Some minor prob­lems where iden­ti­fied (miss­ing soft­ware which can be installed out of the ports, some minor issues in the build sys­tem and some oth­er easy to fix stuff I don’t remem­ber ATM) in a first round of log-review.

This reminds me that I should have a look if there are some new logs. Maybe I get time at the week­end. Let’s hope I don’t for­get about it… 😉

Send to Kin­dle