1 /* 2 * Copyright (c) 1982, 1986 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)subr_xxx.c 7.4 (Berkeley) 06/06/87 7 */ 8 9 #include "../machine/pte.h" 10 11 #include "param.h" 12 #include "systm.h" 13 #include "conf.h" 14 #include "inode.h" 15 #include "dir.h" 16 #include "user.h" 17 #include "buf.h" 18 #include "proc.h" 19 #include "fs.h" 20 #include "vm.h" 21 #include "cmap.h" 22 #include "uio.h" 23 24 /* 25 * Routine placed in illegal entries in the bdevsw and cdevsw tables. 26 */ 27 nodev() 28 { 29 30 return (ENODEV); 31 } 32 33 /* 34 * Null routine; placed in insignificant entries 35 * in the bdevsw and cdevsw tables. 36 */ 37 nulldev() 38 { 39 40 return (0); 41 } 42 43 /* 44 * Definitions of various trivial functions; 45 * usually expanded inline rather than being defined here. 46 */ 47 #if !defined(vax) && !defined(tahoe) 48 imin(a, b) 49 { 50 51 return (a < b ? a : b); 52 } 53 54 imax(a, b) 55 { 56 57 return (a > b ? a : b); 58 } 59 60 unsigned 61 min(a, b) 62 u_int a, b; 63 { 64 65 return (a < b ? a : b); 66 } 67 68 unsigned 69 max(a, b) 70 u_int a, b; 71 { 72 73 return (a > b ? a : b); 74 } 75 #endif 76 77 #if !defined(vax) && !defined(tahoe) 78 ffs(mask) 79 register long mask; 80 { 81 register int i; 82 83 for(i = 1; i < NSIG; i++) { 84 if (mask & 1) 85 return (i); 86 mask >>= 1; 87 } 88 return (0); 89 } 90 #endif 91 92 #if !defined(vax) 93 bcmp(s1, s2, len) 94 register char *s1, *s2; 95 register unsigned len; 96 { 97 98 while (len--) 99 if (*s1++ != *s2++) 100 return (1); 101 return (0); 102 } 103 104 strlen(s1) 105 register char *s1; 106 { 107 register int len; 108 109 for (len = 0; *s1++ != '\0'; len++) 110 /* void */; 111 return (len); 112 } 113 #endif 114