pgl: add pglTerminateProcess

This commit is contained in:
Michael Scire 2020-04-14 04:46:23 -07:00 committed by fincs
parent 27b34533ac
commit 02e4aad9dc
3 changed files with 51 additions and 0 deletions

View File

@ -64,6 +64,7 @@ extern "C" {
#include "switch/services/pcv.h"
#include "switch/services/clkrst.h"
#include "switch/services/fan.h"
#include "switch/services/pgl.h"
#include "switch/services/psm.h"
#include "switch/services/spsm.h"
//#include "switch/services/bsd.h" Use <sys/socket.h> instead

View File

@ -0,0 +1,20 @@
/**
* @file pgl.h
* @brief PGL service IPC wrapper.
* @author SciresM
* @copyright libnx Authors
*/
#pragma once
#include "../types.h"
#include "../sf/service.h"
/// Initialize pgl.
Result pglInitialize(void);
/// Exit pgl.
void pglExit(void);
/// Gets the Service object for the actual pgl service session.
Service* pglGetServiceSession(void);
Result pglTerminateProcess(u64 pid);

30
nx/source/services/pgl.c Normal file
View File

@ -0,0 +1,30 @@
#define NX_SERVICE_ASSUME_NON_DOMAIN
#include "service_guard.h"
#include "services/pgl.h"
#include "runtime/hosversion.h"
static Service g_pglSrv;
NX_GENERATE_SERVICE_GUARD(pgl);
Result _pglInitialize(void) {
if (hosversionBefore(10,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return smGetService(&g_pglSrv, "pgl");
}
void _pglCleanup(void) {
serviceClose(&g_pglSrv);
}
Service* pglGetServiceSession(void) {
return &g_pglSrv;
}
static Result _pglCmdInU64(Service* srv, u32 cmd_id, u64 inval) {
return serviceDispatchIn(srv, cmd_id, inval);
}
Result pglTerminateProcess(u64 pid) {
return _pglCmdInU64(&g_pglSrv, 1, pid);
}