When such an external program is being used, the server does not change any register fields related to clock selection, and the external program must be careful to only modify clock selection fields. The program is run with stdin and stdout set to xf86Info.consoleFd -- which is the fd to use for display-related ioctl() operations if required. Stderr is the same as the server's stderr -- so error or warning messages should be directed there. The program is run with the uid set to the real user's ID -- so if it needs to use privileged system calls it should be suid-root. The program does not inherit any I/O access privileges, so it will need to do whatever is required to enable them.
The program is expected to return an exit status 0 when successful, and a status in the range 1-254 when it fails. If the external program fails during the server initialisation stage, the server exits. If it fails for a mode switch, the mode switch is aborted (the server assumes that the clock frequency hasn't been changed) and the server keeps running. If necessary an exit status may be specified in the future for which the server would exit if the program fails for a mode switch.
A sample clock switching program is provided for use with many ET4000 cards
that have a fixed set of 8 clocks. This program is only intended as a sample,
and it is not intended for general use (the internal server code handles this
type of card). The program is
in the source tree, and
/usr/X11R6/lib/X11/etc/et4000clock.c in the binary tree.
The idea of using an external clock program was suggested by Frank Klemm <email@example.com>
$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/clkprog.sgml,v 3.7 1997/01/24 09:32:48 dawes Exp $ $XConsortium: clkprog.sgml /main/3 1996/02/21 17:46:48 kaleb $