OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [libiberty/] [getpagesize.c] - Blame information for rev 823

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Emulation of getpagesize() for systems that need it. */
2
 
3
/*
4
 
5
@deftypefn Supplemental int getpagesize (void)
6
 
7
Returns the number of bytes in a page of memory.  This is the
8
granularity of many of the system memory management routines.  No
9
guarantee is made as to whether or not it is the same as the basic
10
memory management hardware page size.
11
 
12
@end deftypefn
13
 
14
BUGS
15
 
16
        Is intended as a reasonable replacement for systems where this
17
        is not provided as a system call.  The value of 4096 may or may
18
        not be correct for the systems where it is returned as the default
19
        value.
20
 
21
*/
22
 
23
#ifndef VMS
24
 
25
#include "config.h"
26
 
27
#include <sys/types.h>
28
#ifdef HAVE_SYS_PARAM_H
29
#include <sys/param.h>
30
#endif
31
 
32
#undef GNU_OUR_PAGESIZE
33
#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
34
#include <unistd.h>
35
#ifdef _SC_PAGESIZE
36
#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
37
#endif
38
#endif
39
 
40
#ifndef GNU_OUR_PAGESIZE
41
# ifdef PAGESIZE
42
#  define       GNU_OUR_PAGESIZE PAGESIZE
43
# else  /* no PAGESIZE */
44
#  ifdef        EXEC_PAGESIZE
45
#   define      GNU_OUR_PAGESIZE EXEC_PAGESIZE
46
#  else /* no EXEC_PAGESIZE */
47
#   ifdef       NBPG
48
#    define     GNU_OUR_PAGESIZE (NBPG * CLSIZE)
49
#    ifndef     CLSIZE
50
#     define    CLSIZE 1
51
#    endif      /* CLSIZE */
52
#   else        /* no NBPG */
53
#    ifdef      NBPC
54
#     define    GNU_OUR_PAGESIZE NBPC
55
#    else       /* no NBPC */
56
#     define    GNU_OUR_PAGESIZE 4096   /* Just punt and use reasonable value */
57
#    endif /* NBPC */
58
#   endif /* NBPG */
59
#  endif /* EXEC_PAGESIZE */
60
# endif /* PAGESIZE */
61
#endif /* GNU_OUR_PAGESIZE */
62
 
63
int
64
getpagesize (void)
65
{
66
  return (GNU_OUR_PAGESIZE);
67
}
68
 
69
#else /* VMS */
70
 
71
#if 0   /* older distributions of gcc-vms are missing <syidef.h> */
72
#include <syidef.h>
73
#endif
74
#ifndef SYI$_PAGE_SIZE  /* VMS V5.4 and earlier didn't have this yet */
75
#define SYI$_PAGE_SIZE 4452
76
#endif
77
extern unsigned long lib$getsyi(const unsigned short *,...);
78
 
79
int getpagesize (void)
80
{
81
  long pagsiz = 0L;
82
  unsigned short itmcod = SYI$_PAGE_SIZE;
83
 
84
  (void) lib$getsyi (&itmcod, (void *) &pagsiz);
85
  if (pagsiz == 0L)
86
    pagsiz = 512L;      /* VAX default */
87
  return (int) pagsiz;
88
}
89
 
90
#endif /* VMS */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.