home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1999 November / SGI IRIX 6.5 Applications 1999 November.iso / dev / java_dev.idb / usr / java / include / sys_api.h.z / sys_api.h
Encoding:
C/C++ Source or Header  |  1998-07-14  |  6.7 KB  |  220 lines

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