tigerdog ([info]tigerdog) wrote in [info]bezilla,
@ 2007-11-23 12:52:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Missing BeOS code?
A little while back, a bug turned up in Thunderbird's dogbert migration code. When support for Mac OSX was added, it appears ifdefs were inserted so code only executed for Unix and not OSX. Turns out some of that code is also needed for BeOS. I spent some time with LXR looking at the 1.8 branch and came up with a number of candidates where such conditionals occur. I'm posting the list here so everyone interested can look at it. Fyysik wanted me to put it in a safe place so he can look at it in his spare time. I hope this is a safe place :)


http://lxr.mozilla.org/mozilla1.8/source/xpcom/threads/plevent.c#342
http://lxr.mozilla.org/mozilla1.8/source/xpcom/threads/plevent.c#667
http://lxr.mozilla.org/mozilla1.8/source/xpcom/threads/plevent.c#954
http://lxr.mozilla.org/mozilla1.8/source/xpcom/threads/plevent.c#1346
--------comment says "nothing to do on other platforms" but I wonder...
Update: tqh, please look at line 945 and beyond. We might be missing a function.

http://lxr.mozilla.org/mozilla1.8/source/xpcom/threads/plevent.c#1734
--------comment says "extra function for unix" do we also need it?

http://lxr.mozilla.org/mozilla1.8/source/xpinstall/src/nsInstallFolder.cpp#610
--------we don't create an actual installer so maybe this isn't important?

http://lxr.mozilla.org/mozilla1.8/source/toolkit/xre/nsUpdateDriver.cpp#94
http://lxr.mozilla.org/mozilla1.8/source/toolkit/mozapps/update/src/updater/updater.cpp#116
--------these two are in updater code but looks like BEOS is missing. need to fix it if we ever put in updater

http://lxr.mozilla.org/mozilla1.8/source/browser/components/migration/src/nsOperaProfileMigrator.h#117
http://lxr.mozilla.org/mozilla1.8/source/browser/components/migration/src/nsOperaProfileMigrator.h#128
http://lxr.mozilla.org/mozilla1.8/source/browser/components/migration/src/nsOperaProfileMigrator.cpp#1090
http://lxr.mozilla.org/mozilla1.8/source/browser/components/migration/src/nsOperaProfileMigrator.cpp#1111
--------may be needed if migrating from old version of Opera for BeOS

http://lxr.mozilla.org/mozilla1.8/source/mail/components/migration/src/nsDogbertProfileMigrator.h#72
http://lxr.mozilla.org/mozilla1.8/source/mail/components/migration/src/nsDogbertProfileMigrator.cpp#141
http://lxr.mozilla.org/mozilla1.8/source/mail/components/migration/src/nsDogbertProfileMigrator.cpp#183
--------more things to look at in Dogbert profile migrator

http://lxr.mozilla.org/mozilla1.8/source/xpfe/appshell/src/nsXULWindow.cpp#976
Update: We can ignore this. Enabling it for BeOS means, among other things, the main window always starts at the top-left corner, rather than saving the window position from the last shutdown.

http://lxr.mozilla.org/mozilla1.8/source/modules/plugin/base/public/npapi.h#470
http://lxr.mozilla.org/mozilla1.8/source/modules/plugin/base/public/nsplugindefs.h#275
http://lxr.mozilla.org/mozilla1.8/source/modules/plugin/base/src/nsPluginNativeWindow.cpp#65
http://lxr.mozilla.org/mozilla1.8/source/modules/plugin/base/src/nsPluginHostImpl.cpp#2674
http://lxr.mozilla.org/mozilla1.8/source/modules/plugin/base/src/nsPluginHostImpl.cpp#3906
--------last one has to do with Java so we may not see this code. Need to check the others to see if they're needed for BeOS

http://lxr.mozilla.org/mozilla1.8/source/modules/plugin/base/src/ns4xPlugin.cpp#1941
--------two instances in this file. BeOS is handled separately in the 1st one, not present in this one.

http://lxr.mozilla.org/mozilla1.8/source/modules/libreg/src/VerReg.c#120
--------lots of references in this file. This is the first.

http://lxr.mozilla.org/mozilla1.8/source/mailnews/import/comm4x/src/nsComm4xProfile.cpp#51
--------another bit of migration code to look at

http://lxr.mozilla.org/mozilla1.8/source/layout/svg/base/src/nsSVGImageFrame.cpp#568

http://lxr.mozilla.org/mozilla1.8/source/layout/generic/nsObjectFrame.cpp#1902
--------platform specific printing code. could be important - if we ever get printing to work :)

http://lxr.mozilla.org/mozilla1.8/source/layout/generic/nsObjectFrame.cpp#2346
--------plug-in stuff. since there aren't many plug-ins for BeOS right now (are there any?) we wouldn't have seen this.

http://lxr.mozilla.org/mozilla1.8/source/layout/generic/nsObjectFrame.cpp#2346



(Post a new comment)


[info]tigerdog
2007-11-24 12:24 am UTC (link)
http://lxr.mozilla.org/mozilla1.8/source/xpcom/threads/plevent.c#944
seems to have code for every platform except BeOS. I don't know what this code does but it seems odd we don't have a presence here.

(Reply to this) (Thread)


[info]fyysik
2007-11-24 01:02 pm UTC (link)
dunno if Cleanup is required, better to ask TQh about it, as our nspr guru, but code there in BeOS section may be like that:
---------------
char portname[64];
char semname[64];
PR_snprintf(portname, sizeof(portname), "event%lx",
(long unsigned) self->handlerThread);
PR_snprintf(semname, sizeof(semname), "sync%lx",
(long unsigned) self->handlerThread);

CODE TO FIND semaphores HERE
CODE TO DELETE semaphores HERE
delete_port( self->eventport );
------------------

(Reply to this) (Parent)(Thread)


[info]tigerdog
2007-11-24 04:01 pm UTC (link)
Calling Mr. tqh! :)

(Reply to this) (Parent)(Thread)


[info]tqh
2007-11-29 12:15 pm UTC (link)
Hey I'm on vacation!

Or was :)
I'd say it shouldn't be needed, but that comment about window desctruction makes me unsure.

(Reply to this) (Parent)(Thread)


[info]tigerdog
2007-11-29 02:36 pm UTC (link)
Sorry to disturb your vacation! I hope you're someplace warm and sunny. When you're back, I'll be happy to work on this with you.

(Reply to this) (Parent)(Thread)


[info]tqh
2007-11-29 08:13 pm UTC (link)
You didn't I replied now that I came back. Will take a few more days before I look at that code though. It was nice and hot in Thailand btw Krabi, Tonsai beach mostly (climbers paradise mostly, although I don't climb more than necessary).

(Reply to this) (Parent)


[info]tigerdog
2007-11-30 05:33 am UTC (link)
Yes, that comment plus the ugly hang that continues to plague us still seems to have something to do with semaphore locking/unlocking. It looks like if this code gets executed, one of the things it should do is delete a semaphore, thus unblocking other threads waiting on that sem.

Sounds like Thailand is even warmer than San Diego this time of year. Glad your holiday was good. I don't climb more than necessary either - usually just climbing out of my chair to go get another beer :)

(Reply to this) (Parent)

Possible problem
[info]tigerdog
2007-11-30 06:14 am UTC (link)
I note in xpcom pl_SetupNativeNotifier and in the code above, "portname" and "semname" are of size 64 (bytes?) and that name is passed to create_port. The BeBook entry for create_port cautions that the port name should not exceed B_OS_NAME_LENGTH">B_OS_NAME_LENGTH, a constant that apparently the maximum size for the name of a thread, semaphort, port, etc. The create_port entry says B_OS_NAME_LENGTH is 32 bytes.

Maybe its no issue at all but if we try to shove a 64 byte name into a 32 byte slot, there's at least the potential for a mix-up. I wonder if this is why Firefox occasionally hangs on a sem without a name?

(Reply to this) (Parent)(Thread)

Re: Possible problem
[info]tigerdog
2007-11-30 06:42 am UTC (link)
Same situation with semname and portname in nsAppShell.cpp and nsToolkit.cpp. fyysik, I see great minds think alike. :)

(Reply to this) (Parent)

Re: Possible problem
[info]tigerdog
2007-11-30 06:49 am UTC (link)
screwed up the link above. Should read B_OS_NAME_LENGTH. Defined in kernel/OS.h as 32 bytes.

(Reply to this) (Parent)


[info]tigerdog
2007-11-30 06:23 am UTC (link)
Is this code to find semaphores? I know, I should really let tqh take care of this. I'm just trying to learn a bit...

(Reply to this) (Parent)

And as long as I'm asking questions...
[info]tigerdog
2007-11-30 07:07 am UTC (link)
...why is code in nsToolkit the only place to create a port without first checking to see if it already exists? Every other instance of create_port seems to either check if the port already exists, or deletes the port before creating a new one.

(Reply to this) (Parent)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…