Application Initialization/Notification API Library Module

The application initialization/notification API library module has the file name appinit.c. This module has two primary uses. It is used by Future Lab GPL servers to signal other applications that the server initialization is in progress. This module is also used by any application that needs to store and retrieve it's application name outside of the application main module.

Here is a list of functions in the this library module:

- appinit_start
- appinit_stop
- appinit_waitfor
- appinit_register_name
- appinit_get_name
- appinit_remove_name
- appinit_get_sname

# Module Dependencies

The following modules are required along with this module:

- fio.c
- logger.c
- logman.c

# Module Header Files

This module requires the header files:

- stdhead.h
- appinit.h

# Module Functions

## appinit_start

    Prototype  : int appinit_start(char *sname)
    Parameters :
          Name : sname
    Description: service name

    Returns    : TRUE upon success, FALSE otherwise

This function will indicate that the application is starting up by creating a zero byte lock file. The service name should be a unique name to identify the application and is usually the socloc service name when dealing with a socket server.

## appinit_stop

    Prototype  : int appinit_stop(char *sname)
    Parameters :
          Name : sname
    Description: service name

    Returns    : TRUE upon success, FALSE otherwise

This function will indicate that the application has completed its initialization by deleting the zero byte lock file. The service name parameter must be the same name used to call appinit_start.

## appinit_waitfor

    Prototype  : int appinit_waitfor(char *sname, int min_timeout)
    Parameters :
          Name : sname
    Description: service name

          Name : min_timeout
    Description: number of minutes to wait

    Returns    : TRUE if the lock file no longer exists, FALSE otherwise

This function will check for a lock file using the service name and wait up to number of minutes to wait for the lock file to be removed.

## appinit_register_name

    Prototype  : int appinit_register_name(char *apname)
    Parameters :
          Name : apname
    Description: application name

    Returns    : TRUE upon success, FALSE otherwise

This function will load the passed application name into the module global appinit_apname.

## appinit_get_name

    Prototype  : int appinit_get_name(char *apname)
    Parameters :
          Name : apname
    Description: returned application name

    Returns    : TRUE upon success, FALSE otherwise

This function will obtain the application name which must already be defined by calling the function appinit_register_name. Function returns the application name loaded into the returned application name which must already be allocated to sufficient size by the caller.

## appinit_remove_name

    Prototype  : int appinit_remove_name(void)

    Returns    : TRUE upon success, FALSE otherwise

This function will de-allocate the current application name stored in appinit_apname.

## appinit_get_sname

    Prototype  : static int appinit_get_sname(char *oldname, char *newname)
    Parameters :
          Name : oldname
    Description: input service name

          Name : newname
    Description: output service name

    Returns    : TRUE upon success, FALSE otherwise

This private function will translate the input service name. The lock file extension will be appended to the name. In addition, any QNX 4.x nameloc global name (starting with /) will have its leading slash removed. Function will load the translated name into the output service name which must already be allocated by the caller to sufficient size.

Goto Top | GPL Software Overview | GPL Library
Future Lab Home | Contact Webmaster | Feedback

Copyright © 2002-2006 Future Lab, Last Updated Jun 30, 2006