modules/portlib/src/main/native/port/windows/hysysinfo.c File Reference


Detailed Description

System information.

#include <stdio.h>
#include <windows.h>
#include "portpriv.h"
#include "hyportpg.h"

Functions

IDATA VMCALL hysysinfo_get_executable_name (struct HyPortLibrary *portLibrary, char *argv0, char **result)
 Determines an absolute pathname for the executable.
const char *VMCALL hysysinfo_get_OS_type (struct HyPortLibrary *portLibrary)
 Determine the OS type.
U_64 VMCALL hysysinfo_get_physical_memory (struct HyPortLibrary *portLibrary)
 Determine the size of the total physical memory in the system, in bytes.
UDATA VMCALL hysysinfo_DLPAR_max_CPUs (struct HyPortLibrary *portLibrary)
 Determine the maximum number of CPUs on this platform.
UDATA VMCALL hysysinfo_get_number_CPUs (struct HyPortLibrary *portLibrary)
 Determine the number of CPUs on this platform.
const char *VMCALL hysysinfo_get_CPU_architecture (struct HyPortLibrary *portLibrary)
 Determine the CPU architecture.
UDATA VMCALL hysysinfo_get_processing_capacity (struct HyPortLibrary *portLibrary)
 Determine the collective processing capacity available to the VM in units of 1% of a physical processor.
const char *VMCALL hysysinfo_get_OS_version (struct HyPortLibrary *portLibrary)
 Determine version information from the operating system.
I_32 VMCALL hysysinfo_startup (struct HyPortLibrary *portLibrary)
 PortLibrary startup.
UDATA VMCALL hysysinfo_DLPAR_enabled (struct HyPortLibrary *portLibrary)
 Determine if DLPAR (i.e.
void VMCALL hysysinfo_shutdown (struct HyPortLibrary *portLibrary)
 PortLibrary shutdown.
UDATA VMCALL hysysinfo_get_pid (struct HyPortLibrary *portLibrary)
 Determine the process ID of the calling process.
U_16 VMCALL hysysinfo_get_classpathSeparator (struct HyPortLibrary *portLibrary)
 Determine the character used to separate entries on the classpath.
IDATA VMCALL hysysinfo_get_username (struct HyPortLibrary *portLibrary, char *buffer, UDATA length)
 Query the operating system for the name of the user associate with the current thread.
UDATA VMCALL hysysinfo_weak_memory_consistency (struct HyPortLibrary *portLibrary)
 Determine if the platform has weak memory consistency behaviour.
IDATA VMCALL hysysinfo_get_env (struct HyPortLibrary *portLibrary, char *envVar, char *infoString, UDATA bufSize)
 Query the operating system for environment variables.


Function Documentation

UDATA VMCALL hysysinfo_DLPAR_enabled ( struct HyPortLibrary portLibrary  ) 

Determine if DLPAR (i.e.

the ability to change number of CPUs and amount of memory dynamically) is enabled on this platform.

Parameters:
[in] portLibrary The port library.
Returns:
1 if DLPAR is supported, otherwise 0.

UDATA VMCALL hysysinfo_DLPAR_max_CPUs ( struct HyPortLibrary portLibrary  ) 

Determine the maximum number of CPUs on this platform.

Parameters:
[in] portLibrary The port library.
Returns:
The maximum number of supported CPUs..

U_16 VMCALL hysysinfo_get_classpathSeparator ( struct HyPortLibrary portLibrary  ) 

Determine the character used to separate entries on the classpath.

Parameters:
[in] portLibrary The port library.
Returns:
the classpathSeparator character.

const char *VMCALL hysysinfo_get_CPU_architecture ( struct HyPortLibrary portLibrary  ) 

Determine the CPU architecture.

Parameters:
[in] portLibrary The port library.
Returns:
A null-terminated string describing the CPU architecture of the hardware, NULL on error.
Note:
portLibrary is responsible for allocation/deallocation of returned buffer.

See http://www.tolstoy.com/samizdat/sysprops.html for good values to return.

IDATA VMCALL hysysinfo_get_env ( struct HyPortLibrary portLibrary,
char *  envVar,
char *  infoString,
UDATA  bufSize 
)

Query the operating system for environment variables.

Obtain the value of the environment variable specified by envVar from the operating system and write out to supplied buffer.

Parameters:
[in] portLibrary The port library.
[in] envVar Environment variable to query.
[out] infoString Buffer for value string describing envVar.
[in] bufSize Size of buffer to hold returned string.
Returns:
0 on success, number of bytes required to hold the information if the output buffer was too small, -1 on failure.
Note:
infoString is undefined on error or when supplied buffer was too small.

IDATA VMCALL hysysinfo_get_executable_name ( struct HyPortLibrary portLibrary,
char *  argv0,
char **  result 
)

Determines an absolute pathname for the executable.

Parameters:
[in] portLibrary The port library.
[in] argv0 argv[0] value
[out] result Null terminated pathname string
Returns:
0 on success, -1 on error (or information is not available).
Note:
Caller is responsible for de-allocating memory for result buffer with hymem_free_memory.

UDATA VMCALL hysysinfo_get_number_CPUs ( struct HyPortLibrary portLibrary  ) 

Determine the number of CPUs on this platform.

Parameters:
[in] portLibrary The port library.
Returns:
The number of supported CPUs.

const char *VMCALL hysysinfo_get_OS_type ( struct HyPortLibrary portLibrary  ) 

Determine the OS type.

Parameters:
[in] portLibrary The port library.
Returns:
OS type string (NULL terminated) on success, NULL on error.
Note:
portLibrary is responsible for allocation/deallocation of returned buffer.

const char *VMCALL hysysinfo_get_OS_version ( struct HyPortLibrary portLibrary  ) 

Determine version information from the operating system.

Parameters:
[in] portLibrary The port library.
Returns:
OS version string (NULL terminated) on success, NULL on error.
Note:
portLibrary is responsible for allocation/deallocation of returned buffer.

U_64 VMCALL hysysinfo_get_physical_memory ( struct HyPortLibrary portLibrary  ) 

Determine the size of the total physical memory in the system, in bytes.

Parameters:
[in] portLibrary The port library.
Returns:
0 if the information was unavailable, otherwise total physical memory in bytes.

UDATA VMCALL hysysinfo_get_pid ( struct HyPortLibrary portLibrary  ) 

Determine the process ID of the calling process.

Parameters:
[in] portLibrary The port library.
Returns:
the PID.

UDATA VMCALL hysysinfo_get_processing_capacity ( struct HyPortLibrary portLibrary  ) 

Determine the collective processing capacity available to the VM in units of 1% of a physical processor.

In environments without some kind of virtual partitioning, this will simply be the number of CPUs * 100.

Parameters:
[in] portLibrary The port library.
Returns:
The processing capacity available to the VM.

IDATA VMCALL hysysinfo_get_username ( struct HyPortLibrary portLibrary,
char *  buffer,
UDATA  length 
)

Query the operating system for the name of the user associate with the current thread.

Obtain the value of the name of the user associated with the current thread, and then write it out into the buffer supplied by the user

Parameters:
[in] portLibrary The port Library
[out] buffer Buffer for the name of the user
[in,out] length The length of the buffer
Returns:
0 on success, number of bytes required to hold the information if the output buffer was too small, -1 on failure.
Note:
buffer is undefined on error or when supplied buffer was too small.

void VMCALL hysysinfo_shutdown ( struct HyPortLibrary portLibrary  ) 

PortLibrary shutdown.

This function is called during shutdown of the portLibrary. Any resources that were created by hysysinfo_startup should be destroyed here.

Parameters:
[in] portLibrary The port library.
Note:
Most implementations will be empty.

I_32 VMCALL hysysinfo_startup ( struct HyPortLibrary portLibrary  ) 

PortLibrary startup.

This function is called during startup of the portLibrary. Any resources that are required for the system information operations may be created here. All resources created here should be destroyed in hysysinfo_shutdown.

Parameters:
[in] portLibrary The port library.
Returns:
0 on success, negative error code on failure. Error code values returned are
  • HYPORT_ERROR_STARTUP_SYSINFO
Note:
Most implementations will simply return success.

UDATA VMCALL hysysinfo_weak_memory_consistency ( struct HyPortLibrary portLibrary  ) 

Determine if the platform has weak memory consistency behaviour.

Parameters:
[in] portLibrary The port library.
Returns:
1 if weak memory consistency, 0 otherwise.


Genereated on Tue Dec 9 14:12:59 2008 by Doxygen.

(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.