Annotation of researchv9/jerq/sgs/libsdp/change.c, revision 1.1.1.1

1.1       root        1: static char ID[] = "@(#) change.c: 1.1 3/16/82";
                      2: #include <stdio.h>
                      3: #include "sdp.h"
                      4: #include "define3.h"
                      5: 
                      6: #ifdef SHORT
                      7: #define CH01   "CH01 "
                      8: #define CH02   "CH02 "
                      9: #define CHAU   "CHAU "
                     10: #else
                     11: #define CH01   "CH01 -- no permission to change\n%o\n",i->manp[j].space
                     12: #define CH02   "CH02 -- frame not found\n%o\n",ptr
                     13: #define CHAU   "%s","CHAU -- audit failed in sdp_change\n"
                     14: #endif
                     15: 
                     16: #ifdef SWEET
                     17: #define PROLOG
                     18: #define EPILOG
                     19: #else
                     20: #define PROLOG         if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\
                     21:                                ERR_RET(CHAU,ERROR)
                     22: #define EPILOG         if(aud_flag == AUDITON)\
                     23:                                aud_set() ;\
                     24:                        if(hist_fp != NULL)\
                     25:                                fprintf(hist_fp,"CH\t%o\t%ld\t%o\n",(i->manp)[j].space,(i->manp)[j].page_id,ptr) ;
                     26: #endif
                     27: 
                     28: extern int aud_flag ;
                     29: extern FILE *hist_fp ;
                     30: extern struct ENVIRON *first_environ ;
                     31: extern struct LIBFILE *Glib_file ;
                     32: 
                     33: extern aud_set() ;
                     34: extern int aud_check() ;
                     35: extern fatal() ;
                     36: 
                     37: int                                    /* SUCCESS or ERROR */
                     38: sdp_change(ptr)
                     39: char   *ptr ;
                     40: {
                     41:        register struct ENVIRON *i ;
                     42:        register int            j ;
                     43:        register unsigned       f ;
                     44:        register unsigned       p ;
                     45:        register int            status ;
                     46: 
                     47:        PROLOG
                     48: 
                     49:        p = (unsigned)ptr ;
                     50:        status = 0 ;
                     51:        for(i=first_environ; i!=NULL; i=i->next_environ)
                     52:        {
                     53:                for(j=0; j<i->num_frames; j++)
                     54:                {
                     55:                        f = (unsigned)(i->manp)[j].frame_pntr ;
                     56:                        if ( f <= p  &&  p < f + (unsigned)i->frame_size )
                     57:                        {
                     58:                                if(i->manp[j].space->perms != WRTN)
                     59:                                        ERR_RET(CH01,ERROR)
                     60:                                i->manp[j].ref_chng = WRTN ;
                     61:                                status = 1 ;
                     62:                                break ;
                     63:                        }
                     64:                }
                     65:                if(status == 1)
                     66:                        break ;
                     67:        }
                     68: 
                     69:        if(status == 0)
                     70:                ERR_RET(CH02,ERROR)
                     71: 
                     72:        EPILOG
                     73:        return(SUCCESS) ;
                     74: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.