X

title: X(7)

text:
# X(7)

## NAME
X - a portable, network-transparent window system

## OVERVIEW
The X Window System is a network transparent window system which runs on a wide range of computing and graphics machines. It should be relatively straightforward to build the X.Org Foundation software distribution on most ANSI C and POSIX compliant systems. Commercial implementations are also available for a wide range of platforms.

The X.Org Foundation requests that the following names be used when referring to this software:

X

X Window System

X Version 11

X Window System, Version 11

X11

X Window System is a trademark of The Open Group.

## DESCRIPTION
X Window System servers run on computers with bitmap displays. The server distributes user input to and accepts output requests from various client programs through a variety of different interprocess communication channels. Although the most common case is for the client programs to be running on the same machine as the server, clients can be run transparently from other machines (including machines with different architectures and operating systems) as well.

X supports overlapping hierarchical subwindows and text and graphics operations, on both monochrome and color displays. For a full explanation of the functions that are available, see the Xlib - C Language X Interface manual, the X Window System Protocol specification, the X Toolkit Intrinsics - C Language Interface manual, and various toolkit documents.

The number of programs that use X is quite large. Programs provided in the core X.Org Foundation distribution include: a terminal emulator, xterm; a window manager, twm; a display manager, xdm; a console redirect program, xconsole; a mail interface, xmh; a bitmap editor, bitmap; resource listing/manipulation tools, appres, editres; access control programs, xauth, xhost, and iceauth; user preference setting programs, xrdb, xcmsdb, xset, xsetroot, xstdcmap, and xmodmap; clocks, xclock and oclock; a font displayer, xfd; utilities for listing information about fonts, windows, and displays, xlsfonts, xwininfo, xlsclients, xdpyinfo, xlsatoms, and xprop; screen image manipulation utilities, xwd, xwud, and xmag; a performance measurement utility, x11perf; a font compiler, bdftopcf; a font server and related utilities, xfs, fsinfo, fslsfonts, fstobdf; a display server and related utilities, Xserver, rgb, mkfontdir; a clipboard manager, xclipboard; keyboard description compiler and related utilities, xkbcomp, setxkbmap xkbprint, xkbbell, xkbevd, xkbvleds, and xkbwatch; a utility to terminate clients, xkill; a firewall security proxy, xfwp; a proxy manager to control them, proxymngr; a utility to find proxies, xfindproxy; web browser plug-ins, libxrx.so and libxrxnest.so; an RX MIME-type helper program, xrx; and a utility to cause part or all of the screen to be redrawn, xrefresh.

Many other utilities, window managers, games, toolkits, etc. are included as user-contributed software in the X.Org Foundation distribution, or are available on the Internet. See your site administrator for details.

## STARTING UP
There are two main ways of getting the X server and an initial set of client applications started. The particular method used depends on what operating system you are running and whether or not you use other window systems in addition to X.

Display Manager

If you want to always have X running on your display, your site administrator can set your machine up to use a Display Manager such as xdm, gdm, or kdm. This program is typically started by the system at boot time and takes care of keeping the server running and getting users logged in. If you are running one of these display managers, you will normally see a window on the screen welcoming you to the system and asking for your login information. Simply type them in as you would at a normal terminal. If you make a mistake, the display manager will display an error message and ask you to try again. After you have successfully logged in, the display manager will start up your X environment. The documentation for the display manager you use can provide more details.

xinit (run manually from the shell)

Sites that support more than one window system might choose to use the xinit program for starting X manually. If this is true for your machine, your site administrator will probably have provided a program named "x11", "startx", or "xstart" that will do site-specific initialization (such as loading convenient default resources, running a window manager, displaying a clock, and starting several terminal emulators) in a nice way. If not, you can build such a script using the xinit program. This utility simply runs one user-specified program to start the server, runs another to start up any desired clients, and then waits for either to finish. Since either or both of the user-specified programs may be a shell script, this gives substantial flexibility at the expense of a nice interface. For this reason, xinit is not intended for end users.

## DISPLAY NAMES
From the user's perspective, every X server has a display name of the form:

hostname:displaynumber.screennumber

This information is used by the application to determine how it should connect to the server and which screen it should use by default (on displays with multiple monitors):

hostname

The hostname specifies the name of the machine to which the display is physically connected. If the hostname is not given, the most efficient way of communicating to a server on the same machine will be used.

displaynumber

The phrase "display" is usually used to refer to a collection of monitors that share a common set of input devices (keyboard, mouse, tablet, etc.). Most workstations tend to only have one display. Larger, multi-user systems, however, frequently have several displays so that more than one person can be doing graphics work at once. To avoid confusion, each display on a machine is assigned a display number (beginning at 0) when the X server for that display is started. The display number must always be given in a display name.

screennumber

Some displays share their input devices among two or more monitors. These may be configured as a single logical screen, which allows windows to move across screens, or as individual screens, each with their own set of windows. If configured such that each monitor has its own set of windows, each screen is assigned a screen number (beginning at 0) when the X server for that display is started. If the screen number is not given, screen 0 will be used.

On POSIX systems, the default display name is stored in your DISPLAY environment variable. This variable is set automatically by the xterm terminal emulator. However, when you log into another machine on a network, you may need to set DISPLAY by hand to point to your display. For example,

```
    % setenv DISPLAY myws:0

    $ DISPLAY=myws:0; export DISPLAY
```

The ssh program can be used to start an X program on a remote machine; it automatically sets the DISPLAY variable correctly.

Finally, most X programs accept a command line option of -display displayname to temporarily override the contents of DISPLAY. This is most commonly used to pop windows on another person's screen or as part of a "remote shell" command to start an xterm pointing back to your display. For example,

```
    % xeyes -display joesws:0 -geometry 1000x1000+0+0

    % rsh big xterm -display myws:0 -ls </dev/null &
```

X servers listen for connections on a variety of different communications channels (network byte streams, shared memory, etc.). Since there can be more than one way of contacting a given server, The hostname part of the display name is used to determine the type of channel (also called a transport layer) to be used. X servers generally support the following types of connections:

local

The hostname part of the display name should be the empty string. For example: :0, :1, and :0.1. The most efficient local transport will be chosen.

TCPIP

The hostname part of the display name should be the server machine's hostname or IP address. Full Internet names, abbreviated names, IPv4 addresses, and IPv6 addresses are all allowed. For example: x.org:0, expo:0, [::1]:0, 198.112.45.11:0, bigmachine:1, and hydra:0.1.

## ACCESS CONTROL
An X server can use several types of access control. Mechanisms provided in Release 7 are:

Host Access

Simple host-based access control.

MIT-MAGIC-COOKIE-1

Shared plain-text "cookies".

XDM-AUTHORIZATION-1

Secure DES based private-keys.

SUN-DES-1

Based on Sun's secure rpc system.

Server Interpreted

Server-dependent methods of access control

Xdm initializes access control for the server and also places authorization information in a file accessible to the user.

Normally, the list of hosts from which connections are always accepted should be empty, so that only clients with are explicitly authorized can connect to the display. When you add entries to the host list (with xhost), the server no longer performs any authorization on connections from those machines. Be careful with this.

The file from which Xlib extracts authorization data can be specified with the environment variable XAUTHORITY, and defaults to the file .Xauthority in the home directory. Xdm uses $HOME/.Xauthority and will create it or merge in authorization records if it already exists when a user logs in.

If you use several machines and share a common home directory across all of the machines by means of a network file system, you never really have to worry about authorization files, the system should work correctly by default. Otherwise, as the authorization files are machine-independent, you can simply copy the files to share them. To manage authorization files, use xauth. This program allows you to extract records and insert them into other files. Using this, you can send authorization to remote machines when you login, if the remote machine does not share a common home directory with your local machine. Note that authorization information transmitted ``in the clear'' through a network file system or using ftp or rcp can be ``stolen'' by a network eavesdropper, and as such may enable unauthorized access. In many environments, this level of security is not a concern, but if it is, you need to know the exact semantics of the particular authorization data to know if this is actually a problem.

For more information on access control, see the Xsecurity(7) manual page.

## GEOMETRY SPECIFICATIONS
One of the advantages of using window systems instead of hardwired terminals is that applications don't have to be restricted to a particular size or location on the screen. Although the layout of windows on a display is controlled by the window manager that the user is running (described below), most X programs accept a command line argument of the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF, and YOFF are numbers) for specifying a preferred size and location for this application's main window.

The WIDTH and HEIGHT parts of the geometry specification are usually measured in either pixels or characters, depending on the application. The XOFF and YOFF parts are measured in pixels and are used to specify the distance of the window from the left or right and top and bottom edges of the screen, respectively. Both types of offsets are measured from the indicated edge of the screen to the corresponding edge of the window. The X offset may be specified in the following ways:

+XOFF

The left edge of the window is to be placed XOFF pixels in from the left edge of the screen (i.e., the X coordinate of the window's origin will be XOFF). XOFF may be negative, in which case the window's left edge will be off the screen.

-XOFF

The right edge of the window is to be placed XOFF pixels in from the right edge of the screen. XOFF may be negative, in which case the window's right edge will be off the screen.

The Y offset has similar meanings:

+YOFF

The top edge of the window is to be YOFF pixels below the top edge of the screen (i.e., the Y coordinate of the window's origin will be YOFF). YOFF may be negative, in which case the window's top edge will be off the screen.

-YOFF

The bottom edge of the window is to be YOFF pixels above the bottom edge of the screen. YOFF may be negative, in which case the window's bottom edge will be off the screen.

Offsets must be given as pairs; in other words, in order to specify either XOFF or YOFF both must be present. Windows can be placed in the four corners of the screen using the following specifications:

+0+0

upper left hand corner.

-0+0

upper right hand corner.

-0-0

lower right hand corner.

+0-0

lower left hand corner.

In the following examples, a terminal emulator is placed in roughly the center of the screen and a load average monitor, mailbox, and clock are placed in the upper right hand corner:

```
    xterm -fn 6x10 -geometry 80x24+30+200 &

    xclock -geometry 48x48-0+0 &

    xload -geometry 48x48-96+0 &

    xbiff -geometry 48x48-48+0 &
```

## WINDOW MANAGERS
The layout of windows on the screen is controlled by special programs called window managers. Although many window managers will honor geometry specifications as given, others may choose to ignore them (requiring the user to explicitly draw the window's region on the screen with the pointer, for example).

Since window managers are regular (albeit complex) client programs, a variety of different user interfaces can be built. The X.Org Foundation distribution comes with a window manager named twm which supports overlapping windows, popup menus, point-and-click or click-to-type input models, title bars, nice icons (and an icon manager for those who don't like separate icon windows).

See the user-contributed software in the X.Org Foundation distribution for other popular window managers.

## FONT NAMES
Collections of characters for displaying text and symbols in X are known as fonts. A font typically contains images that share a common appearance and look nice together (for example, a single size, boldness, slant, and character set). Similarly, collections of fonts that are based on a common type face (the variations are usually called roman, bold, italic, bold italic, oblique, and bold oblique) are called families.

Fonts come in various sizes. The X server supports scalable fonts, meaning it is possible to create a font of arbitrary size from a single source for the font. The server supports scaling from outline fonts and bitmap fonts. Scaling from outline fonts usually produces significantly better results than scaling from bitmap fonts.

An X server can obtain fonts from individual files stored in directories in the file system, or from one or more font servers, or from a mixtures of directories and font servers. The list of places the server looks when trying to find a font is controlled by its font path. Although most installations will choose to have the server start up with all of the commonly used font directories in the font path, the font path can be changed at any time with the xset program. However, it is important to remember that the directory names are on the server's machine, not on the application's.

Bitmap font files are usually created by compiling a textual font description into binary form, using bdftopcf. Font databases are created by running the mkfontdir program in the directory containing the source or compiled versions of the fonts. Whenever fonts are added to a directory, mkfontdir should be rerun so that the server can find the new fonts. To make the server reread the font database, reset the font path with the xset program. For example, to add a font to a private directory, the following commands could be used:

```
    % cp newfont.pcf ~/myfonts

    % mkfontdir ~/myfonts

    % xset fp rehash
```

The xfontsel and xlsfonts programs can be used to browse through the fonts available on a server. Font names tend to be fairly long as they contain all of the information needed to uniquely identify individual fonts. However, the X server supports wildcarding of font names, so the full specification

```
    -adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1
```

might be abbreviated as:

```
    -*-courier-medium-r-normal--*-100-*-*-*-*-iso8859-1
```

Because the shell also has special meanings for * and ?, wildcarded font names should be quoted:

```
    % xlsfonts -fn '-*-courier-medium-r-normal--*-100-*-*-*-*-*-*'
```

The xlsfonts program can be used to list all of the fonts that match a given pattern. With no arguments, it lists all available fonts. This will usually list the same font at many different sizes. To see just the base scalable font names, try using one of the following patterns:

```
    -*-*-*-*-*-*-0-0-0-0-*-0-*-*

    -*-*-*-*-*-*-0-0-75-75-*-0-*-*

    -*-*-*-*-*-*-0-0-100-100-*-0-*-*
```

To convert one of the resulting names into a font at a specific size, replace one of the first two zeros with a nonzero value. The field containing the first zero is for the pixel size; replace it with a specific height in pixels to name a font at that size. Alternatively, the field containing the second zero is for the point size; replace it with a specific size in decipoints (there are 722.7 decipoints to the inch) to name a font at that size. The last zero is an average width field, measured in tenths of pixels; some servers will anamorphically scale if this value is specified.

## FONT SERVER NAMES
One of the following forms can be used to name a font server that accepts TCP connections:

```
    tcp/hostname:port

    tcp/hostname:port/cataloguelist
```

The hostname specifies the name (or decimal numeric address) of the machine on which the font server is running. The port is the decimal TCP port on which the font server is listening for connections. The cataloguelist specifies a list of catalogue names, with '+' as a separator.

Examples: tcp/x.org:7100, tcp/198.112.45.11:7100/all.

## COLOR NAMES
Most applications provide ways of tailoring (usually through resources or command line arguments) the colors of various elements in the text and graphics they display. A color can be specified either by an abstract color name, or by a numerical color specification. The numerical specification can identify a color in either device-dependent (RGB) or device-independent terms. Color strings are case-insensitive.

X supports the use of abstract color names, for example, "red", "blue". A value for this abstract name is obtained by searching one or more color name databases. Xlib first searches zero or more client-side databases; the number, location, and content of these databases is implementation dependent. If the name is not found, the color is looked up in the X server's database. The text form of this database is commonly stored in the file usr/share/X11/rgb.txt.

A numerical color specification consists of a color space name and a set of values in the following syntax:

```
    <color_space_name>:<value>/.../<value>
```

An RGB Device specification is identified by the prefix "rgb:" and has the following syntax:

```
    rgb:<red>/<green>/<blue>

        <red>, <green>, <blue> := h | hh | hhh | hhhh

        h := single hexadecimal digits
```

Note that h indicates the value scaled in 4 bits, hh the value scaled in 8 bits, hhh the value scaled in 12 bits, and hhhh the value scaled in 16 bits, respectively. These values are passed directly to the X server, and are assumed to be gamma corrected.

The eight primary colors can be represented as:

black

rgb:0/0/0

red

rgb:ffff/0/0

green

rgb:0/ffff/0

blue

rgb:0/0/ffff

yellow

rgb:ffff/ffff/0

magenta

rgb:ffff/0/ffff

cyan

rgb:0/ffff/ffff

white

rgb:ffff/ffff/ffff

For backward compatibility, an older syntax for RGB Device is supported, but its continued use is not encouraged. The syntax is an initial sharp sign character followed by a numeric specification, in one of the following formats:

\#RGB

(4 bits each)

\#RRGGBB

(8 bits each)

\#RRRGGGBBB

(12 bits each)

\#RRRRGGGGBBBB

(16 bits each)

The R, G, and B represent single hexadecimal digits. When fewer than 16 bits each are specified, they represent the most-significant bits of the value (unlike the "rgb:" syntax, in which values are scaled). For example, #3a7 is the same as #3000a0007000.

An RGB intensity specification is identified by the prefix "rgbi:" and has the following syntax:

```
    rgbi:<red>/<green>/<blue>
```

The red, green, and blue are floating point values between 0.0 and 1.0, inclusive. They represent linear intensity values, with 1.0 indicating full intensity, 0.5 half intensity, and so on. These values will be gamma corrected by Xlib before being sent to the X server. The input format for these values is an optional sign, a string of numbers possibly containing a decimal point, and an optional exponent field containing an E or e followed by a possibly signed integer string.

The standard device-independent string specifications have the following syntax:

CIEXYZ:<X>/<Y>/<Z>

(none, 1, none)

CIEuvY:<u>/<v>/<Y>

(~.6, ~.6, 1)

CIExyY:<x>/<y>/<Y>

(~.75, ~.85, 1)

CIELab:<L>/<a>/<b>

(100, none, none)

CIELuv:<L>/<u>/<v>

(100, none, none)

TekHVC:<H>/<V>/<C>

(360, 100, 100)

All of the values (C, H, V, X, Y, Z, a, b, u, v, y, x) are floating point values. Some of the values are constrained to be between zero and some upper bound; the upper bounds are given in parentheses above. The syntax for these values is an optional '+' or '-' sign, a string of digits possibly containing a decimal point, and an optional exponent field consisting of an 'E' or 'e' followed by an optional '+' or '-' followed by a string of digits.

For more information on device independent color, see the Xlib reference manual.

## KEYBOARDS
The X keyboard model is broken into two layers: server-specific codes (called keycodes) which represent the physical keys, and server-independent symbols (called keysyms) which represent the letters or words that appear on the keys. Two tables are kept in the server for converting keycodes to keysyms:

modifier list

Some keys (such as Shift, Control, and Caps Lock) are known as modifier and are used to select different symbols that are attached to a single key (such as Shift-a generates a capital A, and Control-l generates a control character ^L). The server keeps a list of keycodes corresponding to the various modifier keys. Whenever a key is pressed or released, the server generates an event that contains the keycode of the indicated key as well as a mask that specifies which of the modifier keys are currently pressed. Most servers set up this list to initially contain the various shift, control, and shift lock keys on the keyboard.

keymap table

Applications translate event keycodes and modifier masks into keysyms using a keysym table which contains one row for each keycode and one column for various modifier states. This table is initialized by the server to correspond to normal typewriter conventions. The exact semantics of how the table is interpreted to produce keysyms depends on the particular program, libraries, and language input method used, but the following conventions for the first four keysyms in each row are generally adhered to:

The first four elements of the list are split into two groups of keysyms. Group 1 contains the first and second keysyms; Group 2 contains the third and fourth keysyms. Within each group, if the first element is alphabetic and the the second element is the special keysym NoSymbol, then the group is treated as equivalent to a group in which the first element is the lowercase letter and the second element is the uppercase letter.

Switching between groups is controlled by the keysym named MODE SWITCH, by attaching that keysym to some key and attaching that key to any one of the modifiers Mod1 through Mod5. This modifier is called the ``group modifier.'' Group 1 is used when the group modifier is off, and Group 2 is used when the group modifier is on.

Within a group, the modifier state determines which keysym to use. The first keysym is used when the Shift and Lock modifiers are off. The second keysym is used when the Shift modifier is on, when the Lock modifier is on and the second keysym is uppercase alphabetic, or when the Lock modifier is on and is interpreted as ShiftLock. Otherwise, when the Lock modifier is on and is interpreted as CapsLock, the state of the Shift modifier is applied first to select a keysym; but if that keysym is lowercase alphabetic, then the corresponding uppercase keysym is used instead.

## OPTIONS
Most X programs attempt to use the same names for command line options and arguments. All applications written with the X Toolkit Intrinsics automatically accept the following options:

-display display

This option specifies the name of the X server to use.

-geometry geometry

This option specifies the initial size and location of the window.

-bg color, -background color

Either option specifies the color to use for the window background.

-bd color, -bordercolor color

Either option specifies the color to use for the window border.

-bw number, -borderwidth number

Either option specifies the width in pixels of the window border.

-fg color, -foreground color

Either option specifies the color to use for text or graphics.

-fn font, -font font

Either option specifies the font to use for displaying text.

-iconic

This option indicates that the user would prefer that the application's windows initially not be visible as if the windows had be immediately iconified by the user. Window managers may choose not to honor the application's request.

-name

This option specifies the name under which resources for the application should be found. This option is useful in shell aliases to distinguish between invocations of an application, without resorting to creating links to alter the executable file name.

-rv, -reverse

Either option indicates that the program should simulate reverse video if possible, often by swapping the foreground and background colors. Not all programs honor this or implement it correctly. It is usually only used on monochrome displays.

+rv

This option indicates that the program should not simulate reverse video. This is used to override any defaults since reverse video doesn't always work properly.

-selectionTimeout

This option specifies the timeout in milliseconds within which two communicating applications must respond to one another for a selection request.

-synchronous

This option indicates that requests to the X server should be sent synchronously, instead of asynchronously. Since Xlib normally buffers requests to the server, errors do not necessarily get reported immediately after they occur. This option turns off the buffering so that the application can be debugged. It should never be used with a working program.

-title string

This option specifies the title to be used for this window. This information is sometimes used by a window manager to provide some sort of header identifying the window.

-xnllanguage language[_territory][.codeset]

This option specifies the language, territory, and codeset for use in resolving resource and other filenames.

-xrm resourcestring

This option specifies a resource name and value to override any defaults. It is also very useful for setting resources that don't have explicit command line arguments.

## RESOURCES
To make the tailoring of applications to personal preferences easier, X provides a mechanism for storing default values for program resources (e.g. background color, window title, etc.) that is used by programs that use toolkits based on the X Toolkit Intrinsics library libXt. (Programs using the common Gtk+ and Qt toolkits use other configuration mechanisms.) Resources are specified as strings that are read in from various places when an application is run. Program components are named in a hierarchical fashion, with each node in the hierarchy identified by a class and an instance name. At the top level is the class and instance name of the application itself. By convention, the class name of the application is the same as the program name, but with the first letter capitalized (e.g. Bitmap or Emacs) although some programs that begin with the letter ``x'' also capitalize the second letter for historical reasons.

The precise syntax for resources is:

```
ResourceLine    =       Comment | IncludeFile | ResourceSpec | <empty line>
Comment         =       "!" {<any character except null or newline>}
IncludeFile     =       "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace
FileName        =       <valid filename for operating system>
ResourceSpec    =       WhiteSpace ResourceName WhiteSpace ":" WhiteSpace Value
ResourceName    =       [Binding] {Component Binding} ComponentName
Binding         =       "." | "*"
WhiteSpace      =       {<space> | <horizontal tab>}
Component       =       "?" | ComponentName
ComponentName   =       NameChar {NameChar}
NameChar        =       "a"-"z" | "A"-"Z" | "0"-"9" | "_" | "-"
Value           =       {<any character except null or unescaped newline>}
```

Elements separated by vertical bar (|) are alternatives. Curly braces ({...}) indicate zero or more repetitions of the enclosed elements. Square brackets ([...]) indicate that the enclosed element is optional. Quotes ("...") are used around literal characters.

IncludeFile lines are interpreted by replacing the line with the contents of the specified file. The word "include" must be in lowercase. The filename is interpreted relative to the directory of the file in which the line occurs (for example, if the filename contains no directory or contains a relative directory specification).

If a ResourceName contains a contiguous sequence of two or more Binding characters, the sequence will be replaced with single "." character if the sequence contains only "." characters, otherwise the sequence will be replaced with a single "*" character.

A resource database never contains more than one entry for a given ResourceName. If a resource file contains multiple lines with the same ResourceName, the last line in the file is used.

Any whitespace character before or after the name or colon in a ResourceSpec are ignored. To allow a Value to begin with whitespace, the two-character sequence ``\space'' (backslash followed by space) is recognized and replaced by a space character, and the two-character sequence ``\tab'' (backslash followed by horizontal tab) is recognized and replaced by a horizontal tab character. To allow a Value to contain embedded newline characters, the two-character sequence ``\n'' is recognized and replaced by a newline character. To allow a Value to be broken across multiple lines in a text file, the two-character sequence ``\newline'' (backslash followed by newline) is recognized and removed from the value. To allow a Value to contain arbitrary character codes, the four-character sequence ``\nnn'', where each n is a digit character in the range of ``0''-``7'', is recognized and replaced with a single byte that contains the octal value specified by the sequence. Finally, the two-character sequence ``\\'' is recognized and replaced with a single backslash.

When an application looks for the value of a resource, it specifies a complete path in the hierarchy, with both class and instance names. However, resource values are usually given with only partially specified names and classes, using pattern matching constructs. An asterisk (*) is a loose binding and is used to represent any number of intervening components, including none. A period (.) is a tight binding and is used to separate immediately adjacent components. A question mark (?) is used to match any single component name or class. A database entry cannot end in a loose binding; the final component (which cannot be "?") must be specified. The lookup algorithm searches the resource database for the entry that most closely matches (is most specific for) the full name and class being queried. When more than one database entry matches the full name and class, precedence rules are used to select just one.

The full name and class are scanned from left to right (from highest level in the hierarchy to lowest), one component at a time. At each level, the corresponding component and/or binding of each matching entry is determined, and these matching components and bindings are compared according to precedence rules. Each of the rules is applied at each level, before moving to the next level, until a rule selects a single entry over all others. The rules (in order of precedence) are:

1.

An entry that contains a matching component (whether name, class, or "?") takes precedence over entries that elide the level (that is, entries that match the level in a loose binding).

2.

An entry with a matching name takes precedence over both entries with a matching class and entries that match using "?". An entry with a matching class takes precedence over entries that match using "?".

3.

An entry preceded by a tight binding takes precedence over entries preceded by a loose binding.

Programs based on the X Toolkit Intrinsics obtain resources from the following sources (other programs usually support some subset of these sources):

RESOURCE_MANAGER root window property

Any global resources that should be available to clients on all machines should be stored in the RESOURCE_MANAGER property on the root window of the first screen using the xrdb program. This is frequently taken care of when the user starts up X through the display manager or xinit.

SCREEN_RESOURCES root window property

Any resources specific to a given screen (e.g. colors) that should be available to clients on all machines should be stored in the SCREEN_RESOURCES property on the root window of that screen. The xrdb program will sort resources automatically and place them in RESOURCE_MANAGER or SCREEN_RESOURCES, as appropriate.

application-specific files

Directories named by the environment variable XUSERFILESEARCHPATH or the environment variable XAPPLRESDIR (which names a single directory and should end with a '/' on POSIX systems), plus directories in a standard place (usually under /usr/share/X11/, but this can be overridden with the XFILESEARCHPATH environment variable) are searched for for application-specific resources. For example, application default resources are usually kept in /usr/share/X11/app-defaults/. See the X Toolkit Intrinsics - C Language Interface manual for details.

XENVIRONMENT

Any user- and machine-specific resources may be specified by setting the XENVIRONMENT environment variable to the name of a resource file to be loaded by all applications. If this variable is not defined, a file named $HOME/.Xdefaults-hostname is looked for instead, where hostname is the name of the host where the application is executing.

-xrm resourcestring

Resources can also be specified from the command line. The resourcestring is a single resource name and value as shown above. Note that if the string contains characters interpreted by the shell (e.g., asterisk), they must be quoted. Any number of -xrm arguments may be given on the command line.

Program resources are organized into groups called classes, so that collections of individual resources (each of which are called instances) can be set all at once. By convention, the instance name of a resource begins with a lowercase letter and class name with an upper case letter. Multiple word resources are concatenated with the first letter of the succeeding words capitalized. Applications written with the X Toolkit Intrinsics will have at least the following resources:

background (class Background)

This resource specifies the color to use for the window background.

borderWidth (class BorderWidth)

This resource specifies the width in pixels of the window border.

borderColor (class BorderColor)

This resource specifies the color to use for the window border.

Most applications using the X Toolkit Intrinsics also have the resource foreground (class Foreground), specifying the color to use for text and graphics within the window.

By combining class and instance specifications, application preferences can be set quickly and easily. Users of color displays will frequently want to set Background and Foreground classes to particular defaults. Specific color instances such as text cursors can then be overridden without having to define all of the related resources. For example,

```
    bitmap*Dashed:  off

    XTerm*cursorColor:  gold

    XTerm*multiScroll:  on

    XTerm*jumpScroll:  on

    XTerm*reverseWrap:  on

    XTerm*curses:  on

    XTerm*Font:  6x10

    XTerm*scrollBar: on

    XTerm*scrollbar*thickness: 5

    XTerm*multiClickTime: 500

    XTerm*charClass:  33:48,37:48,45-47:48,64:48

    XTerm*cutNewline: off

    XTerm*cutToBeginningOfLine: off

    XTerm*titeInhibit:  on

    XTerm*ttyModes:  intr ^c erase ^? kill ^u

    XLoad*Background: gold

    XLoad*Foreground: red

    XLoad*highlight: black

    XLoad*borderWidth: 0

    emacs*Geometry:  80x65-0-0

    emacs*Background:  rgb:5b/76/86

    emacs*Foreground:  white

    emacs*Cursor:  white

    emacs*BorderColor:  white

    emacs*Font:  6x10

    xmag*geometry: -0-0

    xmag*borderColor:  white
```

If these resources were stored in a file called .Xresources in your home directory, they could be added to any existing resources in the server with the following command:

```
    % xrdb -merge $HOME/.Xresources
```

This is frequently how user-friendly startup scripts merge user-specific defaults into any site-wide defaults. All sites are encouraged to set up convenient ways of automatically loading resources. See the Xlib manual section Resource Manager Functions for more information.

## ENVIRONMENT
DISPLAY

This is the only mandatory environment variable. It must point to an X server. See section "Display Names" above.

XAUTHORITY

This must point to a file that contains authorization data. The default is $HOME/.Xauthority. See Xsecurity(7), xauth(1), xdm(1), Xau(3).

ICEAUTHORITY

This must point to a file that contains authorization data. The default is $HOME/.ICEauthority.

LC_ALL, LC_CTYPE, LANG

The first non-empty value among these three determines the current locale's facet for character handling, and in particular the default text encoding. See locale(7), setlocale(3), locale(1).

XMODIFIERS

This variable can be set to contain additional information important for the current locale setting. Typically set to @im=<input-method> to enable a particular input method. See XSetLocaleModifiers(3).

XLOCALEDIR

This must point to a directory containing the locale.alias file and Compose and XLC_LOCALE file hierarchies for all locales. The default value is /usr/share/X11/locale.

XENVIRONMENT

This must point to a file containing X resources. The default is $HOME/.Xdefaults-<hostname>. Unlike $HOME/.Xresources, it is consulted each time an X application starts.

XFILESEARCHPATH

This must contain a colon separated list of path templates, where libXt will search for resource files. The default value consists of

```
    /etc/X11/%L/%T/%N%C%S:\

    /etc/X11/%l/%T/%N%C%S:\

    /etc/X11/%T/%N%C%S:\

    /etc/X11/%L/%T/%N%S:\

    /etc/X11/%l/%T/%N%S:\

    /etc/X11/%T/%N%S:\

    /usr/share/X11/%L/%T/%N%C%S:\

    /usr/share/X11/%l/%T/%N%C%S:\

    /usr/share/X11/%T/%N%C%S:\

    /usr/share/X11/%L/%T/%N%S:\

    /usr/share/X11/%l/%T/%N%S:\

    /usr/share/X11/%T/%N%S:\

    /usr/lib/X11/%L/%T/%N%C%S:\

    /usr/lib/X11/%l/%T/%N%C%S:\

    /usr/lib/X11/%T/%N%C%S:\

    /usr/lib/X11/%L/%T/%N%S:\

    /usr/lib/X11/%l/%T/%N%S:\

    /usr/lib/X11/%T/%N%S
```

A path template is transformed to a pathname by substituting:

```
    %D => the implementation-specific default path

    %N => name (basename) being searched for

    %T => type (dirname) being searched for

    %S => suffix being searched for

    %C => value of the resource "customization"

          (class "Customization")

    %L => the locale name

    %l => the locale's language (part before '_')

    %t => the locale's territory (part after '_` but before '.')

    %c => the locale's encoding (part after '.')
```

XUSERFILESEARCHPATH

This must contain a colon separated list of path templates, where libXt will search for user dependent resource files. The default value is:

```
    $XAPPLRESDIR/%L/%N%C:\

    $XAPPLRESDIR/%l/%N%C:\

    $XAPPLRESDIR/%N%C:\

    $HOME/%N%C:\

    $XAPPLRESDIR/%L/%N:\

    $XAPPLRESDIR/%l/%N:\

    $XAPPLRESDIR/%N:\

    $HOME/%N
```

$XAPPLRESDIR defaults to $HOME, see below.

A path template is transformed to a pathname by substituting:

```
    %D => the implementation-specific default path

    %N => name (basename) being searched for

    %T => type (dirname) being searched for

    %S => suffix being searched for

    %C => value of the resource "customization"

          (class "Customization")

    %L => the locale name

    %l => the locale's language (part before '_')

    %t => the locale's territory (part after '_` but before '.')

    %c => the locale's encoding (part after '.')
```

XAPPLRESDIR

This must point to a base directory where the user stores the application dependent resource files. The default value is $HOME. Only used if XUSERFILESEARCHPATH is not set.

XKEYSYMDB

This must point to a file containing nonstandard keysym definitions. The default value is /usr/share/X11/XKeysymDB.

XCMSDB

This must point to a color name database file. The default value is /usr/lib/X11/Xcms.txt.

RESOURCE_NAME

This serves as main identifier for resources belonging to the program being executed. It defaults to the basename of pathname of the program.

SESSION_MANAGER

Denotes the session manager to which the application should connect. See xsm(1), rstart(1).

XF86BIGFONT_DISABLE

Setting this variable to a non-empty value disables the XFree86-Bigfont extension. This extension is a mechanism to reduce the memory consumption of big fonts by use of shared memory.

XKB_FORCE

XKB_DISABLE

XKB_DEBUG

_XKB_CHARSET

_XKB_LOCALE_CHARSETS

_XKB_OPTIONS_ENABLE

_XKB_LATIN1_LOOKUP

_XKB_CONSUME_LOOKUP_MODS

_XKB_CONSUME_SHIFT_AND_LOCK

_XKB_IGNORE_NEW_KEYBOARDS

_XKB_CONTROL_FALLBACK

_XKB_COMP_LED _XKB_COMP_FAIL_BEEP

These variables influence the X Keyboard Extension.

## EXAMPLES
The following is a collection of sample command lines for some of the more frequently used commands. For more information on a particular command, please refer to that command's manual page.

```
    %  xrdb $HOME/.Xresources

    %  xmodmap -e "keysym BackSpace = Delete"

    %  mkfontdir /usr/local/lib/X11/otherfonts

    %  xset fp+ /usr/local/lib/X11/otherfonts

    %  xmodmap $HOME/.keymap.km

    %  xsetroot -solid 'rgbi:.8/.8/.8'

    %  xset b 100 400 c 50 s 1800 r on

    %  xset q

    %  twm

    %  xmag

    %  xclock -geometry 48x48-0+0 -bg blue -fg white

    %  xeyes -geometry 48x48-48+0

    %  xbiff -update 20

    %  xlsfonts '*helvetica*'

    %  xwininfo -root

    %  xdpyinfo -display joesworkstation:0

    %  xhost -joesworkstation

    %  xrefresh

    %  xwd | xwud

    %  bitmap companylogo.bm 32x32

    %  xcalc -bg blue -fg magenta

    %  xterm -geometry 80x66-0-0 -name myxterm $*
```

## DIAGNOSTICS
A wide variety of error messages are generated from various programs. The default error handler in Xlib (also used by many toolkits) uses standard resources to construct diagnostic messages when errors occur. The defaults for these messages are usually stored in usr/share/X11/XErrorDB. If this file is not present, error messages will be rather terse and cryptic.

When the X Toolkit Intrinsics encounter errors converting resource strings to the appropriate internal format, no error messages are usually printed. This is convenient when it is desirable to have one set of resources across a variety of displays (e.g. color vs. monochrome, lots of fonts vs. very few, etc.), although it can pose problems for trying to determine why an application might be failing. This behavior can be overridden by the setting the StringConversionWarnings resource.

To force the X Toolkit Intrinsics to always print string conversion error messages, the following resource should be placed in the file that gets loaded onto the RESOURCE_MANAGER property using the xrdb program (frequently called .Xresources or .Xres in the user's home directory):

```
    *StringConversionWarnings: on
```

To have conversion messages printed for just a particular application, the appropriate instance name can be placed before the asterisk:

```
    xterm*StringConversionWarnings: on
```

## SEE ALSO
XOrgFoundation(7), XStandards(7), Xsecurity(7), appres(1), bdftopcf(1), bitmap(1), editres(1), fsinfo(1), fslsfonts(1), fstobdf(1), iceauth(1), imake(1), makedepend(1), mkfontdir(1), oclock(1), proxymngr(1), rgb(1), resize(1), rstart(1), smproxy(1), twm(1), x11perf(1), x11perfcomp(1), xauth(1), xclipboard(1), xclock(1), xcmsdb(1), xconsole(1), xdm(1), xdpyinfo(1), xfd(1), xfindproxy(1), xfs(1), xfwp(1), xhost(1), xinit(1), xkbbell(1), xkbcomp(1), xkbevd(1), xkbprint(1), xkbvleds(1), xkbwatch(1), xkill(1), xlogo(1), xlsatoms(1), xlsclients(1), xlsfonts(1), xmag(1), xmh(1), xmodmap(1), xprop(1), xrdb(1), xrefresh(1), xrx(1), xset(1), xsetroot(1), xsm(1), xstdcmap(1), xterm(1), xwd(1), xwininfo(1), xwud(1). Xserver(1), Xorg(1), Xdmx(1), Xephyr(1), Xnest(1), Xquartz(1), Xvfb(1), Xvnc(1), XWin(1). Xlib - C Language X Interface, and X Toolkit Intrinsics - C Language Interface

## TRADEMARKS
X Window System is a trademark of The Open Group.

## AUTHORS
A cast of thousands, literally. Releases 6.7 and later are brought to you by the X.Org Foundation. The names of all people who made it a reality will be found in the individual documents and source files.

Releases 6.6 and 6.5 were done by The X.Org Group. Release 6.4 was done by The X Project Team. The Release 6.3 distribution was from The X Consortium, Inc. The staff members at the X Consortium responsible for that release were: Donna Converse (emeritus), Stephen Gildea (emeritus), Kaleb Keithley, Matt Landau (emeritus), Ralph Mor (emeritus), Janet O'Halloran, Bob Scheifler, Ralph Swick, Dave Wiggins (emeritus), and Reed Augliere.

The X Window System standard was originally developed at the Laboratory for Computer Science at the Massachusetts Institute of Technology, and all rights thereto were assigned to the X Consortium on January 1, 1994. X Consortium, Inc. closed its doors on December 31, 1996. All rights to the X Window System have been assigned to The Open Group.


XOrgFoundation

package: xorg-docs

title: XOrgFoundation(7)

summary: X.Org Foundation information

text:
# XOrgFoundation(7)

## NAME
XOrgFoundation - X.Org Foundation information

## SYNOPSIS
Release 6.7 and later of X Version 11 is brought to you by the X.Org Foundation.

## DESCRIPTION
The X.Org Foundation is an independent, not-for-profit 501(c)(3) charity corporation. It was formed in 2004 as the successor to the X.Org Group at The Open Group. The purpose of the X.Org Foundation is to foster the development, evolution, and maintenance of the X Window System, a comprehensive set of vendor-neutral, system-architecture neutral, network-transparent windowing and user interface standards. Membership in the X.Org Foundation is free and open to anyone. The X.Org Foundation hosts a public git repository of the source code on freedesktop.org.

The X Window System was created in the mid-1980s at the Massachusetts Institute of Technology. In 1988, MIT formed a member-funded consortium to provide the technical and administrative leadership necessary to support further development of the X Window System. In 1992, MIT and the membership decided it was in their best interests to move the consortium out of MIT and create an independent, stand-alone organization. All rights to the X Window System were assigned by MIT to X Consortium, Inc. on January 1, 1994. On December 31, 1996 the X Consortium, Inc. closed its doors and all rights to the X Window System were assigned to The Open Group (then known as the Open Software Foundation).

## ADDRESSES
The X.Org Foundation's web site is http://www.x.org/

The X.Org Foundation's public ftp site is ftp://ftp.x.org/

Information about the X.Org Foundation git repository is on the X.Org web site at http://www.x.org/wiki/Development/git


XProjectTeam

title: XProjectTeam(7)

summary: X.Org Group information

text:
# XProjectTeam(7)

## NAME
X.Org, XProjectTeam - X.Org Group information

## SYNOPSIS
Release 6.5 and 6.6 of X Version 11 was brought to you by The X.Org Group. Release 6.4 of X Version 11 was brought to you by The X Project Team.

## DESCRIPTION
The Open Group's X Project Team was created as the successor to the X Consortium, Inc., after the X Consortium ceased operations and transferred ownership of X11 to The Open Group. The X.Org Group (hereinafter called "X.Org") was created as the successor to The X Project Team after the The Open Group ceased operating The X Project Team. The purpose of X.Org was to foster development, evolution, and maintenance of the X Window System. X.Org operates under the corporate umbrella of The Open Group.

The X Consortium was an independent, not-for-profit Delaware membership corporation. It was formed in 1993 as the successor to the MIT X Consortium.

The X Window System was created in the mid-1980s at the Massachusetts Institute of Technology. In 1988, MIT formed a member-funded consortium to provide the technical and administrative leadership necessary to support further development of the X Window System. In 1992, MIT and the membership decided it was in their best interests to move the consortium out of MIT and create an independent, stand-alone organization. All rights to the X Window System were assigned by MIT to X Consortium, Inc. on January 1, 1994. On December 31, 1996 the X Consortium, Inc. closed its doors and all rights to the X Window System were assigned to The Open Group.

## ADDRESS
To reach The Open Group public World Wide Web server, use http://www.opengroup.org/.

To reach The X.Org public World Wide Web server, use http://www.x.org/.

To reach The X.Org public ftp machine, use anonymous ftp at ftp://ftp.x.org/

## FULL MEMBERS

```
Attachmate
Barco
Compaq
Hewlett-Packard
Hummingbird
IBM
ICS
Metro Link
MITRE
Shiman Associates
Silicon Graphics Incorporated
Starnet Communications
Sun Microsystems
The XFree86 Project
US Navy
WRQ
Xi Graphics
```


Xsecurity

title: Xsecurity(7)

summary: X display access control

text:
# Xsecurity(7)

## NAME
Xsecurity - X display access control

## OVERVIEW
X provides mechanism for implementing many access control systems. The sample implementation includes five mechanisms:

```
    Host Access	Simple host-based access control.

    MIT-MAGIC-COOKIE-1	Shared plain-text "cookies".

    XDM-AUTHORIZATION-1	Secure DES based private-keys.

    SUN-DES-1	Based on Sun's secure rpc system.

    Server Interpreted	Server-dependent methods of access control
```

Not all of these are available in all builds or implementations.

## ACCESS SYSTEM DESCRIPTIONS
Host Access

Any client on a host in the host access control list is allowed access to the X server. This system can work reasonably well in an environment where everyone trusts everyone, or when only a single person can log in to a given machine, and is easy to use when the list of hosts used is small. This system does not work well when multiple people can log in to a single machine and mutual trust does not exist. The list of allowed hosts is stored in the X server and can be changed with the xhost command. The list is stored in the server by network address, not host names, so is not automatically updated if a host changes address while the server is running. When using the more secure mechanisms listed below, the host list is normally configured to be the empty list, so that only authorized programs can connect to the display. See the GRANTING ACCESS section of the Xserver man page for details on how this list is initialized at server startup.

MIT-MAGIC-COOKIE-1

When using MIT-MAGIC-COOKIE-1, the client sends a 128 bit "cookie" along with the connection setup information. If the cookie presented by the client matches one that the X server has, the connection is allowed access. The cookie is chosen so that it is hard to guess; xdm generates such cookies automatically when this form of access control is used. The user's copy of the cookie is usually stored in the .Xauthority file in the home directory, although the environment variable XAUTHORITY can be used to specify an alternate location. Xdm automatically passes a cookie to the server for each new login session, and stores the cookie in the user file at login.

The cookie is transmitted on the network without encryption, so there is nothing to prevent a network snooper from obtaining the data and using it to gain access to the X server. This system is useful in an environment where many users are running applications on the same machine and want to avoid interference from each other, with the caveat that this control is only as good as the access control to the physical network. In environments where network-level snooping is difficult, this system can work reasonably well.

XDM-AUTHORIZATION-1

Sites who compile with DES support can use a DES-based access control mechanism called XDM-AUTHORIZATION-1. It is similar in usage to MIT-MAGIC-COOKIE-1 in that a key is stored in the .Xauthority file and is shared with the X server. However, this key consists of two parts - a 56 bit DES encryption key and 64 bits of random data used as the authenticator.

When connecting to the X server, the application generates 192 bits of data by combining the current time in seconds (since 00:00 1/1/1970 GMT) along with 48 bits of "identifier". For TCP/IPv4 connections, the identifier is the address plus port number; for local connections it is the process ID and 32 bits to form a unique id (in case multiple connections to the same server are made from a single process). This 192 bit packet is then encrypted using the DES key and sent to the X server, which is able to verify if the requestor is authorized to connect by decrypting with the same DES key and validating the authenticator and additional data. This system is useful in many environments where host-based access control is inappropriate and where network security cannot be ensured.

SUN-DES-1

Recent versions of SunOS (and some other systems) have included a secure public key remote procedure call system. This system is based on the notion of a network principal; a user name and NIS domain pair. Using this system, the X server can securely discover the actual user name of the requesting process. It involves encrypting data with the X server's public key, and so the identity of the user who started the X server is needed for this; this identity is stored in the .Xauthority file. By extending the semantics of "host address" to include this notion of network principal, this form of access control is very easy to use.

To allow access by a new user, use xhost. For example,

```
    xhost keith@ ruth@mit.edu
```

adds "keith" from the NIS domain of the local machine, and "ruth" in the "mit.edu" NIS domain. For keith or ruth to successfully connect to the display, they must add the principal who started the server to their .Xauthority file. For example:

```
    xauth add expo.lcs.mit.edu:0 SUN-DES-1 unix.expo.lcs.mit.edu@our.domain.edu
```

This system only works on machines which support Secure RPC, and only for users which have set up the appropriate public/private key pairs on their system. See the Secure RPC documentation for details. To access the display from a remote host, you may have to do a keylogin on the remote host first.

Server Interpreted

The Server Interpreted method provides two strings to the X server for entry in the access control list. The first string represents the type of entry, and the second string contains the value of the entry. These strings are interpreted by the server and different implementations and builds may support different types of entries. The types supported in the sample implementation are defined in the SERVER INTERPRETED ACCESS TYPES section below. Entries of this type can be manipulated via xhost. For example to add a Server Interpreted entry of type localuser with a value of root, the command is xhost +si:localuser:root.

## THE AUTHORIZATION FILE
Except for Host Access control and Server Interpreted Access Control, each of these systems uses data stored in the .Xauthority file to generate the correct authorization information to pass along to the X server at connection setup. MIT-MAGIC-COOKIE-1 and XDM-AUTHORIZATION-1 store secret data in the file; so anyone who can read the file can gain access to the X server. SUN-DES-1 stores only the identity of the principal who started the server (unix.hostname@domain when the server is started by xdm), and so it is not useful to anyone not authorized to connect to the server.

Each entry in the .Xauthority file matches a certain connection family (TCP/IP, DECnet or local connections) and X display name (hostname plus display number). This allows multiple authorization entries for different displays to share the same data file. A special connection family (FamilyWild, value 65535) causes an entry to match every display, allowing the entry to be used for all connections. Each entry additionally contains the authorization name and whatever private authorization data is needed by that authorization type to generate the correct information at connection setup time.

The xauth program manipulates the .Xauthority file format. It understands the semantics of the connection families and address formats, displaying them in an easy to understand format. It also understands that SUN-DES-1 uses string values for the authorization data, and displays them appropriately.

The X server (when running on a workstation) reads authorization information from a file name passed on the command line with the -auth option (see the Xserver manual page). The authorization entries in the file are used to control access to the server. In each of the authorization schemes listed above, the data needed by the server to initialize an authorization scheme is identical to the data needed by the client to generate the appropriate authorization information, so the same file can be used by both processes. This is especially useful when xinit is used.

MIT-MAGIC-COOKIE-1

This system uses 128 bits of data shared between the user and the X server. Any collection of bits can be used. Xdm generates these keys using a cryptographically secure pseudo random number generator, and so the key to the next session cannot be computed from the current session key.

XDM-AUTHORIZATION-1

This system uses two pieces of information. First, 64 bits of random data, second a 56 bit DES encryption key (again, random data) stored in 8 bytes, the last byte of which is ignored. Xdm generates these keys using the same random number generator as is used for MIT-MAGIC-COOKIE-1.

SUN-DES-1

This system needs a string representation of the principal which identifies the associated X server. This information is used to encrypt the client's authority information when it is sent to the X server. When xdm starts the X server, it uses the root principal for the machine on which it is running (unix.hostname@domain, e.g., "unix.expire.lcs.mit.edu@our.domain.edu"). Putting the correct principal name in the .Xauthority file causes Xlib to generate the appropriate authorization information using the secure RPC library.

## SERVER INTERPRETED ACCESS TYPES
The sample implementation includes several Server Interpreted mechanisms:

```
    IPv6	IPv6 literal addresses

    hostname	Network host name

    localuser	Local connection user id

    localgroup	Local connection group id
```

IPv6

A literal IPv6 address as defined in IETF RFC 3513. This allows adding IPv6 addresses when the X server supports IPv6, but the xhost client was compiled without IPv6 support.

hostname

The value must be a hostname as defined in IETF RFC 2396. Due to Mobile IP and dynamic DNS, the name service is consulted at connection authentication time, unlike the traditional host access control list which only contains numeric addresses and does not automatically update when a host's address changes. Note that this definition of hostname does not allow use of literal IP addresses.

localuser & localgroup

On systems which can determine in a secure fashion the credentials of a client process, the "localuser" and "localgroup" authentication methods provide access based on those credentials. The format of the values provided is platform specific. For POSIX & UNIX platforms, if the value starts with the character '#', the rest of the string is treated as a decimal uid or gid, otherwise the string is defined as a user name or group name.

If your system supports this method and you use it, be warned that some programs that proxy connections and are setuid or setgid may get authenticated as the uid or gid of the proxy process. For instance, some versions of ssh will be authenticated as the user root, no matter what user is running the ssh client, so on systems with such software, adding access for localuser:root may allow wider access than intended to the X display.

## FILES
.Xauthority

## SEE ALSO
X(7), xdm(1), xauth(1), xhost(1), xinit(1), Xserver(1)


xymon

package: xymon-man

title: xymon(7)

summary: Introduction to Xymon

text:
# xymon(7)

## NAME
Xymon - Introduction to Xymon

## OVERVIEW
Xymon is a tool for monitoring the health of your networked servers and the applications running on them. It provides a simple, intuitive way of checking the health of your systems from a web browser, and can also alert you to any problems that arise through alarms sent as e-mail, SMS messages, via a pager or by other means.

Xymon is Open Source software, licensed under the GNU GPL. This means that you are free to use Xymon as much as you like, and you are free to re-distribute it and change it to suit your specific needs. However, if you change it then you must make your changes available to others on the same terms that you received Xymon originally. See the file COPYING in the Xymon source-archive for details.

Xymon was called "Hobbit" until November 2008, when it was renamed to Xymon. This was done because the name "Hobbit" is trademarked.

Xymon initially began life as an enhancement to Big Brother called "bbgen". Over a period of 5 years, Xymon has evolved from a small add-on to a full-fledged monitoring system with capabilities far exceeding what was in the original Big Brother package. Xymon does still maintain some compatibility with Big Brother, so it is possible to migrate from Big Brother to Xymon without too much trouble.

Migrating to Xymon will give you a significant performance boost, and provide you with much more advanced monitoring. The Xymon tools are designed for installations that need to monitor a large number of hosts, with very little overhead on the monitoring server. Monitoring of thousands of hosts with a single Xymon server is possible - it was developed to handle just this task.

## FEATURES
These are some of the core features in Xymon:

Monitoring of hosts and networks

Xymon collects information about your systems in two ways: From querying network services (Web, LDAP, DNS, Mail etc.), or from scripts that run either on the Xymon server or on the systems you monitor. The Xymon package includes a Xymon client which you can install on the servers you monitor; it collects data about the CPU-load, disk- and memory-utilization, log files, network ports in use, file- and directory-information and more. All of the information is stored inside Xymon, and you can define conditions that result in alerts, e.g. if a network service stops responding, or a disk fills up.

Centralized configuration

All configuration of Xymon is done on the Xymon server. Even when monitoring hundreds or thousands of hosts, you can control their configuration centrally on the Xymon server - so there is no need for you to login to a system just to change e.g. which processes are monitored.

Works on all major platforms

The Xymon server works on all Unix-like systems, including Linux, Solaris, FreeBSD, AIX, HP-UX and others. The Xymon client supports all major Unix platforms, and there are other Open Source projects - e.g. BBWin, see http://bbwin.sourceforge.net/ - providing support for Microsoft Windows based systems.

A simple, intuitive web-based front-end

"Green is good, red is bad". Using the Xymon web pages is as simple as that. The hosts you monitor can be grouped together in a way that makes sense in your organisation and presented in a tree-structure. The web pages use many techniques to convey information about the monitored systems, e.g. different icons can be used for recently changed statuses; links to sub-pages can be listed in multiple columns; different icons can be used for dial-up-tests or reverse-tests; selected columns can be dropped or unconditionally included on the web pages to eliminate unwanted information, or always include certain information; user-friendly names can be shown for hosts regardless of their true hostname. You can also have automatic links to on-line documentation, so information about your critical systems is just a click away.

Integrated trend analysis, historical data and SLA reporting

Xymon stores trend- and availability-information about everything it monitors. So if you need to look at how your systems behave over time, Xymon has all of the information you need: Whether it is response times of your web pages during peak hours, the CPU utilization over the past 4 weeks, or what the availability of a site was compared to the SLA - it's all there inside Xymon. All measurements are tracked and made available in time-based graphs. When you need to drill down into events that have occurred, Xymon provides a powerful tool for viewing the event history for each status log, with overviews of when problems have occurred during the past and easy-to-use zoom-in on the event.

For SLA reporting, You can configure planned downtime, agreed service availability level, service availability time and have Xymon generate availability reports directly showing the actual availability measured against the agreed SLA. Such reports of service availability can be generated on-the-fly, or pre-generated e.g. for monthly reporting.

Role-based views

You can have multiple different views of the same hosts for different parts of the organisation, e.g. one view for the hardware group, and another view for the webmasters - all of them fed by the same test tools. If you have a dedicated Network Operations Center, you can configure precisely which alerts will appear on their monitors - e.g. a simple anomaly in the system log file need not trigger a call to 3rd-level support at 2 AM, but if the on-line shop goes down you do want someone to respond immediately. So you put the web-check for the on-line shop on the NOC monitor page, and leave out the log-file check.

Also for the techies

The Xymon user-interface is simple, but engineers will also find lots of relevant information. E.g. the data that clients report to Xymon contain the raw output from a number of system commands. That information is available directly in Xymon, so an administrator no longer needs to login to a server to get an overview of how it is behaving - the very commands they would normally run have already been performed, and the results are on-line in Xymon.

Easy to adapt to your needs

Xymon includes a lot of tests in the core package, but there will always be something specific to your setup that you would like to watch. Xymon allows you to write test scripts in your favorite scripting language and have the results show up as regular status columns in Xymon. You can trigger alerts from these, and even track trends in graphs just by a simple configuration setting.

Real network service tests

The network test tool knows how to test most commonly used protocols, including HTTP, SMTP (e-mail), DNS, LDAP (directory services), and many more. When checking websites, it is possible to not only check that the web server is responding, but also that the response looks correct by matching the response against a pre-defined pattern or a check-sum. So you can test that a network service is really working and supplying the data you expect - not just that the service is running. Protocols that use SSL encryption such as https web sites are fully supported, and while checking such services the network tester will automatically run a check of the validity of the SSL server certificate, and warn about certificates that are about to expire.

Highly configurable alerts

You want to know when something breaks. But you don't want to get flooded with alerts all the time. Xymon lets you define several criteria for when to send out an alert, so you only get alerts when there is really something that needs your attention right away. While you are handling an incident, you can tell Xymon about it so it stops sending more alerts, and so that everyone else can check with Xymon and know that the problem is being taken care of.

Combined super-tests and test inter-dependencies

If a single test is not enough, combination tests can be defined that combine the result of several tests to a single status-report. So if you need to monitor that at least 3 out of 5 servers are running at any time, Xymon can do that for you and generate the necessary availability report. Tests can also be configured to depend on each other, so that when a critical router goes down you will get alerts only for the router - and not from the 200 hosts behind the router.

## SECURITY
All of the Xymon server tools run under an unprivileged user account. A single program - the xymonping(1) network connectivity tester - must be installed setuid-root, but has been written so that it drops all root privileges immediately after performing the operation that requires root privileges.

It is recommended that you setup a dedicated account for Xymon.

Communications between the Xymon server and Xymon clients use the Big Brother TCP port 1984. If the Xymon server is located behind a firewall, it must allow for inbound connections to the Xymon server on tcp port 1984. Normally, Xymon clients - i.e. the servers you are monitoring - must be permitted to connect to the Xymon server on this port. However, if that is not possible due to firewall policies, then Xymon includes the xymonfetch(8) and msgcache(8) tools to allows for a pull-style way of collecting data, where it is the Xymon server that initiates connections to the clients.

The Xymon web pages are dynamically generated through CGI programs.

Access to the Xymon web pages is controlled through your web server access controls, e.g. you can require a login through some form of HTTP authentication.

## DEMONSTRATION SITE
A site running this software can be seen at http://www.xymon.com/

## PREREQUISITES AND INSTALLATION
You will need a Unix-like system (Linux, Solaris, HP-UX, AIX, FreeBSD, Mac OS X or similar) with a web server installed. You will also need a C compiler and some additional libraries, but many systems come with the required development tools and libraries pre-installed. The required libraries are:

RRDtool This library is used to store and present trend-data. It is required.

libpcre This library is used for advanced pattern-matching of text strings in configuration files. This library is required.

OpenSSL This library is used for communication with SSL-enabled network services. Although optional, it is recommended that you install this for Xymon since many network tests do use SSL.

OpenLDAP This library is used for testing LDAP servers. Use of this is optional.

For more detailed information about Xymon system requirements and how to install Xymon, refer to the on-line documentation "Installing Xymon" available from the Xymon web server (via the "Help" menu), or from the "docs/install.html" file in the Xymon source archive.

## SUPPORT and MAILING LISTS
xymon@xymon.com is an open mailing list for discussions about Xymon. If you would like to participate, send an e-mail to xymon-subscribe@xymon.com to join the list, or visit http://lists.xymon.com/mailman/listinfo/xymon .

An archive of the mailing list is available at http://lists.xymon.com/archive/

If you just want to be notified of new releases of Xymon, please subscribe to the xymon-announce mailing list. This is a moderated list, used only for announcing new Xymon releases. To be added to the list, send an e-mail to xymon-announce-subscribe@xymon.com or visit http://lists.xymon.com/mailman/listinfo/xymon-announce .

## XYMON SERVER TOOLS
These tools implement the core functionality of the Xymon server:

xymond(8) is the core daemon that collects all reports about the status of your hosts. It uses a number of helper modules to implement certain tasks such as updating log files and sending out alerts: xymond_client, xymond_history, xymond_alert and xymond_rrd. There is also a xymond_filestore module for compatibility with Big Brother.

xymond_channel(8) Implements the communication between the Xymon daemon and the other Xymon server modules.

xymond_history(8) Stores historical data about the things that Xymon monitors.

xymond_rrd(8) Stores trend data, which is used to generate graphs of the data monitored by Xymon.

xymond_alert(8) handles alerts. When a status changes to a critical state, this module decides if an alert should be sent out, and to whom.

xymond_client(8) handles data collected by the Xymon clients, analyzes the data and feeds back several status updates to Xymon to build the view of the client status.

xymond_hostdata(8) stores historical client data when something breaks. E.g. when a web page stops responding xymond_hostdata will save the latest client data, so that you can use this to view a snapshot of how the system state was just prior to it failing.

## XYMON NETWORK TEST TOOLS
These tools are used on servers that execute tests of network services.

xymonping(1) performs network connectivity (ping) tests.

xymonnet(1) runs the network service tests.

xymonnet-again.sh(1) is an extension script for re-doing failed network tests with a higher frequency than the normal network tests. This allows Xymon to pick up the recovery of a network service as soon as it happens, resulting in less downtime being recorded.

## XYMON TOOLS HANDLING THE WEB USER-INTERFACE
These tools take care of generating and updating the various Xymon web-pages.

xymongen(1) takes care of updating the Xymon web pages.

svcstatus.cgi(1) This CGI program generates an HTML view of a single status log. It is used to present the Xymon status-logs.

showgraph.cgi(1) This CGI program generates graphs of the trend-data collected by Xymon.

hostgraphs.cgi(1) When you want to combine multiple graphs into one, this CGI lets you combine graphs so you can e.g. compare the load on all of the nodes in your server farm.

criticalview.cgi(1) Generates the Critical Systems view, based on the currently critical systems and the configuration of what systems and services you want to monitor when.

history.cgi(1) This CGI program generates a web page with the most recent history of a particular host+service combination.

eventlog.cgi(1) This CGI lets you view a log of events that have happened over a period of time, for a single host or test, or for multiple systems.

ack.cgi(1) This CGI program allows a user to acknowledge an alert he received from Xymon about a host that is in a critical state. Acknowledging an alert serves two purposes: First, it stops more alerts from being sent so the technicians are not bothered wit more alerts, and secondly it provides feedback to those looking at the Xymon web pages that the problem is being handled.

xymon-mailack(8) is a tool for processing acknowledgments sent via e-mail, e.g. as a response to an e-mail alert.

enadis.cgi(8) is a CGI program to disable or re-enable hosts or individual tests. When disabling a host or test, you stop alarms from being sent and also any outages do not affect the SLA calculations. So this tool is useful when systems are being brought down for maintenance.

findhost.cgi(1) is a CGI program that finds a given host in the Xymon web pages. As your Xymon installation grows, it can become difficult to remember exactly which page a host is on; this CGI script lets you find hosts easily.

report.cgi(1) This CGI program triggers the generation of Xymon availability reports, using xymongen(1) as the reporting back-end engine.

reportlog.cgi(1) This CGI program generates the detailed availability report for a particular host+service combination.

snapshot.cgi(1) is a CGI program to build the Xymon web pages in a "snapshot" mode, showing the look of the web pages at a particular point in time. It uses xymongen(1) as the back-end engine.

statusreport.cgi(1) is a CGI program reporting test results for a single status but for several hosts. It is used to e.g. see which SSL certificates are about to expire, across all of the Xymon web pages.

csvinfo.cgi(1) is a CGI program to present information about a host. The information is pulled from a CSV (Comma Separated Values) file, which is easily exported from any spreadsheet or database program.

## CLIENT-SIDE TOOLS
logfetch(1) is a utility used by the Xymon Unix client to collect information from log files on the client. It can also monitor various other file-related data, e.g. file meta-data or directory sizes.

clientupdate(1) Is used on Xymon clients, to automatically update the client software with new versions. Through this tool, updates of the client software can happen without an administrator having to logon to the server.

msgcache(8) This tool acts as a mini Xymon server to the client. It stores client data internally, so that the xymonfetch(8) utility can pick it up later and send it to the Xymon server. It is typically used on hosts that cannot contact the Xymon server directly due to network- or firewall-restrictions.

## XYMON COMMUNICATION TOOLS
These tools are used for communications between the Xymon server and the Xymon clients. If there are no firewalls then they are not needed, but it may be necessary due to network or firewall issues to make use of them.

xymonproxy(8) is a proxy-server that forwards Xymon messages between clients and the Xymon server. The clients must be able to talk to the proxy, and the proxy must be able to talk to the Xymon server.

xymonfetch(8) is used when the client is not able to make outbound connections to neither xymonproxy nor the Xymon server (typically, for clients located in a DMZ network zone). Together with the msgcache(8) utility running on the client, the Xymon server can contact the clients and pick up their data.

## OTHER TOOLS
xymonlaunch(8) is a program scheduler for Xymon. It acts as a master program for running all of the Xymon tools on a system. On the Xymon server, it controls running all of the server tasks. On a Xymon client, it periodically launches the client to collect data and send them to the Xymon server.

xymon(1) is the tool used to communicate with the Xymon server. It is used to send status reports to the Xymon server, through the custom Xymon/BB protocol, or via HTTP. It can be used to query the state of tests on the central Xymon server and retrieve Xymon configuration files. The server-side script xymoncgimsg.cgi(1) used to receive messages sent via HTTP is also included.

xymoncmd(1) is a wrapper for the other Xymon tools which sets up all of the environment variables used by Xymon tools.

xymongrep(1) is a utility for use by Xymon extension scripts. It allows an extension script to easily pick out the hosts that are relevant to a script, so it need not parse a huge hosts.cfg file with lots of unwanted test-specifications.

xymoncfg(1) is a utility to dump the full hosts.cfg(5) file following any "include" statements.

xymondigest(1) is a utility to compute message digest values for use in content checks that use digests.

combostatus(1) is an extension script for the Xymon server, allowing you to build complicated tests from simpler Xymon test results. E.g. you can define a test that uses the results from testing your web server, database server and router to have a single test showing the availability of your enterprise web application.

trimhistory(8) is a tool to trim the Xymon history logs. It will remove all log entries and optionally also the individual status-logs for events that happened before a given time.

## VERSIONS
Version 1 of bbgen was released in November 2002, and optimized the web page generation on Big Brother servers.

Version 2 of bbgen was released in April 2003, and added a tool for performing network tests.

Version 3 of bbgen was released in September 2004, and eliminated the use of several external libraries for network tests, resulting in a significant performance improvement.

With version 4.0 released on March 30 2005, the project was de-coupled from Big Brother, and the name changed to Hobbit. This version was the first full implementation of the Hobbit server, but it still used the data collected by Big Brother clients for monitoring host metrics.

Version 4.1 was released in July 2005 included a simple client for Unix. Log file monitoring was not implemented.

Version 4.2 was released in July 2006, and includes a fully functional client for Unix.

Version 4.3 was released in November 2010, and implemented the renaming of the project to Xymon. This name was already introduced in 2008 with a patch version of 4.2, but with version 4.3.0 this change of names was fully implemented.

## COPYRIGHT
Xymon is

Copyright (C) 2002-2011 Henrik Storner <henrik@storner.dk>

Parts of the Xymon sources are from public-domain or other freely available sources. These are the the Red-Black tree implementation, and the MD5-, SHA1- and RIPEMD160-implementations. Details of the license for these is in the README file included with the Xymon sources. All other files are released under the GNU General Public License version 2, with the additional exemption that compiling, linking, and/or using OpenSSL is allowed. See the file COPYING for details.

## SEE ALSO
xymond(8), xymond_channel(8), xymond_history(8), xymond_rrd(8), xymond_alert(8), xymond_client(8), xymond_hostdata(8), xymonping(1), xymonnet(1), xymonnet-again.sh(1), xymongen(1), svcstatus.cgi(1), showgraph.cgi(1), hostgraphs.cgi(1), criticalview.cgi(1), history.cgi(1), eventlog.cgi(1), ack.cgi(1), xymon-mailack(8), enadis.cgi(8), findhost.cgi(1), report.cgi(1), reportlog.cgi(1), snapshot.cgi(1), statusreport.cgi(1), csvinfo.cgi(1), logfetch(1), clientupdate(1), msgcache(8), xymonproxy(8), xymonfetch(8), xymonlaunch(8), xymon(1), xymoncgimsg.cgi(1), xymoncmd(1), xymongrep(1), xymoncfg(1), xymondigest(1), combostatus(1), trimhistory(8), hosts.cfg(5), tasks.cfg(5), xymonserver.cfg(5), alerts.cfg(5), analysis.cfg(5), client-local.cfg(5)


package: yasm

title: yasm_arch(7)

summary: Yasm Supported Target Architectures

text:
# yasm_arch(7)

## NAME
yasm_arch - Yasm Supported Target Architectures

## SYNOPSIS
yasm -a arch [-m machine] ...

## DESCRIPTION
The standard Yasm distribution includes a number of modules for different target architectures. Each target architecture can support one or more machine architectures.

The architecture and machine are selected on the yasm(1) command line by use of the -a arch and -m machine command line options, respectively.

The machine architecture may also automatically be selected by certain object formats. For example, the “elf32” object format selects the “x86” machine architecture by default, while the “elf64” object format selects the “amd64” machine architecture by default.

## X86 ARCHITECTURE
The “x86” architecture supports the IA-32 instruction set and derivatives and the AMD64 instruction set. It consists of two machines: “x86” (for the IA-32 and derivatives) and “amd64” (for the AMD64 and derivatives). The default machine for the “x86” architecture is the “x86” machine.

### BITS Setting
The x86 architecture BITS setting specifies to Yasm the processor mode in which the generated code is intended to execute. x86 processors can run in three different major execution modes: 16-bit, 32-bit, and on AMD64-supporting processors, 64-bit. As the x86 instruction set contains portions whose function is execution-mode dependent (such as operand-size and address-size override prefixes), Yasm cannot assemble x86 instructions correctly unless it is told by the user in what processor mode the code will execute.

The BITS setting can be changed in a variety of ways. When using the NASM-compatible parser, the BITS setting can be changed directly via the use of the BITS xx assembler directive. The default BITS setting is determined by the object format in use.

### BITS 64 Extensions
The AMD64 architecture is a new 64-bit architecture developed by AMD, based on the 32-bit x86 architecture. It extends the original x86 architecture by doubling the number of general purpose and SIMD registers, extending the arithmetic operations and address space to 64 bits, as well as other features.

Recently, Intel has introduced an essentially identical version of AMD64 called EM64T.

When an AMD64-supporting processor is executing in 64-bit mode, a number of additional extensions are available, including extra general purpose registers, extra SSE2 registers, and RIP-relative addressing.

Yasm extends the base NASM syntax to support AMD64 as follows. To enable assembly of instructions for the 64-bit mode of AMD64 processors, use the directive BITS 64. As with NASM's BITS directive, this does not change the format of the output object file to 64 bits; it only changes the assembler mode to assume that the instructions being assembled will be run in 64-bit mode. To specify an AMD64 object file, use -m amd64 on the Yasm command line, or explicitly target a 64-bit object format such as -f win64 or -f elf64. -f elfx32 can be used to select 32-bit ELF object format for AMD64 processors.

Register Changes

The additional 64-bit general purpose registers are named r8-r15. There are also 8-bit (rXb), 16-bit (rXw), and 32-bit (rXd) subregisters that map to the least significant 8, 16, or 32 bits of the 64-bit register. The original 8 general purpose registers have also been extended to 64-bits: eax, edx, ecx, ebx, esi, edi, esp, and ebp have new 64-bit versions called rax, rdx, rcx, rbx, rsi, rdi, rsp, and rbp respectively. The old 32-bit registers map to the least significant bits of the new 64-bit registers.

New 8-bit registers are also available that map to the 8 least significant bits of rsi, rdi, rsp, and rbp. These are called sil, dil, spl, and bpl respectively. Unfortunately, due to the way instructions are encoded, these new 8-bit registers are encoded the same as the old 8-bit registers ah, dh, ch, and bh. The processor tells which is being used by the presence of the new REX prefix that is used to specify the other extended registers. This means it is illegal to mix the use of ah, dh, ch, and bh with an instruction that requires the REX prefix for other reasons. For instance:

```
add ah, [r10]
```

(NASM syntax) is not a legal instruction because the use of r10 requires a REX prefix, making it impossible to use ah.

In 64-bit mode, an additional 8 SSE2 registers are also available. These are named xmm8-xmm15.

64 Bit Instructions

By default, most operations in 64-bit mode remain 32-bit; operations that are 64-bit usually require a REX prefix (one bit in the REX prefix determines whether an operation is 64-bit or 32-bit). Thus, essentially all 32-bit instructions have a 64-bit version, and the 64-bit versions of instructions can use extended registers “for free” (as the REX prefix is already present). Examples in NASM syntax:

```
mov eax, 1  ; 32-bit instruction
```

```
mov rcx, 1  ; 64-bit instruction
```

Instructions that modify the stack (push, pop, call, ret, enter, and leave) are implicitly 64-bit. Their 32-bit counterparts are not available, but their 16-bit counterparts are. Examples in NASM syntax:

```
push eax  ; illegal instruction
```

```
push rbx  ; 1-byte instruction
```

```
push r11  ; 2-byte instruction with REX prefix
```

Implicit Zero Extension

Results of 32-bit operations are implicitly zero-extended to the upper 32 bits of the corresponding 64-bit register. 16 and 8 bit operations, on the other hand, do not affect upper bits of the register (just as in 32-bit and 16-bit modes). This can be used to generate smaller code in some instances. Examples in NASM syntax:

```
mov ecx, 1  ; 1 byte shorter than mov rcx, 1
```

```
and edx, 3  ; equivalent to and rdx, 3
```

Immediates

For most instructions in 64-bit mode, immediate values remain 32 bits; their value is sign-extended into the upper 32 bits of the target register prior to being used. The exception is the mov instruction, which can take a 64-bit immediate when the destination is a 64-bit register. Examples in NASM syntax:

```
add rax, 1           ; optimized down to signed 8-bit
```

```
add rax, dword 1     ; force size to 32-bit
```

```
add rax, 0xffffffff  ; sign-extended 32-bit
```

```
add rax, -1          ; same as above
```

```
add rax, 0xffffffffffffffff ; truncated to 32-bit (warning)
```

```
mov eax, 1           ; 5 byte
```

```
mov rax, 1           ; 5 byte (optimized to signed 32-bit)
```

```
mov rax, qword 1     ; 10 byte (forced 64-bit)
```

```
mov rbx, 0x1234567890abcdef ; 10 byte
```

```
mov rcx, 0xffffffff  ; 10 byte (does not fit in signed 32-bit)
```

```
mov ecx, -1          ; 5 byte, equivalent to above
```

```
mov rcx, sym         ; 5 byte, 32-bit size default for symbols
```

```
mov rcx, qword sym   ; 10 byte, override default size
```

The handling of mov reg64, unsized immediate is different between YASM and NASM 2.x; YASM follows the above behavior, while NASM 2.x does the following:

```
add rax, 0xffffffff  ; sign-extended 32-bit immediate
```

```
add rax, -1          ; same as above
```

```
add rax, 0xffffffffffffffff ; truncated 32-bit (warning)
```

```
add rax, sym         ; sign-extended 32-bit immediate
```

```
mov eax, 1           ; 5 byte (32-bit immediate)
```

```
mov rax, 1           ; 10 byte (64-bit immediate)
```

```
mov rbx, 0x1234567890abcdef ; 10 byte instruction
```

```
mov rcx, 0xffffffff  ; 10 byte instruction
```

```
mov ecx, -1          ; 5 byte, equivalent to above
```

```
mov ecx, sym         ; 5 byte (32-bit immediate)
```

```
mov rcx, sym         ; 10 byte instruction
```

```
mov rcx, qword sym   ; 10 byte (64-bit immediate)
```

Displacements

Just like immediates, displacements, for the most part, remain 32 bits and are sign extended prior to use. Again, the exception is one restricted form of the mov instruction: between the al/ax/eax/rax register and a 64-bit absolute address (no registers allowed in the effective address). In NASM syntax, use of the 64-bit absolute form requires [qword]. Examples in NASM syntax:

```
mov eax, [1]    ; 32 bit, with sign extension
```

```
mov al, [rax-1] ; 32 bit, with sign extension
```

```
mov al, [qword 0x1122334455667788] ; 64-bit absolute
```

```
mov al, [0x1122334455667788] ; truncated to 32-bit (warning)
```

RIP Relative Addressing

In 64-bit mode, a new form of effective addressing is available to make it easier to write position-independent code. Any memory reference may be made RIP relative (RIP is the instruction pointer register, which contains the address of the location immediately following the current instruction).

In NASM syntax, there are two ways to specify RIP-relative addressing:

```
mov dword [rip+10], 1
```

stores the value 1 ten bytes after the end of the instruction. 10 can also be a symbolic constant, and will be treated the same way. On the other hand,

```
mov dword [symb wrt rip], 1
```

stores the value 1 into the address of symbol symb. This is distinctly different than the behavior of:

```
mov dword [symb+rip], 1
```

which takes the address of the end of the instruction, adds the address of symb to it, then stores the value 1 there. If symb is a variable, this will not store the value 1 into the symb variable!

Yasm also supports the following syntax for RIP-relative addressing:

```
mov [rel sym], rax  ; RIP-relative
```

```
mov [abs sym], rax  ; not RIP-relative
```

The behavior of:

```
mov [sym], rax
```

Depends on a mode set by the DEFAULT directive, as follows. The default mode is always "abs", and in "rel" mode, use of registers, an fs or gs segment override, or an explicit "abs" override will result in a non-RIP-relative effective address.

```
default rel
```

```
mov [sym], rbx      ; RIP-relative
```

```
mov [abs sym], rbx  ; not RIP-relative (explicit override)
```

```
mov [rbx+1], rbx    ; not RIP-relative (register use)
```

```
mov [fs:sym], rbx   ; not RIP-relative (fs or gs use)
```

```
mov [ds:sym], rbx   ; RIP-relative (segment, but not fs or gs)
```

```
mov [rel sym], rbx  ; RIP-relative (redundant override)
```

```
default abs
```

```
mov [sym], rbx      ; not RIP-relative
```

```
mov [abs sym], rbx  ; not RIP-relative
```

```
mov [rbx+1], rbx    ; not RIP-relative
```

```
mov [fs:sym], rbx   ; not RIP-relative
```

```
mov [ds:sym], rbx   ; not RIP-relative
```

```
mov [rel sym], rbx  ; RIP-relative (explicit override)
```

Memory references

Usually the size of a memory reference can be deduced by which registers you're moving--for example, "mov [rax],ecx" is a 32-bit move, because ecx is 32 bits. YASM currently gives the non-obvious "invalid combination of opcode and operands" error if it can't figure out how much memory you're moving. The fix in this case is to add a memory size specifier: qword, dword, word, or byte.

Here's a 64-bit memory move, which sets 8 bytes starting at rax:

```
mov qword [rax], 1
```

Here's a 32-bit memory move, which sets 4 bytes:

```
mov dword [rax], 1
```

Here's a 16-bit memory move, which sets 2 bytes:

```
mov word [rax], 1
```

Here's an 8-bit memory move, which sets 1 byte:

```
mov byte [rax], 1
```

## LC3B ARCHITECTURE
The “lc3b” architecture supports the LC-3b ISA as used in the ECE 312 (now ECE 411) course at the University of Illinois, Urbana-Champaign, as well as other university courses. See http://courses.ece.uiuc.edu/ece411/ for more details and example code. The “lc3b” architecture consists of only one machine: “lc3b”.

## SEE ALSO
yasm(1)

## BUGS
When using the “x86” architecture, it is overly easy to generate AMD64 code (using the BITS 64 directive) and generate a 32-bit object file (by failing to specify -m amd64 on the command line or selecting a 64-bit object format). Similarly, specifying -m amd64 does not default the BITS setting to 64. An easy way to avoid this is by directly specifying a 64-bit object format such as -f elf64.

## AUTHOR
Peter Johnson <peter@tortall.net>

Author.

## COPYRIGHT
Copyright © 2004, 2005, 2006, 2007 Peter Johnson


title: yasm_dbgfmts(7)

summary: Yasm Supported Debugging Formats

text:
# yasm_dbgfmts(7)

## NAME
yasm_dbgfmts - Yasm Supported Debugging Formats

## SYNOPSIS
yasm -g dbgfmt ...

## DESCRIPTION
The standard Yasm distribution includes a number of modules for different debugging formats. The debugging information is embedded into the object file. Use of a non-“null” debug format also causes Yasm to output all symbols to the object file (including local symbols).

The debug format is selected on the yasm(1) command line by use of the -g dbgfmt command line option.

## CV8
The CV8 debug format is used by Microsoft Visual Studio 2005 (version 8.0) and is completely undocumented, although it bears strong similarities to earlier CodeView formats. Yasm´s support for the CV8 debug format is currently limited to generating assembly-level line number information (to allow some level of source-level debugging). The CV8 debug information is stored in the .debug$S and .debug$T sections of the Win64 object file.

## DWARF2
The DWARF 2 debug format is a complex, well-documented standard for debugging information. It was created to overcome shortcomings in STABS, allowing for much more detailed and compact descriptions of data structures, data variable movement, and complex language structures such as in C++. The debugging information is stored in sections (just like normal program sections) in the object file. Yasm supports full pass-through of DWARF2 debugging information (e.g. from a C++ compiler), and can also generate assembly-level line number information.

## NULL
The “null” debug format is a placeholder; it adds no debugging information to the output file.

## STABS
The STABS debug format is a poorly documented, semi-standard format for debugging information in COFF and ELF object files. The debugging information is stored as part of the object file´s symbol table and thus is limited in complexity and scope. Despite this, STABS is a common debugging format on older Unix and compatible systems, as well as DJGPP.

## SEE ALSO
yasm(1), yasm_objfmts(7)

## AUTHOR
Peter Johnson <peter@tortall.net>

Author.

## COPYRIGHT
Copyright © 2006 Peter Johnson