home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / solaris2 / jdk / include / sys_api.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-30  |  4.8 KB  |  147 lines

  1. /*
  2.  * @(#)sys_api.h    1.38 95/10/17  
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. /*
  21.  * System or Host dependent API.  This defines the "porting layer" for
  22.  * POSIX.1 compliant operating systems.
  23.  */
  24.  
  25. #ifndef _SYS_API_H_
  26. #define _SYS_API_H_
  27.  
  28. /*
  29.  * typedefs_md.h includes basic types for this platform;
  30.  * any macros for HPI functions have been moved to "sysmacros_md.h"
  31.  */
  32. #include "typedefs_md.h"
  33.  
  34. /*
  35.  * Some platforms, notably Windows, require that extra keywords
  36.  * be prepended for things that can be called from other libs.
  37.  * The default is just to declare things "extern".
  38.  */
  39. #ifndef EXPORTED
  40. #define EXPORTED extern
  41. #endif
  42.  
  43. /*
  44.  * Miscellaneous system utility APIs that fall outside the POSIX.1
  45.  * spec.
  46.  *
  47.  * Until POSIX (P1003.1a) formerly P.4 is standard, we'll use our
  48.  * time struct definitions found in timeval.h.
  49.  */
  50. #include <timeval.h>
  51. EXPORTED long     sysGetMilliTicks(void);
  52. EXPORTED long    sysTime(long *);
  53. EXPORTED int64_t sysTimeMillis(void);
  54.  
  55. #include <time.h>
  56. EXPORTED struct tm * sysLocaltime(time_t *, struct tm*);
  57. EXPORTED struct tm * sysGmtime(time_t *, struct tm*);
  58.  
  59. /*
  60.  * System API for general allocations
  61.  */
  62. EXPORTED void *    sysMalloc(size_t);
  63. EXPORTED void *    sysRealloc(void*, size_t);
  64. EXPORTED void    sysFree(void*);
  65. EXPORTED void *    sysCalloc(unsigned int, unsigned int);
  66.  
  67. /*
  68.  * System API for dynamic linking libraries into the interpreter
  69.  */
  70. EXPORTED char * sysInitializeLinker(void);
  71. EXPORTED int    sysAddDLSegment(char *);
  72. EXPORTED void   sysSaveLDPath(char *);
  73. EXPORTED long   sysDynamicLink(char *);
  74. EXPORTED void    sysBuildLibName(char *, int, char *, char *);
  75.  
  76. /*
  77.  * System API for threads
  78.  */
  79. typedef struct   sys_thread sys_thread_t;
  80. typedef struct   sys_mon sys_mon_t;
  81. typedef void   * stackp_t;
  82.  
  83. EXPORTED int      sysThreadBootstrap(sys_thread_t **);
  84. EXPORTED void      sysThreadInitializeSystemThreads(void);
  85. EXPORTED int      sysThreadCreate(long, uint_t flags, 
  86.                      void *(*)(void *), 
  87.                      sys_thread_t **,
  88.                       void *);
  89. EXPORTED  void     sysThreadExit(void);
  90. EXPORTED  sys_thread_t * sysThreadSelf(void);
  91. EXPORTED  void     sysThreadYield(void);
  92. EXPORTED  int     sysThreadSuspend(sys_thread_t *);
  93. EXPORTED  int     sysThreadResume(sys_thread_t *);
  94. EXPORTED  int     sysThreadSetPriority(sys_thread_t *, int);
  95. EXPORTED  int     sysThreadGetPriority(sys_thread_t *, int *);
  96. EXPORTED  void * sysThreadStackPointer(sys_thread_t *); 
  97. EXPORTED  stackp_t sysThreadStackBase(sys_thread_t *); 
  98. EXPORTED  int     sysThreadSingle(void);
  99. EXPORTED  void     sysThreadMulti(void);
  100. EXPORTED  int    sysThreadEnumerateOver(int (*)(sys_thread_t *, void *), void *);
  101. EXPORTED  void     sysThreadInit(sys_thread_t *, stackp_t);
  102. EXPORTED  void     sysThreadSetBackPtr(sys_thread_t *, void *);
  103. EXPORTED  void * sysThreadGetBackPtr(sys_thread_t *);
  104. EXPORTED  int    sysThreadCheckStack(void);
  105. EXPORTED  int    sysInterruptsPending(void);
  106. EXPORTED  void     sysThreadPostException(sys_thread_t *, void *);
  107. EXPORTED  void     sysThreadDumpInfo(sys_thread_t *);
  108.  
  109. /*
  110.  * System API for monitors
  111.  */
  112. EXPORTED int     sysMonitorSizeof(void);
  113. EXPORTED int     sysMonitorInit(sys_mon_t *, bool_t);
  114. EXPORTED int     sysMonitorEnter(sys_mon_t *);
  115. EXPORTED bool_t  sysMonitorEntered(sys_mon_t *);
  116. EXPORTED int     sysMonitorExit(sys_mon_t *);
  117. EXPORTED int     sysMonitorNotify(sys_mon_t *);
  118. EXPORTED int     sysMonitorNotifyAll(sys_mon_t *);
  119. EXPORTED int      sysMonitorWait(sys_mon_t *, int);
  120. EXPORTED int     sysMonitorDestroy(sys_mon_t *, sys_thread_t *);
  121. EXPORTED void    sysMonitorDumpInfo(sys_mon_t *);
  122.  
  123. #define SYS_OK            0
  124. #define SYS_TIMEOUT     1
  125. #define SYS_ERR           -1
  126. #define SYS_INVALID    -2    /* invalid arguments */
  127. #define SYS_NOTHREAD   -3    /* no such thread */
  128. #define SYS_MINSTACK   -4    /* supplied stack size less than min stack size */
  129. #define SYS_NOMEM      -5
  130. #define SYS_NORESOURCE -6
  131. #define SYS_DESTROY    -7
  132.  
  133. /*
  134.  * System API for raw memory allocation
  135.  */
  136. EXPORTED void * sysMapMem(long, long *);
  137. EXPORTED void * sysUnmapMem(void *, long, long *);
  138. EXPORTED void * sysCommitMem(void *, long, long *);
  139. EXPORTED void * sysUncommitMem(void *, long, long *);
  140.  
  141. /*
  142.  * Include platform specific macros to override these
  143.  */
  144. #include "sysmacros_md.h"
  145.  
  146. #endif /* !_SYS_API_H_ */
  147.