mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 23:35:55 +00:00
Fix build with open() defined to open64()
This commit is contained in:
parent
eb781ce689
commit
07e902fe95
@ -94,6 +94,32 @@ int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req,
|
|||||||
// hook this variant of open(), since that's what SDL uses. When we see
|
// hook this variant of open(), since that's what SDL uses. When we see
|
||||||
// the open a FD for the same card as the Qt DRM master FD, we'll drop
|
// the open a FD for the same card as the Qt DRM master FD, we'll drop
|
||||||
// master on the Qt FD to allow the new FD to have master.
|
// master on the Qt FD to allow the new FD to have master.
|
||||||
|
int openHook(const char *funcname, const char *pathname, int flags, va_list va);
|
||||||
|
|
||||||
|
// fcntl.h may define open to open64 which will cause us to define open64 twice.
|
||||||
|
// Remove this redirection to allow our hooks to build properly with _FILE_OFFSET_BITS=64.
|
||||||
|
#ifdef open
|
||||||
|
#undef open
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int open(const char *pathname, int flags, ...)
|
||||||
|
{
|
||||||
|
va_list va;
|
||||||
|
va_start(va, flags);
|
||||||
|
int fd = openHook(__FUNCTION__, pathname, flags, va);
|
||||||
|
va_end(va);
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
int open64(const char *pathname, int flags, ...)
|
||||||
|
{
|
||||||
|
va_list va;
|
||||||
|
va_start(va, flags);
|
||||||
|
int fd = openHook(__FUNCTION__, pathname, flags, va);
|
||||||
|
va_end(va);
|
||||||
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
@ -152,24 +178,6 @@ int openHook(const char *funcname, const char *pathname, int flags, va_list va)
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int open(const char *pathname, int flags, ...)
|
|
||||||
{
|
|
||||||
va_list va;
|
|
||||||
va_start(va, flags);
|
|
||||||
int fd = openHook(__FUNCTION__, pathname, flags, va);
|
|
||||||
va_end(va);
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
int open64(const char *pathname, int flags, ...)
|
|
||||||
{
|
|
||||||
va_list va;
|
|
||||||
va_start(va, flags);
|
|
||||||
int fd = openHook(__FUNCTION__, pathname, flags, va);
|
|
||||||
va_end(va);
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Our close() hook handles restoring DRM master to the Qt FD
|
// Our close() hook handles restoring DRM master to the Qt FD
|
||||||
// after SDL closes its DRM FD.
|
// after SDL closes its DRM FD.
|
||||||
int close(int fd)
|
int close(int fd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user