Previous Page | Next Page

  1. Introduction
  2. Boot Process
  3. Init and System Initialization
  4. rc.sysinit script
  5. rc script
  6. functions script
  7. Services
  8. apm daemon
  9. network startup
  10. The network script file
  11. The network-functions file
  12. Portmap startup
  13. Random initialization
  14. Syslog initialization
  15. Gated
  16. Atd
  17. cron initialization
  18. pcmcia
  19. inetd daemon
  20. named daemon
  21. lpd daemon
  22. mars-nwe
  23. netfs startup
  24. dhcpd daemon
  25. autofs daemon
  26. keytable daemon
  27. sendmail daemon
  28. gpm daemon
  29. httpd daemon
  30. xfs startup
  31. smb startup
  32. innd startup
  33. linuxconf startup
  34. rc.local script
  35. Init, Getty, Login
  36. The shell
  37. Shutting down
  38. X
  39. Conclusions
  40. App A. rc.sysinit listing
  41. App B. functions listing
  42. App C. rc listing
  43. Credits

Starting Linux X

The X system is better explained in the "HOW Linux Works CTDP Guide". A detailed analysis of the X system is planned for this document, but is not available for this version. See the "HOW Linux Works CTDP Guide" for more information.

To start Xwindows, the user must type "startx" on the command line. In Redhat Linux version 6.0, this file is in the "/usr/X11R6/bin" directory. It is listed below:

1	#!/bin/sh
2	#
3	# (c) 1999 Red Hat Software, Inc.
4
5	bindir=/usr/X11R6/bin
6
7	userclientrc=$HOME/.xinitrc
8	userserverrc=$HOME/.xserverrc
9	sysclientrc=/etc/X11/xinit/xinitrc
10	sysserverrc=/etc/X11/xinit/xserverrc
11	clientargs=""
12	serverargs=""
13
14	if [ -f $userclientrc ]; then
15	    clientargs=$userclientrc
16	else if [ -f $sysclientrc ]; then
17	    clientargs=$sysclientrc
18	fi
19	fi
20
21	if [ -f $userserverrc ]; then
22	    serverargs=$userserverrc
23	else if [ -f $sysserverrc ]; then
24	    serverargs=$sysserverrc
25	fi
26	fi
27
28	display=:0
29	whoseargs="client"
30	while [ "x$1" != "x" ]; do
31	    case "$1" in
32		/''*|\.*)	if [ "$whoseargs" = "client" ]; then
33			    if [ "x$clientargs" = x ]; then
34				clientargs="$1"
35			    else
36				clientargs="$clientargs $1"
37			    fi
38			else
39			    if [ "x$serverargs" = x ]; then
40				serverargs="$1"
41			    else
42				serverargs="$serverargs $1"
43			    fi
44			fi ;;
45		--)	whoseargs="server" ;;
46		*)	if [ "$whoseargs" = "client" ]; then
47			    clientargs="$clientargs $1"
48			else
49			    serverargs="$serverargs $1"
50			case "$1" in
51			    :[0-9]) display="$1"
52			    ;;
53			esac
54			fi ;;
55	    esac
56	    shift
57	done
58
59	# set up default Xauth info for this machine
60	mcookie=`mcookie`
61	serverargs="$serverargs -auth $HOME/.Xauthority"
62	xauth add $display . $mcookie
63	xauth add `hostname -f`$display . $mcookie
64
65	xinit $clientargs -- $serverargs
66
67	# various machines need special cleaning up,
68	# which should be done here

userclientrc=$HOME/.xinitrc
userserverrc=$HOME/.xserverrc
sysclientrc=/etc/X11/xinit/xinitrc
sysserverrc=/etc/X11/xinit/xserverrc
This file sets $clientargs to $userclientrc if the file exists or $sysclientrc if that file exists and the first one did not. The case statement is used to pass parameters on the command line of this script file to the strings "$clientargs" and "$serverargs". After setting up the authority, this file calls xinit and passes the arguments on the command line.