From: Brian Aker Date: Tue, 9 Feb 2010 18:30:12 +0000 (-0800) Subject: Patches from Piotr Sikora < piotr.sikora@frickle.com > for OpenBSD. X-Git-Tag: 0.40~55 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=7da7d839bffc2b41ea532c70dbe386fb742e714d;p=awesomized%2Flibmemcached Patches from Piotr Sikora < piotr.sikora@frickle.com > for OpenBSD. --- diff --git a/clients/memcapable.c b/clients/memcapable.c index 5318ff01..67146658 100644 --- a/clients/memcapable.c +++ b/clients/memcapable.c @@ -342,7 +342,7 @@ static enum test_return recv_packet(response *rsp) * @param dta the data to store with the key * @param dtalen the length of the data to store with the key * @param flags the flags to store along with the key - * @param exp the expiry time for the key + * @param exptime the expiry time for the key */ static void storage_command(command *cmd, uint8_t cc, @@ -351,7 +351,7 @@ static void storage_command(command *cmd, const void* dta, size_t dtalen, uint32_t flags, - uint32_t exp) + uint32_t exptime) { /* all of the storage commands use the same command layout */ protocol_binary_request_set *request= &cmd->set; @@ -364,7 +364,7 @@ static void storage_command(command *cmd, request->message.header.request.bodylen= (uint32_t)(keylen + 8 + dtalen); request->message.header.request.opaque= 0xdeadbeef; request->message.body.flags= flags; - request->message.body.expiration= exp; + request->message.body.expiration= exptime; off_t key_offset= sizeof (protocol_binary_request_no_extras) + 8; memcpy(cmd->bytes + key_offset, key, keylen); @@ -435,7 +435,7 @@ static void flush_command(command *cmd, * @param keylen the number of bytes in the key * @param delta the number to add/subtract * @param initial the initial value if the key doesn't exist - * @param exp when the key should expire if it isn't set + * @param exptime when the key should expire if it isn't set */ static void arithmetic_command(command *cmd, uint8_t cc, @@ -443,7 +443,7 @@ static void arithmetic_command(command *cmd, size_t keylen, uint64_t delta, uint64_t initial, - uint32_t exp) + uint32_t exptime) { memset(cmd, 0, sizeof (cmd->incr)); cmd->incr.message.header.request.magic= PROTOCOL_BINARY_REQ; @@ -454,7 +454,7 @@ static void arithmetic_command(command *cmd, cmd->incr.message.header.request.opaque= 0xdeadbeef; cmd->incr.message.body.delta= htonll(delta); cmd->incr.message.body.initial= htonll(initial); - cmd->incr.message.body.expiration= htonl(exp); + cmd->incr.message.body.expiration= htonl(exptime); off_t key_offset= sizeof (protocol_binary_request_no_extras) + 20; memcpy(cmd->bytes + key_offset, key, keylen); diff --git a/clients/memslap.c b/clients/memslap.c index 18ac2dd1..38343b86 100644 --- a/clients/memslap.c +++ b/clients/memslap.c @@ -112,7 +112,7 @@ static void ms_options_parse(int argc, char *argv[]); static int ms_check_para(void); static void ms_statistic_init(void); static void ms_stats_init(void); -static void ms_print_statistics(int time); +static void ms_print_statistics(int in_time); static void ms_print_memslap_stats(struct timeval *start_time, struct timeval *end_time); static void ms_monitor_slap_mode(void); diff --git a/clients/ms_conn.c b/clients/ms_conn.c index 86e98fe1..005879bd 100644 --- a/clients/ms_conn.c +++ b/clients/ms_conn.c @@ -797,7 +797,11 @@ static int ms_network_connect(ms_conn_t *c, * that otherwise mess things up. */ memset(&hints, 0, sizeof(hints)); +#ifdef AI_ADDRCONFIG hints.ai_flags= AI_PASSIVE | AI_ADDRCONFIG; +#else ++ hints.ai_flags= AI_PASSIVE; +#endif /* AI_ADDRCONFIG */ if (is_udp) { hints.ai_protocol= IPPROTO_UDP; diff --git a/libmemcached/byteorder.c b/libmemcached/byteorder.c index 4b6eeb07..96a39bf8 100644 --- a/libmemcached/byteorder.c +++ b/libmemcached/byteorder.c @@ -12,14 +12,14 @@ #include "byteorder.h" /* Byte swap a 64-bit number. */ +#ifndef swap64 static inline uint64_t swap64(uint64_t in) { #ifndef WORDS_BIGENDIAN /* Little endian, flip the bytes around until someone makes a faster/better * way to do this. */ uint64_t rv= 0; - uint8_t x= 0; - for(x= 0; x < 8; x++) + for (uint8_t x= 0; x < 8; x++) { rv= (rv << 8) | (in & 0xff); in >>= 8; @@ -28,8 +28,9 @@ static inline uint64_t swap64(uint64_t in) #else /* big-endian machines don't need byte swapping */ return in; -#endif +#endif // WORDS_BIGENDIAN } +#endif uint64_t ntohll(uint64_t value) { diff --git a/libmemcached/byteorder.h b/libmemcached/byteorder.h index df47cc69..f43dbc43 100644 --- a/libmemcached/byteorder.h +++ b/libmemcached/byteorder.h @@ -14,6 +14,11 @@ #include "config.h" +#if HAVE_SYS_TYPES_H +#include +#endif + + /* Define this here, which will turn on the visibilty controls while we're * building libmemcached. */