[Linux-ia64] ANNOUNCE: prctl tool

From: Khalid Aziz <khalid_at_lyra.fc.hp.com>
Date: 2000-09-30 07:29:10
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

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:


Please feel free to give any feedback on this tool.


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

PRCTL(1)                                                 PRCTL(1)

       prctl - Process operations

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

       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.

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

       --help Print usage information and exit.

              Print software version and exit.

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

              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

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

       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".


       Khalid Aziz <khalid_aziz@hp.com>

       This software is made available under the GNU General Pub­
       lic License (GPL) Version 2.  This software comes with  NO
Received on Fri Sep 29 13:29:19 2000

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:00 EST