xref: /freebsd/contrib/ntp/kernel/sys/ppsclock.h (revision c0b746e5)
1c0b746e5SOllivier Robert /*
2c0b746e5SOllivier Robert  * This software was developed by the Computer Systems Engineering group
3c0b746e5SOllivier Robert  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66.
4c0b746e5SOllivier Robert  *
5c0b746e5SOllivier Robert  * Copyright (c) 1992 The Regents of the University of California.
6c0b746e5SOllivier Robert  * All rights reserved.
7c0b746e5SOllivier Robert  *
8c0b746e5SOllivier Robert  * Redistribution and use in source and binary forms, with or without
9c0b746e5SOllivier Robert  * modification, are permitted provided that the following conditions
10c0b746e5SOllivier Robert  * are met:
11c0b746e5SOllivier Robert  * 1. Redistributions of source code must retain the above copyright
12c0b746e5SOllivier Robert  *    notice, this list of conditions and the following disclaimer.
13c0b746e5SOllivier Robert  * 2. Redistributions in binary form must reproduce the above copyright
14c0b746e5SOllivier Robert  *    notice, this list of conditions and the following disclaimer in the
15c0b746e5SOllivier Robert  *    documentation and/or other materials provided with the distribution.
16c0b746e5SOllivier Robert  * 3. All advertising materials mentioning features or use of this software
17c0b746e5SOllivier Robert  *    must display the following acknowledgement:
18c0b746e5SOllivier Robert  *	This product includes software developed by the University of
19c0b746e5SOllivier Robert  *	California, Lawrence Berkeley Laboratory.
20c0b746e5SOllivier Robert  * 4. The name of the University may not be used to endorse or promote
21c0b746e5SOllivier Robert  *    products derived from this software without specific prior
22c0b746e5SOllivier Robert  *    written permission.
23c0b746e5SOllivier Robert  *
24c0b746e5SOllivier Robert  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25c0b746e5SOllivier Robert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26c0b746e5SOllivier Robert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27c0b746e5SOllivier Robert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28c0b746e5SOllivier Robert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29c0b746e5SOllivier Robert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30c0b746e5SOllivier Robert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31c0b746e5SOllivier Robert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32c0b746e5SOllivier Robert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33c0b746e5SOllivier Robert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34c0b746e5SOllivier Robert  * SUCH DAMAGE.
35c0b746e5SOllivier Robert  */
36c0b746e5SOllivier Robert 
37c0b746e5SOllivier Robert #ifndef TIOCGPPSEV
38c0b746e5SOllivier Robert #define PPSCLOCKSTR	"ppsclock"
39c0b746e5SOllivier Robert 
40c0b746e5SOllivier Robert #ifndef HAVE_STRUCT_PPSCLOCKEV
41c0b746e5SOllivier Robert struct ppsclockev {
42c0b746e5SOllivier Robert 	struct timeval tv;
43c0b746e5SOllivier Robert 	u_int serial;
44c0b746e5SOllivier Robert };
45c0b746e5SOllivier Robert #endif
46c0b746e5SOllivier Robert 
47c0b746e5SOllivier Robert #if defined(__STDC__) || defined(SYS_HPUX)
48c0b746e5SOllivier Robert #ifdef	_IOR
49c0b746e5SOllivier Robert #define CIOGETEV        _IOR('C', 0, struct ppsclockev)	/* get last pps event */
50c0b746e5SOllivier Robert #else	/* XXX SOLARIS is different */
51c0b746e5SOllivier Robert #define	CIO	('C'<<8)
52c0b746e5SOllivier Robert #define CIOGETEV        (CIO|0)		/* get last pps event */
53c0b746e5SOllivier Robert #endif	/* _IOR */
54c0b746e5SOllivier Robert #else	/* __STDC__ */
55c0b746e5SOllivier Robert #ifdef	_IOR
56c0b746e5SOllivier Robert #define CIOGETEV        _IOR(C, 0, struct ppsclockev)	/* get last pps event */
57c0b746e5SOllivier Robert #else	/* XXX SOLARIS is different */
58c0b746e5SOllivier Robert #define	CIO	('C'<<8)
59c0b746e5SOllivier Robert #define CIOGETEV        (CIO|0)		/* get last pps event */
60c0b746e5SOllivier Robert #endif	/* _IOR */
61c0b746e5SOllivier Robert #endif	/* __STDC__ */
62c0b746e5SOllivier Robert #else
63c0b746e5SOllivier Robert #define CIOGETEV TIOCGPPSEV
64c0b746e5SOllivier Robert #endif
65