Add socket system call constants

This commit is contained in:
EnderIce2 2024-01-26 03:35:34 +02:00
parent d2b23eb2e8
commit 56168a6d3d
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -10,6 +10,9 @@
#define __NR_close 6
#define __NR_socketcall 102
#define SYS_SOCKET 1
#define SYS_CONNECT 3
#define O_RDONLY 00
#define likely(expr) (__builtin_expect(!!(expr), 1))
@ -136,6 +139,7 @@ void ConnectToSocket(int fd)
print("XDG_RUNTIME_DIR: %s\n", runtime);
/* TODO: check for multiple discord instances and create a pipe for each */
const char *discordUnixPipes[] = {
"/discord-ipc-0",
"/snap.discord/discord-ipc-0",
@ -161,7 +165,7 @@ void ConnectToSocket(int fd)
(unsigned long)&socketAddr,
sizeof(socketAddr)};
sockRet = sys_socketcall(3, socketArgs);
sockRet = sys_socketcall(SYS_CONNECT, socketArgs);
free(pipePath);
if (sockRet >= 0)
@ -372,7 +376,7 @@ NewConnection:
(unsigned long)SOCK_STREAM,
0};
int fd = sys_socketcall(1, socketArgs);
int fd = sys_socketcall(SYS_SOCKET, socketArgs);
print("Socket %d created\n", fd);