Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: Bob Harris <harris@zk3.dec.com>
Subject: Re: Kernel memory
Date: Thu, 02 Aug 2001 09:01:58 -0400	[thread overview]
Message-ID: <020820010901584492%harris@zk3.dec.com> (raw)
In-Reply-To: 2f6bec0a.0108020002.29080aa8@posting.google.com

[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

In article <2f6bec0a.0108020002.29080aa8@posting.google.com>, Ginny E.
Kim <banny52@yahoo.com> wrote:

X  --------------------
X  #if defined(__DECC) && __DECC_VER >= 50860003
X  #define FINDINDEX(size) (__builtin_isconstant(size) ?
X  BUCKETINDEX(size) : -1)
X  #else
X  #define FINDINDEX(size) BUCKETINDEX(size)
X  #endif
X  
X  #define MALLOC(space, cast, size, type, flags) \
X          (space) = (cast)malloc((u_long)(size), FINDINDEX(size), type,
X  flags)
X  
X  
X  int     statesize = 5737;
X  static state_t **table = NULL;
X  
X  int table_init()
X  {
X          MALLOC(table, state_t **, sizeof(state_t *) * statesize,
X  M_TEMP, M_NOWAIT);
X          if (table != NULL)
X                  bzero((char *)table, statesize * sizeof(state_t *));
X          else {
X                  return -1;
X          }
X              ......................
X  }
X  -------------------------------------------
X  
X  In this case, if statesize is 5737, I can't have the system to
X  allocate memory using MALLOC. if statesize is 127 or 100, system can
X  allocate memory using MALLOC.
X  This program is a part of the loadable kernel module in Tru64UNIX 5.1.
X  Do Tru64UNIX V5.1 have the option that kernel memory to be allocate is
X  limited?
X  If then, how can it be increased?

MALLOC is used when the size of the storage can be specified as either
a hard coded constant, a #define contant, or a sizeof(...) constant.

MALLOC_VAR is used when the size of the storage is passed as a
variable.  'statesize' is a variable and thus you should be using
MALLOC_VAR

                                        Bob Harris


  reply	other threads:[~2001-08-02 13:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-02  8:02 Kernel memory Ginny E. Kim
2001-08-02 13:01 ` Bob Harris [this message]
2001-08-03  4:55   ` Ginny E. Kim
2001-08-03 13:43     ` Brian Haley
2001-08-04  6:32       ` Ginny E. Kim
2001-08-10 15:48         ` Brian Haley
2001-08-13  5:21           ` Ginny E. Kim
2001-08-13 18:47             ` Brian Haley
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox