Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 130889 | Differences between
and this patch

Collapse All | Expand All

(-)jpeg-6b/jmemansi.c (-1 / +30 lines)
Lines 12-17 Link Here
12
 * is shoved onto the user.
12
 * is shoved onto the user.
13
 */
13
 */
14
14
15
#include <unistd.h>
16
17
#ifdef __FreeBSD__
18
#include <sys/types.h>
19
#include <sys/sysctl.h>
20
#include <sys/vmmeter.h>
21
#include <vm/vm_param.h>
22
#endif
23
15
#define JPEG_INTERNALS
24
#define JPEG_INTERNALS
16
#include "jinclude.h"
25
#include "jinclude.h"
17
#include "jpeglib.h"
26
#include "jpeglib.h"
Lines 157-163 jpeg_open_backing_store (j_common_ptr ci Link Here
157
GLOBAL(long)
166
GLOBAL(long)
158
jpeg_mem_init (j_common_ptr cinfo)
167
jpeg_mem_init (j_common_ptr cinfo)
159
{
168
{
160
  return DEFAULT_MAX_MEM;	/* default for max_memory_to_use */
169
#ifdef _SC_AVPHYS_PAGES
170
  long phys_size;
171
 
172
  if ((phys_size = sysconf(_SC_AVPHYS_PAGES)) == -1)
173
    return DEFAULT_MAX_MEM; /* default for max_memory_to_use */
174
  if ((phys_size *= sysconf(_SC_PAGESIZE)) < 0)
175
    return DEFAULT_MAX_MEM;
176
  return (long) (phys_size * 0.95);
177
#if HAVE_SYSCTL && defined HW_PHYSMEM
178
  { /* This works on *bsd and darwin.  */
179
    unsigned int physmem;
180
    size_t len = sizeof physmem;
181
    static int mib[2] = { CTL_HW, HW_PHYSMEM };
182
183
    if (sysctl (mib, ARRAY_SIZE (mib), &physmem, &len, NULL, 0) == 0
184
        && len == sizeof (physmem))
185
      return (long) (physmem * 0.95 );
186
  }
187
#endif
188
189
  return DEFAULT_MAX_MEM;
161
}
190
}
162
191
163
GLOBAL(void)
192
GLOBAL(void)

Return to bug 130889