diff options
author | wtc%netscape.com <devnull@localhost> | 2000-05-11 23:54:04 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2000-05-11 23:54:04 +0000 |
commit | 61ce2d5bb2a4bc43ab655366690cad302d1195f7 (patch) | |
tree | 7c5e62d540f39fac47ca9ffb7f9bdd43d8f5eed4 | |
parent | bdd248d26b0eda034e358128002e81885b47d463 (diff) | |
download | nspr-hg-61ce2d5bb2a4bc43ab655366690cad302d1195f7.tar.gz |
Bugzilla bug #38996: added new function PR_GetMemMapAlignment().
Modified files: prio.h, _beos.h, _macos.h, _os2.h, _unixos.h, _win16.h,
_win95.h, _winnt.h, primpl.h, prmmap.c, bmmap.c, macio.c, os2misc.c,
ntmisc.c, w16fmem.c
-rw-r--r-- | pr/include/md/_beos.h | 2 | ||||
-rw-r--r-- | pr/include/md/_macos.h | 3 | ||||
-rw-r--r-- | pr/include/md/_os2.h | 3 | ||||
-rw-r--r-- | pr/include/md/_unixos.h | 2 | ||||
-rw-r--r-- | pr/include/md/_win16.h | 3 | ||||
-rw-r--r-- | pr/include/md/_win95.h | 3 | ||||
-rw-r--r-- | pr/include/md/_winnt.h | 3 | ||||
-rw-r--r-- | pr/include/prio.h | 8 | ||||
-rw-r--r-- | pr/include/private/primpl.h | 3 | ||||
-rw-r--r-- | pr/src/io/prmmap.c | 5 | ||||
-rw-r--r-- | pr/src/md/beos/bmmap.c | 7 | ||||
-rw-r--r-- | pr/src/md/mac/macio.c | 7 | ||||
-rw-r--r-- | pr/src/md/os2/os2misc.c | 7 | ||||
-rw-r--r-- | pr/src/md/windows/ntmisc.c | 8 | ||||
-rw-r--r-- | pr/src/md/windows/w16fmem.c | 7 |
15 files changed, 70 insertions, 1 deletions
diff --git a/pr/include/md/_beos.h b/pr/include/md/_beos.h index cd8eee65..e9550785 100644 --- a/pr/include/md/_beos.h +++ b/pr/include/md/_beos.h @@ -359,6 +359,7 @@ struct protoent* getprotobynumber(int number); /* Memory mapped file I/O */ #define _MD_CREATE_FILE_MAP _MD_create_file_map +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment #define _MD_MEM_MAP _MD_mem_map #define _MD_MEM_UNMAP _MD_mem_unmap #define _MD_CLOSE_FILE_MAP _MD_close_file_map @@ -552,6 +553,7 @@ NSPR_API(void) _MD_free_segment(PRSegment *seg); /* Memory mapped file I/O */ NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size); +NSPR_API(PRInt32) _MD_get_mem_map_alignment(void); NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len); NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size); NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap); diff --git a/pr/include/md/_macos.h b/pr/include/md/_macos.h index 2c2710b3..aed235ed 100644 --- a/pr/include/md/_macos.h +++ b/pr/include/md/_macos.h @@ -591,6 +591,9 @@ struct _MDFileMap { extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size); #define _MD_CREATE_FILE_MAP _MD_CreateFileMap +extern PRInt32 _MD_GetMemMapAlignment(void); +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment + extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset, PRUint32 len); #define _MD_MEM_MAP _MD_MemMap diff --git a/pr/include/md/_os2.h b/pr/include/md/_os2.h index 70e8d112..5f8f460b 100644 --- a/pr/include/md/_os2.h +++ b/pr/include/md/_os2.h @@ -443,6 +443,9 @@ struct _MDFileMap { extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size); #define _MD_CREATE_FILE_MAP _MD_CreateFileMap +extern PRInt32 _MD_GetMemMapAlignment(void); +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment + extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset, PRUint32 len); #define _MD_MEM_MAP _MD_MemMap diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h index 7bd86872..1a0352d7 100644 --- a/pr/include/md/_unixos.h +++ b/pr/include/md/_unixos.h @@ -455,6 +455,8 @@ struct _MDFileMap { extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size); #define _MD_CREATE_FILE_MAP _MD_CreateFileMap +#define _MD_GET_MEM_MAP_ALIGNMENT PR_GetPageSize() + extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset, PRUint32 len); #define _MD_MEM_MAP _MD_MemMap diff --git a/pr/include/md/_win16.h b/pr/include/md/_win16.h index 2885f871..81a829a0 100644 --- a/pr/include/md/_win16.h +++ b/pr/include/md/_win16.h @@ -499,6 +499,9 @@ struct _MDFileMap { extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size); #define _MD_CREATE_FILE_MAP _MD_CreateFileMap +extern PRInt32 _MD_GetMemMapAlignment(void); +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment + extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset, PRUint32 len); #define _MD_MEM_MAP _MD_MemMap diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h index 4e8e37a7..741fd482 100644 --- a/pr/include/md/_win95.h +++ b/pr/include/md/_win95.h @@ -440,6 +440,9 @@ struct _MDFileMap { extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size); #define _MD_CREATE_FILE_MAP _MD_CreateFileMap +extern PRInt32 _MD_GetMemMapAlignment(void); +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment + extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset, PRUint32 len); #define _MD_MEM_MAP _MD_MemMap diff --git a/pr/include/md/_winnt.h b/pr/include/md/_winnt.h index b4bd27f2..41602fb8 100644 --- a/pr/include/md/_winnt.h +++ b/pr/include/md/_winnt.h @@ -518,6 +518,9 @@ struct _MDFileMap { extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size); #define _MD_CREATE_FILE_MAP _MD_CreateFileMap +extern PRInt32 _MD_GetMemMapAlignment(void); +#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment + extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset, PRUint32 len); #define _MD_MEM_MAP _MD_MemMap diff --git a/pr/include/prio.h b/pr/include/prio.h index 33f997ec..46a88475 100644 --- a/pr/include/prio.h +++ b/pr/include/prio.h @@ -1750,9 +1750,15 @@ NSPR_API(PRFileMap *) PR_CreateFileMap( PRInt64 size, PRFileMapProtect prot); +/* + * return the alignment (in bytes) of the offset argument to PR_MemMap + */ +NSPR_API(PRInt32) PR_GetMemMapAlignment(void); + NSPR_API(void *) PR_MemMap( PRFileMap *fmap, - PROffset64 offset, /* must be aligned and sized to whole pages */ + PROffset64 offset, /* must be aligned and sized according to the + * return value of PR_GetMemMapAlignment() */ PRUint32 len); NSPR_API(PRStatus) PR_MemUnmap(void *addr, PRUint32 len); diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index 7547ccb6..1cb6e7f0 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -1803,6 +1803,9 @@ extern PRStatus _PR_MD_UNLOCKFILE(PRInt32 osfd); extern PRStatus _PR_MD_CREATE_FILE_MAP(PRFileMap *fmap, PRInt64 size); #define _PR_MD_CREATE_FILE_MAP _MD_CREATE_FILE_MAP +extern PRInt32 _PR_MD_GET_MEM_MAP_ALIGNMENT(void); +#define _PR_MD_GET_MEM_MAP_ALIGNMENT _MD_GET_MEM_MAP_ALIGNMENT + extern void * _PR_MD_MEM_MAP( PRFileMap *fmap, PROffset64 offset, diff --git a/pr/src/io/prmmap.c b/pr/src/io/prmmap.c index 351adb1a..a824a132 100644 --- a/pr/src/io/prmmap.c +++ b/pr/src/io/prmmap.c @@ -50,6 +50,11 @@ PR_IMPLEMENT(PRFileMap *) PR_CreateFileMap( } } +PR_IMPLEMENT(PRInt32) PR_GetMemMapAlignment(void) +{ + return _PR_MD_GET_MEM_MAP_ALIGNMENT(); +} + PR_IMPLEMENT(void *) PR_MemMap( PRFileMap *fmap, PROffset64 offset, diff --git a/pr/src/md/beos/bmmap.c b/pr/src/md/beos/bmmap.c index 8f35e0dd..30b31f60 100644 --- a/pr/src/md/beos/bmmap.c +++ b/pr/src/md/beos/bmmap.c @@ -19,6 +19,13 @@ _PR_MD_CREATE_FILE_MAP(PRFileMap *fmap, PRInt64 size) return PR_FAILURE; } +PR_EXTERN(PRInt32) +_PR_MD_GET_MEM_MAP_ALIGNMENT(void) +{ + PR_SetError( PR_NOT_IMPLEMENTED_ERROR, 0 ); + return -1; +} + PR_EXTERN(void *) _PR_MD_MEM_MAP(PRFileMap *fmap, PRInt64 offset, PRUint32 len) { diff --git a/pr/src/md/mac/macio.c b/pr/src/md/mac/macio.c index 07aa4bc0..d062ce7a 100644 --- a/pr/src/md/mac/macio.c +++ b/pr/src/md/mac/macio.c @@ -1898,6 +1898,13 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) return PR_FAILURE; } +PRInt32 _MD_GetMemMapAlignment(void) +{ + PR_ASSERT(!"Not implemented"); + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +} + void * _MD_MemMap( PRFileMap *fmap, PROffset64 offset, diff --git a/pr/src/md/os2/os2misc.c b/pr/src/md/os2/os2misc.c index 27277e68..fc1ada88 100644 --- a/pr/src/md/os2/os2misc.c +++ b/pr/src/md/os2/os2misc.c @@ -495,6 +495,13 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) return PR_FAILURE; } +PRInt32 _MD_GetMemMapAlignment(void) +{ + PR_ASSERT(!"Not implemented"); + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +} + void * _MD_MemMap( PRFileMap *fmap, PROffset64 offset, diff --git a/pr/src/md/windows/ntmisc.c b/pr/src/md/windows/ntmisc.c index f03a9ef6..e1042b26 100644 --- a/pr/src/md/windows/ntmisc.c +++ b/pr/src/md/windows/ntmisc.c @@ -665,6 +665,14 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) } return PR_SUCCESS; } + +PRInt32 _MD_GetMemMapAlignment(void) +{ + SYSTEM_INFO info; + GetSystemInfo(&info); + return info.dwAllocationGranularity; +} + #include "prlog.h" extern PRLogModuleInfo *_pr_shma_lm; void * _MD_MemMap( diff --git a/pr/src/md/windows/w16fmem.c b/pr/src/md/windows/w16fmem.c index 9a9a72d4..e544522c 100644 --- a/pr/src/md/windows/w16fmem.c +++ b/pr/src/md/windows/w16fmem.c @@ -33,6 +33,13 @@ PRStatus _MD_CreateFileMap(PRFileMap *fmap, PRInt64 size) return PR_FAILURE; } +PRInt32 _MD_GetMemMapAlignment(void) +{ + PR_ASSERT(!"Not implemented"); + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return -1; +} + void * _MD_MemMap( PRFileMap *fmap, PRInt64 offset, |