[FreeVMS] RE: new str$ routines - to NULL or not to NULL, that is the question....

Roger Tucker roger.tucker at mci.com
Mar 6 Sep 18:57:19 CEST 2005


STR$ routines are not AST or thread re-entrant with respect to the same
strings.  Here is a quote from the 8.2-1 doc set:

--------------

You can call the string resource allocation routines only from user mode, at
asynchronous system trap (AST) or non-AST level. However, be extremely
careful if you manipulate dynamic strings at AST level. The string
manipulation routines in the Run-Time Library do not prevent the strings
that they are manipulating at non-AST level from being modified at AST
level. 

For example, consider the case in which a string manipulation routine has
calculated the lengths and addresses involved in a concatenation operation.
This string manipulation routine may be interrupted by an AST. The user, at
AST level, may write to the same string, changing its length and address. It
is then possible to resume execution of the routine with addresses that are
no longer allocated or string lengths that are no longer valid. For this
reason, if you use dynamic strings at AST level, you should allocate, use,
and deallocate them within the AST code. 

The dynamic string manipulation routines are intended for use at user mode
only. To manipulate dynamic strings at another access mode, you should
allocate and deallocate storage for each string at that access mode to avoid
side effects. Link each segment of your program that runs at a different
access mode with the /NOSYSSHR qualifier. In this way, you establish a
separate copy of the string database for each access mode. 

-------------

Malloc() may not be re-entrant, but should be.  I'll try to look into this.
I haven't been working on the str$ routines because I didn't want to step on
anyone and I haven't had much time lately.  Although, I may be able to work
on things again this week.

I never did get a freevms system built or working correctly and I ran out of
time, so I gave up.  That's going to be a problem, we all have very limited
time so things have to work and be straight forward or we just spend our
time getting there and not having anytime to do anything.

Oh well,
Roger


-----Original Message-----
From: Roar Thronæs [mailto:roart at nvg.ntnu.no] 
Sent: Monday, September 05, 2005 8:41 AM
To: Roger Tucker
Cc: 'FreeVMS mailing list'
Subject: Re: new str$ routines - to NULL or not to NULL, that is the
question....

On Thu, Aug 11, 2005 at 05:53:53PM -0600, Roger Tucker wrote:
> 
> If everyone agrees, I'm going to fix the str$ routines to work the way
they
> should... and come out with a new version that fixes all the bugs in
them...

Could you also take a look at asynchronous/locking issues?
As you know, I have problems with telnet crashing inside malloc.
Now I suspect it may have something to do with asynchronous use of
descriptors.
And/or a different "malloc" implementation that does not store data in
the 8 bytes below what malloc gives you.
But I am not sure.

-- 
Regards,
Roar Thronæs





Plus d'informations sur la liste de diffusion FreeVMS