跳到內容

將開源軟體移植到 OpenVMS

來自 Wikibooks,開放世界中的開放書籍

將開源(UNIX)軟體移植到 OpenVMS

[編輯 | 編輯原始碼]

OpenVMS 和開源軟體都從一段時間前開始使用 Open 字首。在此之前,我們只有很多作業系統,其中一個是 VAX VMS。每個作業系統都有自己的功能、優點和缺點。如果你想要一個應用程式在你的計算機上執行,你就會購買或自己構建應用程式。讓應用程式在你的計算機上執行所需的努力往往非常大,人們會尋找方法來簡化應用程式在不同平臺上的實現過程(即移植)。特別是那些旨在在許多不同平臺上實現的軟體,以及那些為尚未已知的平臺開發的軟體,都需要採取措施來儘可能地簡化實現過程。符合開放標準或行業標準非常有用。如果軟體在交付時包括原始碼,以便客戶可以根據自己的(不斷變化的)需求修改軟體,並有義務將修改後的程式碼提供給其他軟體使用者,那麼就會想到開源軟體的概念。儘管開源軟體和開放標準在嚴格意義上並不一定相關,但它們通常會被一起提及,因為當兩者都能最優地使用時,人們將獲益最多:輕鬆(因此廉價)地部署應用程式。OpenVMS 中的 open 僅僅意味著人們可以依賴 OpenVMS 作業系統對開放標準的符合性。OpenVMS 不僅可以在 VAX 硬體上執行,也可以在 Alpha 上執行,並且從 2004 年開始也可以在行業標準的 IA64 硬體上執行。

本指南將解釋如何使用 OpenVMS DII COE 版本(7.2-6C1 和 7.2-6C2)中引入的功能將開源軟體移植到 OpenVMS。本指南並非專門針對這些 OpenVMS 版本,但它們是第一個公開發布的包含一些新 UNIX 功能的 OpenVMS 版本。更具體地說,OpenVMS 版本 7.3 7.3- 1、7.3-2 及更高版本。最新的 OpenVMS 版本(OpenVMS 8.4)擁有這些新功能中的大部分。由於移植工具的開發正在快速進展,並且未來將在 OpenVMS 中新增更多可移植性功能,因此我們將定期更新本指南。許多開源專案使用 UNIX shell 指令碼進行構建和安裝。我們將探討如何使用 GNV 套件提供的 UNIX 命令和實用程式在 OpenVMS 上執行相同的操作。我們將不討論將開源軟體移植到較早版本的 OpenVMS,儘管這些較早版本仍然受支援。移植到這些較早版本的 OpenVMS 可以完成,但難度要大得多。

目標受眾基本上是所有對開源軟體感興趣的人。如果一切都完美,這將是唯一的需求,但可惜的是,事情並不完美。在當前版本的開源軟體中,OpenVMS 很少被識別或考慮為目標平臺。我們認為(並希望)這種情況很快會改變。在此期間,移植人員將從一些程式設計經驗中受益。在 OpenVMS 或 UNIX 系統上擁有 C 和/或 C++ 經驗是一個很大的優勢。開源世界中常用的其他語言包括 bash、make 和 perl。系統管理經驗更多地是需求,因為移植可能需要對 OpenVMS 上的移植環境進行調整。

我們感謝所有以任何形式為本指南做出貢獻的人。許多人貢獻了材料、想法或內部資訊。如果沒有他們的貢獻,本指南將不會像現在這樣有用。

第一部分:開源、Unix 和 OpenVMS

[編輯 | 編輯原始碼]

開源與專有軟體

[編輯 | 編輯原始碼]

本指南不會從對開源、免費軟體、共享軟體和專有軟體之間差異的深入哲學討論開始。相反,我們更願意遵循以下出版物中的定義

Title: The BUSINESS and ECONOMICS of LINUX and OPEN SOURCE
Written by: Martin Fink
Printed by: Prentice Hall
ISBN: 0-13-047677-3

對於我們的目的,這些定義以及各種許可協議帶來的法律含義並不相關。我們將專注於將開源軟體移植到 OpenVMS 過程的技術方面。

Unix、Linux、開放 Unix 標準

[編輯 | 編輯原始碼]

由於大多數開源軟體源於某種形式的 UNIX,因此我們需要了解此類平臺的特點以及這些平臺與目標平臺 OpenVMS 之間的差異。說起來容易做起來難,因為 UNIX 的實現數量與硬體和作業系統軟體供應商的數量一樣多。從 UNIX 的早期開始,當大學不僅可以訪問 UNIX,還可以訪問作業系統的原始碼時,各種針對常見問題的解決方案就出現了。這導致了通常稱為 UNIX 的相關作業系統家族的出現。UNIX 品牌名稱的所有權幾經易手,情況變得相當混亂。誰擁有真正的 UNIX?因此,人們開始定義標準(雖然不是一個標準……),透過這些標準可以識別“真正的”UNIX。在 <reference> 中,我們將比較以下 UNIX 標準與 OpenVMS 功能:XSI、POSIX Base、Unix 98、Unix 95、P96 P92、C99、C89、SVID3、BSD、LSB 1.3

LINUX 是一個非常流行的類似 UNIX 的作業系統,它有許多不同的發行版,每個發行版都有略微不同的特性。為如此多樣的環境製作軟體是一場噩夢。但極具創造力的軟體開發人員找到了解決方案。解決方案有兩方面:

  • 透過標準化來定義和實施最小功能集,類似於 TCP/IP 的 RFC。
  • 使用一套能夠找到平臺差異並做出反應(適應)的工具來自動化構建過程。這導致了 autoconf、automake 和 libtool 的開發。這些工具也稱為 GNU autotools 環境 (http://sources.redhat.com/autobook/)

OpenVMS、開放標準

[編輯 | 編輯原始碼]

另一方面,OpenVMS 是惠普擁有和維護的專有作業系統。有一些專案旨在建立 OpenVMS 克隆版(例如 freeVMS (http://www.freevms.net)),但本指南將重點介紹惠普的 OpenVMS 作業系統。如 SPD(軟體產品說明)中所述,OpenVMS 符合一組開放標準。在這方面,開放標準意味著標準化組織負責標準的確切文字。我們認為,完全符合該標準意味著產品將在發現差異時適應該標準,而不是相反(將標準適應產品的行為,就像所謂的行業標準通常所做的那樣)。對於將開源移植到 OpenVMS 的開發人員來說,最有趣的開放標準是

  • 分散式計算環境 (DCE) 支援
  • 對 OSF/Motif 和 X 視窗系統標準的支援(X11R6 伺服器和 X11R5 客戶端)
  • ANSI X3.4-1986:美國資訊交換標準程式碼
  • ANSI X3.41-1974:用於 7 位 ASCII 的程式碼擴充套件技術
  • FIPS 1-2:資訊交換程式碼、其表示形式、子集和擴充套件
  • ISO 646:ISO 7 位資訊交換編碼字元集
  • ISO 2022:用於 ISO 646 的程式碼擴充套件技術
  • ISO 3307:一天時間的表示
  • ISO 4873:8 位資訊交換程式碼 - 結構和實施規則
  • ISO 9660:資訊處理 - 用於資訊交換的 CD-ROM 的卷和檔案結構

OpenVMS 上的開源

[編輯 | 編輯原始碼]

這裡的問題不是我們能否在 OpenVMS 上使用開源軟體,因為你已經在使用一些開源軟體。CDSA 是一個開源安全框架,現在已用於 OpenVMS。沒有它,你就無法安裝當前版本的 OpenVMS。CDSA 有兩個附加元件,SSL 和 Kerberos。兩者都是開源的。在 TCP/IP 包中,你會發現來自網際網路軟體聯盟的 BIND 和 DHCP。那麼 SMTP、POP、IMAP、SSH 呢…… 這些只是標準 OpenVMS 發行版中包含的一些軟體包。但還有更多,還有 Apache、Mozilla、Samba、MySQL、Tomcat、Perl、Python。然後是開源的商業理由。你或你的公司為什麼要使用開源軟體?這不像許多人想的那樣簡單。開源軟體免費並不一定意味著它對你或你的公司來說執行成本更低。由於主題的複雜性,我們想向你推薦一本關於該主題的好書

Title: The BUSINESS and ECONOMICS of LINUX and OPEN SOURCE
Written by: Martin Fink
Printed by: Prentice Hall
ISBN: 0-13-047677-3

OpenVMS-UNIX 差異

[編輯 | 編輯原始碼]

比較 UNIX 和 OpenVMS 的最佳方法可能是透過一張表格,並排比較有趣的方面。<reference> 就是這樣的表格。這只是一個部分列表。可能最好是推薦一些關於該主題的好書。來自 John Wisniewski 的著作,他推動了 OpenVMS 愛好者計劃,這是一本優秀的書籍

Title: Linux and OpenVMS Interoperability
Written by: John Wisniewski
Printed by: Digital Press
ISBN: 1-55558-267-2

以下書籍旨在讓熟悉 OpenVMS 的人更容易地學習 UNIX 環境

Title: UNIX for VMS Users
Written by: Philip E. Bourne
Printed by: Digital Press
ISBN: 1-55558-034-3

第二部分:在 OpenVMS 上構建開源移植環境

[編輯 | 編輯原始碼]

構建 OpenVMS 移植系統

[編輯 | 編輯原始碼]

移植過程的第一步是讓一個合適的 OpenVMS 系統執行起來。雖然 OpenVMS 在三個硬體平臺上可用,但只有兩個平臺裝備齊全,可以進行嚴肅的開源移植:Alpha 和 IA64。VAX 平臺缺少獨立配置中某些重要功能的支援。例如,VAX OpenVMS 缺少對原生 ODS5 和 GNV 的支援。由於大多數人只能訪問 Alpha 系統,並且 IA64 OpenVMS 在很大程度上在功能上等同於 Alpha OpenVMS,因此所有示例均基於 Alpha OpenVMS。在 www.oooovms.dyndns.org 網站的參考部分,提供了構建 OpenVMS 系統所涉及的步驟示例。關於 升級韌體OpenVMS 的初始安裝首次啟動OpenVMS 的初始配置 的文件。

在模擬器上安裝 OpenVMS 8.4

[編輯 | 編輯原始碼]
   +-------------+    V i r t u a l       serial0
   |F|r|e|e|A|X|P|      A l p h a         on emulator workshop (128 MB)
   +-------------+                        x64 version 2.4.3.533

ff.fe.fd.fc.fb.fa.f9.f8.f7.
ERROR: ISA table corrupt!
Initializing table to defaults
type >>>init to use these changes
f6.f5.
ef.df.ee.ed.ec.f4.eb.ea.
TIMER_TPS environment variable invalid
Defaulting to 1mS per tick
e9.e8.e7.e6.....e5.
V7.0-9, built on Mar 18 1999 at 13:25:37
>>>b dka100
(boot dka100.1.0.6.0 -flags 0)
block 0 of dka100.1.0.6.0 is a valid boot block
reading 1230 blocks from dka100.1.0.6.0
bootstrap code read in
base = 1f2000, image_start = 0, image_bytes = 99c00
initializing HWRPB at 2000
initializing page table at 1e4000
initializing machine state
setting affinity to the primary CPU
jumping to bootstrap code


    OpenVMS (TM) Alpha Operating System, Version V8.4
    © Copyright 1976-2010 Hewlett-Packard Development Company, L.P.





    Installing required known files...

    Configuring devices...

%EWA0, Twisted-Pair mode set by console
%EWA0, Link state: UP


    ****************************************************************

    You can install or upgrade the OpenVMS ALPHA operating system
    or you can install or upgrade layered products that are included
    on the OpenVMS ALPHA distribution media (CD/DVD).

    You can also execute DCL commands and procedures to perform
    "standalone" tasks, such as backing up the system disk.

    Please choose one of the following:

        1)  Upgrade, install or reconfigure OpenVMS ALPHA Version V8.4
        2)  Display layered products that this procedure can install
        3)  Install or upgrade layered products
        4)  Show installed products
        5)  Reconfigure installed products
        6)  Remove installed products
        7)  Find, Install or Undo patches; Show or Delete Recovery Data
        8)  Execute DCL commands and procedures
        9)  Shut down this system

Enter CHOICE or ? for help: (1/2/3/4/5/6/7/8/9/?) 1
    ***********************************************************

    This procedure will ask a series of questions.

          () - encloses acceptable answers
          [] - encloses default answers

    Type your response and press the <Return> key.  Type:

          ? - to repeat an explanation
          ^ - to change prior input (not always possible)
          Ctrl/Y - to exit the installation procedure

    There are two choices for installation/upgrade:

    Initialize - Removes all software and data files that were
        previously on the target disk and installs OpenVMS ALPHA.

    Preserve -- Installs or Upgrades OpenVMS ALPHA on the target disk
        and retains all other contents of the target disk.

   * Note: You cannot use preserve to install OpenVMS ALPHA on a disk on
        which any other operating system is installed.  This includes
        implementations of OpenVMS for other architectures.

Do you want to INITIALIZE or to PRESERVE? [PRESERVE] initialize


    You must enter the device name for the target disk on which
    OpenVMS ALPHA will be installed.

Enter device name for target disk: (? for choices) ?

Device                  Device           Error    Volume         Free  Trans Mnt
 Name                   Status           Count     Label        Blocks Count Cnt
DKA0:                   Online               0
DKA100:                 Mounted wrtlck       2  ALPHA084        137373    83   1
DVA0:                   Offline              0
DAD0:                   Online               0


Enter device name for target disk: (? for choices) dka0

Enter volume label for target system disk: [ALPHASYS]

    The target system disk can be initialized with On-Disk Structure
    Level 2 (ODS-2) or Level 5 (ODS-5).  (? for more information)

Do you want to initialize with ODS-2 or ODS-5? (2/5/?) 5

    Hard links can be enabled on ODS-5 disks.  (? for more information)

Do you want to enable hard links? (Yes/No/?) yes


    You have chosen to install OpenVMS ALPHA on a new disk.

    The target system disk, DKA0:, will be initialized
    with structure level 5 (ODS-5).
    Hard links WILL be enabled.
    The disk will be labeled ALPHASYS.
    Any data currently on the target system disk will be lost.

Is this OK? (Yes/No) yes

    Initializing and mounting target....

    Creating page and swap files....


    You must enter a password for the SYSTEM account.

    The password must be a minimum of 8 characters in length, and
    may not exceed 31 characters.  It will be checked and verified.
    The system will not accept passwords that can be guessed easily.

    The password will not be displayed as you enter it.

Password for SYSTEM account: password not echoed

Re-enter SYSTEM password for verification:  password not echoed


Will this system be a member of an OpenVMS Cluster? (Yes/No) no

Will this system be an instance in an OpenVMS Galaxy? (Yes/No) no


    For your system to operate properly, you must set two parameters:
    SCSNODE and SCSSYSTEMID.

    SCSNODE can be from 1 to 6 letters or numbers.  It must contain at
    least one letter.

    If you plan to use DECnet, SCSNODE must be the DECnet Phase IV
    node name, or the DECnet-Plus (Phase V) node synonym.

    If you have multiple OpenVMS systems, the SCSNODE on each system
    must be unique.

Enter SCSNODE: star

    If you plan to use DECnet, SCSSYSTEMID must be set based on the
    DECnet Phase IV address.

Do you plan to use DECnet? (Yes/No) [Yes] no

    Please choose an SCSSYSTEMID between 1 and 65535.  If you have multiple
    OpenVMS systems, the SCSSYSTEMID on each system must be unique.

Enter SCSSYSTEMID: [65534]

  Configuring the Local Time Zone


TIME ZONE SPECIFICATION -- MAIN Time Zone Menu            "*" indicates a menu

  0* GMT
  1* AFRICA          17) EST             33) IRAN            49) PORTUGAL
  2* AMERICA         18) EST5EDT         34) ISRAEL          50) PRC
  3* ANTARCTICA      19* ETC             35) JAMAICA         51) PST8PDT
  4* ARCTIC          20* EUROPE          36) JAPAN           52) ROC
  5* ASIA            21) FACTORY         37) KWAJALEIN       53) ROK
  6* ATLANTIC        22) GB-EIRE         38) LIBYA           54) SINGAPORE
  7* AUSTRALIA       23) GB              39) MET             55) TURKEY
  8* BRAZIL          24) GMT-0           40* MEXICO          56) UCT
  9* CANADA          25) GMT             41* MIDEAST         57) UNIVERSAL
 10) CET             26) GMT0            42) MST             58* US
 11* CHILE           27) GMTPLUS0        43) MST7MDT         59) UTC
 12) CST6CDT         28) GREENWICH       44) NAVAJO          60) W-SU
 13) CUBA            29) HONGKONG        45) NZ-CHAT         61) WET
 14) EET             30) HST             46) NZ              62) ZULU
 15) EGYPT           31) ICELAND         47* PACIFIC
 16) EIRE            32* INDIAN          48) POLAND

Press "Return" to redisplay, enter "=" to search or "?" for help, or
Select the number above that best represents the desired time zone: 20

EUROPE Time Zone Menu                                     "*" indicates a menu

  0* RETURN TO MAIN TIME ZONE MENU
  1) AMSTERDAM       16) HELSINKI        31) MOSCOW          46) SOFIA
  2) ANDORRA         17) ISLE_OF_MAN     32) NICOSIA         47) STOCKHOLM
  3) ATHENS          18) ISTANBUL        33) OSLO            48) TALLINN
  4) BELFAST         19) JERSEY          34) PARIS           49) TIRANE
  5) BELGRADE        20) KALININGRAD     35) PODGORICA       50) TIRASPOL
  6) BERLIN          21) KIEV            36) POLAND          51) UZHGOROD
  7) BRATISLAVA      22) LISBON          37) PORTUGAL        52) VADUZ
  8) BRUSSELS        23) LJUBLJANA       38) PRAGUE          53) VATICAN
  9) BUCHAREST       24) LONDON          39) RIGA            54) VIENNA
 10) BUDAPEST        25) LUXEMBOURG      40) ROME            55) VILNIUS
 11) CHISINAU        26) MADRID          41) SAMARA          56) VOLGOGRAD
 12) COPENHAGEN      27) MALTA           42) SAN_MARINO      57) WARSAW
 13) DUBLIN          28) MARIEHAMN       43) SARAJEVO        58) ZAGREB
 14) GIBRALTAR       29) MINSK           44) SIMFEROPOL      59) ZAPOROZHYE
 15) GUERNSEY        30) MONACO          45) SKOPJE          60) ZURICH

Press "Return" to redisplay, enter "=" to search or "?" for help, or
Select the number above that best represents the desired time zone: 1

You selected EUROPE / AMSTERDAM as your time zone.
Is this correct? (Yes/No) [YES]: yes


    Configuring the Time Differential Factor (TDF)


    Default Time Differential Factor for standard time is 1:00.
    Default Time Differential Factor for daylight saving time is 2:00.

    The Time Differential Factor (TDF) is the difference between your
    system time and Coordinated Universal Time (UTC).  UTC is similar
    in most respects to Greenwich Mean Time (GMT).

    The TDF is expressed as hours and minutes, and should be entered
    in the hh:mm format.  TDFs for the Americas will be negative
    (-3:00, -4:00, etc.); TDFs for Europe, Africa, Asia and Australia
    will be positive (1:00, 2:00, etc.).

This time zone supports daylight saving time.
Is this time zone currently on daylight saving time? (Yes/No): no

Enter the Time Differential Factor [1:00]: 1:00

    NEW SYSTEM TIME DIFFERENTIAL FACTOR = 1:00

Is this correct? [Y]: y


    If you have Product Authorization Keys (PAKs) to register,
    you can register them now.

Do you want to register any Product Authorization Keys? (Yes/No) [Yes] no


    The following products are part of the OpenVMS installation;
    they will be installed along with the OpenVMS operating system:

        o Availability Manager (base) for OpenVMS Alpha
        o CDSA for OpenVMS Alpha
        o KERBEROS for OpenVMS Alpha
        o SSL for OpenVMS Alpha
        o Performance Data Collector (base) for OpenVMS Alpha
        o HP Binary Checker for OpenVMS Alpha

    You can also install the following optional products along with the
    OpenVMS operating system:

        o DECwindows Motif for OpenVMS Alpha
        o DECnet-Plus for OpenVMS Alpha
        o DECnet Phase IV for OpenVMS Alpha
        o HP TCP/IP Services for OpenVMS

    If you want to change your selections, you can do so later in the
    installation by answering "NO" to the following question:

        "Do you want the defaults for all options?"



    Do you want to install DECwindows Motif for OpenVMS Alpha V1.7?
(Yes/No) [Yes] yes




    Beginning with OpenVMS V7.1, the DECnet-Plus kit is provided with
    the OpenVMS operating system kit.  HP strongly recommends that
    DECnet users install DECnet-Plus.  DECnet Phase IV applications are
    supported by DECnet-Plus.

    DECnet Phase IV is also provided as an option.

    If you install DECnet-Plus and TCP/IP you can run DECnet
    applications over a TCP/IP network.  Please see the OpenVMS
    Management Guide for information on running DECnet over TCP/IP.

    Do you want to install DECnet-Plus for OpenVMS Alpha V8.4?
(Yes/No) [Yes] no



    Do you want to install DECnet Phase IV for OpenVMS Alpha V8.4?
(Yes/No) [Yes] no



    Do you want to install HP TCP/IP Services for OpenVMS V5.7-13?
(Yes/No) [Yes] yes





    The installation operation can provide brief or detailed descriptions.
    In either case, you can request the detailed descriptions by typing ?.

Do you always want detailed descriptions? (Yes/No) [No] yes

The system was booted from a device containing the OpenVMS Alpha distribution.
Validation of signed kits is not supported in this restricted environment.

The following product has been selected:
    DEC AXPVMS OPENVMS V8.4                Platform (product suite)

Configuration phase starting ...

You will be asked to choose options, if any, for each selected product and for
any products that may be installed to satisfy software dependency requirements.

Configuring DEC AXPVMS OPENVMS V8.4: OPENVMS and related products Platform

          This  is  a  PLATFORM  kit  which  installs  OpenVMS  Alpha,  and,
          optionally the following related products:

              DECwindows Motif for OpenVMS Alpha
              DECnet-Plus for OpenVMS Alpha
              HP TCP/IP Services for OpenVMS Alpha

    COPYRIGHT 1976, 21-APR-2010

          HP Registered in U.S. Patent and Trademark Office.
          in the United States and/or other countries.

          Confidential computer software. Valid license from HP required for
          possession, use or copying. Consistent with FAR 12.211 and 12.212,
          Commercial Computer Software, Computer Software Documentation, and
          Technical Data for Commercial  Items  are  licensed  to  the  U.S.
          Government under vendor's standard commercial license.

          HP  shall  not  be  liable  for  technical  or editorial errors or
          omissions contained herein.  The information contained  herein  is
          subject to change without notice.

    Hewlett-Packard Development Company, L.P.

          Houston  Texas

Do you want the defaults for all options? [YES]

    Availability Manager (base) for OpenVMS Alpha

          This  part  installs  the  Data  Collector  files  needed  for the
          Availability Manager (formerly DECamds).

    CDSA for OpenVMS Alpha

          This part installs CDSA for OpenVMS Alpha, which is the
          Common Data Security Architecture.

    KERBEROS for OpenVMS Alpha

          This  part  installs  KERBEROS  for  OpenVMS  Alpha,  which  is  a
          network authentication protocol that provides  authentication  for
          applications using secret-key cryptography.

    SSL for OpenVMS Alpha

          SSL  (Secure  Socket Layer) is a protocol that provides encryption
          and authentication of TCP/IP data communications between a  client
          and a server.

    Performance Data Collector (base) for OpenVMS Alpha

          This  part  installs  the run time portion of the Performance Data
          Collector for OpenVMS Alpha.

    HP Binary Checker for OpenVMS Alpha

          This part  installs  the run time portion of the HP Binary Checker.
          Alpha

Do you want to review the options? [NO] yes

DEC AXPVMS OPENVMS V8.4: OPENVMS and related products Platform
    DEC AXPVMS VMS V8.4: OpenVMS Operating System
      DECdtm Distributed Transaction Manager: YES
      Support for DECnet-Plus or DECnet (Phase IV) for OpenVMS: YES
      Programming Support: YES
        Debugger Utility: YES
        Image Dump Utility: YES
        Macro libraries: YES
        Macro-32 Migration Compiler: YES
        TLB intermediary form of STARLET: YES
        C Object Libraries: YES
        C Header Files: YES
        VMS text libraries of Ada declarations: YES
      RMS Journaling Recovery Utility: YES
      System Programming Support: YES
        Delta Debugger: YES
        System Dump Analyzer Utility: YES
        Miscellaneous Symbol Table Files: YES
      OpenVMS Management Station Software -- PC files: YES
      Utilities: YES
        Phone Utility: YES
        Error Log Generator Utility: YES
        XPG4 Internationalization Utilities: YES
        World Wide PostScript Printing Subsystem: YES
      Bliss Require Files: YES
      Example Files: YES
      Message Facility Files (HELP/MESSAGE): YES
      Translated Image Support: YES
      UETP Files: YES
      DECwindows Server Support: YES
        DEC AXPVMS DWMOTIF_SUPPORT V8.4: DECwindows Server Support
          DECwindows workstation files: YES
          video fonts: YES
            100 dots-per-inch video fonts: YES
          Euro base support: YES
            Euro 100 dots-per-inch video fonts: YES
      Delete any obsolete OpenVMS files: YES
      Delete files archived by OpenVMS remedial kits: YES
    Availability Manager (base) for OpenVMS Alpha
      HP AXPVMS AVAIL_MAN_BASE V8.4: hp Availability Manager Base OS Drivers
    CDSA for OpenVMS Alpha
      CPQ AXPVMS CDSA V2.4-320
    KERBEROS for OpenVMS Alpha
      HP AXPVMS KERBEROS V3.1-152
    SSL for OpenVMS Alpha
      HP AXPVMS SSL V1.4-331: SSL for OpenVMS Alpha V1.4 (Based on OpenSSL 0.9.8h)
        Run the installation verification procedure (IVP)?: YES
    Performance Data Collector (base) for OpenVMS Alpha
      HP AXPVMS TDC_RT V2.3-20: The Performance Data Collector (base) for OpenVMS
    HP Binary Checker for OpenVMS Alpha
      HP AXPVMS HPBINARYCHECKER V1.1: HP Binary Checker
    DECwindows Motif for OpenVMS Alpha: YES
      DEC AXPVMS DWMOTIF V1.7: DECwindows Motif
        Install Low Bandwidth X (LBX) Support: YES
        Install the DECwindows Motif Version 1.7 client software: YES
          Install New Desktop: YES
            Install Manual (reference) pages for the New Desktop: YES
            Make the New Desktop the default desktop: YES
          Install traditional DECwindows Desktop: YES
          Programming Support for the C Language: YES
          Programming Support for the Pascal Language: YES
          Programming Support for the FORTRAN Language: YES
          Programming Support for the New Desktop: YES
          Programming examples: YES
            Sound example files: YES
            Programming examples for DECwindows: YES
            Programming examples for the New Desktop: YES
          Translated Image Support: YES
    DECnet-Plus for OpenVMS Alpha: NO
    DECnet Phase IV for OpenVMS Alpha: NO
    HP TCP/IP Services for OpenVMS: YES
      DEC AXPVMS TCPIP V5.7-13: HP TCP/IP Services for OpenVMS.
        Applications: YES

Are you satisfied with these options? [YES] yes

Execution phase starting ...

The following products will be installed to destinations:
    CPQ AXPVMS CDSA V2.4-320               DISK$ALPHASYS:[VMS$COMMON.]
    DEC AXPVMS DWMOTIF V1.7                DISK$ALPHASYS:[VMS$COMMON.]
    DEC AXPVMS DWMOTIF_SUPPORT V8.4        DISK$ALPHASYS:[VMS$COMMON.]
    DEC AXPVMS OPENVMS V8.4                DISK$ALPHASYS:[VMS$COMMON.]
    DEC AXPVMS TCPIP V5.7-13               DISK$ALPHASYS:[VMS$COMMON.]
    DEC AXPVMS VMS V8.4                    DISK$ALPHASYS:[VMS$COMMON.]
    HP AXPVMS AVAIL_MAN_BASE V8.4          DISK$ALPHASYS:[VMS$COMMON.]
    HP AXPVMS HPBINARYCHECKER V1.1         DISK$ALPHASYS:[VMS$COMMON.]
    HP AXPVMS KERBEROS V3.1-152            DISK$ALPHASYS:[VMS$COMMON.]
    HP AXPVMS SSL V1.4-331                 DISK$ALPHASYS:[VMS$COMMON.]
    HP AXPVMS TDC_RT V2.3-20               DISK$ALPHASYS:[VMS$COMMON.]

Portion done: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%
%PCSI-I-PRCOUTPUT, output from subprocess follows ...
% - Execute SYS$MANAGER:TCPIP$CONFIG.COM to proceed with configuration of
%   HP TCP/IP Services for OpenVMS.
%
Portion done: 100%

The following products have been installed:
    CPQ AXPVMS CDSA V2.4-320               Layered Product
    DEC AXPVMS DWMOTIF V1.7                Layered Product
    DEC AXPVMS DWMOTIF_SUPPORT V8.4        Layered Product
    DEC AXPVMS OPENVMS V8.4                Platform (product suite)
    DEC AXPVMS TCPIP V5.7-13               Layered Product
    DEC AXPVMS VMS V8.4                    Operating System
    HP AXPVMS AVAIL_MAN_BASE V8.4          Layered Product
    HP AXPVMS HPBINARYCHECKER V1.1         Layered Product
    HP AXPVMS KERBEROS V3.1-152            Layered Product
    HP AXPVMS SSL V1.4-331                 Layered Product
    HP AXPVMS TDC_RT V2.3-20               Layered Product

DEC AXPVMS OPENVMS V8.4: OPENVMS and related products Platform

    HP AXPVMS KERBEROS V3.1-152

      Configure and set up Kerberos

      If Kerberos will be run on this system, but has not been
      used previously, you need to perform the following steps.

       o Run the Kerberos configuration procedure:

          @SYS$STARTUP:KRB$CONFIGURE.COM

       o Add the following line to SYS$MANAGER:SYSTARTUP_VMS.COM:

          $ @SYS$STARTUP:KRB$STARTUP

       o Add the following line to SYS$MANAGER:SYLOGIN.COM:

          $ @SYS$MANAGER:KRB$SYMBOLS


      Press RETURN to continue:

    HP AXPVMS SSL V1.4-331: SSL for OpenVMS Alpha V1.4 (Based on OpenSSL 0.9.8h)

      There are post installation tasks that you must complete

      including the following items that are described in detail:

          - ensuring SSL startup and logical names creation files
            are executed

          - updating or copying the necessary startup, shutdown and
            configuration files from the installed template files

          - running the Installation Verification Program (IVP)

      Refer to the SSL release notes and the OpenVMS SSL documentation for
      more information about activities that should be performed once the
      installation has finished.

      SSL has created the following directory structure and files in
      PCSI$DESTINATION (which defaults to SYS$SYSDEVICE:[VMS$COMMON]):

          [SSL]                 Top-level SSL directory
          [SSL.ALPHA_EXE]       Contains the images for the Alpha platform
          [SSL.COM]             Directory to hold the various command procedures
          [SSL.DEMOCA]          Directory structure to demo SSL's CA features
          [SSL.DEMOCA.CERTS]    Directory to hold the certificates and keys
          [SSL.DEMOCA.CONF]     Contains the configuration files
          [SSL.DEMOCA.CRL]      Contains revoked certificates and CRLs
          [SSL.DEMOCA.PRIVATE]  Directory for private keys and random data
          [SSL.DOC]             OpenSSL.org provided documentation & information
          [SSL.INCLUDE]         Contains the C Header (.H) files
          [SSL.TEST]            Contains the files used during the IVP

          [SYS$STARTUP]         Startup and shutdown templates and files
          [SYSHLP]              Release notes
          [SYSHLP.EXAMPLES.SSL] SSL crypto and secure session examples
          [SYSLIB]              SSL shareable image files
          [SYSTEST]             SSL$IVP.COM test files


      after upgrading from previous SSL versions

      The SSL release notes provide information to verify the SSL startup,
      shutdown, and configuration template files.  Template files provide the
      user with new features or changes, but do not overwrite existing command
      procedures and configuration files.  A product upgrade or re-installation
      will not overwrite or create a new file version if the file has been modified.
      It will only create the template files. It is suggested that you review
      these files for any changes.

      For more information, refer to the SSL Release Notes and other SSL
      files using the system logical name definitions, or the subdirectory of
      the PCSI destination device and directory.


      including verifying startup command procedures and logical names.

      Once the installation is complete, verify that SSL$STARTUP.COM is
      located in SYS$MANAGER:SYSTARTUP_VMS.COM file. This will define the
      SSL$ executive mode logical names in the SYSTEM logical name table,
      and install the SSL shareable images in memory that reside in the
      [SYSLIB] directory.

      Also, add SSL$SHUTDOWN.COM to the SYS$MANAGER:SYSHUTDWN.COM file to remove
      the installed images and deassign the SSL$ logical name definitions.

      If you have customized the SSL command files for the site, it is
      suggested that you compare the SSL provided template files with your
      existing command procedures and take the appropriate action to update
      your files. A product upgrade or re-installation will not overwrite
      these files.

      By default SYS$STARTUP: logical can be used to locate the SSL provided
      startup files.

      System managers should modify site-specific requirements in SSL files:

         SSL$COM:SSL$SYSTARTUP.COM
         SSL$COM:SSL$SYSHUTDOWN.COM

      HP recommends that these site-specific SSL command procedures are utilized
      to tailor the SSL installation specific to the reqirements of the system
      or site. These files are located in the SSL$COM: directory.


      Refer to SYS$HELP:SSL014.RELEASE_NOTES for more information.

      The SSL product release notes contain up to date information regarding
      bug fixes, known problems, and general installation information.


    HP AXPVMS TDC_RT V2.3-20: The Performance Data Collector (base) for OpenVMS

      Users of this product require the following privileges:
          (CMKRNL,LOG_IO,WORLD,PHY_IO,SYSPRV,SYSLCK)

      Users of this product require the following process resource limits:
          WSQUO minimum 6000

      A read-me file is available in SYS$COMMON:[TDC]TDC_README.TXT

      Release notes are available in SYS$COMMON:[TDC]TDC_RELEASE_NOTES.TXT

      or use PRODUCT EXTRACT RELEASE_NOTES
      -------------------------------------------------------------------------------


    HP AXPVMS HPBINARYCHECKER V1.1: HP Binary Checker

      Release notes for HP Binary Checker available

      The release notes for the OpenVMS HP Binary Checker are available in
      the file SYS$HELP:HPBINARYCHECKER.RELEASE_NOTES.

    DEC AXPVMS TCPIP V5.7-13: HP TCP/IP Services for OpenVMS.

      Check the release notes for current status of the product.

      The release notes for TCPIP Services for OpenVMS are available in the file

      SYS$HELP:TCPIP*.RELEASE_NOTES.



    The installation is now complete.

    When the newly installed system is first booted, a special
    startup procedure will be run.  This procedure will:

        o  Configure the system for standalone or OpenVMS Cluster operation.
        o  Run AUTOGEN to set system parameters.
        o  Reboot the system with the newly set parameters.


    You may shut down now or continue with other operations.


  Process AXPVMS_INSTALL logged out at 23-DEC-2013 14:31:30.23

Press Return to continue...

    ****************************************************************

    You can install or upgrade the OpenVMS ALPHA operating system
    or you can install or upgrade layered products that are included
    on the OpenVMS ALPHA distribution media (CD/DVD).

    You can also execute DCL commands and procedures to perform
    "standalone" tasks, such as backing up the system disk.

    Please choose one of the following:

        1)  Upgrade, install or reconfigure OpenVMS ALPHA Version V8.4
        2)  Display layered products that this procedure can install
        3)  Install or upgrade layered products
        4)  Show installed products
        5)  Reconfigure installed products
        6)  Remove installed products
        7)  Find, Install or Undo patches; Show or Delete Recovery Data
        8)  Execute DCL commands and procedures
        9)  Shut down this system

Enter CHOICE or ? for help: (1/2/3/4/5/6/7/8/9/?) 8



    WARNING --

    The normal OpenVMS startup procedure has not executed.
    Some commands and utilities will not work as documented.
    HP does not support PRODUCT INSTALL and other
    PRODUCT operations in this environment.


    Enter DCL commands -- Enter "LOGOUT" when done.
    When you enter "LOGOUT" a message will be displayed saying
    "Process SA_STARTUP_DCL  logged out at <date> <time>",
    and you will be returned to the menu.

$$$ show device d

Device                  Device           Error    Volume         Free  Trans Mnt
 Name                   Status           Count     Label        Blocks Count Cnt
DKA0:                   Mounted alloc        0  ALPHASYS      16143120     1   1
DKA100:                 Mounted wrtlck       2  ALPHA084        137373    83   1
DVA0:                   Offline              0
DAD0:                   Online               0
$$$ show device dka0/full

Disk DKA0:, device type DEC RZ1DF-CB, is online, allocated, deallocate on
    dismount, mounted, file-oriented device, shareable, available to cluster,
    error logging is enabled.

    Error count                    0    Operations completed             113331
    Owner process       "SA_STARTUP"    Owner UIC                         [1,4]
    Owner process ID        00000024    Dev Prot            S:RWPL,O:RWPL,G:R,W
    Reference count                2    Default buffer size                 512
    Total blocks            17713920    Sectors per track                   128
    Total cylinders              659    Tracks per cylinder                 210
    Logical Volume Size     17713920    Expansion Size Limit         4261348350

    Volume label          "ALPHASYS"    Relative volume number                0
    Cluster size                  16    Transaction count                     1
    Free blocks             16143120    Maximum files allowed          16711679
    Extend quantity                5    Mount count                           1
    Mount status             Process    Cache name           "_DKA100:XQPCACHE"
    Extent cache size             64    Max blocks in extent cache      1614312
    File ID cache size            64    Blocks in extent cache           403152
    Quota cache size               0    Maximum buffers in FCP cache       2935
    Volume owner UIC           [1,1]    Vol Prot    S:RWCD,O:RWCD,G:RWCD,W:RWCD

  Volume Status:  ODS-5, subject to mount verification, file high-water marking,
      write-through XFC caching enabled, write-back XQP caching enabled, hard
      links enabled, special files enabled.

$$$ set volume/nohigh dka0
$$$ show device dka0/full

Disk DKA0:, device type DEC RZ1DF-CB, is online, allocated, deallocate on
    dismount, mounted, file-oriented device, shareable, available to cluster,
    error logging is enabled.

    Error count                    0    Operations completed             113430
    Owner process       "SA_STARTUP"    Owner UIC                         [1,4]
    Owner process ID        00000024    Dev Prot            S:RWPL,O:RWPL,G:R,W
    Reference count                2    Default buffer size                 512
    Total blocks            17713920    Sectors per track                   128
    Total cylinders              659    Tracks per cylinder                 210
    Logical Volume Size     17713920    Expansion Size Limit         4261348350

    Volume label          "ALPHASYS"    Relative volume number                0
    Cluster size                  16    Transaction count                     1
    Free blocks             16143120    Maximum files allowed          16711679
    Extend quantity                5    Mount count                           1
    Mount status             Process    Cache name           "_DKA100:XQPCACHE"
    Extent cache size             64    Max blocks in extent cache      1614312
    File ID cache size            64    Blocks in extent cache           403152
    Quota cache size               0    Maximum buffers in FCP cache       2935
    Volume owner UIC           [1,1]    Vol Prot    S:RWCD,O:RWCD,G:RWCD,W:RWCD

  Volume Status:  ODS-5, subject to mount verification, write-through XFC
      caching enabled, write-back XQP caching enabled, hard links enabled,
      special files enabled.

$$$ logout
  Process SA_STARTUP_DCL logged out at 23-DEC-2013 14:41:28.17

    ****************************************************************

    You can install or upgrade the OpenVMS ALPHA operating system
    or you can install or upgrade layered products that are included
    on the OpenVMS ALPHA distribution media (CD/DVD).

    You can also execute DCL commands and procedures to perform
    "standalone" tasks, such as backing up the system disk.

    Please choose one of the following:

        1)  Upgrade, install or reconfigure OpenVMS ALPHA Version V8.4
        2)  Display layered products that this procedure can install
        3)  Install or upgrade layered products
        4)  Show installed products
        5)  Reconfigure installed products
        6)  Remove installed products
        7)  Find, Install or Undo patches; Show or Delete Recovery Data
        8)  Execute DCL commands and procedures
        9)  Shut down this system

Enter CHOICE or ? for help: (1/2/3/4/5/6/7/8/9/?) 9

    Shutting down the system

        SYSTEM SHUTDOWN COMPLETE


halted CPU 0

halt code = 5
HALT instruction executed
PC = ffffffff80089a84
>>>

為了建立一個最佳環境,我們需要關注系統引數、一些系統檔案大小以及程序配額和設定。讓我們從系統引數開始。

系統引數

[編輯 | 編輯原始碼]

OpenVMS 系統引數非常類似於 UNIX 核心引數。系統引數在系統啟動時生效,儘管有一些系統引數可以在執行系統中更改並立即生效。因此,除非你想要經常重啟,否則你應該花些時間將系統引數設定為適合你的系統的正確值。系統引數的新值應該在 sys$system:modparams.dat 中進行編輯。此檔案是節點特定的,應包含你希望在下一次系統啟動時生效的所有更改。此檔案由 autogen 過程讀取。我們建議你對該檔案中的所有更改進行註釋。CHANNELCNT 應該設定為不小於 UAF FILLM 值的值。一個好的做法是將該值設定為以下值中的最大值:當前值、最大的 UAF FILLM 值以及 4096。請注意,SDK 程序將具有 UAF 配額 FILLM 或 SYSGEN 引數 CHANNELCNT 的較低值。

modparams.dat 的一部分

 .
 .
 ! Created during installation of OpenVMS AXP V7.3-1 26-JAN-2003 16:05:09.28
 MIN_GBLSECTIONS=1000
 !
 ALLOCLASS=1
 SHADOWING=2
 SHADOW_SYS_DISK=1
 SHADOW_SYS_UNIT=0
 SHADOW_MAX_COPY=4
 !
 CHANNELCNT=8192
 !
 MAXPROCESSCNT=128
 !
 MIN_CTLPAGES=1536
 !
 SWAPFILE=0
 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 .
 .

在對 sys$system:modparams.dat 進行必要的更改後,呼叫 autogen 過程

 $ @sys$update:autogen savparams setparams feedback

你可以按如下方式檢查該過程的結果

 $ set terminal/width=132
 $ differences/parallel sys$system:setparams.dat
 ----------------------------------------------------------------------------------------
 File SYS$SYSROOT:[SYSEXE]SETPARAMS.DAT;7   | File SYS$SYSROOT:[SYSEXE]SETPARAMS.DAT;6
 -------------------- 11 ----------------------------------------- 11 -------------------
 set SYSMWCNT 2102
 set WSMAX 262144
 set NPAGEDYN 4349952
 set NPAGEVIR 19169280
 set PAGEDYN 1794048
 -------------------- 58 ----------------------------------------- 58 -------------------
 set GBLPAGES 1118016                       | set GBLPAGES 1105978
 ----------------------------------------------------------------------------------------
 Number of difference sections found: 2 Number of difference records found: 6
 DIFFERENCES /IGNORE=()/PARALLEL
     SYS$SYSROOT:[SYSEXE]SETPARAMS.DAT;7
     SYS$SYSROOT:[SYSEXE]SETPARAMS.DAT;6

如果你對生成的或更改後的系統引數滿意,請在方便時重啟系統

 $ @sys$update:autogen reboot

其他設定

[編輯 | 編輯原始碼]

PAGEFILESIZE 當你增加 PGFLQUO UAF 引數時,你也應該根據需要增加系統的頁面檔案大小,以適應新的 PGFLQUO 引數。Autogen(參見系統引數部分)也會計算交換檔案、頁面檔案和系統轉儲檔案的新的值,除非在 sys$system:modparams.dat 中指定指令不這樣做,或者不指定 genfiles 階段。你也可以使用 sys$update:swapfiles.com 過程手動設定頁面檔案大小

 $ @sys$update:swapfiles
 To leave a file size at its current value type a carriage return in response to its size prompt.
 Current file sizes are:

 Directory SYS$SPECIFIC:[SYSEXE]
 PAGEFILE.SYS;2          1056800
 SYSDUMP.DMP;4            208583
 SWAPFILE.SYS;3            16400

 Total of 4 files, 1682393 blocks.
 There are 10110396 available blocks on SYS$SYSDEVICE.
 Enter new size for paging file: Enter new size for system dump file: Enter new size for swapping file:
 $

安裝 GNV

[編輯 | 編輯原始碼]

GNV 代表 GNU is not VMS。它是一組移植到 OpenVMS 的開源命令和實用程式。GNV 工具包包含 bash shell 的移植版、gnu diff 實用程式、gnu 檔案實用程式、gnu find 實用程式、gawk、grep、gzip、less、gnu make、man、sed、gnu shell 實用程式、gnu 文字實用程式、(un)zip、tpu 的 vi 包裝器、vms(un)tar 以及 ar、cc、gcc 和 cpp 的包裝器。此列表並不完整,隨著 GNV 工具包的每個新版本,更多 UNIX 實用程式將變得可用。GNV 是一個開源專案,有一個網頁 http://gnv.sourceforge.net 和幾個郵件列表。如果你打算將工具新增到 GNV,請加入 gnv 開發者列表。

首先,從 OpenVMS 開源頁面 http://www.openvms.compaq.com/opensource 或 GNV 專案頁面 http://gnv.sourceforge.net 下載最新的工具包。列印安裝說明,並使用它們來安裝工具包。請仔細閱讀,因為它包含一些重要資訊。安裝和使用 GNV 的要求是

  • 必須安裝在 ODS-5 磁碟上
  • 必須使用 ODS-5 磁碟

要檢查安裝磁碟,請使用以下命令

 $ SHOW DEVICE DSA0: /FULL

 Disk DSA0:, device type COMPAQ BB00911CA0, is online, mounted, file-oriented
     device, shareable, available to cluster, error logging is enabled, device
     supports bitmaps (no bitmaps active).

     Error count                    0    Operations completed           11118695
     Owner process                 ""    Owner UIC                      [SYSTEM]
     Owner process ID        00000000    Dev Prot            S:RWPL,O:RWPL,G:R,W
     Reference count             1204    Default buffer size                 512
     Total blocks            17773524    Sectors per track                   168
     Total cylinders             5290    Tracks per cylinder                  20
     Logical Volume Size     17773524    Expansion Size Limit           17793024

     Volume label          "ALPHASYS"    Relative volume number                0
     Cluster size                   3    Transaction count                  1249
     Free blocks             10110408    Maximum files allowed           2221690
     Extend quantity                5    Mount count                           1
     Mount status              System    Cache name             "_DSA0:XQPCACHE"
     Extent cache size             64    Maximum blocks in extent cache  1011040
     File ID cache size            64    Blocks in extent cache           237132
     Quota cache size               0    Maximum buffers in FCP cache        630
     Volume owner UIC           [1,1]    Vol Prot    S:RWCD,O:RWCD,G:RWCD,W:RWCD

 Volume Status: ODS-5, subject to mount verification, protected subsystems
     enabled, write-through caching enabled, access dates enabled, hard links
     enabled.

 Disk $1$DKA600:, device type COMPAQ BB00911CA0, is online, member of shadow set
     DSA0:, error logging is enabled.

     Error count                    0    Shadow member operation count  10118018
     Allocation class               1

這並非所有資訊,但最重要的部分在示例文字的底部。在“卷狀態:”標題之後,它顯示為 ODS-5。因此,此磁碟應該可以使用。還要注意,硬連結已啟用。為了 UNIX 的可移植性,通常建議啟用它。啟用捲上的訪問日期也是一個好主意,因為這是 POSIX 要求。我們還建議使用多成員影子集。首先,影子集更安全,也就是說,當磁碟出現故障時,您不會丟失所有資料,而且因為影子集名稱中沒有“$”符號。“$”符號在 UNIX shell 指令碼中具有特殊含義。要在名稱中使用“$”符號,您需要使用“\”符號對“$”符號進行轉義。順便說一句,您至少可以使用單成員影子集來防止這種情況。要使磁碟與 ODS-5 相容,請使用以下命令

 $ SET VOLUME <device>: /STRUCTURE=5

要啟用硬連結和訪問日期,請使用以下命令

 $ SET VOLUME <device>: /VOLUME_CHARACTERISTICS=(HARDLINKS, ACCESS_DATES)

請注意,啟用硬連結可能需要相當長的時間!您想了解有關影子和如何將磁碟裝載為影子集的所有資訊,請參閱 OpenVMS 文件:HP OpenVMS 卷影子。 “help” 命令也可以幫助您。

我要在這裡注意的另一件事是高水位標記。這是另一個典型的 OpenVMS 安全功能,預設情況下處於啟用狀態。高水位標記保證使用者無法讀取使用者未寫入的資料,方法是在 EOF 標記之後銷燬磁碟塊中的所有資料。這樣做會帶來很小的效能損失。雖然這種損失現在只是微不足道的,但很多人會建議您將其關閉。您可以透過以下命令來實現

 $ SET VOLUME <device>: /NOHIGHWATER_MARKING

停用高水位標記對於安裝 GNV 或 UNIX 可移植性不是必需的。

要進行當前 GNV 軟體的預設安裝,請按照文件中描述的步驟進行

  • 登入到 SYSTEM 帳戶(在登入提示符下,輸入使用者名稱 SYSTEM 和相應的密碼),或具有等效許可權的帳戶。
  • 在 DCL 提示符 ($) 下,轉到您將從 Internet 下載的可執行檔案儲存的目錄,並透過執行可執行檔案來提取 PCSI 套件
 $ RUN DEC-AXPVMS-GNV-V0106-002-1.PCSI_SFX_AXPEXE
  • 輸入以下命令,如所示
 $ PRODUCT INSTALL GNV
  • 當您輸入 PRODUCT INSTALL 命令時,系統將響應類似於以下內容的顯示:
 The following product has been selected:DEC AXPVMS GNV V1.6 Layered Product
 Do you want to continue? [YES]

繼續該過程,按 ENTER 鍵以使用預設答案(YES)。該過程可能需要幾分鐘,並且螢幕上可能會顯示許多訊息。對於系統顯示的每個提示,請透過按 ENTER 鍵選擇預設答案。

  • 要使用 GNV,我們需要進行一些系統範圍的設定。為此,我們啟動以下 DCL 命令過程
 $ @SYS$STARTUP:GNV$STARTUP.COM

要每次啟動系統時都進行此設定,我們需要將上述命令新增到系統啟動過程 SYS$MANAGER:SYSTARTUP_VMS.COM 中。因此,啟動編輯器

 $ EDIT SYS$MANAGER:SYSTARTUP_VMS.COM

轉到檔案末尾(DO bottom),並在 $ EXIT 之前輸入以下行

$!
$! GNV
$!
$ file := SYS$STARTUP:GNV$STARTUP.COM
$ IF F$SEARCH(file) .NES. "" THEN @'file' 
$!

然後使用 <Crtl>Z 退出編輯器。注意:GNV$STARTUP.COM 過程使用 sys$common:[sys$startup]gnv_destination.com 過程來定義安裝 GNV 的位置。如果您手動將 GNV 移動到其他位置,則需要修改此過程。

  • 我們還需要進行一些使用者設定。對於我們當前的登入會話,請執行以下操作
$ IF F$TRNLNM(“GNU”,"LNM$SYSTEM_TABLE") .NES. “” THEN @GNU:[LIB]GNV_SETUP.COM

如果我們希望此使用者設定在您登入時發生,我們必須將上述行新增到我們的 SYS$LOGIN:LOGIN.COM 中。這適用於系統上想要使用 GNV 工具的每個使用者。如果我們希望這適用於系統上的每個使用者,我們可以將該行新增到系統範圍的登入過程 SYS$MANAGER:SYLOGIN.COM ($ EDIT 'F$TRNLNM(“SYS$SYLOGIN”)'.COM) 中。只需記住在 EXIT 語句之前新增該行(登入指令碼通常根據當前模式登入 (F$MODE) 來執行操作,請注意,如果您計劃在命令列上使用 gnv 設定過程,則必須使其在互動模式下工作)。當然,不需要重新啟動。

程序配額

[edit | edit source]

管理程序配額是另一個 OpenVMS 優勢。它允許系統管理系統資源併為系統上的所有程序維持可接受的效能。以下建議來自 2003 年 7 月出版的“最佳化 HP OpenVMS 上 Java 技術軟體效能”一文。您可以在 HP OpenVMS 電子商務技術頁面 http://www.openvms.compaq.com/ebusiness/technology.html. 上找到此文件。請注意,建議的配額是 UNIX 相容性的最低要求。這些配額是為執行 JAVA 應用程式的使用者帳戶指定的,但通常建議為移植人員和執行移植的開源軟體的使用者提供相同的配額。OpenVMS 上的外觀和感覺(效能)將更接近其他平臺上的外觀和感覺。

帳戶配額

[edit | edit source]

以使用者 SYSTEM 的身份登入並轉到 SYS$SYSTEM 目錄

 $ SET DEFAULT SYS$SYSTEM:

啟動帳戶管理程式

 $ MCR AUTHORIZE

顯示您的帳戶設定(在下面的示例中,顯示了 DEFAULT 帳戶,這是一個用於帳戶建立的特殊帳戶)

 UAF> sho default

 Username: DEFAULT                          Owner:  
 Account:                                   UIC:    [200,200] ([DEFAULT])
 CLI:      DCL                              Tables: DCLTABLES
 Default:  [USER]
 LGICMD:   
 Flags:  DisUser
 Primary days:   Mon Tue Wed Thu Fri        
 Secondary days:                     Sat Sun
 No access restrictions
 Expiration:            (none)    Pwdminimum:  6   Login Fails:     0
 Pwdlifetime:         90 00:00    Pwdchange:      (pre-expired) 
 Last Login:            (none) (interactive),            (none) (non-interactive)
 Maxjobs:         0  Fillm:       100  Bytlm:        64000
 Maxacctjobs:     0  Shrfillm:      0  Pbytlm:           0
 Maxdetach:       0  BIOlm:       150  JTquota:       4096
 Prclm:           8  DIOlm:       150  WSdef:         2000
 Prio:            4  ASTlm:       250  WSquo:         4000
 Queprio:         4  TQElm:        10  WSextent:     16384
 CPU:        (none)  Enqlm:      2000  Pgflquo:      50000
 Authorized Privileges: 
   NETMBX       TMPMBX
 Default Privileges: 
   NETMBX       TMPMBX
 UAF>

我們將更改以下最小帳戶配額

名稱
Fillm 4096
Wsdef 2048
Wsquo 4096
Wsextent 16384
Wsmax 16384
Pgflquo 2097152*
bytlm 400000
biolm 150
diolm 150
tqelm 100
* Indicates the appropriate number for Pgflquo (2 x heap-size).
 For example, 128 MB (2*128*1024*1024)/512 = 524288.
 When you increase the Pgflquo parameter, you should always increase the
 system's page file size to accommodate the new Pgflquo parameter, if required.

要更改引數的值,請執行以下操作

 UAF> MODIFY <account> /<parameter>=<value>

您可以在同一個命令中更改多個引數,只需為每個需要更改的值新增另一個 /= 即可。要更改 DEFAULT 帳戶的 WSDEF、WSQUO 和 WSEXTENT,您將輸入以下命令

 
 UAF> MODIFY DEFAULT /WSDEF=2048 /WSQUO=4096 /WSEXTENT=16384

您可以透過鍵入 EXIT 或

<Ctrl>Z

(您使用的終端模擬器可能將 EXIT 函式正確對映到 F10 功能鍵)退出 AUTHORIZE 實用程式。如前所述,DEFAULT 帳戶用作建立新帳戶的模板。如果您想提高系統上建立的所有新帳戶的預設配額,修改 DEFAULT 帳戶可能是個好主意。更改預設帳戶不會更改現有帳戶的任何設定。根據需要檢查和修改現有帳戶。

設定移植帳戶

[edit | edit source]

到目前為止,我們已經為移植嘗試設定了正確的環境。讓我們總結一下涉及的步驟。要建立移植帳戶,必須遵循以下幾個步驟

  • 使用正確的系統引數設定 OpenVMS 移植系統
  • 安裝並啟動 GNV、編譯器和其他移植工具
  • 設定預設 UAF 帳戶
  • 建立其他移植帳戶和/或修改現有帳戶。
  • 為移植人員建立和修改主目錄。

之後,要使用更改後的帳戶設定,您必須登出並重新登入。

建立其他帳戶

[edit | edit source]

要建立其他移植帳戶,您可以使用以下命令

 $ mcr authorize
 UAF> add 'user' /uic=['group','member'] /device='userdevice': /directory=['user'] /passw='secret'/flag=nodisuser/nopwdexp
 UAF> exit
 $ create/dir 'userdevice':['user'] /owner='user'
 $ create/dir 'userdevice':['user'.temp]/owner='user'
 $
 $ create 'userdevice':['user']login.com
 $! login.com for OpenOffice portingroup member
 $
 $ set term/dev=vt300
 $ set term/line/insert
 $! start gnv
 $ @GNU:[lib]GNV_SETUP.COM
 $!
 $! setup tools
 $ set proc/parse_style=extended
 $ set process /case_lookup=(blind)
 $ define/job decc$pipe_buffer_size 65000
 $
 $
 $ scratch = f$trnlnm("sys$login") - "]" + ".temp]"
 $ define/job sys$scratch 'scratch' $!
 $ exit
 <Ctrl>Z
 $ create 'userdevice':['user'].bashrc
 # .bashrc
 #
 PATH=$PATH:/usr/bin:/usr/local/bin
 export PATH
 export GNV_DISABLE_DCL_FALLBACK=1
 <Ctrl>Z
 $

可以在附錄 3 中找到建立多個移植使用者(包括示例執行)的過程

第三部分:使用移植環境和 GNV 工具的提示和技巧

[edit | edit source]

使用 GNV

[edit | edit source]

如果正確安裝了 GNV,您應該能夠直接從 DCL 中使用 UNIX 命令(如 ls)。但是,如果您安裝了 LSE,ls 命令將啟動 LSE 編輯器。當您在 DCL 提示符下鍵入 bash 時,bash shell 將啟動,從那時起,一切都會像您使用 UNIX 機器一樣工作。但是,有一些細微但重要的區別。您可能知道 UNIX 系統使用層次檔案系統,而 OpenVMS 沒有。但是,OpenVMS 下會模擬一些重要的層次結構。預設情況下,/ 目錄指向 OpenVMSGNU:[000000]目錄。/bin 目錄指向 OpenVMSGNU:[bin]目錄。等等。簡而言之,/ 目錄不是磁碟的根目錄!您可以透過鍵入 /裝置名稱或隱藏的裝置邏輯/目錄來訪問其他位置。例如DSA50:[kits.gnu]變為/dsa50/kits/gnu. 在 bash 中,您可以輸入大多數 DCL 命令,除非存在名稱衝突,例如 ls - LSE 問題。在這種情況下,您可以輸入 bash dcl 命令並在其後面輸入 DCL 命令。例如,DCL LS Readme 命令在 bash 中變為 dcl “ls Readme”,並在 LSE 中開啟 Readme 檔案。如果您不希望 bash “回退”到 DCL 以執行命令,請在 BASH 中執行以下操作

bash$ export GNV_DISABLE_DCL_FALLBACK=1

我們建議將此命令放在登入目錄中的 .bashrc 過程中。請參閱“建立其他帳戶”部分中的示例過程。順便說一句,您始終可以使用 BASH dcl 命令來執行任何 DCL 命令!

提示

[edit | edit source]
  • 始終在 ODS-5 磁碟上工作
$ SET VOLUME <device>: /STRUCTURE=5
  • 始終啟用 ODS-5 擴充套件檔名解析
$ SET PROCESS /PARSE_STYLE=EXTENDED

(您可以將此行放在您的 LOGIN.COM 中)

  • 由於 bash 當前處理管道的 方式,我們需要執行以下操作
$ DEFINE/JOB DECC$PIPE_BUFFER_SIZE=65000

(您可以將此行放在您的 LOGIN.COM 中)

  • 處理 UNIX 符號連結的最佳方法是在您正在使用的磁碟上使用硬連結
$ SET VOLUME <device>: /VOLUME_CHARACTERISTICS=(HARDLINKS)

請注意,這可能需要相當長的時間。

  • 可能需要支援 POSIX 樣式的訪問日期
$ SET VOLUME <device>: /VOLUME_CHARACTERISTICS=(ACCESS_DATES)
  • 執行 configure 指令碼時,最好停用 DCL 回退
bash$ export GNV_DISABLE_DCL_FALLBACK=1

(您可以將其放在您的 .bashrc 中)

如果您想了解更多關於使用 UNIX 或 bash 的知識,Internet 上有很多資訊。如果您更喜歡書籍,請檢視 O'Reilly 的作品 http://www.oreilly.com/。我建議您花一些時間學習 UNIX 環境,然後再繼續。

第四部分:構建開源軟體

[編輯 | 編輯原始碼]

大多數人可能知道開源意味著軟體通常以原始碼形式分發。要在您的系統上使用該軟體,您需要自己構建它。為了使構建更加容易,GNU 社群開發了 GNU 構建工具。這些工具不僅使您的生活更輕鬆,而且還使開源開發人員的生活更輕鬆。現在讓我們看一下如何在 UNIX 或 Linux 機器上構建一些開源軟體。

  • 從網際網路下載原始碼發行版。大多數情況下,這將是一個 .tar.gz 檔案,但您也會發現 .tgz、.tar.Z .tar.bzip2 或 .zip 檔案。
  • 建立一個目錄
 % mkdir <name>
  • 轉到您剛剛建立的目錄
 % cd <name>
  • 解壓縮檔案(某些選項可能尚未在 OpenVMS 上執行)
    • .tar.gz
      •  % zcat <filename> | tar xvf
        
      •  % tar xvzf <filename>
        
      •  % gunzip <filename>
        
        以及
         % tar xvf <filename - .gz>
        
    • .tgz檢視.tar.gz
    • .tar.Z檢視.tar.gz
      •  % uncompress <filename>
        
        以及
      •  % tar xvf <filename - .Z>
        
    • .tar.bz2
      •  % bz2cat <filename> | tar xvf -
        
      •  % bunzip2 <filename>
        
        以及
      •  % tar xvf <filename - .bz2>
        
    • .zip
      •  % unzip <filename>
        
  • 查詢 configure 指令碼。該指令碼可能位於您所在的目錄中,但也可能位於解壓縮發行版檔案建立的目錄中。例如,如果您從網際網路下載的檔名為tar-1.2.4.tar.gz您可能現在擁有一個名為tar-1.2.4的目錄,位於您的當前目錄中。進入該目錄以查詢 configure 檔案。如果找不到,請查詢具有大寫名稱的檔案,例如 README 或 INSTALL。
  • 找到 configure 指令碼後,執行它
% ./configure
  • 如果一切順利,您可以構建可執行檔案
 % make
  • 並安裝包(通常您必須先成為 root 使用者才能安裝任何東西)
 % make install

就是這樣。

好吧,如果一切按預期工作,那就這樣。即使在 UNIX 機器上,事情也可能出錯。要分析問題所在,請執行以下操作

  • 閱讀具有大寫名稱的檔案,瞭解您是否滿足先決條件,瞭解您是否需要為您的 UNIX(OpenVMS)版本執行一些特殊操作(畢竟 UNIX(OpenVMS)≠ UNIX)
  • 嘗試
     ./configure --help
    
    這可能會讓您瞭解您可能需要使用./configure命令指定的額外引數。
  • 檢查由 configure 指令碼生成的檔案config.cache、config.log、config.status、config.h 和 Makefile

如果這沒有幫助,您可能需要親自動手。

GNU 構建系統

[編輯 | 編輯原始碼]

我之前不是說過 GNU 構建系統會讓您的生活更輕鬆嗎?確實是這樣的。但我先解釋一下在最後一個示例中可能出現的問題。configure 指令碼和 Makefile.in 檔案可能是在您的 UNIX(OpenVMS!)系統或系統版本存在之前建立的,因此它不知道您的系統特定情況。考慮一下 OpenVMS,可能那裡沒有一個 configure 指令碼和 make 檔案瞭解我們 OpenVMS 上的 GNV 環境。但讓我們回到眼前的問題。為了讓 configure 指令碼和 Makefile.in 檔案瞭解我們系統的特定情況,我們需要在構建示例中新增一些步驟。以下步驟位於步驟 5 和 6 之間

a.

% aclocal

b.

% autoconf

c.

% automake -a

為了使此操作正常工作,您的系統應該具有這些軟體包以及GNU make、m4、texinfo以及GNU tar已安裝。對於大多數開源 UNIX 克隆(如 Linux、FreeBSD、NetBSD 和 MacOS X)來說,這是真的。但對於許多商業 UNIX 系統來說,情況並非如此。至於 OpenVMS,只有GNU make目前可用。對於大多數商業 UNIX 系統來說,最好的辦法是檢查您的 UNIX 系統製造商是否釋出了缺少的工具供下載。如果沒有,請從 GNU 網站檢視最新版本的缺少的工具。如果什麼都沒用,您將與我們一樣,面臨我們 OpenVMS 上的 GNV 環境問題。此時我認為我們應該清楚地認識到,我們儘快需要所有這些工具。如果您想詳細瞭解 gnu 構建系統,請檢視以下網站GNU Autoconf、Automake以及Libtool: http://sources.redhat.com/autobook/

OpenVMS 推薦

[編輯 | 編輯原始碼]

由於 GNV 不斷更新,我們建議您從 CVS 儲存庫獲取最新的 GNV 原始碼,並自行構建 GNV 工具包。請參閱 http://www.4ovms.dyndns.org 上的構建說明。不要忘記提高管道緩衝區大小。

 bash$ dcl “define/job DECC\$PIPE_BUFFER_SIZE 65000”

另外,不要忘記停用 DCL 回退。

 bash$ export GNV_DISABLE_DCL_FALLBACK=1

始終檢查 configure 指令碼中的 conftest.dir。將此檔名更改為類似 conftest.ddd 的名稱

 bash$ mv configure configure.org
 bash$ sed 's/conftest\.dir/conftest\.ddd/g' configure.org > configure

使用 configure 選項--build=. 對於 OpenVMS Alpha,configure 選項為--build=alpha-hp-vms. 由於 GNV bash 版本有些過時,因此某些 shell 指令碼無法正常工作。其中一個指令碼稱為 depcomp。該指令碼用於在編譯期間確定依賴關係。要消除此依賴關係檢查,您可以新增--disable-dependency-tracking選項到 configure 命令。

OpenVMS C 執行時庫

[編輯 | 編輯原始碼]

C 執行時庫或 CRTL 是 OpenVMS 共享庫,其中包含大多數“標準”C 函式。我加引號是因為 a) 標準有很多,我沒有說哪一個。b) 每個標準都是不斷變化的。自 DII COE 計劃以來,HP 旨在使 CRTL 符合最新的 X-Open 標準。由於 OpenVMS 和 UNIX 之間的架構差異,這是一項艱鉅的任務,特別是如果您還想維護向後相容性。OpenVMS CRTL 開發人員決定隨著每個新的 OpenVMS 和 CRTL 版本逐步新增這些新功能。HP 還決定這些新功能將在 Alpha 和新的 Itanium 架構上提供。某些功能也可能在 VAX 上提供,但由於 VAX 上沒有 ODS-5 擴充套件檔名支援,因此對開源移植至關重要的功能可能永遠不會在 VAX 上提供。新的 CRTL 功能可以分為兩組

  1. 具有新的和更標準功能的現有函式
  2. 完全新的函式,使 CRTL 更符合標準(X-Open v.6)。

對於第一組中的函式,經典行為是標準的,要使用新功能,您需要設定功能開關(稍後將詳細介紹)。第二組中的函式可以進一步細分為兩組

  1. 在經典 OpenVMS 環境和新的類 UNIX 環境中應該具有相同功能的函式
  2. 在兩種環境中功能不應相同的函式

對於最後一組,請考慮使用或返回路徑的函式。對於這組函式,這些函式的行為由前面提到的功能開關決定。

那麼這些功能開關是什麼,我該如何設定它們呢?

[編輯 | 編輯原始碼]

我不會解釋有哪些功能開關以及它們的功能,因為您可以在 CRTL 幫助、CRTL 發行說明和 CRTL 參考手冊中找到所有相關資訊。但我將向您展示 OpenVMS 8.4 中一些有趣的新功能開關。我還將向您展示如何更改它們的值。因此,讓我們先看看最有趣的新功能開關,特別是當您剛開始移植時。它是 DECC$UNIX_LEVEL。以下文字摘自 CRTL 參考手冊(CRTL 1-36)

使用 DECC$UNIX_LEVEL 邏輯名,您可以一次管理多個 C RTL 功能邏輯名。透過為 DECC$UNIX_LEVEL 設定從 1 到 100 的值,您可以確定一組功能邏輯名的預設值。您設定的值具有累加效果:值越高,受影響的組越多。例如,設定值為 20 將啟用與 DECC$UNIX_LEVEL 為 20、10 和 1 關聯的所有功能邏輯。

影響類 UNIX 行為的主要邏輯名按以下方式分組

      1 General corrections 
     10 Enhancements 
     20 UNIX style filenames 
     30 UNIX style file attributes 
     90 Full UNIX behavior - No concessions to OpenVMS

級別 30 適用於類 UNIX 程式,例如 BASH 和 GNV。

DECC$UNIX_LEVEL 值和受影響的功能邏輯名組如下

 General Corrections          (DECC$UNIX_LEVEL 1)

    DECC$FIXED_LENGTH_SEEK_TO_EOF   1 
    DECC$POSIX_SEEK_STREAM_FILE     1 
    DECC$SELECT_IGNORES_INVALID_FD  1 
    DECC$STRTOL_ERANGE              1 
    DECC$VALIDATE_SIGNAL_IN_KILL    1

 General Enhancements        (DECC$UNIX_LEVEL 10)

    DECC$ARGV_PARSE_STYLE           1 
    DECC$EFS_CASE_PRESERVE          1 
    DECC$STDIO_CTX_EOL              1 
    DECC$PIPE_BUFFER_SIZE           4096 
    DECC$USE_RAB64                  1

 UNIX style filenames       (DECC$UNIX_LEVEL 20)

    DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION 1 
    DECC$EFS_CHARSET                1 
    DECC$FILENAME_UNIX_NO_VERSION   1 
    DECC$FILENAME_UNIX_REPORT       1 
    DECC$READDIR_DROPDOTNOTYPE      1 
    DECC$RENAME_NO_INHERIT          1 
    DECC$GLOB_UNIX_STYLE

 UNIX like file attributes     (DECC$UNIX_LEVEL 30)

    DECC$EFS_FILE_TIMESTAMPS        1 
    DECC$EXEC_FILEATTR_INHERITANCE  1 
    DECC$FILE_OWNER_UNIX            1 
    DECC$FILE_PERMISSION_UNIX       1 
    DECC$FILE_SHARING               1

 UNIX compliant behavior       (DECC$UNIX_LEVEL 90)

    DECC$FILENAME_UNIX_ONLY         1 
    DECC$POSIX_STYLE_UID            1 
    DECC$USE_JPI$_CREATOR           1 
    DECC$DETACHED_CHILD_PROCESS     1

注意

  • 為單個功能邏輯定義邏輯名將取代 DECC$UNIX_LEVEL 為該功能建立的預設值。
  • 將來修訂的 C RTL 可能會在給定的 DECC$UNIX_LEVEL 中新增新的功能邏輯。對於指定該 UNIX 級別值的應用程式,效果是預設啟用這些功能。

請注意,引文中沒有列出所有可用的功能開關。未列出的開關不屬於任何 UNIX 級別!請閱讀 CRTL 幫助、發行說明和文件,以瞭解支援的功能開關的完整列表及其預期用途。您可能已經注意到設定這些功能開關的一種方法。您可以使用相同名稱和適當值定義邏輯名。由於功能開關在執行時更改行為,因此您不必在使用開關時重新編譯。但當您完成確定開關的適當值後,您可能希望從程式內部設定它們的值。當然,您可以透過從程式內部設定邏輯名來實現這一點,但還有更好的方法。CRTL 函式decc$feature_get_index、decc$feature_get_name、decc$feature_get_value、以及decc$feature_set_value專門為執行此任務而設計。

下面是一個小型示例程式

 static int set_feature_default(char *name, int value)
 {
      int index = decc$feature_get_index(name);
       if (index == -1 || decc$feature_set_value(index, 0, value) == -1)
       {
            perror(name);
            return -1;
       }
       return 0;
 }

 static void my_init( void)
 {
       set_feature_default("DECC$POSIX_SEEK_STREAM_FILE" , TRUE);
       set_feature_default("DECC$ARGV_CASE_PARSE_STYLE" , TRUE);
       set_feature_default("DECC$EFS_CASE_PRESERVE" , TRUE);
       set_feature_default("DECC$FILE_SHARING" , TRUE);
 }

將這樣的程式碼新增到程式中並不困難,但有一個問題。像DECC$ARGV_PARSE_STYLE這樣的功能開關需要在解析引數之前設定,這發生在影像啟用和呼叫程式主函式之間的某個地方。程式啟動前發生的事情的流程在《OpenVMS 程式設計概念手冊》中有所說明。在第 18 章中,您將找到一個完整的流程,說明發生了什麼以及何時發生(見下圖)。

'插入圖片'

這裡需要注意的是LIB$INITIALIZE函式。我們要做的是建立一個原始檔,該檔案定義一個LIB$INITIALIZE指向將功能開關設定為其適當值的函式的函式。現在讓我們回到上面我使用的示例。下面給出了該示例的增強版本。

 #pragma extern_model save
 #pragma extern_model strict_refdef "LIB$INITIALIZE" nowrt, long
 #if __INITIAL_POINTER_SIZE
 #    pragma __pointer_size __save
 #    pragma __pointer_size 32
 #else
 #    pragma __required_pointer_size __save
 #    pragma __required_pointer_size 32
 #endif
      /* Set our contribution to the LIB$INITIALIZE array */
 void (* const iniarray[])() = {my_init, } ;
 #if __INITIAL_POINTER_SIZE
 #    pragma __pointer_size __restore
 #else
 #    pragma __required_pointer_size __restore
 #endif
 #pragma extern_model restore

 /*
 ** Force a reference to LIB$INITIALIZE to ensure it
 ** exists in the image.
 */
 int LIB$INITIALIZE();
 globaldef int (*lib_init_ref)() = LIB$INITIALIZE;

將示例的兩部分放在一個原始檔中。與您的程式一起編譯和連結以使其工作。它的優點是您不必更改要移植的程式來設定功能開關!如果你想看更完整的例子,請檢視GNU:[src.GNV.CRTLSUP.SRC]]VMS_CRTL_INIT.C檔案。此檔案由一些 GNV 工具使用。

一個好的起點是 UNIX 級別 30,但不要使用 DECC$UNIX_LEVEL 功能開關。設定構成 UNIX 級別 30 的各個功能開關,並將 DECC$PIPE_BUFFER_SIZE 增加到至少 8192。不使用 DECC$UNIX_LEVEL 功能開關的原因是與 OpenVMS 7.3-1 相容,以及一個簡單的事實,即您可能不需要組成級別 30 的所有功能開關,或者您想使用不同的值(請參見 DECC$PIPE_BUFFER_SIZE 的建議)。

預定義宏

[編輯 | 編輯原始碼]

以下列表是使用標準 DECC C 編譯器版本 6.5 在 OpenVMS 7.3-2 Alpha 上的預定義宏列表。

 These macros are in effect at the start of the compilation.
 ----- ------ --- -- ------ -- --- ----- -- --- ------------

  __G_FLOAT=1  __DECC=1  vms=1  VMS=1  __32BITS=1  __PRAGMA_ENVIRONMENT=1 
  __CRTL_VER=70320000  __vms_version="V7.3-2  "  CC$gfloat=1  __X_FLOAT=1 
  vms_version="V7.3-2  "  __DATE__="Feb  7 2004"  __STDC_VERSION__=199901L 
  __DECC_MODE_RELAXED=1  __DECC_VER=60590001  __VMS=1  __ALPHA=1 
  VMS_VERSION="V7.3-2  "  __IEEE_FLOAT=0  __VMS_VERSION="V7.3-2  " 
  __STDC_HOSTED__=1  __TIME__="13:54:21"  __Alpha_AXP=1  __VMS_VER=70320022 
  __BIASED_FLT_ROUNDS=2  __INITIAL_POINTER_SIZE=0  __STDC__=1 
  __LANGUAGE_C__=1  __vms=1  __alpha=1  __D_FLOAT=0

以下宏對於移植很重要

備註
VMS, vms 是我們可用於一般 OpenVMS 特定內容的宏
ALPHA, Alpha_AXP, __alpha 可用於 Alpha 特定內容
VAXC, VAX11C, vaxc, vax11c 可用於 VAX 特定內容
IA64, ia64 可用於 Itanium (ia64) 特定內容
__VMS_VER 可用於 OpenVMS 版本特定內容(請使用 __CRTL_VER 代替
__DECC_VER 可用於編譯器版本特定內容
__CRTL_VER 可用於 CRTL 版本特定內容

請注意,我只包含宏的首選格式,大多數宏也存在沒有前面兩個破折號的情況。

其他宏

[編輯 | 編輯原始碼]

還有許多其他宏可以更改一個或多個 CRTL 函式的行為。

備註
_XOPEN_SOURCE_EXTENDED 使 XPG4 擴充套件功能可見,包括以前未被 X/Open 採用的傳統基於 UNIX 的介面。選定標準:XPG4 V2。其他隱含標準:XPG4、ISO POSIX-2、ISO POSIX-1、ANSI C
_XOPEN_SOURCE 使 XPG4 標準符號可見,並在未定義 _POSIX_C_SOURCE 或其值大於 2 的情況下將其設定為 2。選定標準:XPG4。其他隱含標準:XPG4、ISO POSIX-2、ISO POSIX-1、ANSI C
_POSIX_C_SOURCE==199506 由 ANSI C 定義的標頭檔案使 IEEE 1003.1c-1995 要求的那些符號可見。選定標準:IEEE 1003.1c-1995。其他隱含標準:ISO POSIX-2、ISO POSIX-1、ANSI C
_POSIX_C_SOURCE==2 由 ANSI C 定義的標頭檔案使 ISO POSIX-2 要求的那些符號可見,以及 ISO POSIX-1 要求的那些符號可見。選定標準:ISO POSIX-2。其他隱含標準:ISO POSIX-1、ANSI C
_POSIX_C_SOURCE==1 由 ANSI C 定義的標頭檔案使 ISO POSIX-1 要求的那些符號可見。選定標準:ISO POSIX-1。其他隱含標準:ANSI C
STDC_VERSION__==199409 使 ISO C Amendment 1 符號可見。選定標準:ISO C Amendment 1。其他隱含標準:ANSI C
_ANSI_C_SOURCE 使 ANSI C 標準符號可見。選定標準:ANSI C。其他隱含標準:無。
_POSIX_EXIT 啟用與 ISO POSIX-1 相容的退出函式。
_BSD44_CURSES 此宏從 4.4BSD Berkeley 軟體發行版中選擇 Curses 包。
_VMS_CURSES 此宏選擇基於 VAX C 編譯器的 Curses 包。這是預設的 Curses 包。
_SOCKADDR_LEN 此宏用於選擇與 4.4BSD 相容和與 XPG4 V2 相容的套接字介面。這些介面需要底層 TCP/IP 軟體中的支援。請聯絡您的 TCP/IP 供應商以詢問您執行的 TCP/IP 軟體版本是否支援 4.4BSD 套接字。(據我所知,HP TCP/IP 支援此功能,Prosess Softwares Multinet 和 TCPware 不支援)
_LARGEFILE C RTL 提供了編譯應用程式以使用 2 GB(千兆位元組)或更大的檔案大小和偏移量。這是透過允許 64 位整數的檔案偏移量來實現的。
__USE_LONG_GID_T 編譯應用程式以支援 32 位 UID/GID。
_DECC_SHORT_GID_T 編譯應用程式以支援 16 位 UID/GID

有關更多資訊,請閱讀 CRTL 幫助和/或 CRTL 參考手冊。

請不要使用 VMS、vms 或 __vms 這樣的通用宏。請改用 CRTL_VER。C 執行時庫在每個新版本的 CRTL 中都變得更加“標準”。在 CRTL 的新版本中,修復可能不再是必需的。在某些情況下,程式功能已被#ifndef VMS以不再必要的方式削弱。使用 CRTL_VER 將使我們能夠更精確地控制需要為 CRTL 的許多不同版本進行哪些更改。當宏 CRTL_VER 不存在時,請使用 __VMS_VER 的值來定義它。

 #  if defined(__VMS_VER) && !defined(__CRTL_VER)
 #    define __CRTL_VER __VMS_VER
 #  endif

在 DCL 中編譯開源程式時,請將/DEFINE=_POSIX_EXIT新增到您的 CC 命令中!這是在 bash 下編譯時的預設值。

GCC 包裝器

[編輯 | 編輯原始碼]

GNV 套件不附帶 gcc,而是附帶了一個包裝器,該包裝器使用 HP C 和 C++ 編譯器來完成其編譯工作,並使用標準 OpenVMS 連結器來代替 ld。順便說一下,還有一個 ar 包裝器使用標準 OpenVMS 庫管理員。GCC 包裝器做得相當好,但它並不完美。還要注意 HP 編譯器非常嚴格。我的意思是,當某些東西可能不完全正確時,它們會立即發出抱怨。因此,在編譯開源軟體時,我們會看到很多警告。您可以使用 -h 或 -help 選項檢視 gcc 包裝器支援的所有選項。我想注意一下 GCC 包裝器行為的以下幾點,包裝器預設將 /DEFINE=_POSIX_EXIT 新增到編譯語句中。如果您想在 gcc 命令列中新增一個 HP CC、CPP 或 LINK 選項,而該選項似乎沒有實現,則 -Wc 和 -Wl gcc 選項可能很有用。您有時需要的一個 gcc 選項是 -names_as_is_short。這將使編譯器區分大小寫,並允許函式名包含超過 32 個字元。您可能會在配置指令碼中使用 gcc -g 選項遇到麻煩。許多配置指令碼預設使用此選項。此選項用於編譯和/或連結包含在程式中的除錯資訊。問題是,在 UNIX 系統上,使用除錯資訊編譯和連結的程式在執行時不會啟動偵錯程式。這與我們 OpenVMS 人員習慣使用的完全不同。如果您在執行配置指令碼時看到偵錯程式提示彈出,請從配置指令碼中刪除 -g 選項,或使用 CFLAGS=”” 啟動配置。

fork 問題在問題列表中排名很高,因為它在開源程式中非常常見,而我們在 OpenVMS 上沒有此函式。我們在 OpenVMS 上確實有 vfork(),但 OpenVMS 上的 vfork() 的實現也不符合標準。但是,我們可以使用它來解決開源軟體中的大多數 fork() 呼叫。在我們深入研究解決方法之前,讓我們首先確定 fork() 應該做什麼。fork() 函式是 UNIX 標準的建立新程序的方式。新(子)程序是呼叫(父)程序的精確副本,除了

  • 子程序具有唯一的程序 ID
  • 子程序 ID 與任何活動程序組 ID 不匹配
  • 子程序具有不同的父程序 ID
  • 子程序擁有其父程序開啟的檔案描述符的副本
  • 子程序擁有其父程序開啟的目錄流的副本
  • 子程序可能擁有父程序訊息目錄描述符的副本。
  • 子程序的 tms_utime、tms_stime、tms_cutime 和 tms_cstime 值被設定為 0。
  • 到鬧鐘訊號的時間被重置為 0。
  • 所有 semadj 值都被清除。
  • 父程序設定的檔案鎖不會被子程序繼承。
  • 子程序的待處理訊號集被初始化為空集。
  • 子程序中的間隔計時器被重置。

在 fork() 之後,父程序和子程序都可以在任何一個終止之前獨立執行。fork() 函式向子程序返回 0,向父程序返回子程序的程序 ID。否則,父程序將返回 -1,不會建立子程序,並且 errno 被設定為指示錯誤。在大多數系統上,vfork() 函式與 fork() 函式相同。在某些系統上,使用 vfork() 建立的子程序可以與父程序共享資料或程式碼段。在 OpenVMS 上,vfork() 函式只提供後續呼叫 exec 函式所需的設定。vfork 呼叫不會建立子程序!當呼叫 vfork 時

  • 它將返回地址(vfork 呼叫的地址)儲存起來,以便稍後用作對 exec 函式呼叫的返回地址。
  • 它儲存當前上下文。
  • 它在第一次被呼叫時(在呼叫 exec 函式之前)返回整數 0。在執行 exec 呼叫後,exec 函式將控制權返回給父程序,在 vfork() 呼叫點,並將子程序的程序 ID 作為返回值返回。

你們中的一些人可能已經看到了 fork() 和 OpenVMS vfork() 之間的一些相似之處。如果 fork() 緊隨其後的是一個 exec 呼叫,我們可以使用 OpenVMS vfork() 並進行一些操作。如果 fork() 單獨存在,我們仍然無法解決。

示例 1(來自 GNU tar 1.15.1 lib/rmdir.c)

 #ifndef __VMS
     cpid = fork ();
 #else /* VMS */
     cpid = vfork ();
 #endif /* VMS */
     switch (cpid)
       {
       case -1:               /* cannot fork */
          return -1;          /* errno already set */

       case 0:                /* child process */
          execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
          _exit (1);

       default:               /* parent process */
 .
 .
 .
          return 0;
       }

示例 2(來自 GNU tar 1.15.1 lib/rtapelib.c)

 #ifndef __VMS
     status = fork ();
 #else /* VMS */
     status = vfork ();
 #endif /* VMS */
     if (status == -1)
     {
         int e = errno;
         free (file_name_copy);
         errno = e;
         return -1;
     }

     if (status == 0)
     {
     /* Child. */
 #ifdef __VMS
         save_stdin = dup (STDIN_FILENO);
         save_stdout = dup (STDOUT_FILENO);
 #endif /* VMS */
         close (STDIN_FILENO);
         dup (to_remote[remote_pipe_number][PREAD]);
         close (to_remote[remote_pipe_number][PREAD]);
 #ifndef __VMS
         close (to_remote[remote_pipe_number][PWRITE]);
 #endif /* VMS */
         close (STDOUT_FILENO);
         dup (from_remote[remote_pipe_number][PWRITE]);
 #ifndef __VMS
         close (from_remote[remote_pipe_number][PREAD]);
 #endif /* VMS */
         close (from_remote[remote_pipe_number][PWRITE]);

         sys_reset_uid_gid ();

         if (remote_user)
             execl (remote_shell, remote_shell_basename, remote_host,
                    "-l", remote_user, rmt_command, (char *) 0);
         else
             execl (remote_shell, remote_shell_basename, remote_host,
             rmt_command, (char *) 0);

         /* Bad problems if we get here. */

         /* In a previous version, _exit was used here instead of exit. */
         error (EXIT_ON_EXEC_ERROR, errno, _("Cannot execute remote shell"));
     }

     /* Parent. */
 #ifdef __VMS
     {
         int status;
         status = dup2 (save_stdin, STDIN_FILENO);
         if (status < 0)
         {
             error (EXIT_ON_EXEC_ERROR, errno, _("Error restoring stdin"));
         }
         status = dup2 (save_stdout, STDOUT_FILENO);
         if (status < 0)
         {
             error (EXIT_ON_EXEC_ERROR, errno, _("Error restoring stdout"));
         }
     }
 #endif /* VMS */
     close (from_remote[remote_pipe_number][PWRITE]);
     close (to_remote[remote_pipe_number][PREAD]);

第二個示例可能看起來有點嚇人,但請記住,在 OpenVMS 上,“子程序”程式碼實際上是由父程序執行的。 “子程序”是由execl()函式呼叫建立,而不是由vfork()函式呼叫建立。

注意 1:預設情況下,OpenVMS exec 呼叫使用LIB$SPAWN建立子程序。在大多數情況下,這是你想要的,但是,在某些情況下,你可能希望子程序成為一個分離的程序。要實現這一點,你可以啟用DECC$DETACHED_CHILD_PROCESS功能開關。這有一些影響。請參見 CRTL 參考指南第 5 章。

注意 2:在 OpenVMS 上,execlp()以及execvp()函式搜尋VAXC$PATH而不是PATH環境變數來獲取要執行的檔案的位置。這可能很麻煩。

RMS 代表記錄管理系統。OpenVMS 檔案系統構建在 RMS 之上,OpenVMS 系統上的所有檔案都是 RMS 檔案。RMS 檔案是面向記錄的,可以包含用於鍵值訪問的鍵(RMS 索引檔案)。RMS 中有許多不同型別的記錄和無數的記錄屬性。與大多數面向記錄的系統一樣,檔案和記錄的鎖定是需要特別注意的。UNIX 沒有這些特性,在 UNIX 系統上,兩個程式可以在檔案的相同位置開啟相同的檔案進行寫入。在 OpenVMS 上,這是不可能的,當遇到這種情況時,你需要處理這個問題。另一個問題是流-lf 檔案和可變長度記錄之間的區別。兩種檔案都包含可變長度的記錄,但從 UNIX 程式的角度來看,流-lf 檔案最類似於 UNIX 檔案。但是,很少有 OpenVMS 程式知道如何處理流-lf 檔案。OpenVMS 程式通常處理具有可變長度記錄型別的檔案。

已知移植問題

[edit | edit source]

許多 CRTL 函式仍然不能完全像其 UNIX 對應物那樣工作,並且一些函式仍然缺失。舉幾個例子:vfork 函式的行為與它的 UNIX 對應物不完全相同(請閱讀 CRTL 參考手冊中的 vfork 部分)。如果一個程式使用 vfork,它可能會在配置期間檢查 vfork 的存在,這也是配置會掛起的情況。解決掛起問題的方法很簡單。使用不同的會話登入,並查詢之前會話的子程序。殺死它,配置指令碼將繼續。雖然我們已經談論到這一點,但不幸的是,OpenVMS 還沒有 fork 函式,但是有很多已知的變通方法可用,只要我們知道在哪裡。這不是關於如何將開原始碼移植到 OpenVMS 的權威指南。事物正在迅速變化。我們應該繼續用 OpenVMS 和 GNV 套件的當前狀態更新此文件。我們在 comp.os.vms 上找到了一份已知移植問題列表,從 UNIX 移植到 OpenVMS 時會出現相容性問題。該列表是我們維護的列表的基礎。該列表可以在附錄 2 中找到:已知問題列表。

主題:開源

華夏公益教科書