pmapp.h File Reference

PM (Process Manager) application service. More...

`#include <3ds/services/fs.h>`
`#include <3ds/exheader.h>`

Go to the source code of this file.

## Enumerations

enum | { PMLAUNCHFLAG_NORMAL_APPLICATION = BIT(0) , PMLAUNCHFLAG_LOAD_DEPENDENCIES = BIT(1) , PMLAUNCHFLAG_NOTIFY_TERMINATION = BIT(2) , PMLAUNCHFLAG_QUEUE_DEBUG_APPLICATION = BIT(3) , PMLAUNCHFLAG_TERMINATION_NOTIFICATION_MASK = 0xF0 , PMLAUNCHFLAG_FORCE_USE_O3DS_APP_MEM = BIT(8) , PMLAUNCHFLAG_FORCE_USE_O3DS_MAX_APP_MEM = BIT(9) , PMLAUNCHFLAG_USE_UPDATE_TITLE = BIT(16) }
| Launch flags for PM launch commands. More...

## Functions

Result | pmAppInit (void)
| Initializes pm:app.
void | pmAppExit (void)
| Exits pm:app.
Handle * | pmAppGetSessionHandle (void)
| Gets the current pm:app session handle. More...
Result | PMAPP_LaunchTitle (const FS_ProgramInfo *programInfo, u32 launchFlags)
| Launches a title. More...
Result | PMAPP_LaunchTitleUpdate (const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags)
| Launches a title, applying patches. More...
Result | PMAPP_GetTitleExheaderFlags (ExHeader_Arm11CoreInfo *outCoreInfo, ExHeader_SystemInfoFlags *outSiFlags, const FS_ProgramInfo *programInfo)
| Gets a title's ExHeader Arm11CoreInfo and SystemInfo flags. More...
Result | PMAPP_SetFIRMLaunchParams (u32 size, const void *in)
| Sets the current FIRM launch parameters. More...
Result | PMAPP_GetFIRMLaunchParams (void *out, u32 size)
| Gets the current FIRM launch parameters. More...
Result | PMAPP_LaunchFIRMSetParams (u32 firmTidLow, u32 size, const void *in)
| Sets the current FIRM launch parameters. More...
Result | PMAPP_PrepareForReboot (s64 timeout)
| Terminate most processes, to prepare for a reboot or a shutdown. More...
Result | PMAPP_TerminateCurrentApplication (s64 timeout)
| Terminates the current Application. More...
Result | PMAPP_TerminateTitle (u64 titleId, s64 timeout)
| Terminates the processes having the specified titleId. More...
Result | PMAPP_TerminateProcess (u32 pid, s64 timeout)
| Terminates the specified process. More...
Result | PMAPP_UnregisterProcess (u64 tid)
| Unregisters a process. More...
Result | PMAPP_SetAppResourceLimit (s64 cpuTime)
| Sets the APPLICATION cputime reslimit. More...
Result | PMAPP_GetAppResourceLimit (s64 *outCpuTime)
| Gets the APPLICATION cputime reslimit. More...

## Detailed Description

PM (Process Manager) application service.

## Enumeration Type Documentation

## anonymous enum

anonymous enum

Launch flags for PM launch commands.

Enumerator
PMLAUNCHFLAG_FORCE_USE_O3DS_APP_MEM | Forces the usage of the O3DS system mode app memory setting even if N3DS system mode is not "Legacy". Dev4 and Dev5 not supported. N3DS only.
PMLAUNCHFLAG_FORCE_USE_O3DS_MAX_APP_MEM | In conjunction with the above, forces the 96MB app memory setting. N3DS only.

## Function Documentation

## PMAPP_GetAppResourceLimit()

Result PMAPP_GetAppResourceLimit | ( | s64 * | outCpuTime | ) |

Gets the APPLICATION cputime reslimit.

Parameters

  [out] | cpuTime | Pointer to write the reslimit value to.

## PMAPP_GetFIRMLaunchParams()

Result PMAPP_GetFIRMLaunchParams | ( | void * | out,
|  | u32 | size
| ) |  |

Gets the current FIRM launch parameters.

Parameters

  | size | Size of the FIRM launch parameter buffer.
  [out] | out | Buffer to write the launch parameters to.

## PMAPP_GetTitleExheaderFlags()

Result PMAPP_GetTitleExheaderFlags | ( | ExHeader_Arm11CoreInfo * | outCoreInfo,
|  | ExHeader_SystemInfoFlags * | outSiFlags,
|  | const FS_ProgramInfo * | programInfo
| ) |  |

Gets a title's ExHeader Arm11CoreInfo and SystemInfo flags.

Parameters

  [out] | outCoreInfo | Pointer to write the ExHeader Arm11CoreInfo to.
  [out] | outSiFlags | Pointer to write the ExHeader SystemInfo flags to.
  | programInfo | Program information of the title.

## PMAPP_LaunchFIRMSetParams()

Result PMAPP_LaunchFIRMSetParams | ( | u32 | firmTidLow,
|  | u32 | size,
|  | const void * | in
| ) |  |

Sets the current FIRM launch parameters.

Parameters

  firmTidLow | Low Title ID of the FIRM title to launch.
  size | Size of the FIRM launch parameter buffer.
  in | Buffer to retrieve the launch parameters from.

## PMAPP_LaunchTitle()

Result PMAPP_LaunchTitle | ( | const FS_ProgramInfo * | programInfo,
|  | u32 | launchFlags
| ) |  |

Launches a title.

Parameters

  programInfo | Program information of the title.
  launchFlags | Flags to launch the title with.

## PMAPP_LaunchTitleUpdate()

Result PMAPP_LaunchTitleUpdate | ( | const FS_ProgramInfo * | programInfo,
|  | const FS_ProgramInfo * | programInfoUpdate,
|  | u32 | launchFlags
| ) |  |

Launches a title, applying patches.

Parameters

  programInfo | Program information of the title.
  programInfoUpdate | Program information of the update title.
  launchFlags | Flags to launch the title with.

## PMAPP_PrepareForReboot()

Result PMAPP_PrepareForReboot | ( | s64 | timeout | ) |

Terminate most processes, to prepare for a reboot or a shutdown.

Parameters

  timeout | Time limit in ns for process termination, after which the remaining processes are killed.

## PMAPP_SetAppResourceLimit()

Result PMAPP_SetAppResourceLimit | ( | s64 | cpuTime | ) |

Sets the APPLICATION cputime reslimit.

Parameters

  cpuTime | Reslimit value.

Note
  cpuTime can be no higher than reslimitdesc[0] & 0x7F in exheader (or 80 if the latter is 0).

## PMAPP_SetFIRMLaunchParams()

Result PMAPP_SetFIRMLaunchParams | ( | u32 | size,
|  | const void * | in
| ) |  |

Sets the current FIRM launch parameters.

Parameters

  size | Size of the FIRM launch parameter buffer.
  in | Buffer to retrieve the launch parameters from.

## PMAPP_TerminateCurrentApplication()

Result PMAPP_TerminateCurrentApplication | ( | s64 | timeout | ) |

Terminates the current Application.

Parameters

  timeout | Timeout in nanoseconds

## PMAPP_TerminateProcess()

Result PMAPP_TerminateProcess | ( | u32 | pid,
|  | s64 | timeout
| ) |  |

Terminates the specified process.

Parameters

  pid | Process-ID of the process to terminate
  timeout | Timeout in nanoseconds

## PMAPP_TerminateTitle()

Result PMAPP_TerminateTitle | ( | u64 | titleId,
|  | s64 | timeout
| ) |  |

Terminates the processes having the specified titleId.

Parameters

  titleId | Title ID of the processes to terminate
  timeout | Timeout in nanoseconds

## PMAPP_UnregisterProcess()

Result PMAPP_UnregisterProcess | ( | u64 | tid | ) |

Unregisters a process.

Parameters

  tid | TitleID of the process to unregister

## pmAppGetSessionHandle()

Handle* pmAppGetSessionHandle | ( | void |  | ) |

Gets the current pm:app session handle.

Returns
  The current pm:app session handle.