Sun Java System Web Proxy Server 4.0.11 NSAPI Developer's Guide

M

magnus_atrestart


Note –

Use the daemon-atrestart function in place of the obsolete magnus_atrestart function.


The magnus_atrestart function enables you to register a callback function named by fn to be used when the server receives a restart signal. Use this function when you need a callback function to deallocate resources allocated by an initialization function.

Syntax

#include <netsite.h>
void magnus_atrestart(void (*fn)(void *), void *data);

Returns

void

Parameters

void (* fn) (void *) is the callback function.

void *data is the parameter passed to the callback function when the server is restarted.

Example

/* Close log file when server is restarted */
	magnus_atrestart(brief_terminate, NULL);return REQPROCEED;

MALLOC

The MALLOC macro is a platform-independent substitute for the C library routine malloc. This macro normally allocates from the request’s memory pool. If pooled memory has been disabled in the configuration file with the pool-init built-in SAF, PERM_MALLOC and MALLOC both obtain their memory from the system heap.

Syntax

void *MALLOC(int size)

Returns

A void pointer to a block of memory.

Parameters

int size is the number of bytes to allocate.

Example

/* Allocate 256 bytes for a name */char *name;name = (char *) MALLOC(256);

See Also

FREE, CALLOC, REALLOC, STRDUP, PERM_MALLOC, PERM_FREE, PERM_CALLOC, PERM_REALLOC, PERM_STRDUP