comparison src/ralloc.c @ 31513:6e606fa28569

(r_alloc_init_fd): Move. Fix conditional for pcc.
author Dave Love <fx@gnu.org>
date Fri, 08 Sep 2000 16:31:11 +0000
parents 6bc82db7d305
children 92dec3ff92a1
comparison
equal deleted inserted replaced
31512:83b2a14bea5b 31513:6e606fa28569
1315 static int mmap_enlarge P_ ((struct mmap_region *, int)); 1315 static int mmap_enlarge P_ ((struct mmap_region *, int));
1316 static struct mmap_region *mmap_find P_ ((POINTER_TYPE *, POINTER_TYPE *)); 1316 static struct mmap_region *mmap_find P_ ((POINTER_TYPE *, POINTER_TYPE *));
1317 POINTER_TYPE *r_alloc P_ ((POINTER_TYPE **, size_t)); 1317 POINTER_TYPE *r_alloc P_ ((POINTER_TYPE **, size_t));
1318 POINTER_TYPE *r_re_alloc P_ ((POINTER_TYPE **, size_t)); 1318 POINTER_TYPE *r_re_alloc P_ ((POINTER_TYPE **, size_t));
1319 void r_alloc_free P_ ((POINTER_TYPE **ptr)); 1319 void r_alloc_free P_ ((POINTER_TYPE **ptr));
1320 1320 void r_alloc_init_fd ();
1321
1322 void
1323 r_alloc_init_fd ()
1324 {
1325 #if !MAP_ANON
1326 /* No anonymous mmap -- we need the file descriptor. */
1327 mmap_fd = open ("/dev/zero", O_RDONLY);
1328 if (mmap_fd < 0)
1329 fatal ("cannot open /dev/zero");
1330 #endif
1331 }
1332 1321
1333 /* Return a region overlapping address range START...END, or null if 1322 /* Return a region overlapping address range START...END, or null if
1334 none. END is not including, i.e. the last byte in the range 1323 none. END is not including, i.e. the last byte in the range
1335 is at END - 1. */ 1324 is at END - 1. */
1336 1325
1665 1654
1666 #ifndef SYSTEM_MALLOC 1655 #ifndef SYSTEM_MALLOC
1667 extern POINTER (*__morecore) (); 1656 extern POINTER (*__morecore) ();
1668 #endif 1657 #endif
1669 1658
1659 /* Set up the file descriptor for non-anonymous mmapping. */
1660
1661 void
1662 r_alloc_init_fd ()
1663 {
1664 #ifdef REL_ALLOC_MMAP
1665 #if !MAP_ANON
1666 /* No anonymous mmap -- we need the file descriptor. */
1667 mmap_fd = open ("/dev/zero", O_RDONLY);
1668 if (mmap_fd < 0)
1669 fatal ("cannot open /dev/zero");
1670 #endif
1671 #endif
1672 }
1673
1670 /* Initialize various things for memory allocation. */ 1674 /* Initialize various things for memory allocation. */
1671 1675
1672 static void 1676 static void
1673 r_alloc_init () 1677 r_alloc_init ()
1674 { 1678 {