ipc_send_message: use stack frame with fixed size

This commit is contained in:
Michael Stapelberg
2013-01-11 19:09:41 +01:00
parent fc0e80ee7f
commit 7b0d75ee0a
3 changed files with 38 additions and 20 deletions

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE)
* © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
*
* This public header defines the different constants and message types to use
* for the IPC interface to i3 (see docs/ipc for more information).
@ -11,6 +11,13 @@
#ifndef I3_I3_IPC_H
#define I3_I3_IPC_H
typedef struct i3_ipc_header {
/* 6 = strlen(I3_IPC_MAGIC) */
char magic[6];
uint32_t size;
uint32_t type;
} __attribute__ ((packed)) i3_ipc_header_t;
/*
* Messages from clients to i3
*

View File

@ -202,8 +202,8 @@ int ipc_connect(const char *socket_path);
* Returns 0 on success.
*
*/
int ipc_send_message(int sockfd, uint32_t message_size,
uint32_t message_type, const uint8_t *payload);
int ipc_send_message(int sockfd, const uint32_t message_size,
const uint32_t message_type, const uint8_t *payload);
/**
* Reads a message from the given socket file descriptor and stores its length