Board.KolibriOS.org

Official KolibriOS board
It is currently Sun Apr 21, 2019 3:49 pm

All times are UTC+03:00




Post new topic  Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Apr 15, 2012 2:10 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1247
I first discovered the problem when writing 'synergyc' application for net branch, some time ago.
This program uses several libraries (console, libini and network library).
Network library uses libini, wich in turn uses libio.

The problem is that libio in libini doesnt load correctly (and perhaps others too).
Thus, when calling ini_get_str, my program crashes because libini trys to call [file.open] (libio) but its value is -1.

Back when i first discovered the problem, I discussed it with diamond, who blamed the problem on a design flaw IIRC.
Since he is no longer here, but the problem is, somebody else will need to fix it.

Does anybody here have more information or insight about this problem ?

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
PostPosted: Sun Apr 15, 2012 4:16 pm 
LibINI uses its own copy of LibIO. Thus, for example, Tinypad has two copies LibIO.

How do you use LibIO?


Top
   
PostPosted: Sun Apr 15, 2012 4:22 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1247
If what I remember is correct, it has to do with lib_init being called multiple times for the same library.
I do not think it's a kernel problem.

BUT.. I havent investigated any of these claims as of yet,
I was hoping somebody here knows more about the dll loading mechanism then I currently do.. :)

The program synergyc does not use libio itself.
BTW: I tought that the dll's are only loaded in memory once ?

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
PostPosted: Sun Apr 15, 2012 5:17 pm 
DLL is loaded into memory only once:
1) if the path to the file system is the same.
2) if the library does not change the memory in its own area, where it has its own code.

LibIO and LibINI violate Rule 2. For this reason, the kernel makes a copy of these libraries for each application.

lib_init is actually a very harmful thing. And for example in box_lib is imitation - you did it. For this reason, the mechanism of the DLL into the kernel does not duplicate Box_Lib.


Top
   
PostPosted: Sun Apr 15, 2012 5:49 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1247
Mario wrote:
DLL is loaded into memory only once:
1) if the path to the file system is the same.
2) if the library does not change the memory in its own area, where it has its own code.

LibIO and LibINI violate Rule 2. For this reason, the kernel makes a copy of these libraries for each application.

lib_init is actually a very harmful thing. And for example in box_lib is imitation - you did it. For this reason, the mechanism of the DLL into the kernel does not duplicate Box_Lib.


So every library, wich uses another library suffers the problem (2) ?

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein


Top
   
PostPosted: Sun Apr 15, 2012 6:19 pm 
If the library does not need a call to lib_init, then the question is not relevant.


Top
   
PostPosted: Thu Apr 19, 2012 6:36 pm 
Offline
Mentor/Kernel Developer
User avatar

Joined: Fri Jun 30, 2006 9:01 am
Posts: 1247
Here is some debugging output I generated.

The way I see it, libini tries to read proc addresses from libio twice. There is no error checking mechanism and on the second call of dll.link, proc addresses get screwed up ?


Attachments:
Clipboard01.gif
Clipboard01.gif [ 10.07 KiB | Viewed 2369 times ]

_________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
Top
   
PostPosted: Thu Apr 19, 2012 10:57 pm 
This is very strange behavior. Most recently, I used LibINI for @PANEL (SVN r.2619 and following) and it is no have problem.
Maybe it makes sense to try a macro SVN_Kolibri\programs\develop\libraries\box_lib\load_lib.mac ?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 8 posts ] 

All times are UTC+03:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited