The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipc: Check that service and client are the same git revision

+19
+8
src/xrt/ipc/client/ipc_client_instance.c
··· 16 16 #include "util/u_misc.h" 17 17 #include "util/u_var.h" 18 18 #include "util/u_debug.h" 19 + #include "util/u_git_tag.h" 19 20 20 21 #include "shared/ipc_protocol.h" 21 22 #include "client/ipc_client.h" ··· 301 302 ii->ipc_c.ism = mmap(NULL, size, access, flags, ii->ipc_c.ism_handle, 0); 302 303 if (ii->ipc_c.ism == NULL) { 303 304 IPC_ERROR((&ii->ipc_c), "Failed to mmap shm!"); 305 + free(ii); 306 + return -1; 307 + } 308 + 309 + if (strncmp(u_git_tag, ii->ipc_c.ism->u_git_tag, IPC_VERSION_NAME_LEN) != 0) { 310 + IPC_ERROR((&ii->ipc_c), "Monado client library version %s does not match service version %s", u_git_tag, 311 + ii->ipc_c.ism->u_git_tag); 304 312 free(ii); 305 313 return -1; 306 314 }
+4
src/xrt/ipc/server/ipc_server_process.c
··· 23 23 #include "util/u_verify.h" 24 24 #include "util/u_process.h" 25 25 26 + #include "util/u_git_tag.h" 27 + 26 28 #include "shared/ipc_shmem.h" 27 29 #include "server/ipc_server.h" 28 30 ··· 319 321 320 322 // Finally tell the client how many devices we have. 321 323 s->ism->num_isdevs = count; 324 + 325 + snprintf(s->ism->u_git_tag, IPC_VERSION_NAME_LEN, "%s", u_git_tag); 322 326 323 327 return 0; 324 328 }
+7
src/xrt/ipc/shared/ipc_protocol.h
··· 37 37 #define IPC_SHARED_MAX_OUTPUTS 128 38 38 #define IPC_SHARED_MAX_BINDINGS 64 39 39 40 + // example: v21.0.0-560-g586d33b5 41 + #define IPC_VERSION_NAME_LEN 64 40 42 41 43 /* 42 44 * ··· 174 176 */ 175 177 struct ipc_shared_memory 176 178 { 179 + /*! 180 + * The git revision of the service, used by clients to detect version mismatches. 181 + */ 182 + char u_git_tag[IPC_VERSION_NAME_LEN]; 183 + 177 184 /*! 178 185 * Number of elements in @ref itracks that are populated/valid. 179 186 */