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 / +27 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
#elif defined(__FreeBSD__)|| defined(__DragonFly__)
178
  int mib[2] = { CTL_VM, VM_METER }
179
  struct vmtotal memory;
180
  size_t len = sizeof(memory);
181
182
  sysctl(mib, 2, &memory, &len, NULL, 0);
183
  return (long) (memory->t_free * getpagesize() * 0.95);
184
#endif
185
186
  return DEFAULT_MAX_MEM;
161
}
187
}
162
188
163
GLOBAL(void)
189
GLOBAL(void)

Return to bug 130889