Solarisのアップグレード

試してみたのはSolaris 10 U7 5/09 → Solaris 10 U8 10/09のアップグレード。

Liveupgradeを使えば、サービスを継続したままSolaris OSのアップグレードの準備をしサービス停止はOS再起動時間のみ、という謳い文句に惹かれてやってみた。
テスト環境なので、そもそもサービスはないけどね。

まず準備するもの

  • インストール済のSolaris環境。Solaris 2.6以降が対象。今回はSolaris 10 U7 (2009年05月版)。
  • アップグレード先のバージョンのSolarisのインストールパッケージ。通常はインストールメディア。今回はSolaris 10 U8 (2009年10月版)のDVDメディア。
  • (場合によって)Liveupgradeのパッケージ。通常はインストールメディアに入っている。

大まかな流れ

  1. 現在のSolaris環境にアップグレード先のバージョンのSolarisに対応したLiveupgradeをインストールする。準備したインストールメディアに入っているものを使うのがよい。
  2. Liveupgradeのツールを使ってアップグレード用ブート環境(Boot Environment = BE)を作成。
  3. アップグレード用ブート環境をアップグレード。
  4. アップグレード用ブート環境で起動するように設定変更。
  5. 再起動。
  6. 起動したらOSのアップグレードが終わっている。

実際の作業

一連の作業をする前の環境の確認。

今回ゾーンは使っていない。ZFSもインストールした直後の状態で、特別なことはしていない。
LiveupgradeのBEは1つも存在しない。

# cat /etc/release
                        Solaris 10 5/09 s10x_u7wos_08 X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 30 March 2009
# 
# uname -a
SunOS aki 5.10 Generic_139556-08 i86pc i386 i86pc
# 
# zoneadm list
global
# zfs list
NAME                       USED  AVAIL  REFER  MOUNTPOINT
rpool                     6.01G  8.26G  35.5K  /rpool
rpool/ROOT                4.01G  8.26G    18K  legacy
rpool/ROOT/s10x_u7wos_08  4.01G  8.26G  4.01G  /
rpool/dump                1.00G  8.26G  1.00G  -
rpool/export                37K  8.26G    19K  /export
rpool/export/home           18K  8.26G    18K  /export/home
rpool/swap                   1G  9.03G   244M  -
# 
# lucurr
ERROR: No boot environments are configured on this system
ERROR: cannot determine boot environment name for mount point </>
# lustatus
ERROR: No boot environments are configured on this system
ERROR: cannot determine list of all boot environment names
# 
アップグレード先Solaris対応Liveupgradeをインストール

一応と思ってやっているけど、見た感じ何年もバージョンが変わっていないので、既に入っているSolaris付属でOK。
ZFS対応は……呼び出される側のツールで吸収?

# ls /cdrom/sol_10_1009_x86/Solaris_10/Tools/Installers/
liveupgrade20  solaris
# sh /cdrom/sol_10_1009_x86/Solaris_10/Tools/Installers/liveupgrade20

Java Accessibility Bridge for GNOME loaded.



Solaris Web Start will assist you in installing software for Live Upgrade.

   <Press ENTER to continue>
Sun Microsystems, Inc.
Binary Code License Agreement
Live Upgrade
READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED
SUPPLEMENTAL LICENSE TERMS (COLLECTIVELY "AGREEMENT")
CAREFULLY BEFORE OPENING THE SOFTWARE MEDIA PACKAGE.  BY
OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS
OF THIS AGREEMENT.  IF YOU ARE ACCESSING THE SOFTWARE
ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY
SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS
AGREEMENT.  IF YOU DO NOT AGREE TO ALL THESE TERMS,
PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE
OF PURCHASE FOR A REFUND OR, IF THE SOFTWARE IS ACCESSED
ELECTRONICALLY, SELECT THE "DECLINE" BUTTON AT THE END OF
THIS AGREEMENT.
1.  LICENSE TO USE.  Sun grants you a non-exclusive and
non-transferable license for the internal use only of the
accompanying software and documentation and any error
corrections provided by Sun (collectively "Software"), by the
number of users and the class of computer hardware for which

    <--[15%]--[ENTER To Continue]--[n To Finish]-->

the corresponding fee has been paid.
2.  RESTRICTIONS Software is confidential and copyrighted.
Title to Software and all associated intellectual property
rights is retained by Sun and/or its licensors.  Except as
specifically authorized in any Supplemental License Terms, you
may not make copies of Software, other than a single copy of
Software for archival purposes.  Unless enforcement is
prohibited by applicable law, you may not modify, decompile,
or reverse engineer Software.  Software is not designed or
licensed for use in on-line control of aircraft, air traffic,
aircraft navigation or aircraft communications; or in the
design, construction, operation or maintenance of any nuclear
facility.  You warrant that you will not use Software for these
purposes.  You may not publish or provide the results of any
benchmark or comparison tests run on Software to any third
party without the prior written consent of Sun.  No right,
title or interest in or to any trademark, service mark, logo or
trade name of Sun or its licensors is granted under this
Agreement.
3. LIMITED WARRANTY.  Sun warrants to you that for a period of

    <--[30%]--[ENTER To Continue]--[n To Finish]-->

ninety (90) days from the date of purchase, as evidenced by a
copy of the receipt, the media on which Software is furnished
(if any) will be free of defects in materials and workmanship
under  normal use.  Except for the foregoing, Software is
provided "AS IS".  Your exclusive remedy and Sun's entire
liability under this limited warranty will be at Sun's option
to replace Software media or refund the fee paid for Software.
4.  DISCLAIMER OF WARRANTY.  UNLESS SPECIFIED IN THIS
AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS,
REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE
EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.
5.  LIMITATION OF LIABILITY.  TO THE EXTENT NOT PROHIBITED BY
LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY
LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT,
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF
OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF
SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  In no

    <--[45%]--[ENTER To Continue]--[n To Finish]-->

event will Sun's liability to you, whether in contract, tort
(including negligence), or otherwise, exceed the amount paid by
you for Software under this Agreement.  The foregoing
limitations will apply even if the above stated warranty fails
of its essential purpose.
6.  Termination.  This Agreement is effective until terminated.
You may terminate this Agreement at any time by destroying all
copies of Software.  This Agreement will terminate immediately
without notice from Sun if you fail to comply with any
provision of this Agreement.  Upon Termination, you must
destroy all copies of Software.
7.  Export Regulations.  All Software and technical data
delivered under this Agreement are subject to US export control
laws and may be subject to export or import regulations in
other countries.  You agree to comply strictly with all such
laws and regulations and acknowledge that you have the
responsibility to obtain such licenses to export, re-export,
or import as may be required after delivery to you.
8.  U.S. Government Restricted Rights.  Use, duplication, or
disclosure by the U.S. Government is subject to restrictions

    <--[60%]--[ENTER To Continue]--[n To Finish]-->

set forth in this Agreement and as provided in
DFARS 227.7202-1 (a) and 227.7202-3(a) (1995), DFARS
252.227-7013 (c)(1)(ii)(Oct 1988), FAR 12.212 (a) (1995), FAR
52.227-19 (June 1987), or FAR 52.227-14(ALT III) (June 1987),
as applicable.
9.  Governing Law.  Any action related to this Agreement will
be governed by California law and controlling U.S. federal law.
No choice of law rules of any jurisdiction will apply.
10.  Severability. If any provision of this Agreement is held
to be unenforceable, This Agreement will remain in effect with
the provision omitted, unless omission would frustrate the
intent of the parties, in which case this Agreement will
immediately terminate.
11.  Integration.  This Agreement is the entire agreement
between you and Sun relating to its subject matter.  It
supersedes all prior or contemporaneous oral or written
communications, proposals, representations and warranties and
prevails over any conflicting or additional terms of any quote,
order, acknowledgment, or other communication between the
parties relating to its subject matter during the term of this

    <--[75%]--[ENTER To Continue]--[n To Finish]-->

Agreement.  No modification of this Agreement will be binding,
unless in writing and signed by an authorized representative
of each party.
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.
Sun Microsystems, Inc.
Supplemental Terms for
Live Upgrade
These terms and conditions for Live Upgrade supplement the
terms of the Binary Code License Agreement ("BCL").
Capitalized terms not defined herein will have the meanings
ascribed to them in the BCL.  These terms and conditions will
supersede any inconsistent or conflicting terms and conditions
in the BCL.
A.Source Code. Software may contain source code that, unless
expressly licensed for other purposes, is provided solely for
reference purposes pursuant to the terms of this Agreement.
Source code may not be redistributed unless expressly provided
for in this Agreement.
B.Third Party Code. Additional copyright notices and license

    <--[90%]--[ENTER To Continue]--[n To Finish]-->

terms applicable to portions of the Software are set forth in
the THIRDPARTYLICENSEREADME.txt file. In addition to any terms
and conditions of any third party opensource/freeware license
identified in the THIRDPARTYLICENSEREADME.txt file, the
disclaimer of warranty and limitation of liability provisions
in paragraphs 5 and 6 of the Binary Code License Agreement
shall apply to all Software in this distribution.
C.Termination for Infringement. Either party may terminate
this Agreement immediately should any Software become, or
in either party's opinion be likely to become, the subject
of a claim of infringement of any intellectual property right.
For inquiries please contact: Sun Microsystems, Inc., 4150
Network Circle, Santa Clara, California 95054, U.S.A.

   Enter 'y' to accept the license agreement. Enter 'n' to decline the license
   agreement and exit the install.y




IMPORTANT NOTICE

Patches Needed to Run Solaris Live Upgrade

Correct operation of Solaris Live Upgrade requires that a limited set of patch
revisions be installed for a given OS version.

Before installing or running Live Upgrade, you are required to install a
limited set of patch revisions. Make sure you have the most recently updated
patch list by consulting sunsolve.sun.com. Search for the info doc 72099 on the
SunSolve(tm) web site.

Live Upgrade may fail to work properly if the latest limited set of patch
revisions are not installed on this system.

   <Press ENTER to continue>

Please select the type of install to perform from the following choices:

Typical - Software will be installed with the most common
options.  Recommended for most users.

Custom - You may choose the options you want to install.
Recommended for advanced users.

1. Typical
2. Custom

   What would you like to do [1]? 

Checking disk space.


The following items will be installed:

Product: Live Upgrade
Location: /
Size: 2.23 MB
---------------------
     Live Upgrade (root)    976.23 KB
Live Upgrade (usr)    1.26 MB
Live Upgrade (config)    17.26 KB



Ready to Install

1. Install Now
2. Start Over
3. Exit Installation

   What would you like to do [1]? 

Installing Live Upgrade
|-1%--------------25%-----------------50%-----------------75%--------------100%|


Installation details:

     Product       Result     More Info
 1.  Live Upgrade  Installed  Available

 2.  Done

   Enter the number corresponding to the desired selection for more
   information, or enter 2 to continue [2]: 

#
アップグレード用BEの作成

lucreateにて作成する。それだけ。今まで1つもBEが無かったので、現在のものと、それをコピーしたものと2つ作成される。

# lucreate -c sol10u7_5_09 -n sol10u8_10_09
Checking GRUB menu...
Analyzing system configuration.
No name for current boot environment.
Current boot environment is named <sol10u7_5_09>.
Creating initial configuration for primary boot environment <sol10u7_5_09>.
The device </dev/dsk/c1t0d0s0> is not a root device for any boot environment; cannot get BE ID.
PBE configuration successful: PBE name <sol10u7_5_09> PBE Boot Device </dev/dsk/c1t0d0s0>.
Comparing source boot environment <sol10u7_5_09> file systems with the 
file system(s) you specified for the new boot environment. Determining 
which file systems should be in the new boot environment.
Updating boot environment description database on all BEs.
Updating system configuration files.
Creating configuration for boot environment <sol10u8_10_09>.
Source boot environment is <sol10u7_5_09>.
Creating boot environment <sol10u8_10_09>.
Cloning file systems from boot environment <sol10u7_5_09> to create boot environment <sol10u8_10_09>.
Creating snapshot for <rpool/ROOT/s10x_u7wos_08> on <rpool/ROOT/s10x_u7wos_08@sol10u8_10_09>.
Creating clone for <rpool/ROOT/s10x_u7wos_08@sol10u8_10_09> on <rpool/ROOT/sol10u8_10_09>.
Setting canmount=noauto for </> in zone <global> on <rpool/ROOT/sol10u8_10_09>.
Saving existing file </boot/grub/menu.lst> in top level dataset for BE <sol10u8_10_09> as <mount-point>//boot/grub/menu.lst.prev.
File </boot/grub/menu.lst> propagation successful
Copied GRUB menu from PBE to ABE
No entry for BE <sol10u8_10_09> in GRUB menu
Population of boot environment <sol10u8_10_09> successful.
Creation of boot environment <sol10u8_10_09> successful.
#
BEを作っただけの状態の確認
# lucurr
sol10u7_5_09
#
# lustatus
Boot Environment           Is       Active Active    Can    Copy      
Name                       Complete Now    On Reboot Delete Status    
-------------------------- -------- ------ --------- ------ ----------
sol10u7_5_09               yes      yes    yes       no     -         
sol10u8_10_09              yes      no     no        yes    -         
#
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                   6.01G  8.26G  35.5K  /rpool
rpool/ROOT                              4.01G  8.26G    18K  legacy
rpool/ROOT/s10x_u7wos_08                4.01G  8.26G  4.01G  /
rpool/ROOT/s10x_u7wos_08@sol10u8_10_09  63.5K      -  4.01G  -
rpool/ROOT/sol10u8_10_09                  82K  8.26G  4.01G  /
rpool/dump                              1.00G  8.26G  1.00G  -
rpool/export                              37K  8.26G    19K  /export
rpool/export/home                         18K  8.26G    18K  /export/home
rpool/swap                                 1G  9.03G   244M  -
# zoneadm list
global
# 
アップグレード用BEをアップグレード

アップグレード用に作成した方のBEを、インストールメディアを使ってアップグレード。
理由は判らないが、何度か失敗したので根気よく何度も実行(^^;

# luupgrade -u -n sol10u8_10_09 -s /cdrom/sol_10_1009_x86
System has findroot enabled GRUB
No entry for BE <sol10u8_10_09> in GRUB menu
Uncompressing miniroot
Copying failsafe kernel from media.
63093 ブロック
miniroot filesystem is <lofs>
Mounting miniroot at </cdrom/sol_10_1009_x86/Solaris_10/Tools/Boot>
Validating the contents of the media </cdrom/sol_10_1009_x86>.
The media is a standard Solaris media.
The media contains an operating system upgrade image.
The media contains <Solaris> version <10>.
Constructing upgrade profile to use.
Locating the operating system upgrade program.
Checking for existence of previously scheduled Live Upgrade requests.
Creating upgrade profile for BE <sol10u8_10_09>.
Checking for GRUB menu on ABE <sol10u8_10_09>.
Saving GRUB menu on ABE <sol10u8_10_09>.
Checking for x86 boot partition on ABE.
Determining packages to install or upgrade for BE <sol10u8_10_09>.
Performing the operating system upgrade of the BE <sol10u8_10_09>.
CAUTION: Interrupting this process may leave the boot environment unstable
or unbootable.
Upgrading Solaris: 100% completed
Installation of the packages from this media is complete.
Restoring GRUB menu on ABE <sol10u8_10_09>.
Updating package information on boot environment <sol10u8_10_09>.
Package information successfully updated on boot environment <sol10u8_10_09>.
Adding operating system patches to the BE <sol10u8_10_09>.
The operating system patch installation is complete.
ABE boot partition backing deleted.
PBE GRUB has no capability information.
PBE GRUB has no versioning information.
ABE GRUB is newer than PBE GRUB. Updating GRUB.
GRUB update was successfull.
Configuring failsafe for system.
Failsafe configuration is complete.
INFORMATION: The file </var/sadm/system/logs/upgrade_log> on boot
environment <sol10u8_10_09> contains a log of the upgrade operation.
INFORMATION: The file </var/sadm/system/data/upgrade_cleanup> on boot
environment <sol10u8_10_09> contains a log of cleanup operations required.
INFORMATION: Review the files listed above. Remember that all of the files
are located on boot environment <sol10u8_10_09>. Before you activate boot
environment <sol10u8_10_09>, determine if any additional system
maintenance is required or if additional media of the software
distribution must be installed.
The Solaris upgrade of the boot environment <sol10u8_10_09> is complete.
Installing failsafe
Failsafe install is complete.
#
アップグレード用BEで起動するように変更

luativateで切り替えるだけ。

# luactivate sol10u8_10_09
System has findroot enabled GRUB
Generating boot-sign, partition and slice information for PBE <sol10u7_5_09>
Saving existing file </etc/bootsign> in top level dataset for BE <sol10u7_5_09> as <mount-point>//etc/bootsign.prev.
A Live Upgrade Sync operation will be performed on startup of boot environment <sol10u8_10_09>.

Generating boot-sign for ABE <sol10u8_10_09>
Saving existing file </etc/bootsign> in top level dataset for BE <sol10u8_10_09> as <mount-point>//etc/bootsign.prev.
Generating partition and slice information for ABE <sol10u8_10_09>
Copied boot menu from top level dataset.
Generating multiboot menu entries for PBE.
Generating multiboot menu entries for ABE.
Disabling splashimage
Re-enabling splashimage
No more bootadm entries. Deletion of bootadm entries is complete.
GRUB menu default setting is unaffected
Done eliding bootadm entries.

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

The target boot environment has been activated. It will be used when you
reboot. NOTE: You MUST NOT USE the reboot, halt, or uadmin commands. You
MUST USE either the init or the shutdown command when you reboot. If you
do not use either init or shutdown, the system will not boot using the
target BE.

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

In case of a failure while booting to the target BE, the following process
needs to be followed to fallback to the currently working boot environment:

1. Boot from Solaris failsafe or boot in single user mode from the Solaris
Install CD or Network.

2. Mount the Parent boot environment root slice to some directory (like
/mnt). You can use the following command to mount:

     mount -Fzfs /dev/dsk/c1t0d0s0 /mnt

3. Run <luactivate> utility with out any arguments from the Parent boot
environment root slice, as shown below:

     /mnt/sbin/luactivate

4. luactivate, activates the previous working boot environment and
indicates the result.

5. Exit Single User mode and reboot the machine.

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

Modifying boot archive service
Propagating findroot GRUB for menu conversion.
File </etc/lu/installgrub.findroot> propagation successful
File </etc/lu/stage1.findroot> propagation successful
File </etc/lu/stage2.findroot> propagation successful
File </etc/lu/GRUB_capability> propagation successful
Deleting stale GRUB loader from all BEs.
File </etc/lu/installgrub.latest> deletion successful
File </etc/lu/stage1.latest> deletion successful
File </etc/lu/stage2.latest> deletion successful
Activation of boot environment <sol10u8_10_09> successful.
#
再起動前の状態を確認
# lucurr
sol10u7_5_09
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
sol10u7_5_09               yes      yes    no        no     -
sol10u8_10_09              yes      no     yes       no     -
#
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                   8.17G  6.10G    39K  /rpool
rpool/ROOT                              6.17G  6.10G    18K  legacy
rpool/ROOT/s10x_u7wos_08                6.85M  6.10G  4.02G  /
rpool/ROOT/sol10u8_10_09                6.16G  6.10G  4.10G  /
rpool/ROOT/sol10u8_10_09@sol10u8_10_09  2.06G      -  4.02G  -
rpool/dump                              1.00G  6.10G  1.00G  -
rpool/export                              37K  6.10G    19K  /export
rpool/export/home                         18K  6.10G    18K  /export/home
rpool/swap                                 1G  6.76G   349M  -
#
# zoneadm list
global
#
再起動

initが呼び出される必要があるのでinitか/sbin/shutdownで再起動。通常はshutdownで。
ここでinitを呼び出さないと切り替わらないので注意。

# shutdown -i 6 -y -g 0
再起動後に終わったことを確認

ちゃんとアップグレードされてたバージョン表記になっている。

# cat /etc/release
                       Solaris 10 10/09 s10x_u8wos_08a X86
           Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                           Assembled 16 September 2009
# uname -a
SunOS aki 5.10 Generic_141445-09 i86pc i386 i86pc
#
# zfs list
NAME                                     USED  AVAIL  REFER  MOUNTPOINT
rpool                                   8.25G  6.03G    40K  /rpool
rpool/ROOT                              6.24G  6.03G    18K  legacy
rpool/ROOT/s10x_u7wos_08                19.4M  6.03G  4.03G  /
rpool/ROOT/sol10u8_10_09                6.22G  6.03G  4.11G  /
rpool/ROOT/sol10u8_10_09@sol10u8_10_09  2.11G      -  4.02G  -
rpool/dump                              1.00G  6.03G  1.00G  -
rpool/export                              37K  6.03G    19K  /export
rpool/export/home                         18K  6.03G    18K  /export/home
rpool/swap                                 1G  6.69G   349M  -
# zoneadm list
global
#
# lucurr
sol10u8_10_09
# lustatus
Boot Environment           Is       Active Active    Can    Copy
Name                       Complete Now    On Reboot Delete Status
-------------------------- -------- ------ --------- ------ ----------
sol10u7_5_09               yes      no     no        yes    -
sol10u8_10_09              yes      yes    yes       no     -
#

後は不要になった、以前使っていたBEを削除するなりすればOK。

注意点

今回のようにディスク構成だと、lucreateで既存の環境用のBEとアップグレード用のBEが作られるが、
既存BEはそのままファイルの更新を行いアップグレード用BEには反映されない。
また逆にアップグレード用BEはアップグレードするが、当たり前のようにそれは既存BEへは反映されない。
#lucreateと同時に自動で行われるZFSスナップショット&クローンで別々にわかれるため。

そのため、既存BEでサービスを継続していて、再起動ののみのサービス停止を考えている場合は、
lucreate後のファイルの作成、削除、変更がアップグレードBEで使えないことを理解しておかないと、
再起動後のサービスの継続ができないかもしれない。

つまり、メールサーバのキューファイルを残したまま切り替えては行けないとか、そんな感じのこと。
共有ディスクなどアップグレードとは関係ないところに置いておけば、無問題。



他には、VirtualBox上でテストしていたためか、何度かOS丸ごとハングアップすることがあった。
少なくとも1回は確実にVirtualBoxのせい。そんなダイアログが出たから。
liveupgradeの処理90%超で出たりと、お涙頂戴物。
またマルチユーザモードのコンソールログインした場合は、liveupgradeコマンドがSegVで落ちた。これは何かSolarisの問題なんだろうな……

32bitホストOSでも64bitゲストOS with VirtualBox

久しぶりに触ってみると、32bitなホストOS上で64bitなゲストOSが動くようになっていた。
いや、この機能はちょっと前にも聞いた気がするが、以前はMac OS Xではダメだった。
今のVirtualBox 3.xではできるようになっているね。

ゲストOSとしてLinuxを起動したところ。

unameをしたら64bitカーネルの証である「x86_64」が見えている。

[chcoopu@bayonetta ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[chcoopu@bayonetta ~]$ cat /etc/enterprise-release 
Enterprise Linux Enterprise Linux Server release 5.4 (Carthage)
[chcoopu@bayonetta ~]$ uname -a
Linux bayonetta.bayonetta.ps3 2.6.18-164.el5 #1 SMP Thu Sep 3 04:15:13 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[chcoopu@bayonetta ~]$ 

アプリの方も64bitだね。

[chcoopu@bayonetta ~]$ file /usr/bin/ssh
/usr/bin/ssh: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, stripped
[chcoopu@bayonetta ~]$ 


ひるがえってホストOSの方はまだOS X 10.5。なので64bitカーネル自体がない。

MyMac:~ chcoopu$ file /mach_kernel
/mach_kernel: Mach-O universal binary with 2 architectures
/mach_kernel (for architecture i386):	Mach-O executable i386
/mach_kernel (for architecture ppc):	Mach-O executable ppc
MyMac:~ chcoopu$ 

(たぶん)libSystemががんばっているので、64bitアプリは扱えているんだろう。

MyMac:~ chcoopu$ ls -l /usr/lib/libSystem.dylib 
lrwxr-xr-x  1 root  wheel  17  8 31  2008 /usr/lib/libSystem.dylib@ -> libSystem.B.dylib
MyMac:~ chcoopu$ 
MyMac:~ chcoopu$ file /usr/lib/libSystem.B.dylib 
/usr/lib/libSystem.B.dylib: Mach-O universal binary with 4 architectures
/usr/lib/libSystem.B.dylib (for architecture ppc7400):	Mach-O dynamically linked shared library ppc
/usr/lib/libSystem.B.dylib (for architecture ppc64):	Mach-O 64-bit dynamically linked shared library ppc64
/usr/lib/libSystem.B.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
/usr/lib/libSystem.B.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
MyMac:~ chcoopu$ 

これでまた楽しい遊び方が増えたよ。
実際には、ハイパーバイザでもない環境で64bit使っても、メモリが多く使える以外にはテスト環境としての使い道しかないから、使わないだろうけど。

それよりも、VirtualBox 2.xの頃はちゃんと使えていたMacBook内蔵のAirMac(無線LAN)でのブリッジが使えないのが微妙につらい。設定はできるが、通信がダメ。
設定間違っているかな?
ブリッジ接続ではなく、NAT接続にすれば、ゲストOSとインターネットの接続はオK。

OS Xの man 1 dtrace 日本語訳

Mac OS Xに付属のDTraceのコマンドdtrace(1)のマニュアルの日本語訳
去年の年末くらいには書き上がってたんけど、上げていなかった。今ざっくり検索しても日本語訳は出てこなかったので上げておこう。8割くらいがSunのSolaris用の日本語訳から。だからライセンスはCDDL?

DTRACE(1)                                                                                          DTRACE(1)



NAME
       dtrace - generic front-end to the DTrace facility
       dtrace - DTrace 機能への汎用フロントエンド

SYNOPSIS
       dtrace [-aACeFhHlqSvVwZ] [-arch arch_name]
              [-b bufsz] [-c fullPathToCommand] [-D name[=def]]
              [-I path] [-L path] [-o output] [-p pid]
              [-s script] [-U name] [-x arg[=val]]
              [-P provider [[predicate] action]]
              [-m [provider:] module [[predicate] action]]
              [-f [[provider:] module:] function [[predicate] action]]
              [-n [[[provider:] module:] function:] name [[predicate] action]]
              [-i probe-id [[predicate] action]]

OVERVIEW
       The  dtrace  command  is a generic front-end to the DTrace facility.  The command implements a simple
       interface to invoke the D language compiler, the ability to retrieve buffered  trace  data  from  the
       DTrace kernel facility, and a set of basic routines to format and print traced data.
	   dtrace コマンドは、DTrace 機能への汎用フロントエンドです。このコマンドはD言語コンパイラを
	   呼び出す簡単なインターフェース、DTraceカーネル機能よりトレースされバッファーされたデータを
	   取得する機能, およびトレースされたデータを整形出力する基本ルーチン群を備えています。

       Users  new  to DTrace are encouraged to read: How To Use DTrace. Sun Microsystems, 2005. Available on
       the web at http://www.sun.com/software/solaris/howtoguides/dtracehowto.jsp
	   新たにDTraceを利用するユーザはこれを読んでください: How To Use DTrace. Sun Microsystems, 2005. 次の
	   webサイトにあります http://www.sun.com/software/solaris/howtoguides/dtracehowto.jsp


DESCRIPTION
       The dtrace command provides a generic interface to all of the  essential  services  provided  by  the
       DTrace facility, including:
       dtrace コマンドは、DTrace 機能が提供する全ての基本サービスに対する汎用インタフェースを提供します。それらを次に示します。


        Options to list the set of probes and providers currently published by DTrace
        DTrace によって現在公開されている一連のプローブやプロバイダを一覧表示するためのオプション

        Options  to enable probes directly using any of the probe description specifiers (provider, module,
         function, name)
        任意のプローブ記述指定子 (provider、module、function、name) を使ってプローブを直接有効にするためのオプション

        Options to run the D compiler and compile one or more D program files or programs written  directly
         on the command-line
         D コンパイラを実行し、1 つ以上の D プログラムファイルまたはコマンド行に直接記述されたプログラムをコンパイルするためのオプション

        Options to generate anonymous tracing programs
		匿名トレースプログラムを生成するためのオプション

        Options to generate program stability reports
		プログラム安定性レポートを生成するためのオプション

        Options to modify DTrace tracing and buffering behavior and enable additional D compiler features
		DTrace のトレース動作やバッファリング動作を変更したり、追加の D コンパイラ機能を有効化したりするためのオプション

OPTIONS
       dtrace has the following options:
	   dtrace には以下のオプションがあります:

       -arch arch_name
              Set dtrace's target data model. See arch(1) for a list of currently supported architectures.
			  dtrace の実行データモデルを設定します. 現在サポートされているアーキテクチャはarch(1)を参照してください.

       -a     Claim anonymous tracing state and display the traced data.  You can combine the -a option with
              the -e option to force dtrace to exit immediately after consuming the anonymous tracing  state
              rather than continuing to wait for new data.
			  匿名トレース状態を要求し、トレースされたデータを表示します。この -a オプションを -e オプションと組み合わせれば、匿名トレース状態を消費したあと、別のデータを待ち続ける代わりにすみやかに終了するように、dtrace に指示することができます。

       -A     Generate  a  plist(5)  of  directives  for  anonymous tracing.  If the -A option is specified,
              dtrace compiles any D programs specified using the -s option or on the command-line  and  con-
              structs  a  plist(5) of dtrace directives to enable the specified probes for anonymous trcaing
              and then  exits.   By  default,  dtrace  attempts  to  store  the  plist  to  the  file  /Sys-
              tem/Library/Extensions/dtrace_dof.kext/Contents/Info.plist.   This  behavior  can  be modified
              using the -o option to specify an alternate output file.
			  匿名トレース用の plist(5) の指令を生成します。-Aオプションが指定された場合、dtrace は-sオプションを使用して指示されたまたはコマンドラインに記述された任意のD プログラムをコンパイルし、指定されたプローブが匿名トレース用に有効化されてから終了するまでの一連の plist(5)のdtrace 指令を作成します。dtrace はデフォルトで、ファイル /System/Library/Extensions/dtrace_dof.kext/Contents/Info.plist にplist を格納しようとします。この動作は-o オプションを使って別の出力ファイルを指定することにより変更できます。

       -b     Set principal trace buffer size.  The trace buffer size can include any of the  size  suffixes
              k,  m, g, or t.  If the buffer space cannot be allocated, dtrace attempts to reduce the buffer
              size or exit depending on the setting of the bufresize property.
			  主トレースバッファーサイズ を設定します。このトレースバッファーサイズには、サイズサフィックス k、m、g、t のいずれかを含めることができます。dtrace は、バッファー領域の割り当てに失敗すると、 バッファーサイズを減らそうとするか、終了します。どちらになるかは、bufresize プロパティーの設定によります。

       -c     Run the specified command cmd and exit upon its completion. If more  than  one  -c  option  is
              present  on  the  command line, dtrace exits when all commands have exited, reporting the exit
              status for each child process as it terminates. The process-ID of the first  command  is  made
              available  to  any D programs specified on the command line or using the -s option through the
              $target macro variable.
			  指定されたコマンド cmd を実行し、その実行が完了したら終了します。コマンド行に -c オプションが複数指定されている場合、dtrace は、すべてのコマンドの終了後に終了しますが、それぞれの子プロセスが終了するたびにその終了ステータスを報告します。最初のコマンドのプロセス ID は $target マクロ変数を介して、コマンド行から指定されたか -s オプションを使って指定されたすべての D プログラムから利用可能になります。

       -C     Run the C preprocessor cpp over D programs before compiling them.  Options can  be  passed  to
              the C preprocessor using the -D, -U, -I, and -H options.  The degree of C standard conformance
              can be selected using the -X option.  Refer to the description of the -X option for a descrip-
              tion of the set of tokens defined by the D compiler when invoking the C preprocessor.
			  D プログラムをコンパイルする前に、それらのプログラムに対して C プリプロセッサ cpp を実行します。-D、-U、-I、-H の各オプションを使えば、C プリプロセッサにオプションを渡すことができます。-X オプションを使えば、C 標準への準拠レベルを選択できます。C プリプロセッサの呼び出し時に D コンパイラによって定義される一連のトークンについては、-X を参照してください。

       -D     Define  the specified name when invoking cpp (enabled using the -C option).  If an equals sign
              (=) and additional value are specified, the name is assigned the  corresponding  value.   This
              options passes the -D option to each cpp invocation.
			  -C オプションで有効化された cpp(1) を呼び出す際に、name を定義します。等号 (=) と追加の value を指定した場合、名前に対応する値が代入されます。このオプションは、cpp が呼び出されるたびに、それに -D オプションを渡します。

       -e     Exit  after compiling any requests and consuming anonymous tracing state (-a option) but prior
              to enabling any probes.  This option can be combined with the -a  option  to  print  anonymous
              tracing  data  and exit, or it can be compiled with D compiler options to verify that programs
              compile without actually executing them and enabling the corresponding instrumentation.
			  すべての要求をコンパイルし、匿名トレース状態を消費し終わったあと (-a オプション)、プローブを有効化する前に終了します。このオプションを -a オプションと組み合わせれば、匿名トレースデータを出力してから終了させることができます。このオプションを D コンパイラのオプションと組み合わせることもできます。この組み合わせを使用した場合、プログラムがコンパイルされるかどうかの検証は行われますが、それらのプログラムが実際に実行されたり対応する計測機能が有効化されたりすることはありません。

       -f     Specify function name to trace or list (-l option).  The corresponding  argument  can  include
              any  of  the  probe  description forms provider:module:function, module:function, or function.
              Unspecified probe description fields are left blank and match any  probes  regardless  of  the
              values  in  those  fields.  If no qualifiers other than function are specified in the descrip-
              tion, all probes with the  corresponding  function  are  matched.   The  -f  argument  can  be
              suffiexed  with  an  optional D probe clause.  More than one -f option may be specified on the
              command-line at a time.
			  トレースまたは一覧表示 (-l オプション) の対象となる関数名を指定します。対応する引数には、プローブ記述形式 provider:module:function、module:function、function のいずれかを含めることができます。指定されなかったプローブ記述フィールドは空のままとなり、そのフィールドの値に関係なくすべてのプローブに一致します。function 以外の修飾子が記述内に指定されなかった場合、その対応する function を持つすべてのプローブに一致します。-f の引数の後にはオプションで、D プローブ節を付加することもできます。-f オプションは、コマンド行で一度に複数指定できます。

       -F     Coalesce trace output by identifying function entry and return.  Function entry probe  reports
              are  indented  and  their output is prefixed with ->.  Function return probe reports are unin-
              dented and their output is prefixed with <-.
			  関数の開始 (entry) と終了 (return) を識別することにより、トレース出力をひとつにまとめます。関数開始プローブのレポートはインデントされ、-> の後ろに出力されます。関数終了プローブのレポートはインデント解除され、<- の後ろに出力されます。

       -h     Generate a header file containing macro definitions for USDT  probes.  If  the  -o  option  is
              present,  the header file is saved using the pathname specified as the argument for this flag.
              If the -o option is not present and the DTrace program is contained in a file  whose  name  is
              filename.d, the header file is saved using the name filename.h.
			  USDT プローブ向けのマクロを格納するヘッダーファイルを生成します。-o オプションが存在している場合、ヘッダーファイルはこのオプションの引数として指定されたパス名を使って保存されます。-o オプションが存在せず、かつ DTrace プログラムが filename.d というファイルに格納されている場合、ヘッダーファイルは名前 filename.h として保存されます。

       -H     Print  the  pathnames of included files when invoking cpp (enabled using the -C option).  This
              option passes the -H option to each cpp invocation, causing it to display the  list  of  path-
              names, one per line, to stderr.
			  -C オプションで有効化された cpp(1) を呼び出す際に、インクルードされたファイルのパス名を出力します。このオプションは、cpp が呼び出されるたびに、それに -H オプションを渡します。その結果、一連のパス名が 1 行に 1 つずつ、標準エラー出力に出力されます。

       -i     Specify  probe identifier to trace or list (-l option).  Probe IDs are specified using decimal
              integers as shown by dtrace -l.  The -i argument can be suffixed  with  an  optional  D  probe
              clause.  More than one -i option may be specified on the command-line at a time.
			  トレースまたは一覧表示 (-l オプション) の対象となるプローブ ID を指定します。プローブ ID を指定する際には、dtrace -l で表示される 10 進整数を使用します。-i の引数の後にはオプションで、D プローブ節を付加することもできます。-i オプションはコマンド行で一度に複数指定できます。

       -I     Add  the  specified  directory  path  to  the search path for #include files when invoking cpp
              (enabled using the -C option).  This option passes the -I option to each cpp invocation.   The
              specified directory is inserted into the search path ahead of the default directory list.
			  -C オプションで有効化された cpp を呼び出す際に、指定されたディレクトリ path を #include ファイルの検索パスに追加します。このオプションは、cpp が呼び出されるたびに、それに -I オプションを渡します。指定されたディレクトリは、検索パス内のデフォルトディレクトリリストの前に挿入されます。

       -l     List  all  probes matching probe specifications appearing in -f, -i, -m, -n, or -P options. No
              tracing is initiated for any probes.
			  -f、-i、-m、-n、-P の各オプション指定に一致するプローブを一覧表示します。これらのオプションが 1 つも指定されなかった場合、このオプションはすべてのプローブを有効化しません。

       -L     Add the specified directory path to the search path for DTrace  libraries.   DTrace  libraries
              are  used  to contain common definitions that may be used when writing D programs.  The speci-
              fied path is added after the default library search path.
			  指定されたディレクトリ path を、DTrace ライブラリの検索パスに追加します。DTrace ライブラリは、D プログラムを記述する際に使用可能な共通定義を格納する目的で使用されます。指定された path は、デフォルトライブラリ検索パスの後に追加されます。

       -m     Specify module name to trace or list (-l option).  The corresponding argument can include  any
              of  the  probe  description  forms  provider:module  or module.  Unspecified probe description
              fields are left blank and match any probes regardless of the values in those  fields.   If  no
              qualifiers other than module are specified in the description, all probes with a corresponding
              module are matched.  The -m argument can be suffixed with an optional D  probe  clause.   More
              than one -m option may be specified on the command-line at a time.
			  トレースまたは一覧表示 (-l オプション) の対象となるモジュール名を指定します。対応する引数には、プローブ記述形式 provider:module、module のいずれかを含めることができます。指定されなかったプローブ記述フィールドは空のままとなり、そのフィールドの値に関係なくすべてのプローブに一致します。module 以外の修飾子が記述内に指定されなかった場合、その対応する module を持つすべてのプローブに一致します。-m の引数の後にはオプションで、D プローブ節を付加することもできます。-m オプションは、コマンド行で一度に複数指定できます。

       -n     Specify  probe  name to trace or list (-l option).  The corresponding argument can include any
              of the probe  description  forms  provider:module:function:name,  module:function:name,  func-
              tion:name,  or name.  Unspecified probe description fields are left blank and match any probes
              regardless of the values in those fields.  If no qualifiers other than name are  specified  in
              the  description,  all  probes  with a corresponding name are matched.  The -n argument can be
              suffixed with an optional D probe clause.  More than one -n option may  be  specified  on  the
              command-line at a time.
			  トレースまたは一覧表示 (-l オプション) の対象となるプローブ名を指定します。対応する引数には、プローブ記述形式 provider:module:function:name、module:function:name、function:name、name のいずれかを含めることができます。指定されなかったプローブ記述フィールドは空のままとなり、そのフィールドの値に関係なくすべてのプローブに一致します。name 以外の修飾子が記述内に指定されなかった場合、その対応する name を持つすべてのプローブに一致します。-n の引数の後にはオプションで、D プローブ節を付加することもできます。-n オプションは、コマンド行で一度に複数指定できます。

       -o     Specify  the  output file for the -A and -l options, or for the traced data.  If the -A option
              is present, and -o is not present, the default output file is /kernel/drv/dtrace.conf.
			  -A および -l オプションまたはトレースデータ自体に対する output ファイルを指定します。-A オプションが存在していて -o が存在していない場合、デフォルトの出力ファイルは /kernel/drv/dtrace.conf になります。

       -p     Grab the specified process-ID pid, cache its symbol tables, and exit upon its  completion.  If
              more  than  one  -p option is present on the command line, dtrace exits when all commands have
              exited, reporting the exit status for each process as it terminates. The first  process-ID  is
              made available to any D programs spe cified on the command line or using the -s option through
              the $target macro variable.
			  指定されたプロセス ID pid を獲得し、そのシンボルテーブルをキャッシュし、その実行が完了したら終了します。コマンド行に -p オプションが複数指定されている場合、dtrace は、すべてのコマンドの終了後に終了しますが、それぞれの子プロセスが終了するたびにその終了ステータスを報告します。最初のプロセス ID は $target マクロ変数を介して、コマンド行から指定されたか -s オプションを使って指定されたすべての D プログラムから利用可能になります。

       -P     Specify provider name to trace or list (-l option).  The remaining  probe  description  fields
              module,  function,  and  name  are left blank and match any probes regardless of the values in
              those fields.  The -P argument can be suffixed with an optional D probe clause.  More than one
              -P option may be specified on the command-line at a time.
			  トレースまたは一覧表示 (-l オプション) の対象となるプロバイダ名を指定します。残りのプローブ記述フィールド module、function、および name は空のままとなり、そのフィールドの値に関係なくすべてのプローブに一致します。-P の引数の後にはオプションで、D プローブ節を付加することもできます。-P オプションは、コマンド行で一度に複数指定できます。

       -q     Set  quiet  mode.   dtrace  will suppress messages such as the number of probes matched by the
              specified options and D programs will not print column headers, the CPU ID, the probe  ID,  or
              insert  newlines into the output.  Only data traced and formatted by D program statements such
              as trace() and printf() will be displayed to stdout.
			  非出力モードを設定します。dtrace は、指定されたオプションや D プログラムの条件に一致するプローブ数などのメッセージを抑制し、列ヘッダーの CPU ID や プローブ ID を出力しなくなるほか、出力に改行を挿入しなくなります。trace() や printf() といった D プログラム文によってトレースおよび書式設定されたデータのみが、標準出力に表示されます。

       -s     Compile the specified D program source file.  If the -e option is present, the program is com-
              piled  but  no instrumentation is enabled.  If the -l option is specified, the program is com-
              piled and the set of probes matched by it is listed, but no instrumentation will  be  enabled.
              If neither -e or -l are present, the instrumentation specified by the D program is enabled and
              tracing begins.
			  指定された D プログラムのソースファイルをコンパイルします。-e オプションが存在している場合、プログラムのコンパイルは行われますが、計測機能は有効化されません。-l オプションが存在している場合、プログラムのコンパイルと一致するプローブの一覧表示は行われますが、計測機能は有効化されません。-e、-l のどちらも存在しない場合には、D プログラムによって指定された計測機能が有効化され、トレースが開始されます。

       -S     Show D compiler intermediate code.  The D compiler will produce a report of  the  intermediate
              code generated for each D program to stderr.
			  D コンパイラの中間コードを表示します。D コンパイラは、個々の D プログラムごとに生成された中間コードに関するレポートを生成し、標準エラー出力に出力します。

       -U     Undefine  the  specified  name  when  invoking cpp (enabled using the -C option).  This option
              passes the -U option to each cpp invocation.
			  -C オプションで有効化された cpp を呼び出す際に、指定された name を未定義にします。このオプションは、cpp が呼び出されるたびに、それに -U オプションを渡します。

       -v     Set verbose mode.  If the -v option is specified, dtrace produces a program  stability  report
              showing the minimum interface stability and dependency level for the specified D programs.
			  冗長モードを設定します。-v オプションが指定された場合、dtrace は、プログラム安定性レポートを生成します。このレポートでは、指定された D プログラムの最小インタフェースの安定性レベルと依存性レベルが示されます。

       -V     Report  the  highest  D programming interface version supported by dtrace.  The version infor-
              maion is printed to stdout and the dtrace command exits.
			  dtrace がサポートする D プログラミングインタフェースのバージョンのうち、もっとも高いバージョンを報告します。このバージョン情報が標準出力に出力されたあと、dtrace コマンドは終了します。

       -w     Allow destructive actions. D programs containing destructive  actions  will  fail  to  compile
              unless this flag is specified.
			  破壊アクションを使用できるようにします。このオプション指定なしでは破壊アクションを含む D プログラムのコンパイルは失敗します。

       -x     Enable or modify a DTrace runtime option or D compiler option.  Boolean options are enabled by
              specifying their name.  Options with values are set by separating the option  name  and  value
              with an equals sign (=).
			  DTrace の実行時オプションまたは D コンパイラオプションを有効化または変更します。ブール型のオプションを有効化するには、その名前を指定します。値を持つオプションを設定するには、オプションの名前と値を等号 (=) で分離します。

       -Z     Permit  probe  descriptions that match zero probes.  If the -Z option is not specified, dtrace
              will report an error and exit if any probe descriptions  specified  in  D  program  files  (-s
              option)  or  on  the command-line (-P, -m, -f, -n, or -i options) contain descriptions that do
              not match any known probes.
			  一致するプローブが 1 つも見つからないようなプローブ記述を許可します。-Z オプションが指定されない場合、D プログラムファイル内で指定されたプローブ記述 (-s オプション) またはコマンド行で指定されたプローブ記述 (-P、-m、-f、-n、または -i オプション) の中で、既知のどのプローブにも一致しないような記述を含むプローブ記述が見つかると、dtrace はエラーを報告し、処理を終了します。

OPERANDS
       Zero or more additional arguments may be specified on the dtrace command line  to  define  a  set  of
       macro  variables ($1, $2, and so on) to be used in any D programs specified using the -s option or on
       the command-line.
	   dtrace コマンド行に 0 個以上の追加引数を指定し、-s オプションを使って指定された D プログラム内またはコマンド行から指定された D プログラム内で一連のマクロ変数 ($1 や $2 など) を定義し使用することができます。

C++ MANGLED NAMES
       By default, dtrace uses the demangled names of C++ symbols. You can tell dtrace to  use  the  mangled
       symbol names by passing -xmangled to the command.
	   標準では、 dtrace はマングル解除( demangled )された C++ シンボル名を使用します。マングルされたシンボル名を使用したい場合は
	    -xmangled をコマンドに与えてください.

OBJECTIVE C PROVIDER
       The  Objective  C  provider is similar to the pid provider, and allows instrumentation of Objective C
       classes and methods. Objective C probe specifiers use the following format:
	   Objective C プロバイダは pid プロバイダと似ており、 Objective C のクラスとメソッドの計測を許可します。 Objective C プローブは次の書式があります。

       objcpid:[class-name[(category-name)]]:[[+|-]method-name]:[name]

       pid    The id number of the process.
	            プロセスid番号

       class-name
              The name of the Objective C class.
			  Objective C のクラス名

       category-name
              The name of the category within the Objective C class.
			  Object C で記述されたカテゴリ名

       method-name
              The name of the Objective C method.
			  Object C メソッド名

       name   The name of the probe, entry, return, or an integer instruction offset within the method.
	               プローブ、エントリー、リターンまたはメソッド内オフセット値の名前

OBJECTIVE C PROVIDER EXAMPLES
       objc123:NSString:-*:entry
              Every instance method of class NSString in process 123.
			  プロセス 123 内の NSString クラス全てのインスタンスメソッド

       objc123:NSString(*)::entry
              Every method on every category of class NSString in process 123.
			  プロセス 123 内の NSString クラス全てのカテゴリの全てのメソッド

       objc123:NSString(foo):+*:entry
              Every class method in NSString's foo category in process 123.
			  プロセス 123 内の NSString クラスの foo カテゴリ全てのクラスメソッド

       objc123::-*:entry
              Every instance method in every class and category in process 123.
			  プロセス 123 内の全てのクラスとカテゴリの全てのインスタンスメソッド

       objc123:NSString(foo):-dealloc:entry
              The dealloc method in the foo category of class NSString in process 123.
			  プロセス 123 内の NSString クラスの foo カテゴリの dealloc メソッド

       objc123::method?with?many?colons:entry
              The method method:with:many:colons in every class in process 123. (A ? wildcard must  be  used
              to  match  colon  characters  inside  of  Objective C method names, as they would otherwise be
              parsed as the provider field separators.)
			  プロセス 123 内の全てのクラスの method:with:many:colons メソッド。 ( コロン(訳注「 : 」)はプロバイダフィールド区切りとして使われているので、Object C メソッド名内部のコロンと一致させるには「 ? 」ワイルドカードを使用する必要がある。 )

BUILDING CODE CONTAINING USDT PROBES
       The process of adding USDT probes to code is  slightly  different  than  documented  in  the  Solaris
       Dynamic Tracing Guide. The steps for adding probes are as follows:
	   USDTプローブをコードに追加する方法は『Solaris 動的トレースガイド』に書いてある方法と若干異なります。プローブ追加方法は以下になります。

       1. Name the provider and specify its probes, using the following form:
	       以下のようにしてプロバイダに名前をつけプローブを指定します。

               provider Example {
                    probe increment(int);
               };

          This  defines  the  Example  provider with one probe, increment, that takes a single int argument.
          Providers can define multiple probes and probes can take multiple arguments.
		  これは一つの int 引数を取る increment プローブ一つを持つ Example プロバイダを定義します。複数の引数を取ったプローブ、複数のプローブを持ったプロバイダを定義することができます。

       2. Process the provider description into a header file.
	       ヘッダファイルにあるプロバイダ記述を処理します。

          The provider description must be converted into a form usable by ObjC/C/C++ code. The dtrace  com-
          mand should be invoked with the -h flag to do this.
		  プロバイダ記述は ObjC/C/C++ コードに変換される必要があります。 dtrace コマンドは -h オプションを使うことによりこれを行います。

               dtrace -h -s exampleProvider.d

          This will generate a header file named exampleProvider.h
		  これは exampleProvider.h というヘッダファイルを生成します。

       3. Add probe invocations to the application
	       アプリケーションにプローブ呼び出しを追加します。

          For  each probe defined in the provider, the provider.h file will contain two macros.The naming is
          as follows:
		  provider.h ファイルにはプロバイダで定義された各プローブに対応した以下の名前を持つ二つのマクロが含まれます。 

               PROVIDER_PROBENAME()
               PROVIDER_PROBENAME_ENABLED()

          In the Example provider, the increment probe becomes:
		  Example プロバイダでは increment プローブになります。

               EXAMPLE_INCREMENT()
               EXAMPLE_INCREMENT_ENABLED()

          Place a macro invocation in the code at each site to be traced. If the arguments passed to a probe
          are expensive to calculate, you may guard the probe placement like this:
		  トレースしたい各部分のコードに呼び出しマクロを記述します。プローブに引数を与えるのに計算量が多い場合、以下のようにプローブを記述する部分をガードすることができます。

               if (EXAMPLE_INCREMENT_ENABLED()) {
                    argument = /* 計算量の多い引数計算コードをここに記述します */;
                    EXAMPLE_INCREMENT(argument);
               };

          The if test will only succeed when the increment probe is active.
		  increment プローブが有効のときのみ if テストが成功し(訳注 プローブが呼び出され)ます。

       4. Compile and link your program normally. No additional compiler or linker flags are required.
	       いつものようにコンパイルとリンクをします。追加のコンパイラオプションやリンカオプションは必要ありません。


EXIT STATUS
       The following exit values are returned by the dtrace utility:
	   dtrace ユーティリティーから次の終了値が返されます。

	   0      The specified requests were completed successfully.  For D program requests, the 0 exit status
              indicates that programs were successfully  compiled,  probes  were  successfully  enabled,  or
              anonymous  state  was  successfully retrieved.  dtrace returns 0 even if the specified tracing
              requests encountered errors or drops.
			  指定された要求が正常終了しました。D プログラム要求の場合、終了ステータス 0 は、プログラムのコンパイル、プローブの有効化、匿名状態の取得、のいずれかが成功したことを示します。指定されたトレース要求でエラーや欠落が発生した場合でも、dtrace は 0 を返します。

       1      A fatal error occurred.  For D program requests, the 1 exit status indicates that program com-
              pilation failed or that the specified request could not be satisfied.
			  致命的エラーが発生しました。D プログラム要求の場合、終了ステータス 1 は、プログラムのコンパイルが失敗したか、指定された要求に応じられなかったことを示します。

       2      Invalid command-line options or arguments were specified.
			  コマンド行に無効なオプションまたは引数が指定された。

SEE ALSO
       How  To  Use  DTrace.  Sun  Microsystems,  2005.  Available  on  the  web at http://www.sun.com/soft-
       ware/solaris/howtoguides/dtracehowto.jsp
       Solaris  Dynamic   Tracing   Guide.    Sun   Microsystems,   2005.    Available   on   the   web   at
       http://docs.sun.com/app/docs/doc/817-6223
       『How  To  Use  DTrace. 』。 Sun  Microsystems、 2005。次のウェブサイトにあります。 
       http://www.sun.com/software/solaris/howtoguides/dtracehowto.jsp
	   『Solaris 動的トレースガイド』。 Sun   Microsystems、 2005。次のウェブサイトにあります。
	   http://docs.sun.com/app/docs/doc/817-6223
	   (訳注 日本語版はこちら http://docs.sun.com/app/docs/doc/819-0395?l=ja )




Version 1.0                                       July 2006                                        DTRACE(1)

Mac OS XのDTrace

DTraceについてちょっと調べてたんだけど、いろいろ試したり、まとめたりする前に力尽きてしまったです。そしてそのまま更新も止まってました。
ちょっと気が向いたので、書けるだけは書いておこうかと。

DTraceに関する基本的な情報。
まずはマニュアル(man)。

man dtrace

でも出てくるけど、ウェブで見れると便利でもあるので書いておこう。

SunにあるSolaris10版のマニュアル 英語日本語訳

それとAppleにあるMac OS X版のマニュアル英語


その他にもSunにある情報。
Solaris 動的トレースガイド(Solaris Dynamic Tracing Guide)英語日本語訳
DTrace ユーザーガイド(DTrace User Guide)英語日本語訳
DTrace by Example: Solving a Real-World Problem英語なPDF
Sun Tech Days 2008 in Tokyoのセッション1-M-2


@ITの記事、OpenSolarisでサーバ構築の連載最終回。DTraceでトラブルシューティング

ITmedia記事


SolarisインターナルにあるwikiDTrace Topics

これがあると便利DTrace ToolkitSolaris用でOS Xではそのまま動かないかも。というか、OS Xには入っている。全部?最新?というのは確認していない。


OS X標準のRubyではDTraceが有効になっているけど、おそらくjoyentパッチそのもの。
なので、USDTプロバイダ。だから

MyMac:~ chcoopu$ sudo dtrace -l | grep ruby
MyMac:~ chcoopu$ 

と、単にdtraceコマンドを起動してプロバイダ一覧を表示してもそこにrubyは出てこない。
そうではなく、コマンドにrubyを指定すれば表示される。

MyMac:~ chcoopu$ sudo dtrace -l -c /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -v | grep ruby
21584    ruby662   libruby.1.dylib                          rb_call0 function-entry
21585    ruby662   libruby.1.dylib                          rb_call0 function-return
21586    ruby662   libruby.1.dylib                   garbage_collect gc-begin
21587    ruby662   libruby.1.dylib                   garbage_collect gc-end
21588    ruby662   libruby.1.dylib                           rb_eval line
21589    ruby662   libruby.1.dylib                      rb_obj_alloc object-create-done
21590    ruby662   libruby.1.dylib                      rb_obj_alloc object-create-start
21591    ruby662   libruby.1.dylib                   garbage_collect object-free
21592    ruby662   libruby.1.dylib                        rb_longjmp raise
21593    ruby662   libruby.1.dylib                           rb_eval rescue
21594    ruby662   libruby.1.dylib                 ruby_dtrace_probe ruby-probe
MyMac:~ chcoopu$ 


RubyをDTrace有効にするためのjoyentパッチをOS X対応させたもの舞波さんがまとめたもの、recompile.netの人が作った資料


といったくらいが調べたこと。

プンソラ 2008.11 がかっこいい件

OpenSolaris 2008.11がリリースされた。

その2008.11バージョンに関する新機能とか紹介のウェブキャスト(英語)

この辺りが超かっこいい

  • タイムスライダーで昔のスナップショットに簡単アクセス ( ウェブキャストの06:00 頃 )。
  • メモリサスペンドに対応。
  • Intel Core i7 ( Nehalem )対応。

先日のSun Tech Days Tokyoの資料見た感じだと、下2つはIntelがいろいろがんばってくれたっぽいね。Intelの発表資料(日本語)※PDF注意


そのままTech Daysの資料を読んでみる。ある程度プンソラに関係ある話だし。


ZFSに関する発表資料(日本語)※PDF注意
send / recvはx86←→SPARCでも問題ないんだ、ふむふむ。
Hybrid Storage Poolのキャッシュデバイス機能はNevadaでしか対応していないみたい。
ということはSun Storage 7000シリーズのOSはOpenSolarisSolaris Express ( = Solaris 11 β )ということかな?7000シリーズのソフト部分であるOpenStorageのページだとSolarisOpenSolarisとしか書いていないのでバージョンは判らないねぇ。


アプリ最適化に関する発表資料(日本語)※PDF注意
Solaris / Sun Studioに限らない話。当たり前の話と、当たり前じゃないけど知っておいた方がいい話。


そうそうここが今回のSun Tech Days Tokyoのページ。

rubyバイナリの速さをベンチマークで比べてみる その2

そういえば、以前書いた時はMac OS X付属のrubyでの計測を忘れていた。今更ながら計測してみる。追加が1つだけでは面白くないので、ruby-1.8.7と1.9.1のpreview1も一緒に。

コンパイルした分は以前と同様configure --prefix=... --enable-shareで。環境変数も同じ。アーキテクチャx86_64が一番速かったので、x86_64のみ。使用したコンパイラも速かった4.0のみ使用。


結果

OSX付属ruby-1.8.6-p114 i386 gcc-4.0? ruby-1.8.6-p287 i386 gcc-4.0 ruby-1.8.6-p287 x86_64 gcc-4.0 ruby-1.8.7-p72 x86_64 gcc-4.0 ruby-1.9.1-preview1 x86_64 gcc-4.0 jruby-1.1.5 Java1.5.0 32bit ClientVM jruby-1.1.5 Java1.6.0 64bit ServerVM
1回目 6.098460 6.204469 5.849351 6.085247 3.755114 4.577866 3.022682
2回目 6.084894 6.276506 5.861438 6.081302 3.709532 4.546147 3.239865
3回目 6.093372 6.265678 5.909926 6.067453 3.703996 4.490303 3.179142
平均 6.092242 6.248884 5.873572 6.078001 3.722881 4.538105 3.147230

※単位は[秒]
以前の結果もめぼしいのは一緒にまとめてみた。


まとめ
OS X付属と比べると同じi386で作ったものは遅い。x86_64にすると速い。1.9.1は速くなっている。実アプリではどれほど期待できるのか。JRubyは使用するJavaVMにより変わるが全体として速い。

ってところかな。