diff options
author | Amitay Isaacs <amitay@gmail.com> | 2017-07-06 14:48:38 +1000 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2017-08-30 14:59:22 +0200 |
commit | 0056a9d7eb8be56282549eebadce79b8e5426c89 (patch) | |
tree | f061e0229537bdd3837cf04bed5a64645d288d41 /ctdb/protocol/protocol_basic.c | |
parent | e0cb2f7b83e6703ecb34cdbb198e8b1a467f7287 (diff) | |
download | samba-0056a9d7eb8be56282549eebadce79b8e5426c89.tar.gz |
ctdb-protocol: Add marshalling for struct timeval
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'ctdb/protocol/protocol_basic.c')
-rw-r--r-- | ctdb/protocol/protocol_basic.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ctdb/protocol/protocol_basic.c b/ctdb/protocol/protocol_basic.c index 689d7decb6e..92277840ada 100644 --- a/ctdb/protocol/protocol_basic.c +++ b/ctdb/protocol/protocol_basic.c @@ -344,3 +344,26 @@ int ctdb_pid_pull(uint8_t *buf, size_t buflen, pid_t *out, size_t *npull) *npull = sizeof(pid_t); return 0; } + +size_t ctdb_timeval_len(struct timeval *in) +{ + return sizeof(struct timeval); +} + +void ctdb_timeval_push(struct timeval *in, uint8_t *buf, size_t *npush) +{ + memcpy(buf, in, sizeof(struct timeval)); + *npush = sizeof(struct timeval); +} + +int ctdb_timeval_pull(uint8_t *buf, size_t buflen, struct timeval *out, + size_t *npull) +{ + if (buflen < sizeof(struct timeval)) { + return EMSGSIZE; + } + + memcpy(out, buf, sizeof(struct timeval)); + *npull = sizeof(struct timeval); + return 0; +} |