proc_mobility_restartexit_set Subroutine

Purpose

Sets or unsets attributes used by AIX® Live Update to indicate that the current process is a exit on restart process.

Library

Standard C library (libc.a)

Syntax

#include <stdio.h>

#include <sys/mobility.h>

int  proc_mobility_restartexit_set (pid, value, flag),
pid_t pid;
int value;
int flag
;

Description

The proc_mobility_restartexit_set subroutine can be used to register the calling process as a exit on restart process for a Live Update operation. The exit on restart processes are frozen on the original logical partition (LPAR) but theLive Update operation does not checkpoint their state. These processes are recreated on the surrogate LPAR. When they are restarted, they call the exit() function and terminate. Applications which do not have specific state information that must be preserved might choose this method. These applications are not required to release resources that are not supported by the mobility operation. If these applications are monitored by a daemon mechanism, the exit may cause a new instance to start on the surrogate LPAR.

Depending on the flags specified, the process can be marked exit on restart for a Live Update operation, or for a workload partition mobility operation, or for both.

Parameters

Item Description
pid Process ID to act upon. The value 0 indicates the current process. If a non-zero value is specified, it must match the PID of the calling process.
value MOBILITY_RESTART_EXIT flag sets the exit on restart attribute. The value 0 is used to unset the exit on restart attribute.
flag The scope for the attribute are:
PROC_MOBILITY_GLOBAL
If the process is exit on restart for the Live Update operation
PROC_MOBILITY_WPAR
If the process is exit on restart for Workload Partition (WPAR) mobility.

Return Values

Item Description
0 Success
1 Error

Error Codes

Error Code Description
ENOSYS No mobility system in place.
ESRCH No such process.
EINVAL Input arguments not valid.

Example

The following example shows the usages of the proc_mobility_restartexit_set subroutine:
#include <stdio.h>
#include <sys/mobility.h>
int main(int argc, char *argv[])
{
	int rc = 0;
	pid_t pid = getpid();

	/* Mark this process as “exit on restart” for  live update */
	rc = proc_mobility_restartexit_set(0, MOBILITY_RESTART_EXIT, PROC_MOBILITY_GLOBAL);

	if (rc) {
		printf(“proc_mobility_restartexit_set failed, errno %d\n”, errno);
		exit(-1);
	}

	printf(“Process %d is now marked to exit on restart during an AIX live update.\n”, pid);

}