Commit | Line | Data |
---|---|---|
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 | * | |
ca67e7b4 | 6 | * @(#)subr_xxx.c 7.5 (Berkeley) 7/21/87 |
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 | */ |
14 | nodev() | |
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 | */ | |
24 | nulldev() | |
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 |
35 | imin(a, b) |
36 | { | |
37 | ||
38 | return (a < b ? a : b); | |
39 | } | |
40 | ||
41 | imax(a, b) | |
42 | { | |
43 | ||
44 | return (a > b ? a : b); | |
45 | } | |
46 | ||
6459ebe0 KM |
47 | unsigned |
48 | min(a, b) | |
b32450f4 | 49 | u_int a, b; |
6459ebe0 KM |
50 | { |
51 | ||
52 | return (a < b ? a : b); | |
53 | } | |
54 | ||
55 | unsigned | |
56 | max(a, b) | |
b32450f4 | 57 | u_int a, b; |
6459ebe0 KM |
58 | { |
59 | ||
60 | return (a > b ? a : b); | |
61 | } | |
fb1db32c | 62 | #endif |
b32450f4 | 63 | |
fb1db32c | 64 | #if !defined(vax) && !defined(tahoe) |
cb99a88a BJ |
65 | ffs(mask) |
66 | register long mask; | |
67 | { | |
68 | register int i; | |
69 | ||
88a7a62a | 70 | for(i = 1; i < NSIG; i++) { |
cb99a88a BJ |
71 | if (mask & 1) |
72 | return (i); | |
73 | mask >>= 1; | |
74 | } | |
75 | return (0); | |
76 | } | |
fb1db32c | 77 | #endif |
febd1daa | 78 | |
fb1db32c | 79 | #if !defined(vax) |
febd1daa BJ |
80 | bcmp(s1, s2, len) |
81 | register char *s1, *s2; | |
9d61b7ff | 82 | register unsigned len; |
febd1daa BJ |
83 | { |
84 | ||
f49dd739 | 85 | while (len--) |
febd1daa BJ |
86 | if (*s1++ != *s2++) |
87 | return (1); | |
88 | return (0); | |
89 | } | |
90 | ||
91 | strlen(s1) | |
92 | register char *s1; | |
93 | { | |
94 | register int len; | |
95 | ||
96 | for (len = 0; *s1++ != '\0'; len++) | |
97 | /* void */; | |
98 | return (len); | |
99 | } | |
100 | #endif |