From: niklas Date: Thu, 18 Apr 1996 21:40:43 +0000 (+0000) Subject: Merge of NetBSD 960317 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=29668b5563ee6301c4d0ffcf3bed0ea678a4674b;p=openbsd Merge of NetBSD 960317 --- diff --git a/sys/sys/audioio.h b/sys/sys/audioio.h index 4833833c4a4..537f3a32751 100644 --- a/sys/sys/audioio.h +++ b/sys/sys/audioio.h @@ -1,5 +1,5 @@ -/* $OpenBSD: audioio.h,v 1.3 1996/03/03 12:11:22 niklas Exp $ */ -/* $NetBSD: audioio.h,v 1.4 1996/02/17 02:28:56 jtk Exp $ */ +/* $OpenBSD: audioio.h,v 1.4 1996/04/18 21:40:43 niklas Exp $ */ +/* $NetBSD: audioio.h,v 1.5 1996/03/11 05:12:28 scottr Exp $ */ /* * Copyright (c) 1991-1993 Regents of the University of California. @@ -78,8 +78,16 @@ struct audio_info { }; typedef struct audio_info audio_info_t; +#ifdef _KERNEL +#define AUDIO_INITINFO(p)\ + { register int n = sizeof(struct audio_info); \ + register u_char *q = (u_char *) p; \ + while (n-- > 0) *q++ = 0xff; } + +#else #define AUDIO_INITINFO(p)\ (void)memset((void *)(p), 0xff, sizeof(struct audio_info)) +#endif /* * Parameter for the AUDIO_GETDEV ioctl to determine current diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 6c80a63d4fa..ef98b8853c8 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.3 1996/03/31 13:16:37 mickey Exp $ */ +/* $OpenBSD: buf.h,v 1.4 1996/04/18 21:40:46 niklas Exp $ */ /* $NetBSD: buf.h,v 1.24 1996/02/18 11:55:45 fvdl Exp $ */ /* diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 57ba2f51df4..e7028601bce 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.5 1996/03/31 13:16:40 mickey Exp $ */ +/* $OpenBSD: conf.h,v 1.6 1996/04/18 21:40:47 niklas Exp $ */ /* $NetBSD: conf.h,v 1.31 1996/03/14 18:59:07 christos Exp $ */ /*- diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h index 10e75d21977..70ba989678f 100644 --- a/sys/sys/cpu.h +++ b/sys/sys/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.3 1996/03/26 15:38:45 mickey Exp $ */ +/* $OpenBSD: cpu.h,v 1.4 1996/04/18 21:40:49 niklas Exp $ */ /* $NetBSD: cpu.h,v 1.4 1996/02/16 17:25:46 gwr Exp $ */ /* diff --git a/sys/sys/device.h b/sys/sys/device.h index 39211b71123..0006060250f 100644 --- a/sys/sys/device.h +++ b/sys/sys/device.h @@ -1,5 +1,5 @@ -/* $OpenBSD: device.h,v 1.2 1996/03/03 12:11:30 niklas Exp $ */ -/* $NetBSD: device.h,v 1.9 1996/02/09 18:25:04 christos Exp $ */ +/* $OpenBSD: device.h,v 1.3 1996/04/18 21:40:51 niklas Exp $ */ +/* $NetBSD: device.h,v 1.11 1996/03/05 22:14:58 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -136,15 +136,20 @@ struct pdevinit { int pdev_count; }; +#ifdef _KERNEL struct device *alldevs; /* head of list of all devices */ struct evcnt *allevents; /* head of list of all events */ void *config_search __P((cfmatch_t, struct device *, void *)); void *config_rootsearch __P((cfmatch_t, char *, void *)); -int config_found __P((struct device *, void *, cfprint_t)); +int config_found_sm __P((struct device *, void *, cfprint_t, cfmatch_t)); int config_rootfound __P((char *, void *)); void config_scan __P((cfscan_t, struct device *)); void config_attach __P((struct device *, void *, void *, cfprint_t)); void evcnt_attach __P((struct device *, const char *, struct evcnt *)); +/* compatibility definitions */ +#define config_found(d, a, p) config_found_sm((d), (a), (p), NULL) +#endif /* _KERNEL */ + #endif /* !_SYS_DEVICE_H_ */ diff --git a/sys/sys/dirent.h b/sys/sys/dirent.h index be379d8795e..e4e4fe1a725 100644 --- a/sys/sys/dirent.h +++ b/sys/sys/dirent.h @@ -1,5 +1,5 @@ -/* $OpenBSD: dirent.h,v 1.2 1996/03/03 12:11:32 niklas Exp $ */ -/* $NetBSD: dirent.h,v 1.9 1994/12/13 15:58:20 mycroft Exp $ */ +/* $OpenBSD: dirent.h,v 1.3 1996/04/18 21:40:52 niklas Exp $ */ +/* $NetBSD: dirent.h,v 1.11 1996/03/08 18:13:05 scottr Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -78,3 +78,15 @@ struct dirent { */ #define IFTODT(mode) (((mode) & 0170000) >> 12) #define DTTOIF(dirtype) ((dirtype) << 12) + +#if defined(_KERNEL) +/* + * The DIRENT_SIZE macro gives the minimum record length which will hold + * the directory entry. This requires the amount of space in struct dirent + * without the d_name field, plus enough space for the name with a terminating + * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. + */ +#define DIRENT_SIZE(dp) \ + ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) + +#endif /* !_KERNEL */ diff --git a/sys/sys/exec_ecoff.h b/sys/sys/exec_ecoff.h index f0e13224e4a..c63bde1db52 100644 --- a/sys/sys/exec_ecoff.h +++ b/sys/sys/exec_ecoff.h @@ -1,5 +1,5 @@ -/* $OpenBSD: exec_ecoff.h,v 1.2 1996/03/03 12:11:42 niklas Exp $ */ -/* $NetBSD: exec_ecoff.h,v 1.7 1995/06/16 02:07:56 mellon Exp $ */ +/* $OpenBSD: exec_ecoff.h,v 1.3 1996/04/18 21:40:54 niklas Exp $ */ +/* $NetBSD: exec_ecoff.h,v 1.8 1996/03/07 14:29:44 christos Exp $ */ /* * Copyright (c) 1994 Adam Glass @@ -101,5 +101,7 @@ struct ecoff_scnhdr { /* needed for size info */ #ifdef _KERNEL int exec_ecoff_makecmds __P((struct proc *, struct exec_package *)); +int cpu_exec_ecoff_hook __P((struct proc *, struct exec_package *, + struct ecoff_aouthdr *)); #endif /* _KERNEL */ #endif /* !_SYS_EXEC_ECOFF_H_ */ diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 787743fe21f..d1040823733 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -1,5 +1,5 @@ -/* $OpenBSD: filedesc.h,v 1.3 1996/03/03 12:11:46 niklas Exp $ */ -/* $NetBSD: filedesc.h,v 1.12 1996/02/09 18:25:11 christos Exp $ */ +/* $OpenBSD: filedesc.h,v 1.4 1996/04/18 21:40:55 niklas Exp $ */ +/* $NetBSD: filedesc.h,v 1.13 1996/03/14 18:59:09 christos Exp $ */ /* * Copyright (c) 1990, 1993 @@ -96,7 +96,6 @@ struct filedesc0 { */ int dupfdopen __P((struct filedesc *fdp, int indx, int dfd, int mode, int error)); -int fdopen __P((dev_t, int, int, struct proc *)); int fdalloc __P((struct proc *p, int want, int *result)); int fdavail __P((struct proc *p, int n)); int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); diff --git a/sys/sys/kcore.h b/sys/sys/kcore.h new file mode 100644 index 00000000000..4c5662b29a4 --- /dev/null +++ b/sys/sys/kcore.h @@ -0,0 +1,65 @@ +/* $OpenBSD: kcore.h,v 1.1 1996/04/18 21:40:57 niklas Exp $ */ +/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:56:00 leo Exp $ */ + +/* + * Copyright (c) 1996 Leo Weppelman. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Leo Weppelman. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SYS_KCORE_H_ +#define _SYS_KCORE_H_ + +/* + * Definitions for the kernel crash-dump format. The structure of + * the files and headers is borrowed from the 'regular' core files + * as described in . + */ +#define KCORE_MAGIC 0x8fca +#define KCORESEG_MAGIC 0x8fac + +/* + * Description of a memory segment. To make this suitable for sharing + * between all architectures, u_quad_t seems to be the necessary type... + */ +typedef struct { + u_quad_t start; /* Physical start address */ + u_quad_t size; /* Size in bytes */ +} phys_ram_seg_t; + +typedef struct kcore_hdr { + u_int32_t c_midmag; /* Magic, id, flags */ + u_int16_t c_hdrsize; /* Aligned header size */ + u_int16_t c_seghdrsize; /* Aligned seg-header size */ + u_int32_t c_nseg; /* Number of segments */ +} kcore_hdr_t; + +typedef struct kcore_seg { + u_int32_t c_midmag; /* Magic, id, flags */ + u_int32_t c_size; /* Sizeof this segment */ +} kcore_seg_t; + +#endif /* _SYS_KCORE_H_ */ diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 3c89d6c1515..0989f69253f 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.h,v 1.4 1996/03/31 13:16:43 mickey Exp $ */ +/* $OpenBSD: malloc.h,v 1.5 1996/04/18 21:40:59 niklas Exp $ */ /* $NetBSD: malloc.h,v 1.22 1996/02/22 12:47:33 jtk Exp $ */ /* diff --git a/sys/sys/mount.h b/sys/sys/mount.h index dd4a430078d..7848c1bd1ad 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.6 1996/03/31 13:16:47 mickey Exp $ */ +/* $OpenBSD: mount.h,v 1.7 1996/04/18 21:41:00 niklas Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -371,9 +371,10 @@ struct msdosfs_args { struct export_args export; /* network export information */ uid_t uid; /* uid that owns msdosfs files */ gid_t gid; /* gid that owns msdosfs files */ - mode_t mask; /* mask to be applied for msdosfs perms */ + mode_t mask; /* mask to be applied for msdosfs perms */ int flags; /* see below */ }; + /* * Msdosfs mount options: */ diff --git a/sys/sys/param.h b/sys/sys/param.h index f32cb138b20..913bfc016c0 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -1,5 +1,5 @@ -/* $OpenBSD: param.h,v 1.6 1996/03/19 21:10:48 mickey Exp $ */ -/* $NetBSD: param.h,v 1.18.2.1 1995/10/12 05:42:01 jtc Exp $ */ +/* $OpenBSD: param.h,v 1.7 1996/04/18 21:41:03 niklas Exp $ */ +/* $NetBSD: param.h,v 1.21 1996/03/16 05:35:45 thorpej Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -45,8 +45,8 @@ #define BSD4_3 1 #define BSD4_4 1 -#define NetBSD 199511 /* NetBSD version (year & month). */ -#define NetBSD1_1 1 /* NetBSD 1.1 */ +#define NetBSD 199603 /* NetBSD version (year & month). */ +#define NetBSD1_1 2 /* NetBSD 1.1A */ #ifndef NULL #define NULL 0 diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 740520be080..3004e965ed2 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,5 +1,5 @@ -/* $OpenBSD: proc.h,v 1.5 1996/03/24 18:07:57 tholo Exp $ */ -/* $NetBSD: proc.h,v 1.42 1996/02/09 18:25:23 christos Exp $ */ +/* $OpenBSD: proc.h,v 1.6 1996/04/18 21:41:05 niklas Exp $ */ +/* $NetBSD: proc.h,v 1.43 1996/03/14 18:59:11 christos Exp $ */ /*- * Copyright (c) 1986, 1989, 1991, 1993 @@ -152,7 +152,7 @@ struct proc { #define p_startzero p_oppid pid_t p_oppid; /* Save parent pid during ptrace. XXX */ - int p_dupfd; /* Sideways return value from fdopen. XXX */ + int p_dupfd; /* Sideways return value from filedescopen. XXX */ /* scheduling */ u_int p_estcpu; /* Time averaged value of p_cpticks. */ diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index aae3e4cb0f3..69c22a29a64 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -1,5 +1,5 @@ -/* $OpenBSD: reboot.h,v 1.2 1996/03/03 12:12:11 niklas Exp $ */ -/* $NetBSD: reboot.h,v 1.7 1994/12/13 15:01:22 mycroft Exp $ */ +/* $OpenBSD: reboot.h,v 1.3 1996/04/18 21:41:07 niklas Exp $ */ +/* $NetBSD: reboot.h,v 1.8 1996/02/22 20:30:16 scottr Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1993, 1994 @@ -37,8 +37,8 @@ */ /* - * Arguments to reboot system call. These are passed to boot program - * in r11, and on to init. + * Arguments to reboot system call. These are passed to the boot program, + * and then on to init. */ #define RB_AUTOBOOT 0 /* flags for system auto-booting itself */ diff --git a/sys/sys/scanio.h b/sys/sys/scanio.h index 1c57c7ac5a3..d29fb5625f6 100644 --- a/sys/sys/scanio.h +++ b/sys/sys/scanio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scanio.h,v 1.2 1996/03/03 12:12:13 niklas Exp $ */ +/* $OpenBSD: scanio.h,v 1.3 1996/04/18 21:41:08 niklas Exp $ */ /* $NetBSD: scanio.h,v 1.1 1996/02/18 20:33:18 mycroft Exp $ */ /* diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index 9cbe6ab830e..db2e547994b 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.30 1995/11/22 23:07:29 cgd Exp + * created from NetBSD: syscalls.master,v 1.31 1996/02/27 04:20:41 jonathan Exp */ #define SYS_syscall 0 @@ -167,8 +167,8 @@ /* 169 is compat_10 osemsys */ /* 170 is compat_10 omsgsys */ /* 171 is compat_10 oshmsys */ +#define SYS_ntp_gettime 175 #define SYS_ntp_adjtime 176 -#define SYS_ntp_gettime 177 #define SYS_setgid 181 #define SYS_setegid 182 #define SYS_seteuid 183 diff --git a/sys/sys/syscallargs.h b/sys/sys/syscallargs.h index 00f6192852c..b2113be847f 100644 --- a/sys/sys/syscallargs.h +++ b/sys/sys/syscallargs.h @@ -2,7 +2,7 @@ * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.30 1995/11/22 23:07:29 cgd Exp + * created from NetBSD: syscalls.master,v 1.31 1996/02/27 04:20:41 jonathan Exp */ #define syscallarg(x) union { x datum; register_t pad; } @@ -741,12 +741,12 @@ struct compat_10_sys_shmsys_args { syscallarg(int) a4; }; -struct sys_ntp_adjtime_args { +struct ntp_gettime_args { syscallarg(struct timex *) tp; }; -struct sys_ntp_gettime_args { - syscallarg(struct ntptimeval *) tp; +struct ntp_adjtime_args { + syscallarg(struct timex *) tp; }; struct sys_setgid_args { @@ -1136,8 +1136,8 @@ int compat_10_sys_msgsys __P((struct proc *, void *, register_t *)); int compat_10_sys_shmsys __P((struct proc *, void *, register_t *)); #else #endif -int sys_ntp_adjtime __P((struct proc *, void *, register_t *)); -int sys_ntp_gettime __P((struct proc *, void *, register_t *)); +int ntp_gettime __P((struct proc *, void *, register_t *)); +int ntp_adjtime __P((struct proc *, void *, register_t *)); int sys_setgid __P((struct proc *, void *, register_t *)); int sys_setegid __P((struct proc *, void *, register_t *)); int sys_seteuid __P((struct proc *, void *, register_t *)); diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 277a085775c..d0448a9223b 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -1,5 +1,5 @@ -/* $OpenBSD: sysctl.h,v 1.3 1996/03/30 04:51:33 mickey Exp $ */ -/* $NetBSD: sysctl.h,v 1.11 1996/02/09 18:25:39 christos Exp $ */ +/* $OpenBSD: sysctl.h,v 1.4 1996/04/18 21:41:13 niklas Exp $ */ +/* $NetBSD: sysctl.h,v 1.14 1996/03/12 00:22:43 jonathan Exp $ */ /* * Copyright (c) 1989, 1993 @@ -135,7 +135,9 @@ struct ctlname { #define KERN_DOMAINNAME 22 /* string: (YP) domainname */ #define KERN_MAXPARTITIONS 23 /* int: number of partitions/disk */ #define KERN_RAWPARTITION 24 /* int: raw partition number */ -#define KERN_MAXID 25 /* number of valid kern ids */ +#define KERN_NTPTIME 25 /* struct: extended-precision time */ +#define KERN_TIMEX 26 /* struct: ntp timekeeping state */ +#define KERN_MAXID 27 /* number of valid kern ids */ #define CTL_KERN_NAMES { \ { 0, 0 }, \ @@ -163,6 +165,8 @@ struct ctlname { { "domainname", CTLTYPE_STRING }, \ { "maxpartitions", CTLTYPE_INT }, \ { "rawpartition", CTLTYPE_INT }, \ + { "ntptime", CTLTYPE_STRUCT }, \ + { "timex", CTLTYPE_STRUCT }, \ } /* @@ -346,6 +350,7 @@ int sysctl_clockrate __P((char *, size_t *)); int sysctl_rdstring __P((void *, size_t *, void *, char *)); int sysctl_rdstruct __P((void *, size_t *, void *, void *, int)); int sysctl_vnode __P((char *, size_t *)); +int sysctl_ntptime __P((char *, size_t *)); void fill_eproc __P((struct proc *, struct eproc *)); diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 4b683a432c0..5bfb437a87c 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,5 +1,5 @@ -/* $OpenBSD: systm.h,v 1.2 1996/02/29 13:57:30 niklas Exp $ */ -/* $NetBSD: systm.h,v 1.40 1996/02/10 00:13:28 christos Exp $ */ +/* $OpenBSD: systm.h,v 1.3 1996/04/18 21:41:14 niklas Exp $ */ +/* $NetBSD: systm.h,v 1.43 1996/03/14 18:59:12 christos Exp $ */ /*- * Copyright (c) 1982, 1988, 1991, 1993 @@ -192,12 +192,13 @@ void doshutdownhooks __P((void)); int uiomove __P((caddr_t, int, struct uio *)); +int setjmp __P((label_t *)); +void longjmp __P((label_t *)); + #include #ifdef DDB /* debugger entry points */ -#ifdef notyet /* XXX: Lots of local decls assume int Debugger */ void Debugger __P((void)); /* in DDB only */ -#endif int read_symtab_from_file __P((struct proc *,struct vnode *,const char *)); #endif diff --git a/sys/sys/timex.h b/sys/sys/timex.h index a673063d981..5dd51d84d5a 100644 --- a/sys/sys/timex.h +++ b/sys/sys/timex.h @@ -1,4 +1,307 @@ -/* $OpenBSD: timex.h,v 1.2 1996/03/03 12:12:29 niklas Exp $ */ +/* $OpenBSD: timex.h,v 1.3 1996/04/18 21:41:16 niklas Exp $ */ +/* $NetBSD: timex.h,v 1.2 1996/02/27 04:20:34 jonathan Exp $ */ + +/****************************************************************************** + * * + * Copyright (c) David L. Mills 1993, 1994 * + * * + * Permission to use, copy, modify, and distribute this software and its * + * documentation for any purpose and without fee is hereby granted, provided * + * that the above copyright notice appears in all copies and that both the * + * copyright notice and this permission notice appear in supporting * + * documentation, and that the name University of Delaware not be used in * + * advertising or publicity pertaining to distribution of the software * + * without specific, written prior permission. The University of Delaware * + * makes no representations about the suitability this software for any * + * purpose. It is provided "as is" without express or implied warranty. * + * * + ******************************************************************************/ + +/* + * Modification history timex.h + * + * 26 Sep 94 David L. Mills + * Added defines for hybrid phase/frequency-lock loop. + * + * 19 Mar 94 David L. Mills + * Moved defines from kernel routines to header file and added new + * defines for PPS phase-lock loop. + * + * 20 Feb 94 David L. Mills + * Revised status codes and structures for external clock and PPS + * signal discipline. + * + * 28 Nov 93 David L. Mills + * Adjusted parameters to improve stability and increase poll + * interval. + * + * 17 Sep 93 David L. Mills + * Created file + */ +/* + * This header file defines the Network Time Protocol (NTP) interfaces + * for user and daemon application programs. These are implemented using + * private syscalls and data structures and require specific kernel + * support. + * + * NAME + * ntp_gettime - NTP user application interface + * + * SYNOPSIS + * #include + * + * int syscall(SYS_ntp_gettime, tptr) + * + * int SYS_ntp_gettime defined in syscall.h header file + * struct ntptimeval *tptr pointer to ntptimeval structure + * + * NAME + * ntp_adjtime - NTP daemon application interface + * + * SYNOPSIS + * #include + * + * int syscall(SYS_ntp_adjtime, mode, tptr) + * + * int SYS_ntp_adjtime defined in syscall.h header file + * struct timex *tptr pointer to timex structure + * + */ +#ifndef _SYS_TIMEX_H_ +#define _SYS_TIMEX_H_ 1 + +#ifndef MSDOS /* Microsoft specific */ +#include +#endif /* MSDOS */ + +/* + * The following defines establish the engineering parameters of the + * phase-lock loop (PLL) model used in the kernel implementation. These + * parameters have been carefully chosen by analysis for good stability + * and wide dynamic range. + * + * The hz variable is defined in the kernel build environment. It + * establishes the timer interrupt frequency, 100 Hz for the SunOS + * kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the OSF/1 + * kernel. SHIFT_HZ expresses the same value as the nearest power of two + * in order to avoid hardware multiply operations. + * + * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen + * for a slightly underdamped convergence characteristic. SHIFT_KH + * establishes the damping of the FLL and is chosen by wisdom and black + * art. + * + * MAXTC establishes the maximum time constant of the PLL. With the + * SHIFT_KG and SHIFT_KF values given and a time constant range from + * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, + * respectively. + */ + + +#define SHIFT_KG 6 /* phase factor (shift) */ +#define SHIFT_KF 16 /* PLL frequency factor (shift) */ +#define SHIFT_KH 2 /* FLL frequency factor (shift) */ +#define MAXTC 6 /* maximum time constant (shift) */ + +/* + * The following defines establish the scaling of the various variables + * used by the PLL. They are chosen to allow the greatest precision + * possible without overflow of a 32-bit word. + * + * SHIFT_SCALE defines the scaling (shift) of the time_phase variable, + * which serves as a an extension to the low-order bits of the system + * clock variable time.tv_usec. + * + * SHIFT_UPDATE defines the scaling (shift) of the time_offset variable, + * which represents the current time offset with respect to standard + * time. + * + * SHIFT_USEC defines the scaling (shift) of the time_freq and + * time_tolerance variables, which represent the current frequency + * offset and maximum frequency tolerance. + * + * FINEUSEC is 1 us in SHIFT_UPDATE units of the time_phase variable. + */ +#define SHIFT_SCALE 22 /* phase scale (shift) */ +#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* time offset scale (shift) */ +#define SHIFT_USEC 16 /* frequency offset scale (shift) */ +#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */ + +/* + * The following defines establish the performance envelope of the PLL. + * They insure it operates within predefined limits, in order to satisfy + * correctness assertions. An excursion which exceeds these bounds is + * clamped to the bound and operation proceeds accordingly. In practice, + * this can occur only if something has failed or is operating out of + * tolerance, but otherwise the PLL continues to operate in a stable + * mode. + * + * MAXPHASE must be set greater than or equal to CLOCK.MAX (128 ms), as + * defined in the NTP specification. CLOCK.MAX establishes the maximum + * time offset allowed before the system time is reset, rather than + * incrementally adjusted. Here, the maximum offset is clamped to + * MAXPHASE only in order to prevent overflow errors due to defective + * protocol implementations. + * + * MAXFREQ is the maximum frequency tolerance of the CPU clock + * oscillator plus the maximum slew rate allowed by the protocol. It + * should be set to at least the frequency tolerance of the oscillator + * plus 100 ppm for vernier frequency adjustments. If the kernel + * PPS discipline code is configured (PPS_SYNC), the oscillator time and + * frequency are disciplined to an external source, presumably with + * negligible time and frequency error relative to UTC, and MAXFREQ can + * be reduced. + * + * MAXTIME is the maximum jitter tolerance of the PPS signal if the + * kernel PPS discipline code is configured (PPS_SYNC). + * + * MINSEC and MAXSEC define the lower and upper bounds on the interval + * between protocol updates. + */ +#define MAXPHASE 512000L /* max phase error (us) */ +#ifdef PPS_SYNC +#define MAXFREQ (512L << SHIFT_USEC) /* max freq error (100 ppm) */ +#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ +#else +#define MAXFREQ (512L << SHIFT_USEC) /* max freq error (200 ppm) */ +#endif /* PPS_SYNC */ +#define MINSEC 16L /* min interval between updates (s) */ +#define MAXSEC 1200L /* max interval between updates (s) */ + +#ifdef PPS_SYNC +/* + * The following defines are used only if a pulse-per-second (PPS) + * signal is available and connected via a modem control lead, such as + * produced by the optional ppsclock feature incorporated in the Sun + * asynch driver. They establish the design parameters of the frequency- + * lock loop used to discipline the CPU clock oscillator to the PPS + * signal. + * + * PPS_AVG is the averaging factor for the frequency loop, as well as + * the time and frequency dispersion. + * + * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum + * calibration intervals, respectively, in seconds as a power of two. + * + * PPS_VALID is the maximum interval before the PPS signal is considered + * invalid and protocol updates used directly instead. + * + * MAXGLITCH is the maximum interval before a time offset of more than + * MAXTIME is believed. + */ +#define PPS_AVG 2 /* pps averaging constant (shift) */ +#define PPS_SHIFT 2 /* min interval duration (s) (shift) */ +#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ +#define PPS_VALID 120 /* pps signal watchdog max (s) */ +#define MAXGLITCH 30 /* pps signal glitch max (s) */ +#endif /* PPS_SYNC */ + +/* + * The following defines and structures define the user interface for + * the ntp_gettime() and ntp_adjtime() system calls. + * + * Control mode codes (timex.modes) + */ +#define MOD_OFFSET 0x0001 /* set time offset */ +#define MOD_FREQUENCY 0x0002 /* set frequency offset */ +#define MOD_MAXERROR 0x0004 /* set maximum time error */ +#define MOD_ESTERROR 0x0008 /* set estimated time error */ +#define MOD_STATUS 0x0010 /* set clock status bits */ +#define MOD_TIMECONST 0x0020 /* set pll time constant */ +#define MOD_CLKB 0x4000 /* set clock B */ +#define MOD_CLKA 0x8000 /* set clock A */ + +/* + * Status codes (timex.status) + */ +#define STA_PLL 0x0001 /* enable PLL updates (rw) */ +#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */ +#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */ +#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */ + +#define STA_INS 0x0010 /* insert leap (rw) */ +#define STA_DEL 0x0020 /* delete leap (rw) */ +#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */ +#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */ + +#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */ +#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */ +#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */ +#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */ + +#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */ + +#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \ + STA_PPSERROR | STA_CLOCKERR) /* read-only bits */ + +/* + * Clock states (time_state) + */ +#define TIME_OK 0 /* no leap second warning */ +#define TIME_INS 1 /* insert leap second warning */ +#define TIME_DEL 2 /* delete leap second warning */ +#define TIME_OOP 3 /* leap second in progress */ +#define TIME_WAIT 4 /* leap second has occured */ +#define TIME_ERROR 5 /* clock not synchronized */ + +/* + * NTP user interface (ntp_gettime()) - used to read kernel clock values + * + * Note: maximum error = NTP synch distance = dispersion + delay / 2; + * estimated error = NTP dispersion. + */ +struct ntptimeval { + struct timeval time; /* current time (ro) */ + long maxerror; /* maximum error (us) (ro) */ + long esterror; /* estimated error (us) (ro) */ +}; + +/* + * NTP daemon interface - (ntp_adjtime()) used to discipline CPU clock + * oscillator + */ +struct timex { + unsigned int modes; /* clock mode bits (wo) */ + long offset; /* time offset (us) (rw) */ + long freq; /* frequency offset (scaled ppm) (rw) */ + long maxerror; /* maximum error (us) (rw) */ + long esterror; /* estimated error (us) (rw) */ + int status; /* clock status bits (rw) */ + long constant; /* pll time constant (rw) */ + long precision; /* clock precision (us) (ro) */ + long tolerance; /* clock frequency tolerance (scaled + * ppm) (ro) */ + /* + * The following read-only structure members are implemented + * only if the PPS signal discipline is configured in the + * kernel. + */ + long ppsfreq; /* pps frequency (scaled ppm) (ro) */ + long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + long stabil; /* pps stability (scaled ppm) (ro) */ + long jitcnt; /* jitter limit exceeded (ro) */ + long calcnt; /* calibration intervals (ro) */ + long errcnt; /* calibration errors (ro) */ + long stbcnt; /* stability limit exceeded (ro) */ + +}; + +#if defined(__FreeBSD__) || defined(__NetBSD__) + +#ifndef _KERNEL +#include + +__BEGIN_DECLS +extern int ntp_gettime __P((struct ntptimeval *)); +extern int ntp_adjtime __P((struct timex *)); +__END_DECLS + +#endif /* not _KERNEL */ + +#endif /* __FreeBSD__ || __NetBSD__ */ +#endif /* _SYS_TIMEX_H_ */ +/* $OpenBSD: timex.h,v 1.3 1996/04/18 21:41:16 niklas Exp $ */ /****************************************************************************** * * diff --git a/sys/sys/types.h b/sys/sys/types.h index be81e234888..1506d5a44fa 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -1,5 +1,5 @@ -/* $OpenBSD: types.h,v 1.6 1996/03/24 18:07:58 tholo Exp $ */ -/* $NetBSD: types.h,v 1.24 1995/12/29 01:15:13 jtc Exp $ */ +/* $OpenBSD: types.h,v 1.7 1996/04/18 21:41:17 niklas Exp $ */ +/* $NetBSD: types.h,v 1.25 1996/03/15 19:54:53 jtc Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993 @@ -50,13 +50,16 @@ #include #include -#ifndef _POSIX_SOURCE +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; + +typedef unsigned char unchar; /* Sys V compatibility */ typedef unsigned short ushort; /* Sys V compatibility */ typedef unsigned int uint; /* Sys V compatibility */ +typedef unsigned long ulong; /* Sys V compatibility */ #endif typedef u_int64_t u_quad_t; /* quads */ @@ -90,7 +93,7 @@ typedef int boolean_t; * long arguments will be promoted to off_t if the program fails to * include that header or explicitly cast them to off_t. */ -#ifndef _POSIX_SOURCE +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) #ifndef _KERNEL #include __BEGIN_DECLS @@ -99,9 +102,9 @@ int ftruncate __P((int, off_t)); int truncate __P((const char *, off_t)); __END_DECLS #endif /* !_KERNEL */ -#endif /* !_POSIX_SOURCE */ +#endif /* !defined(_POSIX_SOURCE) ... */ -#ifndef _POSIX_SOURCE +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) /* Major, minor numbers, dev_t's. */ #define major(x) ((int32_t)(((u_int32_t)(x) >> 8) & 0xff)) #define minor(x) ((int32_t)((x) & 0xff)) @@ -128,7 +131,7 @@ typedef _BSD_TIME_T_ time_t; #undef _BSD_TIME_T_ #endif -#ifndef _POSIX_SOURCE +#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) #define NBBY 8 /* number of bits in a byte */ /* @@ -181,5 +184,5 @@ struct tty; struct uio; #endif -#endif /* !_POSIX_SOURCE */ +#endif /* !defined(_POSIX_SOURCE) ... */ #endif /* !_SYS_TYPES_H_ */ diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 53ebc38152b..bd7705de932 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.3 1996/03/29 19:06:46 mickey Exp $ */ +/* $OpenBSD: vnode.h,v 1.4 1996/04/18 21:41:19 niklas Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /*