Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

lib$create_vm_zone

 
SOLVED
Go to solution
Highlighted
Super Advisor

lib$create_vm_zone

Hello, All!

I have used the piece of code to creating VM Zones. It works as expected if:
[flags] = 0
and [extend-size] = 'Zone flags'


May be some one can help me to resolve this puzzle ?



10 REPLIES 10
Highlighted
Honored Contributor

Re: lib$create_vm_zone

Hi Ruslan,

If you look at the argument of LIB$CREATE_VM_ZONE as per documentation,
Parameter1 = Zone-id
Parameter2 = algorithm
Parameter3 = algorithm-argument
Parameter4 = flags
Parameter5 = extend-size
...

In your program, you are passing,
VMZoneFlags as 3rd parameter (it should be 4th parameter)
VMZsz as 4th parameter (it should be 3rd parameter).
...

check the following link for LIB$CREATE_VM_ZONE documentation -
http://h71000.www7.hp.com/doc/82final/5932/5932pro_005.html
-> Section "LIB$CREATE_VM_ZONE"

You need to have a look at the documentation of LIB$CREATE_VM_ZONE and
ensure that you are passing the parameters correctly.
Do these changes and let us know if the problem is solved.

Hope this helps.

Regards,
Murali
Let There Be Rock - AC/DC
Highlighted
Super Advisor

Re: lib$create_vm_zone

Hello!

Can I ask you using the has been attached VMZ.c to try to confirm that in your case all works as described in the docs ?


Thanks.

Highlighted
Honored Contributor

Re: lib$create_vm_zone

Hi Rusian,

>> Can I ask you using the has been attached VMZ.c to try to confirm that
>> in your case all works as described in the docs ?
Let me know what problem you are facing.
In your program, there is a piece of code within the "#if 0 ....".
Looks like, that portion of the code is not working as expected.
Is that correct ?

Is there a access violation with the program
or
extend size not getting set properly ?

I will try using your program.

Regards,
Murali
Let There Be Rock - AC/DC
Highlighted
Trusted Contributor

Re: lib$create_vm_zone

Hi Ruslan,

I compiled and run your program on V8.3 IA64 with and without the flags and extend-size. But did not see any difference in output. Not sure, if I am doing anything wrong here. Please refer the attachment for the output.


Regards,
Ketan
Highlighted
Super Advisor

Re: lib$create_vm_zone


if ( !(1 & (status = lib$create_vm_zone(&VMZid, /* zone-id */
&VMZoneAlg, /* algorithm *
0, /* algorithm-argument */
&VMZsz, /* flags */
&VMZoneFlags, /* extend-size */
0, /* initial-size */
0, /* block-size */
0, /* alignment */
0, /* page-limit */
0, /* smallest-block-size */
0, /* zone-name */
0, /* get-page */
0))) ) /* free-page */
lib$signal(status);



$ run vmz
Zone Id = 00046800, Zone name = ""

Algorithm = LIB$K_VM_FIXED with block size of 117

Flags = 00000022
LIB$M_VM_GET_FILL0
LIB$M_VM_EXTEND_AREA

Initial size = 16 pages Current size = 0 pages in 0 areas
Extend size = 16 pages Page limit = None

Requests are rounded up to a multiple of 8 bytes,
naturally aligned on 8 byte boundaries

0 bytes have been freed and not yet reallocated

88 bytes are used for zone and area control blocks, or 100.0% overhea
---------------------------------
if ( !(1 & (status = lib$create_vm_zone(&VMZid, /* zone-id */
&VMZoneAlg, /* algorithm *
&VMZsz, /* algorithm-argument */
&VMZoneFlags, /* flags */
0, /* extend-size */
0, /* initial-size */
0, /* block-size */
0, /* alignment */
0, /* page-limit */
0, /* smallest-block-size */
0, /* zone-name */
0, /* get-page */
0))) ) /* free-page */
lib$signal(status);
$ run vmz
Zone Id = 00046800, Zone name = ""

Algorithm = LIB$K_VM_FIXED with block size of 34

Flags = 00000000

Initial size = 16 pages Current size = 0 pages in 0 areas
Extend size = 16 pages Page limit = None

Requests are rounded up to a multiple of 8 bytes,
naturally aligned on 8 byte boundaries

0 bytes have been freed and not yet reallocated

88 bytes are used for zone and area control blocks, or 100.0% overhead

$
Highlighted
Honored Contributor

Re: lib$create_vm_zone

Hi Rusian,

Check the following link for sample program on LIB$CREATE_VM_ZONE -
http://www.eight-cubed.com/examples/framework.php?file=lib_vm.c

Hope this helps.

Regards,
Murali
Let There Be Rock - AC/DC
Highlighted
Solution

Re: lib$create_vm_zone

Hello Ruslan,

Here is the answer for you puzzle!


if ( !(1 & (status = lib$create_vm_zone(&VMZid, /* zone-id */
&VMZoneAlg, /* algorithm * <<<<<<
&VMZsz, /* algorithm-argument */

If you notice the above 3 lines carefully you will find
the character "/" missing after "*". So to solve your puzzle
you just have to put "/" after "*".


Cheers,
Sunil
Highlighted
Honored Contributor

Re: lib$create_vm_zone

Ruslan,

Reading your code in a colourising source editor, the bug stands out as the (inadvertently) commented out argument is a different colour from the rest. I'm using Notepad++ on a PC.

I thought C++ was capable of strong type checking arguments with appropriate template definitions? Doesn't HP provide them for LIB$ routines? That might also have helped detect the bug as it would have caused a mismatch between the VMZname string and another argument.

Language technology has progressed way beyond relying on eyeballing code for correctness of things like mismatched argument lists. For your own sanity, and the safety of your code, please use as much automated checking as possible!
A crucible of informative mistakes
Highlighted
Honored Contributor

Re: lib$create_vm_zone

> Doesn't HP provide them for LIB$ routines?

Around here [*], even defining __NEW_STARLET
doesn't buy you much in this case:

SYS$COMMON:[DECC$LIB.REFERENCE.SYS$STARLET_C]LIB$ROUTINES.H:

[...]
#define lib$create_vm_zone LIB$CREATE_VM_ZONE

#ifdef __NEW_STARLET
unsigned int lib$create_vm_zone(
unsigned int *zone_id,
__optional_params
);
#else /* __OLD_STARLET */
unsigned int lib$create_vm_zone(__unknown_params);
#endif /* #ifdef __NEW_STARLET */
[...]


[*]
alp $ cc /version
HP C V7.3-009 on OpenVMS Alpha V8.3