<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Developing an extern clock setting program </TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">

<A HREF="clkprog.html"><EM> Information for using/developing external clock setting programs</EM></A>
 <b>:</b> <EM>Developing an extern clock setting program </EM><BR>
<b>Previous:</b> <A HREF="clkprog1.html"><EM>Using an external clock setting program </EM></A><BR>
<b>Next:</b> <A HREF="clkprog.html"><EM> Information for using/developing external clock setting programs</EM></A>


<HR NOSHADE>
  <H2><A NAME="2"></A>2. Developing an extern clock setting program </H2>
<p>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.</p>
<p>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.</p>
<p>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
<code>xc/programs/Xserver/hw/xfree86/etc/et4000clock.c</code>
in the source tree, and 
<code>/usr/X11R6/lib/X11/etc/et4000clock.c</code> in the binary tree.</p>
<p>The idea of using an external clock program was suggested by
Frank Klemm &lt;<i>pfk@rz.uni-jena.de</i>&gt;</p>
<p>
<pre>
$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 $
</pre>
</p>

 <HR NOSHADE>
<A HREF="clkprog.html"><EM> Information for using/developing external clock setting programs</EM></A>
 <b>:</b> <EM>Developing an extern clock setting program </EM><BR>
<b>Previous:</b> <A HREF="clkprog1.html"><EM>Using an external clock setting program </EM></A><BR>
<b>Next:</b> <A HREF="clkprog.html"><EM> Information for using/developing external clock setting programs</EM></A>



</BODY>
</HTML>
