Jamie Reece Wilson
7046ccec11
[+] Added new shell dirs API [+] AuOptional<AuROString> GetUserDocuments() [+] AuOptional<AuROString> GetUserDownloads() [+] AuOptional<AuROString> GetUserDesktop() [+] AuOptional<AuROString> GetUserPhotos() [+] AuOptional<AuROString> GetUserVideos() [+] AuOptional<AuROString> GetUserMusic() [*] Amend IPCHandle::InitFromSharing (use string view) [*] AuFS devices API should now use string views [*] AuProcess, Process APIs now use string views (ModuleLoadRequest, LoadModule, GetProcAddressEx, etc) [*] AuProcess, Paths APIs now use string views (GetProcessDirectory, GetProcessFullPath, etc) [*] Fix XP using common my documents vs local user documents
78 lines
1.6 KiB
C++
78 lines
1.6 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: UnixIO.cpp
|
|
Date: 2022-4-12
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
#include "UnixIO.hpp"
|
|
#include "FDIpcServer.hpp"
|
|
|
|
namespace Aurora::IO::UNIX
|
|
{
|
|
AUKN_SYM AuString ShareFileDescriptor(int fd)
|
|
{
|
|
IPC::IPCToken token;
|
|
IPC::IPCHandle handle;
|
|
|
|
if (!FDServe(fd, token))
|
|
{
|
|
return {};
|
|
}
|
|
|
|
handle.PushId(IPC::EIPCHandleType::eIPCSharedFd, token);
|
|
|
|
return handle.ToString();
|
|
}
|
|
|
|
AUKN_SYM void ShareFileDescriptorStop(const AuROString &handle)
|
|
{
|
|
IPC::IPCHandle handle2;
|
|
if (!handle2.FromString(handle))
|
|
{
|
|
SysPushErrorIO("Invalid handle string");
|
|
return;
|
|
}
|
|
|
|
if (auto val = handle2.GetToken(IPC::EIPCHandleType::eIPCSharedFd, 0))
|
|
{
|
|
FDServeEnd(val->token);
|
|
}
|
|
}
|
|
|
|
AUKN_SYM int ShareFileDescriptorAccept(const AuROString &handle)
|
|
{
|
|
IPC::IPCHandle handle2;
|
|
if (!handle2.FromString(handle))
|
|
{
|
|
SysPushErrorIO("Invalid handle string");
|
|
return -1;
|
|
}
|
|
|
|
auto val = handle2.GetToken(IPC::EIPCHandleType::eIPCSharedFd, 0);
|
|
if (!val)
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
int fd {-1};
|
|
if (!FDAccept(val->token, fd))
|
|
{
|
|
SysPushErrorNested();
|
|
return -1;
|
|
}
|
|
|
|
return fd;
|
|
}
|
|
|
|
void InitUnixIO()
|
|
{
|
|
InitIPCBackend();
|
|
}
|
|
|
|
void DeinitUnixIO()
|
|
{
|
|
DeinitIPCBackend();
|
|
}
|
|
} |