From af6338d92750354179a2c37c7a63186b29ad348b Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 23 Sep 2011 11:28:00 -0700 Subject: [PATCH] From Matt Burke - Fixes a bug with DEC C v6.5-001 for OpenVMS/Alpha - Adds support for OpenVMS/Integrity --- Pcap-VMS/pcap-vci/VMS_PCAP.COM | 5 +- Pcap-VMS/pcap-vci/pcap-vms.c | 11 ++--- Pcap-VMS/pcap-vci/pcapvci.c | 9 +++- Pcap-VMS/pcap-vci/vms_pcap.com_new | 64 -------------------------- Pcap-VMS/pcapvcm/build_pcapvcm.com | 62 +++++++++++++++++++++++++ Pcap-VMS/pcapvcm/pcap_client.c | 26 ++++++----- Pcap-VMS/pcapvcm/pcapvcm.c | 74 ++++++++++++++++++++++++++++-- 7 files changed, 160 insertions(+), 91 deletions(-) delete mode 100644 Pcap-VMS/pcap-vci/vms_pcap.com_new diff --git a/Pcap-VMS/pcap-vci/VMS_PCAP.COM b/Pcap-VMS/pcap-vci/VMS_PCAP.COM index 3e9c5135..be4799c1 100644 --- a/Pcap-VMS/pcap-vci/VMS_PCAP.COM +++ b/Pcap-VMS/pcap-vci/VMS_PCAP.COM @@ -2,7 +2,7 @@ $ if f$search("pcap.olb") .eqs. "" $ then $ libr/crea pcap.olb $ endif -$ if p1 .nes. "" +$ if p1 .eqs. "DEBUG" $ then $ opt = "/debug/noopt" $ else @@ -39,7 +39,7 @@ $ libr/replace pcap grammar $ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - inet+sys$share:sys$lib_c.tlb/lib $ libr/replace pcap inet -$ cc/name=( as_is,shortened)/opt'opt/include=sys$disk:[] - +$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - nametoaddr+sys$share:sys$lib_c.tlb/lib $ libr/replace pcap nametoaddr $ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - @@ -61,4 +61,3 @@ $ cc/name=( as_is,shortened)/opt/nomember_alig'opt/include=sys$disk:[] - pcap-vms+sys$share:sys$lib_c.tlb/lib $ libr/replace pcap pcap-vms $ exit - diff --git a/Pcap-VMS/pcap-vci/pcap-vms.c b/Pcap-VMS/pcap-vci/pcap-vms.c index 2d56ebf6..30b5d874 100644 --- a/Pcap-VMS/pcap-vci/pcap-vms.c +++ b/Pcap-VMS/pcap-vci/pcap-vms.c @@ -17,6 +17,9 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * + * X-5 MB Matt Burke 10-Jun-2011 + * Changed protocol type from 'IP' to 'DEC Customer Protocol' + * * X-4 Mark Pizzolato mark@infocomm.com 30-Oct-2003 * Changed the interface names returned by pcap_platform_finddevs * to be upper case to conform to the form provided by UCX. This @@ -302,7 +305,7 @@ pcap_t *pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char * pcap_t *pcap_handle; char *ctlptr; char proto[5] = {8,0,0x2b,0x80,0x00}; - char pty[2] = {0x08,0x00}; + char pty[2] = {0x60,0x06}; unsigned long ctldesc[2]; INTERFACE interface; @@ -368,13 +371,9 @@ pcap_t *pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char * // Use standard ethernet package type // ctlptr = pcap_handle->lan_ctl; -// ADD_INT_VAL(ctlptr, NMA$C_PCLI_FMT, NMA$C_LINFM_802E); ADD_INT_VAL(ctlptr, NMA$C_PCLI_FMT, NMA$C_LINFM_ETH); -// ADD_INT_VAL(ctlptr, NMA$C_PCLI_SAP, 0xfffe); ADD_INT_VAL(ctlptr, NMA$C_PCLI_PAD, NMA$C_STATE_OFF); -// ADD_INT_VAL(ctlptr, NMA$C_PCLI_CRC, NMA$C_STATE_OFF); ADD_INT_VAL(ctlptr, NMA$C_PCLI_MLT, NMA$C_STATE_ON); -// ADD_INT_VAL(ctlptr, NMA$C_PCLI_ACC, NMA$C_ACC_SHR); // @@ -382,7 +381,6 @@ pcap_t *pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char * // ADD_INT_VAL(ctlptr, NMA$C_PCLI_BFN, 255); ADD_INT_VAL(ctlptr, NMA$C_PCLI_BUS, 2048); -// ADD_INT_VAL(ctlptr, NMA$C_PCLI_DCH, NMA$C_STATE_ON); // // If promiscious mode, enable it @@ -395,7 +393,6 @@ pcap_t *pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char * // All ethernet packets // ADD_INT_VAL(ctlptr, NMA$C_PCLI_PTY, *(int *)pty); -// ADD_CNT_VAL(ctlptr, NMA$C_PCLI_PID, sizeof(proto), proto); // // Calculate length diff --git a/Pcap-VMS/pcap-vci/pcapvci.c b/Pcap-VMS/pcap-vci/pcapvci.c index 0753e44e..440849dd 100644 --- a/Pcap-VMS/pcap-vci/pcapvci.c +++ b/Pcap-VMS/pcap-vci/pcapvci.c @@ -1,4 +1,4 @@ -#pragma module PCAPVCI "X-1" +#pragma module PCAPVCI "X-2" /* **++ ** FACILITY: PCAP @@ -25,6 +25,9 @@ ** ** MODIFICATION HISTORY: ** +** X-2 MB Matt Burke 10-Jun-2011 +** Changes to allow compilation on IA64. +** ** X-1 Ankan 25-Oct-2003 ** Lock/unlock data prior to passing it to execlet. ** Return proper status from enable/disable port. @@ -447,7 +450,11 @@ int load_execlet () // Get the shared context. We built the execlet so that the address // of the routine that does this is at home base... +#ifdef __ia64 + rtnptr = *(void **)reference_handle.ldrimg_ptr->ldrimg$l_segments[5].ldrisd$p_base; +#else rtnptr = *(void **)reference_handle.ldrimg_ptr->ldrimg$l_nonpag_w_base; +#endif if (rtnptr) { getContext = (int (*)())rtnptr; status = (*getContext)(&pcapvcm); diff --git a/Pcap-VMS/pcap-vci/vms_pcap.com_new b/Pcap-VMS/pcap-vci/vms_pcap.com_new deleted file mode 100644 index 3b474d45..00000000 --- a/Pcap-VMS/pcap-vci/vms_pcap.com_new +++ /dev/null @@ -1,64 +0,0 @@ -$ if f$search("pcap.olb") .eqs. "" -$ then -$ libr/crea pcap.olb -$ endif -$ if p1 .eqs. "DEBUG" -$ then -$ opt = "/debug/noopt" -$ else -$! Nodebug -$ opt = "/opt=(level=4)" -$ endif -$ cc/opt/name=(as_is, shortened)/nomember_align'opt/include=sys$disk:[] - - pcapvci+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap pcapvci -$ cc/opt/name=(as_is, shortened)/nomember_align'opt/include=sys$disk:[] - - vcmutil+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap vcmutil -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - bpf_dump+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap bpf_dump -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - bpf_filter+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap bpf_filter -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - bpf_image+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap bpf_image -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - etherent+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap etherent -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - fad-gifc+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap fad-gifc -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - gencode+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap gencode -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - grammar+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap grammar -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - inet+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap inet -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - nametoaddr+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap nametoaddr -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - optimize+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap optimize -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - pcap+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap pcap -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - savefile+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap savefile -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - scanner+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap scanner -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - snprintf+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap snprintf -$ cc/name=( as_is,shortened)/opt/nomember_align'opt/include=sys$disk:[] - - pcap-vms+sys$share:sys$lib_c.tlb/lib -$ libr/replace pcap pcap-vms -$ exit - diff --git a/Pcap-VMS/pcapvcm/build_pcapvcm.com b/Pcap-VMS/pcapvcm/build_pcapvcm.com index 89dce2b1..b18446db 100644 --- a/Pcap-VMS/pcapvcm/build_pcapvcm.com +++ b/Pcap-VMS/pcapvcm/build_pcapvcm.com @@ -26,6 +26,7 @@ $ SAVE_DEFAULT = F$ENVIRONMENT("DEFAULT") $ NEW_DEFAULT = F$ENVIRONMENT("PROCEDURE") $ NEW_DEFAULT = F$PARSE(NEW_DEFAULT,,,"DEVICE") + - F$PARSE(NEW_DEFAULT,,,"DIRECTORY") +$ ARCH_NAME = F$GETSYI("ARCH_NAME") $ SET DEFAULT 'NEW_DEFAULT' $ $ DEFINE PCAPVCM$OBJ 'NEW_DEFAULT' @@ -52,6 +53,8 @@ $ LIBRARY/OBJECT/REPLACE PCAPVCM PCAPVCM_INIT,PCAPVCM,vci_jacket,vcmutil $ ENDIF $ $! Link it +$ IF ARCH_NAME .EQS. "Alpha" +$ THEN $ LINK/NOTRACE/NOUSERLIB/MAP=pcapvcm/FULL/NOSYSLIB/NOSYSSHR - /SHARE - /NATIVEONLY - @@ -121,6 +124,65 @@ COLLECT=INIT/ATTRIBUTES=INITIALIZATION_CODE, EXEC$INIT_LINKAGE, - EXEC$INIT_SSTBL_000, - EXEC$INIT_SSTBL_001, - EXEC$INIT_SSTBL_002 +$ ENDIF +$ +$ IF ARCH_NAME .EQS. "IA64" +$ THEN +$ LINK/NOTRACE/NOUSERLIB/MAP=PCAPVCM/FULL/NOSYSSHR - + /SHARE - + /NATIVEONLY - + /BPAGE=14/NOTRACEBACK/NODEMAND_ZERO - + /SYSEXE=SELECTIVE - + /EXE=PCAPVCM.EXE - + SYS$INPUT/OPT + +SYMBOL_TABLE=GLOBALS + +! +vector_table = sys$share:sys$public_vectors.exe +! +! Ensure fixups are done before our initialization routines are called +! +IA64$LIBRARY:STARLET/INCLUDE=(SYS$DOINIT,SYS$SSDEF) +! +PCAPVCM$OBJ:PCAPVCM/INCLUDE=(PCAPVCM_INIT, PCAPVCM, VCI_JACKET, VCMUTIL) +SYS$LIBRARY:VMS$VOLATILE_PRIVATE_INTERFACES/INCLUDE=(BUGCHECK_CODES) +! +SHORT_DATA=WRT +CASE_SENSITIVE=YES +PSECT_ATTR=$CODE$, CON,REL,GBL,SHR,EXE,RD,NOWRT,NOVEC +PSECT_ATTR=EXEC$NONPAGED_CODE, CON,REL,GBL,SHR,EXE,RD,NOWRT,NOVEC + +PSECT_ATTR=EXEC$INIT_CODE, CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC +PSECT_ATTR=EXEC$INIT_000, QUAD,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC +PSECT_ATTR=EXEC$INIT_001, QUAD,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC +PSECT_ATTR=EXEC$INIT_002, QUAD,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC +PSECT_ATTR=EXEC$INIT_SSTBL_000, OCTA,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC,MOD +PSECT_ATTR=EXEC$INIT_SSTBL_001, OCTA,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC,MOD +PSECT_ATTR=EXEC$INIT_SSTBL_002, OCTA,CON,REL,GBL,NOSHR,EXE,RD,WRT,NOVEC,MOD + +PSECT_ATTR=$BSS$, CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC,MOD +PSECT_ATTR=$READONLY$, CON,REL,GBL,NOSHR,NOEXE,RD,WRT,NOVEC + +COLLECT=NONPAGED_READONLY_PSECTS/ATTRIBUTES=RESIDENT,- + $CODE$,- + EXEC$NONPAGED_CODE + +COLLECT=NONPAGED_READWRITE_PSECTS/ATTRIBUTES=RESIDENT,- + $BSS$,- + $READONLY$ + + +COLLECT=INITIALIZATION_PSECTS/ATTRIBUTES=INITIALIZATION_CODE,- + EXEC$INIT_CODE,- + EXEC$INIT_000,- + EXEC$INIT_001,- + EXEC$INIT_002,- + EXEC$INIT_SSTBL_000,- + EXEC$INIT_SSTBL_001,- + EXEC$INIT_SSTBL_002 +CASE_SENSITIVE=NO +$ ENDIF $ $ WRITE SYS$OUTPUT "" $ WRITE SYS$OUTPUT "To use the PCAPVCM.EXE execlet you must copy it to" diff --git a/Pcap-VMS/pcapvcm/pcap_client.c b/Pcap-VMS/pcapvcm/pcap_client.c index 261e26f2..679afe0b 100644 --- a/Pcap-VMS/pcapvcm/pcap_client.c +++ b/Pcap-VMS/pcapvcm/pcap_client.c @@ -1,4 +1,4 @@ -#pragma module pcap_client "X-1" +#pragma module pcap_client "X-2" /* ***************************************************************************** * @@ -34,15 +34,15 @@ /* Define data structures and constants */ -#include /* Descriptors */ -#include /* Loaded image data block */ -#include /* Logical names */ -#include /* Linkage pairs */ -#include /* System service proto-types */ -#include /* System service status codes */ -#include -#include /* CRTL I/O */ -#include /* CTRL strings */ +#include /* Descriptors */ +#include /* Loaded image data block */ +#include /* Logical names */ +#include /* Linkage pairs */ +#include /* System service proto-types */ +#include /* System service status codes */ +#include +#include /* CRTL I/O */ +#include /* CTRL strings */ #include #include @@ -399,7 +399,11 @@ int load_execlet () // Get the shared context. We built the execlet so that the address // of the routine that does this is at home base... - rtnptr = *(void **)reference_handle.ldrimg_ptr->ldrimg$l_nonpag_w_base; +#ifdef __ia64 + rtnptr = *(void **)reference_handle.ldrimg_ptr->ldrimg$l_segments[5].ldrisd$p_base; +#else + rtnptr = *(void **)reference_handle.ldrimg_ptr->ldrimg$l_nonpag_w_base; +#endif if (rtnptr) { getContext = (int (*)())rtnptr; status = (*getContext)(&pcapvcm); diff --git a/Pcap-VMS/pcapvcm/pcapvcm.c b/Pcap-VMS/pcapvcm/pcapvcm.c index 14340763..77cffa4f 100644 --- a/Pcap-VMS/pcapvcm/pcapvcm.c +++ b/Pcap-VMS/pcapvcm/pcapvcm.c @@ -1,4 +1,4 @@ -#pragma module PCAPVCM "X-1" +#pragma module PCAPVCM "X-3" #pragma code_psect "EXEC$NONPAGED_CODE" #pragma linkage_psect "EXEC$NONPAGED_LINKAGE" @@ -62,6 +62,17 @@ // // REVISION HISTORY: // +// X-3 MB Matt Burke 07-Jul-2011 +// Missing fork_unlock for return path in +// pcap$vcm_read_packet when queue is empty. +// +// X-2 MB Matt Burke 10-Jun-2011 +// 03 IOLOCK8 must be held whilst calling any LAN +// functions to ensure proper synchronization +// on SMP systems. +// 02 Changes to allow compilation on IA64. +// 01 Fix register corruption in pcap_event on ALPHA. +// // X-1 Ankan Anders Ahgren 21-Mar-2003 // Initial version. // @@ -137,22 +148,38 @@ int pcap$vcm_get_statistics(VCMCTX_64P vcmctx, CHAR_64P stats); // are called via JSBs from the LAN driver (LAN.MAR). // /* Transmit Complete */ +#ifdef __ia64 +#pragma linkage_ia64 pcap_txLnkg = (parameters(r4,r3), preserved(r28,r4,r5), nopreserve(r8,r9)) +#else #pragma linkage pcap_txLnkg = (parameters(r4,r3), preserved(r2,r4,r5), nopreserve(r0,r1)) +#endif #pragma use_linkage pcap_txLnkg (pcap_txCompl) void pcap_txCompl( VCIBDLLDEF *vcib, VCRPDEF *request ); /* PortMgmt Complete */ +#ifdef __ia64 +#pragma linkage_ia64 pcap_mgmLnkg = (parameters(r4,r3), preserved(r28,r4,r5), nopreserve(r8,r9)) +#else #pragma linkage pcap_mgmLnkg = (parameters(r4,r3), preserved(r2,r4,r5), nopreserve(r0,r1)) +#endif #pragma use_linkage pcap_mgmLnkg (pcap_mgmCompl) void pcap_mgmCompl( VCIBDLLDEF *vcib, VCRPDEF *request ); /* Receive */ +#ifdef __ia64 +#pragma linkage_ia64 pcap_rxLnkg = (parameters(r4,r3), preserved(r28,r4,r5), nopreserve(r8,r9)) +#else #pragma linkage pcap_rxLnkg = (parameters(r4,r3), preserved(r2,r4,r5), nopreserve(r0,r1)) +#endif #pragma use_linkage pcap_rxLnkg (pcap_rxCompl) void pcap_rxCompl( VCIBDEF *vcib, VCRPDEF *request ); /* Events */ -#pragma linkage pcap_evtLnkg = (parameters(r4,r1, r2), preserved(r5), nopreserve(r0,r1)) +#ifdef __ia64 +#pragma linkage_ia64 pcap_evtLnkg = (parameters(r4,r9,r28), preserved(r4,r5), nopreserve(r8,r9)) +#else +#pragma linkage pcap_evtLnkg = (parameters(r4,r1,r2), preserved(r4,r5), nopreserve(r0,r1)) +#endif #pragma use_linkage pcap_evtLnkg (pcap_event) void pcap_event( VCIBDLLDEF *vcib, int event, int reason ); @@ -259,15 +286,26 @@ int pcap$vcm_init (LDRIMG *ini_image_block, ini_image_block->ldrimg$l_unlvec = unlvec; // - // Allocate a 2 pages for our shared data structure + // Allocate 2 pages for our shared data structure // with our companion, the PCAP library. // +#if __VMS_VER >= 80200000 + status = mmg$allocate_sva_and_pfns ( + 2, // number of pages + 0, + 0, + 1, // S1 space + PTE$C_UW | PTE$M_ASM, // User mode RW + 1, // nonpaged + (VOID_PPQ) &pcapvcm ); +#else status = mmg_std$alloc_system_va_map ( PTE$C_UW | PTE$M_ASM, // User mode RW 2, // number of pages 1, // nonpaged 1, // S1 space (VOID_PPQ) &pcapvcm ); +#endif if (!$VMS_STATUS_SUCCESS(status)) bug_check (CUSTOMER, FATAL, COLD); @@ -352,7 +390,7 @@ void pcap_txCompl( VCIBDLLDEF *vcib, VCRPDEF *request ) // -// Do nothing. We own the management VCRP an have a method for getting +// Do nothing. We own the management VCRP and have a method for getting // the status below. // void pcap_mgmCompl( VCIBDLLDEF *vcib, VCRPDEF *request ) @@ -375,7 +413,8 @@ void pcap_rxCompl( VCIBDEF *vcib, VCRPDEF *request ) PCAPVCIB *pcapvcib; VCRPDEF *vcrpout; VCMCTX *vcmctx; - + int saved_ipl; + // // Get our port context @@ -397,7 +436,9 @@ void pcap_rxCompl( VCIBDEF *vcib, VCRPDEF *request ) // If we failed to insert this item, drop it // if (status < 0) { + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_delete_vcrp(request); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); vcmctx->stat.recv_packets_dropped++; return; } @@ -415,7 +456,9 @@ void pcap_rxCompl( VCIBDEF *vcib, VCRPDEF *request ) status = __PAL_REMQTIL(vcib, (void *)&vcrpout); vcib->vcib$w_size--; if (status != 0) { + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_delete_vcrp(vcrpout); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); vcmctx->stat.recv_packets_dropped++; } } @@ -525,9 +568,12 @@ int pcap$vcm_getdevice(VCMCTX_64P vcmctx, CHAR_64P devnam) LDCDEF *ldc; unsigned char *tmpname; int len = 0; + int saved_ipl; id = vcmctx->ldcid; + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_get_device(&id, &ldc); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); if ($VMS_STATUS_SUCCESS(status)) { vcmctx->ldcid = id; tmpname = (unsigned char *) ldc->ldc$a_name; @@ -554,6 +600,7 @@ int pcap$vcm_create_port(VCMCTX_64P vcmctx, CHAR_64P device) char tmpdev[128]; int len; PCAPVCIB *pcapvcib; + int saved_ipl; len = (int) device[0]; memcpy(tmpdev, device, len+1); @@ -578,7 +625,9 @@ int pcap$vcm_create_port(VCMCTX_64P vcmctx, CHAR_64P device) pcapvcib->vcmctx = (VCMCTX *) vcmctx; if $VMS_STATUS_SUCCESS(status) { + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_create_port((VCIBDLLDEF *)&vcmctx->vcib); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); } return status; @@ -590,8 +639,11 @@ int pcap$vcm_create_port(VCMCTX_64P vcmctx, CHAR_64P device) int pcap$vcm_delete_port(VCMCTX_64P vcmctx) { int status; + int saved_ipl; + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_delete_port((VCIBDLLDEF *)&vcmctx->vcib); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); return status; } @@ -602,6 +654,7 @@ int pcap$vcm_delete_port(VCMCTX_64P vcmctx) int pcap$vcm_enable_port(VCMCTX_64P vcmctx, int p2len, CHAR_64P p2buf) { int status; + int saved_ipl; if (p2len > 0 && p2buf != NULL) { memcpy(&vcmctx->p2_buf[0], p2buf, p2len); @@ -615,8 +668,10 @@ int pcap$vcm_enable_port(VCMCTX_64P vcmctx, int p2len, CHAR_64P p2buf) } if $VMS_STATUS_SUCCESS(status) { + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_mgmt_port((VCRPLANDEF *)&vcmctx->vcrp, (VCIBDLLDEF *)&vcmctx->vcib); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); } return status; @@ -628,13 +683,16 @@ int pcap$vcm_enable_port(VCMCTX_64P vcmctx, int p2len, CHAR_64P p2buf) int pcap$vcm_disable_port(VCMCTX_64P vcmctx) { int status = SS$_NORMAL; + int saved_ipl; status = init_mgmt_vcrp((VCRPLANDEF *)&vcmctx->vcrp, VCRP$K_FC_DISABLE_PORT, 0, 0); if $VMS_STATUS_SUCCESS(status) { + fork_lock(SPL$C_IOLOCK8, &saved_ipl); status = vci_mgmt_port((VCRPLANDEF *)&vcmctx->vcrp, (VCIBDLLDEF *)&vcmctx->vcib); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); } return status; @@ -707,6 +765,7 @@ int pcap$vcm_read_packet(VCMCTX_64P vcmctx, int len, CHAR_64P packet) // If queue is empty, give up // if (status <= 0) { + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); return SS$_NOSUCHOBJECT; } @@ -777,7 +836,9 @@ int pcap$vcm_send_packet(VCMCTX_64P vcmctx, int hdrlen, int len, // Point to where we're going to put the packet // packptr = (char *) vcrp + VCRP$T_LAN_DATA + LAN$C_MAX_HDR_SIZE + 8; + fork_lock(SPL$C_IOLOCK8, &saved_ipl); built_hdrlen = vci_build_header(packptr, &reshdr, 0, 0, (VCRPLANDEF *)&vcmctx->vcib); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); // // Save the port context address @@ -832,6 +893,7 @@ int pcap$vcm_build_header(VCMCTX_64P vcmctx, int len, CHAR_64P header) char *reshdr; char *hdrptr; int hdrlen; + int saved_ipl; // // Set up pointer to (the middle of) header @@ -841,7 +903,9 @@ int pcap$vcm_build_header(VCMCTX_64P vcmctx, int len, CHAR_64P header) // // Build the header // + fork_lock(SPL$C_IOLOCK8, &saved_ipl); hdrlen = vci_build_header(hdrptr, &reshdr, 0, 0, (VCRPLANDEF *)&vcmctx->vcib); + fork_unlock(SPL$C_IOLOCK8, saved_ipl, SMP_RESTORE); // // Copy header just built