param.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* $OpenBSD: param.c,v 1.35 2015/01/09 05:01:56 tedu Exp $ */
  2. /* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */
  3. /*
  4. * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
  5. * All rights reserved.
  6. * (c) UNIX System Laboratories, Inc.
  7. * All or some portions of this file are derived from material licensed
  8. * to the University of California by American Telephone and Telegraph
  9. * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  10. * the permission of UNIX System Laboratories, Inc.
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. * 1. Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the distribution.
  20. * 3. Neither the name of the University nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  25. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  30. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  31. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  33. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  34. * SUCH DAMAGE.
  35. *
  36. * @(#)param.c 7.20 (Berkeley) 6/27/91
  37. */
  38. #include <sys/param.h>
  39. #include <sys/systm.h>
  40. #include <sys/socket.h>
  41. #include <sys/proc.h>
  42. #include <sys/vnode.h>
  43. #include <sys/file.h>
  44. #include <sys/timeout.h>
  45. #include <sys/mbuf.h>
  46. #include <ufs/ufs/quota.h>
  47. #include <sys/kernel.h>
  48. #include <sys/utsname.h>
  49. #ifdef SYSVSHM
  50. #include <machine/vmparam.h>
  51. #include <sys/shm.h>
  52. #endif
  53. #ifdef SYSVSEM
  54. #include <sys/sem.h>
  55. #endif
  56. #ifdef SYSVMSG
  57. #include <sys/msg.h>
  58. #endif
  59. /*
  60. * System parameter formulae.
  61. *
  62. * This file is copied into each directory where we compile
  63. * the kernel; it should be modified there to suit local taste
  64. * if necessary.
  65. *
  66. * Compiled with -DHZ=xx -DTIMEZONE=x -DDST=x -DMAXUSERS=xx
  67. */
  68. #ifndef TIMEZONE
  69. # define TIMEZONE 0
  70. #endif
  71. #ifndef DST
  72. # define DST 0
  73. #endif
  74. #ifndef HZ
  75. #define HZ 100
  76. #endif
  77. int hz = HZ;
  78. int tick = 1000000 / HZ;
  79. int tickadj = 240000 / (60 * HZ); /* can adjust 240ms in 60s */
  80. struct timezone tz = { TIMEZONE, DST };
  81. #define NPROCESS (30 + 16 * MAXUSERS)
  82. #define NTEXT (80 + NPROCESS / 8) /* actually the object cache */
  83. #define NVNODE (NPROCESS * 2 + NTEXT + 100)
  84. int initialvnodes = NVNODE;
  85. int maxprocess = NPROCESS;
  86. int maxthread = NPROCESS + 8 * MAXUSERS;
  87. int maxfiles = 5 * (NPROCESS + MAXUSERS) + 80;
  88. int nmbclust = NMBCLUSTERS;
  89. #ifndef MBLOWAT
  90. #define MBLOWAT 16
  91. #endif
  92. int mblowat = MBLOWAT;
  93. #ifndef MCLLOWAT
  94. #define MCLLOWAT 8
  95. #endif
  96. int mcllowat = MCLLOWAT;
  97. #ifndef BUFCACHEPERCENT
  98. #define BUFCACHEPERCENT 20
  99. #endif
  100. int bufcachepercent = BUFCACHEPERCENT;
  101. #ifndef BUFPAGES
  102. #define BUFPAGES 0
  103. #endif
  104. long bufpages = BUFPAGES;
  105. int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */
  106. /*
  107. * Values in support of System V compatible shared memory. XXX
  108. */
  109. #ifdef SYSVSHM
  110. #define SHMMAX SHMMAXPGS /* shminit() performs a `*= PAGE_SIZE' */
  111. #define SHMMIN 1
  112. #define SHMMNI 128 /* <64k, see IPCID_TO_IX in ipc.h */
  113. #define SHMSEG 128
  114. #define SHMALL (SHMMAXPGS)
  115. struct shminfo shminfo = {
  116. SHMMAX,
  117. SHMMIN,
  118. SHMMNI,
  119. SHMSEG,
  120. SHMALL
  121. };
  122. #endif
  123. /*
  124. * Values in support of System V compatible semaphores.
  125. */
  126. #ifdef SYSVSEM
  127. struct seminfo seminfo = {
  128. SEMMNI, /* # of semaphore identifiers */
  129. SEMMNS, /* # of semaphores in system */
  130. SEMMNU, /* # of undo structures in system */
  131. SEMMSL, /* max # of semaphores per id */
  132. SEMOPM, /* max # of operations per semop call */
  133. SEMUME, /* max # of undo entries per process */
  134. SEMUSZ, /* size in bytes of undo structure */
  135. SEMVMX, /* semaphore maximum value */
  136. SEMAEM /* adjust on exit max value */
  137. };
  138. #endif
  139. /*
  140. * This has to be allocated somewhere; allocating
  141. * them here forces loader errors if this file is omitted
  142. * (if they've been externed everywhere else; hah!).
  143. */
  144. struct utsname utsname;