Welcome, Guest. Please login or register.

Author Topic: Libraries & CreateNewProc  (Read 3223 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Libraries & CreateNewProc
« on: September 01, 2004, 03:29:04 AM »
@Jose

This "only-exec" rule is broken all over, and it's common practice to share library bases, except those explicitly known to be non-shareable. Typically at least all standard system libraries are considered shareable.

About bsdsocket.library

One of the special non-shareable libraries is bsdsocket.library. One of the reasons is that each process needs to maintain certain set of static data about the network stack, and it would be really inefficient if each library function would need to lookup caller task context from some list or array (ok, it could use hashtable or btree). Instead each opener task gets unique librarybase with unique static data in possize and (back)ptr to global base/data (the one found from system LibList). This way no lookup is needed and each function can access the local data directly.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: Libraries & CreateNewProc
« Reply #1 on: September 01, 2004, 01:16:37 PM »
Quote
Those DOS functions which need a process structure are protected against tasks.

Well, for example SetIoErr() is not, and various other parts of dos.library call it. So it's a bit risky to call functions from within a task, you risk trashing some memory past struct Task.