home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2004 May / SGI IRIX 6.5 Applications 2004 May.iso / dev / java_dev.idb / usr / java / include / sys_api.h.z / sys_api.h
Encoding:
C/C++ Source or Header  |  2000-05-20  |  6.3 KB  |  213 lines

  1. /*
  2.  * @(#)sys_api.h    1.66 99/01/22
  3.  *
  4.  * Copyright 1995-1999 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  * 
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. /*
  16.  * System or Host dependent API.  This defines the "porting layer" for
  17.  * POSIX.1 compliant operating systems.
  18.  */
  19.  
  20. #ifndef _SYS_API_H_
  21. #define _SYS_API_H_
  22.  
  23. /*
  24.  * typedefs_md.h includes basic types for this platform;
  25.  * any macros for HPI functions have been moved to "sysmacros_md.h"
  26.  */
  27. #include "typedefs_md.h"
  28.  
  29. /*
  30.  * Miscellaneous system utility APIs that fall outside the POSIX.1
  31.  * spec.
  32.  *
  33.  * Until POSIX (P1003.1a) formerly P.4 is standard, we'll use our
  34.  * time struct definitions found in timeval.h.
  35.  */
  36. #include "timeval.h"
  37. long     sysGetMilliTicks(void);
  38. long    sysTime(long *);
  39. int64_t sysTimeMillis(void);
  40.  
  41. #include "time.h"
  42. struct tm * sysLocaltime(time_t *, struct tm*);
  43. struct tm * sysGmtime(time_t *, struct tm*);
  44. void        sysStrftime(char *, int, char *, struct tm *);
  45. time_t      sysMktime(struct tm*);
  46.  
  47. /*
  48.  * System API for general allocations
  49.  */
  50. void *    sysMalloc(size_t);
  51. void *    sysRealloc(void*, size_t);
  52. void    sysFree(void*);
  53. void *    sysCalloc(size_t, size_t);
  54. #ifdef PAGED_HEAPS
  55. void *  sysAllocBlock(size_t, void**);
  56. void    sysFreeBlock(void *);
  57. #endif /* PAGED_HEAPS */
  58.  
  59. /*
  60.  * System API for dynamic linking libraries into the interpreter
  61.  */
  62. char *  sysInitializeLinker(void);
  63. int     sysAddDLSegment(char *);
  64. void    sysSaveLDPath(char *);
  65. long    sysDynamicLink(char *);
  66. void    sysBuildLibName(char *, int, char *, char *);
  67. int     sysBuildFunName(char *, int, void *, int);
  68. #if (_MIPS_SIM == _ABIO32)
  69. long *
  70. sysInvokeNative(int, size_t, size_t, size_t, void *, void *, size_t *,int,char *, size_t *, unsigned char *);
  71. #else /* n32 */
  72. long *
  73. sysInvokeNative(void *, size_t, int, void *, size_t *, int, char *, size_t *, unsigned char *);
  74. #endif
  75.  
  76. /*
  77.  * System API for invoking the interpreter from native applications
  78.  */
  79. void    sysGetDefaultJavaVMInitArgs(void *);
  80. int     sysInitializeJavaVM(void *, void *);
  81. int     sysFinalizeJavaVM(void *);
  82. void    sysAttachThreadLock();
  83. void    sysAttachThreadUnlock();
  84.  
  85. /*
  86.  * System API for threads
  87.  */
  88. typedef struct  sys_thread sys_thread_t;
  89. typedef struct  sys_mon sys_mon_t;
  90. typedef void *  stackp_t;
  91.  
  92. int     sysThreadBootstrap(sys_thread_t **, void *);
  93. void     sysThreadInitializeSystemThreads(void);
  94. int     sysThreadCreate(long, uint_t flags, void *(*)(void *),
  95.             sys_thread_t **, void *);
  96. void    sysThreadExit(void);
  97. sys_thread_t * sysThreadSelf(void);
  98. void    sysThreadYield(void);
  99. int     sysThreadVMSuspend(sys_thread_t *, sys_thread_t *);
  100. void    sysThreadVMSuspendMe(void);
  101. int     sysThreadVMUnsuspend(sys_thread_t *);
  102. int    sysThreadSuspend(sys_thread_t *);
  103. int    sysThreadResume(sys_thread_t *);
  104. int    sysThreadSetPriority(sys_thread_t *, int);
  105. int    sysThreadGetPriority(sys_thread_t *, int *);
  106. void *  sysThreadStackPointer(sys_thread_t *); 
  107. stackp_t sysThreadStackBase(sys_thread_t *); 
  108. void    sysThreadSetStackBase(sys_thread_t *, stackp_t); 
  109. int    sysThreadSingle(void);
  110. void    sysThreadMulti(void);
  111. int     sysThreadEnumerateOver(int (*)(sys_thread_t *, void *), void *);
  112. void    sysThreadInit(sys_thread_t *, stackp_t);
  113. void *  sysThreadGetBackPtr(sys_thread_t *);
  114. int     sysThreadCheckStack(void);
  115. stackp_t sysThreadStackLimit(void);
  116. int     sysInterruptsPending(void);
  117. void    sysThreadPostException(sys_thread_t *, void *);
  118. void    sysThreadDumpInfo(sys_thread_t *);
  119. void    sysThreadInterrupt(sys_thread_t *);
  120. int     sysThreadIsInterrupted(sys_thread_t *, long);
  121. int     sysThreadAlloc(sys_thread_t **, stackp_t, void *);
  122. int     sysThreadFree(sys_thread_t *);
  123.  
  124. /*
  125.  * System API for monitors
  126.  */
  127. int     sysMonitorSizeof(void);
  128. int     sysMonitorInit(sys_mon_t *);
  129. int     sysMonitorDestroy(sys_mon_t *);
  130. int     sysMonitorEnter(sys_mon_t *);
  131. bool_t  sysMonitorEntered(sys_mon_t *);
  132. int     sysMonitorExit(sys_mon_t *);
  133. int     sysMonitorNotify(sys_mon_t *);
  134. int     sysMonitorNotifyAll(sys_mon_t *);
  135. int     sysMonitorWait(sys_mon_t *, int, bool_t);
  136. void    sysMonitorDumpInfo(sys_mon_t *);
  137. bool_t  sysMonitorInUse(sys_mon_t *);
  138.  
  139. #define SYS_OK            0
  140. #define SYS_ERR           -1
  141. #define SYS_INTRPT     -2    /* Operation was interrupted */
  142. #define SYS_TIMEOUT    -3    /* A timer ran out */
  143. #define SYS_NOMEM      -5    /* Ran out of memory */
  144. #define SYS_NORESOURCE -6    /* Ran out of some system resource */
  145.  
  146. /*
  147.  * Symbolic constant to be used when waiting indefinitly on a condition
  148.  * variable
  149.  */
  150. #define SYS_TIMEOUT_INFINITY -1
  151.  
  152. /*
  153.  * System API for raw memory allocation
  154.  */
  155. void *  sysMapMem(long, long *);
  156. void *  sysUnmapMem(void *, long, long *);
  157. void *  sysCommitMem(void *, long, long *);
  158. void *  sysDecommitMem(void *, long, long *);
  159. void *  sysUncommitMem(void *, long, long *);
  160.  
  161. /*
  162.  * System API for termination
  163.  */
  164. void    sysExit(int);
  165. int    sysAtexit(void (*func)(void));
  166. void    sysAbort(void);
  167.  
  168. /*
  169.  * System API for files
  170.  */
  171. extern int sysIsAbsolute(const char* path);
  172. extern int sysAccess(const char* pFile, int perm);
  173.  
  174. extern int sysStat(const char *path, struct stat *sbuf);
  175. extern int sysFStat(int fd, struct stat * sbuf);
  176.  
  177. extern int sysOpen(const char *name, int openMode, int filePerm);
  178. extern int sysClose(int fd);
  179.  
  180. extern long sysSeek(int fd, long offset, int whence);
  181. extern int sysAvailable(int fd, long* bytes);
  182. extern size_t sysRead(int fd, void *buf, unsigned int nBytes);
  183. extern size_t sysWrite(int fd, const void *buf, unsigned int nBytes);
  184.  
  185. extern int sysRename(const char* srcName, const char* dstName);
  186. extern int sysUnlink(const char* file);
  187.  
  188. extern int sysMkdir(const char* path, int mode);
  189. extern int sysRmdir(const char* path);
  190. extern int sysCanonicalPath(char *path, char *result, int result_len);
  191.  
  192. #include "io_md.h"
  193. extern DIR* sysOpenDir(const char* path);
  194. extern int sysCloseDir(DIR* dp);
  195. extern struct dirent* sysReadDir(DIR* dp);
  196.  
  197. /*
  198.  * API support needed for various multiprocessor related syncronization
  199.  * primitives.  Systems that don't use real threads can just define
  200.  * these to be 0 in their sysmacros_md.h.
  201.  */
  202.  
  203. int sysIsMP();
  204. void sysMemoryFlush();
  205. void sysStoreBarrier();
  206.  
  207. /*
  208.  * Include platform specific macros to override these
  209.  */
  210. #include "sysmacros_md.h"
  211.  
  212. #endif /* !_SYS_API_H_ */
  213.