VFLUSHO -> VDISCARD
[unix-history] / usr / src / sys / kern / subr_xxx.c
CommitLineData
da7c5cc6 1/*
0880b18e 2 * Copyright (c) 1982, 1986 Regents of the University of California.
da7c5cc6
KM
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 *
06f5dbd9 6 * @(#)subr_xxx.c 7.7 (Berkeley) %G%
da7c5cc6 7 */
961945a8 8
d30e3c48 9#include "errno.h"
ae9e2121 10
ae9e2121 11/*
50a84b40 12 * Routine placed in illegal entries in the bdevsw and cdevsw tables.
ae9e2121
BJ
13 */
14nodev()
15{
16
50a84b40 17 return (ENODEV);
ae9e2121
BJ
18}
19
20/*
21 * Null routine; placed in insignificant entries
22 * in the bdevsw and cdevsw tables.
23 */
24nulldev()
25{
26
50a84b40 27 return (0);
ae9e2121
BJ
28}
29
fb1db32c
MK
30/*
31 * Definitions of various trivial functions;
32 * usually expanded inline rather than being defined here.
33 */
34#if !defined(vax) && !defined(tahoe)
ae9e2121
BJ
35imin(a, b)
36{
37
38 return (a < b ? a : b);
39}
40
41imax(a, b)
42{
43
44 return (a > b ? a : b);
45}
46
6459ebe0
KM
47unsigned
48min(a, b)
06f5dbd9 49 unsigned a, b;
6459ebe0
KM
50{
51
52 return (a < b ? a : b);
53}
54
55unsigned
56max(a, b)
06f5dbd9 57 unsigned a, b;
6459ebe0
KM
58{
59
60 return (a > b ? a : b);
61}
fb1db32c 62#endif
b32450f4 63
06f5dbd9 64#if !defined(vax) && !defined(tahoe) && !defined(hp300)
cb99a88a
BJ
65ffs(mask)
66 register long mask;
67{
42c08c41 68 register int bit;
cb99a88a 69
42c08c41
KB
70 if (!mask)
71 return(0);
72 for (bit = 1;; ++bit)
73 if (mask&0x01)
74 return(bit);
cb99a88a
BJ
75 mask >>= 1;
76 }
cb99a88a 77}
fb1db32c 78#endif
febd1daa 79
06f5dbd9 80#if !defined(vax) && !defined(hp300)
febd1daa
BJ
81bcmp(s1, s2, len)
82 register char *s1, *s2;
9d61b7ff 83 register unsigned len;
febd1daa
BJ
84{
85
f49dd739 86 while (len--)
febd1daa
BJ
87 if (*s1++ != *s2++)
88 return (1);
89 return (0);
90}
91
92strlen(s1)
93 register char *s1;
94{
95 register int len;
96
97 for (len = 0; *s1++ != '\0'; len++)
98 /* void */;
99 return (len);
100}
101#endif