New upstream version 24.0.1+dfsg1
This commit is contained in:
parent
b14f9eae6d
commit
5a730d6ec3
842 changed files with 42245 additions and 33385 deletions
40
deps/ipc-util/ipc-util/pipe-windows.c
vendored
40
deps/ipc-util/ipc-util/pipe-windows.c
vendored
|
|
@ -47,15 +47,14 @@ error:
|
|||
}
|
||||
|
||||
static inline bool ipc_pipe_internal_create_pipe(ipc_pipe_server_t *pipe,
|
||||
const char *name)
|
||||
const char *name)
|
||||
{
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
char new_name[512];
|
||||
void *sd;
|
||||
const DWORD access = PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED;
|
||||
const DWORD flags = PIPE_TYPE_MESSAGE |
|
||||
PIPE_READMODE_MESSAGE |
|
||||
PIPE_WAIT;
|
||||
const DWORD flags = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE |
|
||||
PIPE_WAIT;
|
||||
|
||||
strcpy_s(new_name, sizeof(new_name), "\\\\.\\pipe\\");
|
||||
strcat_s(new_name, sizeof(new_name), name);
|
||||
|
|
@ -70,14 +69,15 @@ static inline bool ipc_pipe_internal_create_pipe(ipc_pipe_server_t *pipe,
|
|||
sa.bInheritHandle = false;
|
||||
|
||||
pipe->handle = CreateNamedPipeA(new_name, access, flags, 1,
|
||||
IPC_PIPE_BUF_SIZE, IPC_PIPE_BUF_SIZE, 0, &sa);
|
||||
IPC_PIPE_BUF_SIZE, IPC_PIPE_BUF_SIZE, 0,
|
||||
&sa);
|
||||
free(sd);
|
||||
|
||||
return pipe->handle != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
static inline void ipc_pipe_internal_ensure_capacity(ipc_pipe_server_t *pipe,
|
||||
size_t new_size)
|
||||
size_t new_size)
|
||||
{
|
||||
if (pipe->capacity >= new_size) {
|
||||
return;
|
||||
|
|
@ -88,7 +88,7 @@ static inline void ipc_pipe_internal_ensure_capacity(ipc_pipe_server_t *pipe,
|
|||
}
|
||||
|
||||
static inline void ipc_pipe_internal_append_bytes(ipc_pipe_server_t *pipe,
|
||||
uint8_t *bytes, size_t size)
|
||||
uint8_t *bytes, size_t size)
|
||||
{
|
||||
size_t new_size = pipe->size + size;
|
||||
ipc_pipe_internal_ensure_capacity(pipe, new_size);
|
||||
|
|
@ -118,7 +118,7 @@ static DWORD CALLBACK ipc_pipe_internal_server_thread(LPVOID param)
|
|||
bool success;
|
||||
|
||||
success = !!ReadFile(pipe->handle, buf, IPC_PIPE_BUF_SIZE, NULL,
|
||||
&pipe->overlap);
|
||||
&pipe->overlap);
|
||||
if (!success && !ipc_pipe_internal_io_pending()) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ static DWORD CALLBACK ipc_pipe_internal_server_thread(LPVOID param)
|
|||
}
|
||||
|
||||
success = !!GetOverlappedResult(pipe->handle, &pipe->overlap,
|
||||
&bytes, true);
|
||||
&bytes, true);
|
||||
if (!success || !bytes) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ static DWORD CALLBACK ipc_pipe_internal_server_thread(LPVOID param)
|
|||
|
||||
if (success) {
|
||||
pipe->read_callback(pipe->param, pipe->read_data,
|
||||
pipe->size);
|
||||
pipe->size);
|
||||
pipe->size = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -147,16 +147,16 @@ static DWORD CALLBACK ipc_pipe_internal_server_thread(LPVOID param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline bool ipc_pipe_internal_start_server_thread(
|
||||
ipc_pipe_server_t *pipe)
|
||||
static inline bool
|
||||
ipc_pipe_internal_start_server_thread(ipc_pipe_server_t *pipe)
|
||||
{
|
||||
pipe->thread = CreateThread(NULL, 0, ipc_pipe_internal_server_thread,
|
||||
pipe, 0, NULL);
|
||||
pipe, 0, NULL);
|
||||
return pipe->thread != NULL;
|
||||
}
|
||||
|
||||
static inline bool ipc_pipe_internal_wait_for_connection(
|
||||
ipc_pipe_server_t *pipe)
|
||||
static inline bool
|
||||
ipc_pipe_internal_wait_for_connection(ipc_pipe_server_t *pipe)
|
||||
{
|
||||
bool success;
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ static inline bool ipc_pipe_internal_wait_for_connection(
|
|||
}
|
||||
|
||||
static inline bool ipc_pipe_internal_open_pipe(ipc_pipe_client_t *pipe,
|
||||
const char *name)
|
||||
const char *name)
|
||||
{
|
||||
DWORD mode = PIPE_READMODE_MESSAGE;
|
||||
char new_name[512];
|
||||
|
|
@ -174,8 +174,8 @@ static inline bool ipc_pipe_internal_open_pipe(ipc_pipe_client_t *pipe,
|
|||
strcpy_s(new_name, sizeof(new_name), "\\\\.\\pipe\\");
|
||||
strcat_s(new_name, sizeof(new_name), name);
|
||||
|
||||
pipe->handle = CreateFileA(new_name, GENERIC_READ | GENERIC_WRITE,
|
||||
0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
pipe->handle = CreateFileA(new_name, GENERIC_READ | GENERIC_WRITE, 0,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (pipe->handle == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ static inline bool ipc_pipe_internal_open_pipe(ipc_pipe_client_t *pipe,
|
|||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
bool ipc_pipe_server_start(ipc_pipe_server_t *pipe, const char *name,
|
||||
ipc_pipe_read_t read_callback, void *param)
|
||||
ipc_pipe_read_t read_callback, void *param)
|
||||
{
|
||||
pipe->read_callback = read_callback;
|
||||
pipe->param = param;
|
||||
|
|
@ -253,7 +253,7 @@ void ipc_pipe_client_free(ipc_pipe_client_t *pipe)
|
|||
}
|
||||
|
||||
bool ipc_pipe_client_write(ipc_pipe_client_t *pipe, const void *data,
|
||||
size_t size)
|
||||
size_t size)
|
||||
{
|
||||
DWORD bytes;
|
||||
|
||||
|
|
|
|||
20
deps/ipc-util/ipc-util/pipe-windows.h
vendored
20
deps/ipc-util/ipc-util/pipe-windows.h
vendored
|
|
@ -19,21 +19,21 @@
|
|||
#include <windows.h>
|
||||
|
||||
struct ipc_pipe_server {
|
||||
OVERLAPPED overlap;
|
||||
HANDLE handle;
|
||||
HANDLE ready_event;
|
||||
HANDLE thread;
|
||||
OVERLAPPED overlap;
|
||||
HANDLE handle;
|
||||
HANDLE ready_event;
|
||||
HANDLE thread;
|
||||
|
||||
uint8_t *read_data;
|
||||
size_t size;
|
||||
size_t capacity;
|
||||
uint8_t *read_data;
|
||||
size_t size;
|
||||
size_t capacity;
|
||||
|
||||
ipc_pipe_read_t read_callback;
|
||||
void *param;
|
||||
ipc_pipe_read_t read_callback;
|
||||
void *param;
|
||||
};
|
||||
|
||||
struct ipc_pipe_client {
|
||||
HANDLE handle;
|
||||
HANDLE handle;
|
||||
};
|
||||
|
||||
static inline bool ipc_pipe_client_valid(ipc_pipe_client_t *pipe)
|
||||
|
|
|
|||
4
deps/ipc-util/ipc-util/pipe.h
vendored
4
deps/ipc-util/ipc-util/pipe.h
vendored
|
|
@ -35,13 +35,13 @@ typedef struct ipc_pipe_client ipc_pipe_client_t;
|
|||
typedef void (*ipc_pipe_read_t)(void *param, uint8_t *data, size_t size);
|
||||
|
||||
bool ipc_pipe_server_start(ipc_pipe_server_t *pipe, const char *name,
|
||||
ipc_pipe_read_t read_callback, void *param);
|
||||
ipc_pipe_read_t read_callback, void *param);
|
||||
void ipc_pipe_server_free(ipc_pipe_server_t *pipe);
|
||||
|
||||
bool ipc_pipe_client_open(ipc_pipe_client_t *pipe, const char *name);
|
||||
void ipc_pipe_client_free(ipc_pipe_client_t *pipe);
|
||||
bool ipc_pipe_client_write(ipc_pipe_client_t *pipe, const void *data,
|
||||
size_t size);
|
||||
size_t size);
|
||||
static inline bool ipc_pipe_client_valid(ipc_pipe_client_t *pipe);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue