mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-03-03 21:26:36 +00:00
ipc: Check that service and client are the same git revision
This commit is contained in:
parent
b3e9653994
commit
f49d3ae404
src/xrt/ipc
|
@ -16,6 +16,7 @@
|
|||
#include "util/u_misc.h"
|
||||
#include "util/u_var.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_git_tag.h"
|
||||
|
||||
#include "shared/ipc_protocol.h"
|
||||
#include "client/ipc_client.h"
|
||||
|
@ -305,6 +306,13 @@ ipc_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (strncmp(u_git_tag, ii->ipc_c.ism->u_git_tag, IPC_VERSION_NAME_LEN) != 0) {
|
||||
IPC_ERROR((&ii->ipc_c), "Monado client library version %s does not match service version %s", u_git_tag,
|
||||
ii->ipc_c.ism->u_git_tag);
|
||||
free(ii);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t count = 0;
|
||||
struct xrt_tracking_origin *xtrack = NULL;
|
||||
struct ipc_shared_memory *ism = ii->ipc_c.ism;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "util/u_verify.h"
|
||||
#include "util/u_process.h"
|
||||
|
||||
#include "util/u_git_tag.h"
|
||||
|
||||
#include "shared/ipc_shmem.h"
|
||||
#include "server/ipc_server.h"
|
||||
|
||||
|
@ -320,6 +322,8 @@ init_shm(struct ipc_server *s)
|
|||
// Finally tell the client how many devices we have.
|
||||
s->ism->num_isdevs = count;
|
||||
|
||||
snprintf(s->ism->u_git_tag, IPC_VERSION_NAME_LEN, "%s", u_git_tag);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#define IPC_SHARED_MAX_OUTPUTS 128
|
||||
#define IPC_SHARED_MAX_BINDINGS 64
|
||||
|
||||
// example: v21.0.0-560-g586d33b5
|
||||
#define IPC_VERSION_NAME_LEN 64
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -174,6 +176,11 @@ struct ipc_layer_slot
|
|||
*/
|
||||
struct ipc_shared_memory
|
||||
{
|
||||
/*!
|
||||
* The git revision of the service, used by clients to detect version mismatches.
|
||||
*/
|
||||
char u_git_tag[IPC_VERSION_NAME_LEN];
|
||||
|
||||
/*!
|
||||
* Number of elements in @ref itracks that are populated/valid.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue