From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 14-JUL-1993 09:05:25.72
To:	EVERHART
CC:	
Subj:	Re: Seeking clusterwide SYS$GETJPIW.

Date: Tue, 13 Jul 1993 14:57:12 +0100
From: Arne Vajhxj <ARNE@kopc.hhs.dk>
Subject: Re: Seeking clusterwide SYS$GETJPIW.
To: jformoso@VAXC.STEVENS-TECH.EDU, INFO-VAX@sri.com
Message-Id: <01H0HXBLBJCY9LV4XD@kopc.hhs.dk>
X-Vms-To: KOPC::IN%"jformoso@VAXC.STEVENS-TECH.EDU"
X-Vms-Cc: IN::"INFO-VAX@SRI.COM"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1
Content-Transfer-Encoding: 8BIT

>         We're attempting to write a home-grown finger program in C.  The
> program is meant to function on a VAXcluster running VMS 5.4-019.  Our present
> difficulty involves getting process information from other nodes on the cluster.
>         Is there any way to get information similar to that returned by a call
> to SYS$GETJPIW from the entire cluster?  Any help or pointers to help would be
> greatly appreciated.

SYS$GETJPIW is clusterwide, when used with SYS$PROCESS_SCAN !

Small example:

#include <stdio.h>
#include <prvdef.h>
#ifdef __DECC
#include <pscandef.h>
#include <jpidef.h>
#else
#include "pscandef.h"
#include "jpidef.h"
#endif

struct itemlist {
                short buflen,code;
                long bufadr,retlenadr;
                };

long sys$setprv();
long sys$process_scan();
long sys$getjpiw();

main()
{
   long stat,cntx,iosb[2],pid;
   char nn[7],un[13],pn[16];
   short nnl,unl,pnl;
   char all[] = "*";
   long priv[2] = { PRV$M_WORLD,0 };
   struct itemlist pslist[3] = { {sizeof(all)-1,PSCAN$_NODENAME,
                                  &all,PSCAN$M_WILDCARD} ,
                                 {sizeof(all)-1,PSCAN$_USERNAME,
                                  &all,PSCAN$M_WILDCARD} ,
                                 {0,0,0,0} };
   struct itemlist jpilist[5] = { {sizeof(pid),JPI$_PID,&pid,0} ,
                                  {sizeof(nn)-1,JPI$_NODENAME,&nn,&nnl} ,
                                  {sizeof(un)-1,JPI$_USERNAME,&un,&unl} ,
                                  {sizeof(pn)-1,JPI$_PRCNAM,&pn,&pnl} ,
                                  {0,0,0,0} };
   stat = sys$setprv(1,priv,0,0);
   stat = sys$process_scan(&cntx,pslist);
   while (1) {
      stat = sys$getjpiw(0,&cntx,0,jpilist,iosb,0,0);
      if ((stat&1)!=1) break;
      if ((iosb[0]&1)!=1) break;
      nn[nnl] = '\0';
      un[unl] = '\0';
      pn[pnl] = '\0';
      printf("%8X %6s %12s %s\n",pid,nn,un,pn);
   };
};

The two header-files PSCANDEF.H and JPIDEF.H is included below.

                                                          Arne

Arne Vajhxj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Business School of Southern Denmark     Internet:      ARNE@KO.HHS.DK

================================================================================

/* 
 *                              PSCANDEF.H
 * 
 *  Definitions created by VAXC_DEFS at  9-MAY-1993 19:44:08.93
 */
#define PSCAN$_BEGIN 0
#define PSCAN$_ACCOUNT 1
#define PSCAN$_AUTHPRI 2
#define PSCAN$_CURPRIV 3
#define PSCAN$_GRP 4
#define PSCAN$_HW_MODEL 5
#define PSCAN$_HW_NAME 6
#define PSCAN$_JOBPRCCNT 7
#define PSCAN$_JOBTYPE 8
#define PSCAN$_MASTER_PID 9
#define PSCAN$_MEM 10
#define PSCAN$_MODE 11
#define PSCAN$_NODE_CSID 12
#define PSCAN$_NODENAME 13
#define PSCAN$_OWNER 14
#define PSCAN$_PRCCNT 15
#define PSCAN$_PRCNAM 16
#define PSCAN$_PRI 17
#define PSCAN$_PRIB 18
#define PSCAN$_STATE 19
#define PSCAN$_STS 20
#define PSCAN$_TERMINAL 21
#define PSCAN$_UIC 22
#define PSCAN$_USERNAME 23
#define PSCAN$_GETJPI_BUFFER_SIZE 24
#define PSCAN$_END 25
#define PSCAN$k_type 129
#define PSCAN$M_OR 1
#define PSCAN$M_BIT_ALL 2
#define PSCAN$M_BIT_ANY 4
#define PSCAN$M_GEQ 8
#define PSCAN$M_GTR 16
#define PSCAN$M_LEQ 32
#define PSCAN$M_LSS 64
#define PSCAN$M_PREFIX_MATCH 128
#define PSCAN$M_WILDCARD 256
#define PSCAN$M_CASE_BLIND 512
#define PSCAN$M_EQL 1024
#define PSCAN$M_NEQ 2048
#define PSCAN$S_item_specific_flags 2
#define PSCAN$V_OR 0
#define PSCAN$V_BIT_ALL 1
#define PSCAN$V_BIT_ANY 2
#define PSCAN$V_GEQ 3
#define PSCAN$V_GTR 4
#define PSCAN$V_LEQ 5
#define PSCAN$V_LSS 6
#define PSCAN$V_PREFIX_MATCH 7
#define PSCAN$V_WILDCARD 8
#define PSCAN$V_CASE_BLIND 9
#define PSCAN$V_EQL 10
#define PSCAN$V_NEQ 11
/* 
 *  End of VAXC_DEFS definitions
 */

/* 
 *                              JPIDEF.H
 * 
 *  Definitions created by VAXC_DEFS at  9-MAY-1993 20:05:16.40
 */
#define JPI$C_ADRTYPE 1
#define JPI$C_CTLTYPE 2
#define JPI$C_PCBTYPE 3
#define JPI$C_PHDTYPE 4
#define JPI$C_PCBFLDTYPE 5
#define JPI$C_PHDFLDTYPE 6
#define JPI$C_JIBTYPE 7
#define JPI$C_ARBTYPE 8
#define JPI$C_MAXSTRUC 6
#define JPI$C_LISTEND 0
#define JPI$_CHAIN -1
#define JPI$_GETJPI_CONTROL_FLAGS -2
#define JPI$M_NO_TARGET_INSWAP 1
#define JPI$M_NO_TARGET_AST 2
#define JPI$M_IGNORE_TARGET_STATUS 4
#define JPI$S_JPICTLDEF 4
#define JPI$V_NO_TARGET_INSWAP 0
#define JPI$V_NO_TARGET_AST 1
#define JPI$V_IGNORE_TARGET_STATUS 2
#define JPI$K_OTHER 0
#define JPI$K_NETWORK 1
#define JPI$K_BATCH 2
#define JPI$K_INTERACTIVE 3
#define JPI$K_DETACHED 0
#define JPI$K_LOCAL 3
#define JPI$K_DIALUP 4
#define JPI$K_REMOTE 5
#define JPI$M_NEW_MAIL_AT_LOGIN 1
#define JPI$M_PASSWORD_CHANGED 2
#define JPI$M_PASSWORD_EXPIRED 4
#define JPI$M_PASSWORD_WARNING 8
#define JPI$M_PASSWORD2_CHANGED 16
#define JPI$M_PASSWORD2_EXPIRED 32
#define JPI$M_PASSWORD2_WARNING 64
#define JPI$S_JPILGIDEF 4
#define JPI$V_NEW_MAIL_AT_LOGIN 0
#define JPI$V_PASSWORD_CHANGED 1
#define JPI$V_PASSWORD_EXPIRED 2
#define JPI$V_PASSWORD_WARNING 3
#define JPI$V_PASSWORD2_CHANGED 4
#define JPI$V_PASSWORD2_EXPIRED 5
#define JPI$V_PASSWORD2_WARNING 6
#define JPI$_ASTACT 768
#define JPI$_ASTEN 769
#define JPI$_PRI 770
#define JPI$_OWNER 771
#define JPI$_UIC 772
#define JPI$_STS 773
#define JPI$_STATE 774
#define JPI$_MEM 775
#define JPI$_GRP 776
#define JPI$_PRIB 777
#define JPI$_APTCNT 778
#define JPI$_TMBU 779
#define JPI$_GPGCNT 780
#define JPI$_PPGCNT 781
#define JPI$_ASTCNT 782
#define JPI$_BIOCNT 783
#define JPI$_BIOLM 784
#define JPI$_BYTCNT 785
#define JPI$_DIOCNT 786
#define JPI$_DIOLM 787
#define JPI$_FILCNT 788
#define JPI$_TQCNT 789
#define JPI$_EFWM 790
#define JPI$_EFCS 791
#define JPI$_EFCU 792
#define JPI$_PID 793
#define JPI$_BYTLM 794
#define JPI$_PRCCNT 795
#define JPI$_PRCNAM 796
#define JPI$_TERMINAL 797
#define JPI$_JOBPRCCNT 798
#define JPI$_ENQCNT 799
#define JPI$_ENQLM 800
#define JPI$_SWPFILLOC 801
#define JPI$_MODE 802
#define JPI$_JOBTYPE 803
#define JPI$_PROC_INDEX 804
#define JPI$_MASTER_PID 805
#define JPI$_RIGHTSLIST 806
#define JPI$_CPU_ID 807
#define JPI$_STS2 808
#define JPI$_NODENAME 809
#define JPI$_NODE_CSID 810
#define JPI$_NODE_VERSION 811
#define JPI$_TT_PHYDEVNAM 812
#define JPI$_TT_ACCPORNAM 813
#define JPI$_PROCESS_RIGHTS 814
#define JPI$_SYSTEM_RIGHTS 815
#define JPI$_IMAGE_RIGHTS 816
#define JPI$_RIGHTS_SIZE 817
#define JPI$_LASTPCB 818
#define JPI$_CURPRIV 1024
#define JPI$_WSAUTH 1025
#define JPI$_WSQUOTA 1026
#define JPI$_DFWSCNT 1027
#define JPI$_FREP0VA 1028
#define JPI$_FREP1VA 1029
#define JPI$_DFPFC 1030
#define JPI$_CPUTIM 1031
#define JPI$_PRCLM 1032
#define JPI$_ASTLM 1033
#define JPI$_PAGEFLTS 1034
#define JPI$_DIRIO 1035
#define JPI$_BUFIO 1036
#define JPI$_CPULIM 1037
#define JPI$_PGFLQUOTA 1038
#define JPI$_FILLM 1039
#define JPI$_TQLM 1040
#define JPI$_WSSIZE 1041
#define JPI$_AUTHPRIV 1042
#define JPI$_IMAGPRIV 1043
#define JPI$_PAGFILCNT 1044
#define JPI$_FREPTECNT 1045
#define JPI$_WSEXTENT 1046
#define JPI$_WSAUTHEXT 1047
#define JPI$_AUTHPRI 1048
#define JPI$_PAGFILLOC 1049
#define JPI$_IMAGECOUNT 1050
#define JPI$_PHDFLAGS 1051
#define JPI$_VP_CPUTIM 1052
#define JPI$_VP_CONSUMER 1053
#define JPI$_LASTPHD 1054
#define JPI$_VIRTPEAK 512
#define JPI$_WSPEAK 513
#define JPI$_USERNAME 514
#define JPI$_ACCOUNT 515
#define JPI$_PROCPRIV 516
#define JPI$_VOLUMES 517
#define JPI$_LOGINTIM 518
#define JPI$_IMAGNAME 519
#define JPI$_SITESPEC 520
#define JPI$_MSGMASK 521
#define JPI$_CLINAME 522
#define JPI$_TABLENAME 523
#define JPI$_CREPRC_FLAGS 524
#define JPI$_UAF_FLAGS 525
#define JPI$_MAXDETACH 526
#define JPI$_MAXJOBS 527
#define JPI$_SHRFILLM 528
#define JPI$_FAST_VP_SWITCH 529
#define JPI$_SLOW_VP_SWITCH 530
#define JPI$_LAST_LOGIN_I 531
#define JPI$_LAST_LOGIN_N 532
#define JPI$_LOGIN_FAILURES 533
#define JPI$_LOGIN_FLAGS 534
#define JPI$_LASTCTL 535
#define JPI$_EXCVEC 256
#define JPI$_FINALEXC 257
#define JPI$_LASTADR 258
#define JPI$_LASTPCBFLD 1280
#define JPI$_LASTPHDFLD 1536
/* 
 *  End of VAXC_DEFS definitions
 */


