ktrace – FreeBSD / Mac OS X Process Tracing and Reporting Tool

Posted on in Categories FreeBSD, Howto, Monitoring, OpenBSD, OS X, programming, Sys admin, Troubleshooting last updated April 16, 2008

Under Linux you can use strace or valgrind tool for reporting and finding a bug. However, under *BSD / Mac OS X you need to use ktrace as replacement for strace tool.

kreace runs on the following platforms:
=> FreeBSD
=> OpenBSD
=> Mac OS X
=> NetBSD

The ktrace utility enables kernel trace logging for the specified processes. Kernel trace data is logged to the file ktrace.out. The kernel operations that are traced include system calls, namei translations, sig nal processing, and I/O. Once tracing is enabled on a process, trace data will be logged until either the process exits or the trace point is cleared. A traced process can generate enormous amounts of log data quickly; It is strongly suggested that users memorize how to disable tracing before attempting to trace a process.

To trace all kernel operations for process id # 2546, enter:
$ ktrace -p 2546
To disable all tracing of process # 2546, enter:
$ ktrace -cp 2546
To disable tracing on all user-owned processes, and, if executed by root, all processes in the system:
# ktrace -C
Attach to process id # 123 and log trace records to myapp.dbg.log instead of ktrace.out.
$ ktrace -p 123 -f myapp.dbg.log
To enable tracing of I/O on process # 123
$ ktrace -ti -p 123
The -t option is very useful to trace various kernel trace points, one per letter. The following table equates the letters with the trace points:

  • c : trace system calls
  • n : trace namei translations
  • i : trace I/O
  • s : trace signal processing
  • u : userland traces
  • w : context switches
  • + : trace the default set of trace points – c, n, i, s, u

Run the command called myapp and track only system calls, enter:
$ ktrace -tc ./myapp
Please note that the output of ktrace is not as informative as strace, but it does help to solve many problems.

truss: trace system calls

FreeBSD has another tool called truss. It traces the system calls called by the specified process or program. Output is to the specified output file, or standard error by default.
Attach to an already-running process # 123, enter
$ truss -p 123
Follow the system calls used myapp
$ truss ./myapp -d /tmp -f 120
Same as above, but put the output into a file called /tmp/myapp.dbg
$ truss -o /tmp/truss.out ./myapp -d /tmp -f 120

strace under FreeBSD

You can install strace under FreeBSD and other *BSD like oses.

Further readings:

  • ktrace man page
  • truss man page

What's new in OpenOffice.Org version 3?

Posted on in Categories Linux desktop, OS X, UNIX, Windows last updated March 19, 2008

OO is a decent free Office Suite for Windows / Linux / Mac and other platforms. This webpage provides OpenOffice.org 3.0’s new features, an early look:

OpenOffice.org 3.0 is 167 days away, but who’s counting? Maybe the software developers are counting because they have a whopping 2,278 issues targeted for this release. Even though OpenOffice.org 2.4 is not yet out the door, let’s see how far they’ve come with OpenOffice.org 3.0.

New features

  • Personal Information Manager (PIM), probably based on Thunderbird/Lightning
  • PDF import into Draw (to maintain correct layout of the original PDF)
  • Web 2.0 support for weblogs and wikis
  • Office 2007 OOXML document import filter
  • Support for Mac OS X Aqua platform
  • Redesigned, more modern GUI.
  • Extensions, to add third party functionality etc

OpenOffice.org 3.0’s new features
(Fig. 01: OpenOffice.Org v3.x Splash Screen)

=> OpenOffice.org 3.0’s new features

Create Encrypted System Partition Under Linux / Windows / Mac OS X

Posted on in Categories Download of the day, File system, Howto, Linux, Linux desktop, OS X, Windows last updated March 14, 2008

TrueCrypt is a software application used for on-the-fly encryption (OTFE). It is free and open source software. TrueCrypt is available for Microsoft Windows, Mac OS X, and Linux. This software can protect date. It encrypts data stored on a computer’s disk and transparently decrypts the information when a user requests it. No special action by the user is required. From the Linux.com article:

Last month the TrueCrypt Foundation released TrueCrypt 5.0, which finally introduces a Linux GUI for the cross-platform encryption application. TrueCrypt 5.0’s numerous other enhancements include a Mac OS X port, XTS operation mode, the ability to encrypt a system partition or drive under Windows, and the addition of the SHA-512 hash algorithm

=> Encrypt volumes through a cross-platform GUI with TrueCrypt 5.0

Mac ZFS Source Code Released

Posted on in Categories Download of the day, OS X, Solaris, Sys admin, Tips, UNIX last updated January 14, 2008

ZFS has amazing feature set and now it is ported to Mac

ZFS file system developed by Sun for its UNIX operating system. ZFS presents a pooled storage model that completely eliminates the concept of volumes and the associated problems of partitions, provisioning, wasted bandwidth and stranded storage. Thousands of filesystems can draw from a common storage pool, each one consuming only as much space as it actually needs. The combined I/O bandwidth of all devices in the pool is available to all filesystems at all times.

Apple has ported ZFS from Open Solaris to the Mac OS X platform. You can download ZFS beta version here (via ./).

Download of the day: RPM Software Package Manager Version 5.0

Posted on in Categories Download of the day, Linux, UNIX last updated January 7, 2008

RPM 5.0.0 has been released.

RPM Package Manager is a software package manager for UNIX and Linux distribution. It is a powerful and command-line package management system capable of installing, uninstalling, verifying, querying, and updating Unix binary / source software packages. RPM was originally written in 1997 by Erik Troan and Marc Ewing for use in the Red Hat Linux distribution. These you can use RPM under many Linux distribution and various UNIX variant such as AIX / OpenSolaris etc. From the press release:

After seven months of comprehensive development, the popular Unix software packaging tool RPM Package Manager (RPM) was released as stable version 5.0.0. The relaunch of the RPM project in spring 2007 and today’s following availability of RPM 5 marks a major milestone for the previously rather Linux-centric RPM. RPM now finally evolved into a fully cross-platform and reusable software packaging tool.

What is new in RPM 5.0.0?

The Automake/Autoconf/Libtool-based build environment of RPM was completely revamped from scratch and as one major result mostly all third-party libraries now can be linked externally and in a very flexible way.

Support for the ancient and obsolete “rpmrc” files was completely removed, as everything is now configured through RPM “macros” under run-time only.

The RPM code base was ported to all major platforms, including the BSD, Linux, Solaris and Mac OS X Unix flavors and Windows/Cygwin.

The RPM packages, in addition to the default Gzip and optional Bzip2 compression, now support also LZMA compression.

Finally, support for the old RPMv3 (LSB) package format was removed to cleanup and simplify the code base. RPM 5, with respect to RPM format packages, now supports RPMv4 format only.

Additional features for use in package specifications (.spec files) were added, including new standard and even custom tags, new standard sections, etc. Most notably, RPM is now able to automatically track vendor distribution files with its new vcheck(1) based “%track” section and now can automatically download the vendor distribution files, too.

Download RPM v5.0

RPM 5.0 Project home page

So Who maintains RPM?

LWN has an interesting write up about RPM:

Once upon a time, RPM was the “Red Hat Package Manager.” In a bid to establish RPM as a wider standard – and, perhaps, to get some development help – Red Hat tried to turn RPM into a community project – rebranding it as the “RPM Package Manager” in the process. But core RPM development remained at Red Hat, under the care of an employee named Jeff Johnson. That, it would seem, is where the trouble starts.

Eat Your Own Dog Food: Microsoft to Push Silverlight Technology

Posted on in Categories News last updated January 3, 2008

Many commercial companies emphasizes the use of its own products inside the company to convey the confidence in its own product.

Now Microsoft decided to eats its own dog food. Microsoft is preparing a fully Silverlight-powered redesign of their website. This will push Silverlight usage to more users. Silverlight is a runtime for browser-based Rich Internet Applications, providing a subset of the animation, vector graphics, and video playback capabilities of Windows Presentation Foundation. The runtime is available for Microsoft Windows and Mac OS X, with Linux support under development via the third-party Moonlight runtime.

=> More information: Microsoft to Push Silverlight via Redesigned Homepage

How to Share a single keyboard, mouse, and clipboard between Windows and UNIX machines

Posted on in Categories Download of the day, Howto, Linux, Linux desktop, OS X, UNIX, Windows last updated December 24, 2007

Generally, you need some sort of hardware to share a single keyboard / mouse between different machines. However, Synergy software lets you share a single keyboard, mouse, and clipboard between machines without special hardware. It’s intended for users with multiple computers on their desk since each system uses its own monitor(s).

It is common practice to run Windows XP and UNIX boxes side by side for various reasons. Synergy is open source and released under the GNU Public License (GPL). It works with Windows, Mac OS X and UNIX operating systems.

In the following example, the user is moving the mouse from left to right. When the cursor reaches the right edge of the left screen it jumps instantly to the left edge of the right screen. Do you wish you could cut and paste between computers? Now you can! Just copy text, HTML, or an image as you normally would on one screen then switch to another screen and paste it. It’s as if all your computers shared a single clipboard (and separate primary selection for you X11 users). It even converts newlines to each computer’s native form so cut and paste between different operating systems works seamlessly. And it does it all in Unicode so any text can be copied.

Share a single keyboard, mouse, clipboard with synergy software
(Fig 01: Synergy software in action ~ sharing mouse between Windows and Linux KDE desktop (image credit: Synergy project] )

Download synergy

=> You can download synergy software here.

BBC iPlayer now supports Mac OS X and Linux Desktop Computer via streaming

Posted on in Categories Linux, Linux desktop, News last updated December 17, 2007

BBC iPlayer extends existing RealPlayer-based “Radio Player” and provides streamed video clip content from BBC website. The service has been criticised for its lack of support for many PCs, browsers including Mac OS X and Linux. Now BBC started to support both Linux and Mac computer. This is great news. From the BBC press release:

From today we are pleased to announce that streaming is now available on BBC iPlayer. This means that Windows, Mac and Linux users can stream programs on iPlayer as long as their computer has the latest version of Flash. Another change is that you do not have to register or sign in any more to download programs

BBC iPlayer now supports Mac OS X and Linux Desktop Computer

Please note that BBC iPlayer is currently restricted to UK ips only. However, you can watch common video and other audio without a problem.

Updated for accuracy.