Bug 1276029 - Add subset of prio.h to PosixNSPR.h so PRFileDesc can be used in SpiderMonkey (r=terrence)

MozReview-Commit-ID: JhNhUcg3eC0

--HG--
extra : rebase_source : 43f5cebebdd4ef889ec71b57f7dd4109c72fa187
This commit is contained in:
Luke Wagner 2016-07-15 12:26:40 -05:00
Родитель b9795bc3cb
Коммит be263565b4
6 изменённых файлов: 109 добавлений и 3 удалений

Просмотреть файл

@ -71,6 +71,8 @@ included_inclnames_to_ignore = set([
'prcvar.h', # NSPR
'prerror.h', # NSPR
'prinit.h', # NSPR
'prio.h', # NSPR
'private/pprio.h', # NSPR
'prlink.h', # NSPR
'prlock.h', # NSPR
'prprf.h', # NSPR

Просмотреть файл

@ -726,7 +726,7 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
}
static const unsigned OOM_FAIL = unsigned(-1);
static const unsigned NO_DATA = unsigned(-2);
static const unsigned DUMMY_INDEX = unsigned(-2);
// Check if it is possible to add numInst instructions and numPoolEntries
// constant pool entries without needing to flush the current pool.
@ -810,7 +810,7 @@ struct AssemblerBufferWithConstantPools : public AssemblerBuffer<SliceSize, Inst
// The pool entry index is returned above when allocating an entry, but
// when not allocating an entry a dummy value is returned - it is not
// expected to be used by the caller.
return NO_DATA;
return DUMMY_INDEX;
}
public:

Просмотреть файл

@ -17,8 +17,10 @@
# include "prcvar.h"
# include "prinit.h"
# include "prio.h"
# include "prlock.h"
# include "prthread.h"
# include "private/pprio.h"
#endif

Просмотреть файл

@ -436,4 +436,11 @@ struct PerThreadDataFriendFields
} /* namespace js */
MOZ_BEGIN_EXTERN_C
// Defined in NSPR prio.h.
typedef struct PRFileDesc PRFileDesc;
MOZ_END_EXTERN_C
#endif /* jspubtd_h */

Просмотреть файл

@ -370,4 +370,46 @@ PR_WaitCondVar(PRCondVar* cvar, PRIntervalTime timeout)
}
}
int32_t
PR_FileDesc2NativeHandle(PRFileDesc* fd)
{
MOZ_CRASH("PR_FileDesc2NativeHandle");
}
PRStatus
PR_GetOpenFileInfo(PRFileDesc *fd, PRFileInfo *info)
{
MOZ_CRASH("PR_GetOpenFileInfo");
}
int32_t
PR_Seek(PRFileDesc *fd, int32_t offset, PRSeekWhence whence)
{
MOZ_CRASH("PR_Seek");
}
PRFileMap*
PR_CreateFileMap(PRFileDesc *fd, int64_t size, PRFileMapProtect prot)
{
MOZ_CRASH("PR_CreateFileMap");
}
void*
PR_MemMap(PRFileMap *fmap, int64_t offset, uint32_t len)
{
MOZ_CRASH("PR_MemMap");
}
PRStatus
PR_MemUnmap(void *addr, uint32_t len)
{
MOZ_CRASH("PR_MemUnmap");
}
PRStatus
PR_CloseFileMap(PRFileMap *fmap)
{
MOZ_CRASH("PR_CloseFileMap");
}
#endif /* JS_POSIX_NSPR */

Просмотреть файл

@ -10,7 +10,8 @@
#ifdef JS_POSIX_NSPR
#include <pthread.h>
#include <stdint.h>
#include "jspubtd.h"
namespace nspr {
class Thread;
@ -138,6 +139,58 @@ PR_TicksPerSecond();
PRStatus
PR_WaitCondVar(PRCondVar* cvar, PRIntervalTime timeout);
int32_t
PR_FileDesc2NativeHandle(PRFileDesc* fd);
enum PRFileType
{
PR_FILE_FILE = 1,
PR_FILE_DIRECTORY = 2,
PR_FILE_OTHER = 3
};
struct PRFileInfo
{
PRFileType type;
int32_t size;
int64_t creationTime;
int64_t modifyTime;
};
PRStatus
PR_GetOpenFileInfo(PRFileDesc *fd, PRFileInfo *info);
enum PRSeekWhence
{
PR_SEEK_SET = 0,
PR_SEEK_CUR = 1,
PR_SEEK_END = 2
};
int32_t
PR_Seek(PRFileDesc *fd, int32_t offset, PRSeekWhence whence);
enum PRFileMapProtect
{
PR_PROT_READONLY,
PR_PROT_READWRITE,
PR_PROT_WRITECOPY
};
struct PRFileMap;
PRFileMap*
PR_CreateFileMap(PRFileDesc *fd, int64_t size, PRFileMapProtect prot);
void*
PR_MemMap(PRFileMap *fmap, int64_t offset, uint32_t len);
PRStatus
PR_MemUnmap(void *addr, uint32_t len);
PRStatus
PR_CloseFileMap(PRFileMap *fmap);
#endif /* JS_POSIX_NSPR */
#endif /* vm_PosixNSPR_h */