modules/portlib/src/main/native/port/shared/hyport.c File Reference


Detailed Description

Port Library.

#include <string.h>
#include "hyport.h"
#include "portpriv.h"
#include "hyportpg.h"

Functions

I_32 VMCALL hyport_init_library (struct HyPortLibrary *portLibrary, struct HyPortLibraryVersion *version, UDATA size)
 Initialize the port library.
I_32 VMCALL hyport_shutdown_library (struct HyPortLibrary *portLibrary)
 PortLibrary shutdown.
I_32 VMCALL hyport_create_library (struct HyPortLibrary *portLibrary, struct HyPortLibraryVersion *version, UDATA size)
 Create the port library.
I_32 VMCALL hyport_startup_library (struct HyPortLibrary *portLibrary)
 PortLibrary startup.
UDATA VMCALL hyport_getSize (struct HyPortLibraryVersion *version)
 Determine the size of the port library.
I_32 VMCALL hyport_getVersion (struct HyPortLibrary *portLibrary, struct HyPortLibraryVersion *version)
 Determine the version of the port library.
I_32 VMCALL hyport_isCompatible (struct HyPortLibraryVersion *expectedVersion)
 Determine port library compatibility.
I_32 VMCALL hyport_isFunctionOverridden (struct HyPortLibrary *portLibrary, UDATA offset)
 Query the port library.
I_32 VMCALL hyport_allocate_library (struct HyPortLibraryVersion *version, struct HyPortLibrary **portLibrary)
 Allocate a port library.
void initNLSCatalog (HyPortLibrary *portLib)
 Initialize the NLS catalog (must be done prior to any NLS usage).


Function Documentation

I_32 VMCALL hyport_allocate_library ( struct HyPortLibraryVersion *  version,
struct HyPortLibrary **  portLibrary 
)

Allocate a port library.

Port library self allocation routines.

Given a pointer to the required version of the port library allocate and initialize the structure. The startup function is not called (hyport_startup_library) allowing the application to override any functions they desire. In the event hyport_startup_library fails when called by the application the port library memory will be freed.

Parameters:
[in] version The required version of the port library.
[out] portLibrary Pointer to the allocated port library table.
Returns:
0 on success, negative return value on failure
Note:
portLibrary will be NULL on failure

The portlibrary version must be compatabile with the that which we are compiled against

hyport_shutdown_library will deallocate this memory as part of regular shutdown

I_32 VMCALL hyport_create_library ( struct HyPortLibrary portLibrary,
struct HyPortLibraryVersion *  version,
UDATA  size 
)

Create the port library.

Standard startup and shutdown (port library allocated on stack or by application).

Given a pointer to a port library and the required version, populate the port library table with the appropriate functions

Parameters:
[in] portLibrary The port library.
[in] version The required version of the port library.
[in] size Size of the port library.
Returns:
0 on success, negative return value on failure
Note:
The portlibrary version must be compatabile with the that which we are compiled against

UDATA VMCALL hyport_getSize ( struct HyPortLibraryVersion *  version  ) 

Determine the size of the port library.

Given a port library version, return the size of the structure in bytes required to be allocated.

Parameters:
[in] version The HyPortLibraryVersion structure.
Returns:
size of port library on success, zero on failure
Note:
The portlibrary version must be compatabile with the that which we are compiled against

I_32 VMCALL hyport_getVersion ( struct HyPortLibrary portLibrary,
struct HyPortLibraryVersion *  version 
)

Determine the version of the port library.

Given a port library return the version of that instance.

Parameters:
[in] portLibrary The port library.
[in,out] version The HyPortLibraryVersion structure to be populated.
Returns:
0 on success, negative return value on failure
Note:
If portLibrary is NULL, version is populated with the version in the linked DLL

I_32 VMCALL hyport_init_library ( struct HyPortLibrary portLibrary,
struct HyPortLibraryVersion *  version,
UDATA  size 
)

Initialize the port library.

Given a pointer to a port library and the required version, populate the port library table with the appropriate functions and then call the startup function for the port library.

Parameters:
[in] portLibrary The port library.
[in] version The required version of the port library.
[in] size Size of the port library.
Returns:
0 on success, negative return value on failure

I_32 VMCALL hyport_isCompatible ( struct HyPortLibraryVersion *  expectedVersion  ) 

Determine port library compatibility.

Given the minimum version of the port library that the application requires determine if the current port library meets that requirements.

Parameters:
[in] expectedVersion The version the application requires as a minimum.
Returns:
1 if compatible, 0 if not compatible

I_32 VMCALL hyport_isFunctionOverridden ( struct HyPortLibrary portLibrary,
UDATA  offset 
)

Query the port library.

Given a pointer to the port library and an offset into the table determine if the function at that offset has been overridden from the default value expected.

Parameters:
[in] portLibrary The port library.
[in] offset The offset of the function to be queried.
Returns:
1 if the function is overriden, else 0.
hyport_isFunctionOverridden(portLibrary, offsetof(HyPortLibrary, mem_allocate_memory));

I_32 VMCALL hyport_shutdown_library ( struct HyPortLibrary portLibrary  ) 

PortLibrary shutdown.

Shutdown the port library, de-allocate resources required by the components of the portlibrary. Any resources that werer created by hyport_startup_library should be destroyed here.

Parameters:
[in] portLibrary The portlibrary.
Returns:
0 on success, negative return code on failure

I_32 VMCALL hyport_startup_library ( struct HyPortLibrary portLibrary  ) 

PortLibrary startup.

Start the port library, allocate resources required by the components of the portlibrary. All resources created here should be destroyed in hyport_shutdown_library.

Parameters:
[in] portLibrary The portlibrary.
Returns:
0 on success, negative error code on failure. Error code values returned are
  • HYPORT_ERROR_STARTUP_THREAD
  • HYPORT_ERROR_STARTUP_MEM
  • HYPORT_ERROR_STARTUP_TLS
  • HYPORT_ERROR_STARTUP_TLS_ALLOC
  • HYPORT_ERROR_STARTUP_TLS_MUTEX
  • HYPORT_ERROR_STARTUP_ERROR
  • HYPORT_ERROR_STARTUP_CPU
  • HYPORT_ERROR_STARTUP_VMEM
  • HYPORT_ERROR_STARTUP_FILE
  • HYPORT_ERROR_STARTUP_TTY
  • HYPORT_ERROR_STARTUP_TTY_HANDLE
  • HYPORT_ERROR_STARTUP_TTY_CONSOLE
  • HYPORT_ERROR_STARTUP_MMAP
  • HYPORT_ERROR_STARTUP_IPCMUTEX
  • HYPORT_ERROR_STARTUP_NLS
  • HYPORT_ERROR_STARTUP_SOCK
  • HYPORT_ERROR_STARTUP_TIME
  • HYPORT_ERROR_STARTUP_GP
  • HYPORT_ERROR_STARTUP_EXIT
  • HYPORT_ERROR_STARTUP_SYSINFO
  • HYPORT_ERROR_STARTUP_SL
  • HYPORT_ERROR_STARTUP_STR
  • HYPORT_ERROR_STARTUP_SHSEM
  • HYPORT_ERROR_STARTUP_SHMEM
  • HYPORT_ERROR_STARTUP_SIGNAL
Note:
The port library memory is deallocated if it was created by hyport_allocate_library

void initNLSCatalog ( HyPortLibrary portLib  ) 

Initialize the NLS catalog (must be done prior to any NLS usage).


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

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