[Linux-ia64] ANNOUNCE: prctl tool

Khalid Aziz
2000-09-29T20:29:10Z

I have written a tool called "prctl" that allows you to run a program
with a different handling of unaligned memory access than the default.
You can choose for the process to get a SIGBUS on an unaligned access or
unaligned access to be handled silently by the kernel. You can also use
it to start a shell with modified unaligned access handling. Further
details are in the man page at the end. One use for this tool could be
to find and fix all unaligned memory accesses in a program while running
the program under gdb which may improve the performance.

prctl makes use of the new options to prctl system call introduced in
2.4.0-test7 kernel, so it will not work on kernels older than
2.4.0-test7.

I have built binary RPM packages for IA-64 and IA-32, and a source RPM
package. These can be downloaded from the following URLs:

<ftp://ftp.hpl.hp.com/pub/linux-ia64/prctl-1.0-1.ia64.rpm>
<ftp://ftp.hpl.hp.com/pub/linux-ia32/prctl-1.0-1.i386.rpm>
<ftp://ftp.hpl.hp.com/pub/linux-ia64/prctl-1.0-1.src.rpm>

Please feel free to give any feedback on this tool.

---
Khalid

==================================
Khalid Aziz Unix System Enablement Laboratory
(970)898-9214 Hewlett-Packard
khalid@fc.hp.com Fort Collins, CO
==================================

PRCTL(1) PRCTL(1)

NAME
prctl - Process operations

SYNOPSIS
prctl [-v] [-h|--help] [--version]
<-q|--unaligned=[silent|signal|default]> [command]

DESCRIPTION
prctl allows you to query or control certain process
behavior. At present, the only supported option is han­
dling of unaligned memory accesses by a process. When a
process performs an unaligned memory access, by default
the kernel would emulate the unaligned access correctly
and log the unaligned access in syslog. This behavior can
be changed so the kernel could either emulate the
unaligned access correctly without logging an error or
send SIGBUS to the process.

prctl can optionally be followed by a command. If a com­
mand is specified, prctl will exec the command with the
processor behavior set to as specified by the options. If
a command is not specified, prctl will fork a new shell
unless the command only queried the current settings. The
shell started by prctl will be as defined by the environ­
ment variable SHELL. If environment variable SHELL is not
defined, shell in the password entry for the user will be
started. If a shell is not found in the password entry,
bash will be started.

OPTIONS
-v Verbose mode. In verbose mode, any new settings are
confirmed with a message on stdout.

--help Print usage information and exit.

--version
Print software version and exit.

-q Query the current settings for the process options
controllable by prctl.

--unaligned=[silent|signal|default]]
Set unaligned memory access behavior to not log the
access (silent), send SIGBUS to the process (sig­
nal), or do the default (default). If a value is
not specified after "=", current setting is
returned.

If an option is specified multiple times, the last
one takes effect.

EXAMPLES
prctl --unaligned=signal
starts up a shell (as defined by the environment
variable SHELL) and sets up any process running
under this shell to be sent SIGBUS upon an
unaligned memory access.

prctl --unaligned=signal gdb tst
starts up a gdb session for the program "tst" with
the process set to receive SIGBUS upon unligned
memory access.

prctl --unaligned displays the current setting for unaligned memory
access handling.

prctl --unaligned= gdb tst
displays the current setting for unaligned memory
access handling and starts up a gdb session for the
program "tst".

SEE ALSO
prctl(2)

AUTHOR
Khalid Aziz <khalid_aziz@hp.com>

LICENSE
This software is made available under the GNU General Pub­
lic License (GPL) Version 2. This software comes with NO
WARRANTY.