build: Fix build on FreeBSD

- ftruncate64() does not exist on FreeBSD
- add missing environ(7) declaration
This commit is contained in:
Ganael Laplanche 2022-10-27 16:56:17 +02:00 committed by lightningterror
parent 67f1cd4e15
commit aa59547af7
2 changed files with 3 additions and 1 deletions

View File

@ -174,7 +174,7 @@ void* HostSys::CreateSharedMemory(const char* name, size_t size)
shm_unlink(name);
// ensure it's the correct size
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(__FreeBSD__)
if (ftruncate64(fd, static_cast<off64_t>(size)) < 0)
#else
if (ftruncate(fd, static_cast<off_t>(size)) < 0)

View File

@ -72,6 +72,8 @@ std::string GetOSVersionString()
static bool SetScreensaverInhibitX11(const WindowInfo& wi, bool inhibit)
{
extern char **environ;
const char* command = "xdg-screensaver";
const char* operation = inhibit ? "suspend" : "resume";
std::string id = fmt::format("0x{:X}", static_cast<u64>(reinterpret_cast<uintptr_t>(wi.window_handle)));