|
Here's an example of printing the current stack of your job stream. It will print the names of all the programs at seclvl 30 and below, but will fail at seclvl 40+ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mih/micommon.h> #include <mih/miinvcom.h> #include <mimchobs.h> #include <mih/matsobj.h> #pragma linkage( _MATINVS1, builtin ) #pragma linkage( _MATINVS2, builtin ) typedef _Packed struct _MATINVS_T { int bytes_prov; /* user provided bytes */ int bytes_avail; /* available bytes */ int num_of_invs; /* number of invocations in stack */ int mark_counter; /* relative from mark */ /* Invocation entires sizeof(_MATINVS_ENTRY_T) * num_of_invs */ } _MATINVS_T; typedef _Packed struct _MATINVS_ENTRY_T { char reserved1[32]; char assc_pgm_ptr[16]; /* Associated Program Pointer */ short int inv_num; /* Invocation Number */ char inv_mech; /* Invocation Mechanism */ char inv_type; /* Invocation Type */ int inv_mark; /* Invocation Mark */ int instr_id; /* Instruction Identifier */ int actgrp_mark; /* Activation Group Mark */ _SUSPENDPTR susp_ptr; /* Suspend Pointer */ char reserverd2[48]; } _MATINVS_ENTRY_T; #define _MEM_TO_ALLOC ( sizeof(_MATINVS_T) + ( sizeof(_MATINVS_ENTRY_T) * show_stack_header->num_of_invs) ) #define _START_OF_ENTRIES ( sizeof(_MATINVS_T) ) void _MATINVS1(_MATINVS_T *, _SYSPTR); void _MATINVS2(_MATINVS_T *); int main(void) { int counter; _MATINVS_T *show_stack_header; char *pos_ptr; _MATINVS_ENTRY_T *stack_entry; show_stack_header = (_MATINVS_T *)malloc( sizeof(_MATINVS_T) ); show_stack_header->bytes_prov = sizeof(_MATINVS_T); _MATINVS2(show_stack_header); show_stack_header = (_MATINVS_T *)realloc(show_stack_header, _MEM_TO_ALLOC); show_stack_header->bytes_prov = _MEM_TO_ALLOC; _MATINVS2(show_stack_header); pos_ptr = (char *)show_stack_header; pos_ptr += sizeof(_MATINVS_T); for (counter = 0; counter < show_stack_header->num_of_invs; counter++) { stack_entry = (_MATINVS_ENTRY_T *)pos_ptr; printf("Program = %s\n", stack_entry->assc_pgm_ptr); pos_ptr += sizeof(_MATINVS_ENTRY_T); } return 0; } +--- | This is the C/400 Mailing List! | To submit a new message, send your mail to C400-L@midrange.com. | To subscribe to this list send email to C400-L-SUB@midrange.com. | To unsubscribe from this list send email to C400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: bob@cstoneindy.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.