Skip to content

Commit

Permalink
Merge pull request #24 from chaos/cleanup
Browse files Browse the repository at this point in the history
fix tab vs space
  • Loading branch information
chu11 authored Nov 19, 2023
2 parents 7b5f551 + 649df8e commit cca0af3
Show file tree
Hide file tree
Showing 48 changed files with 697 additions and 697 deletions.
6 changes: 3 additions & 3 deletions src/cerebro-admin/cerebro-admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ static void
_usage(void)
{
fprintf(stderr,
"Usage: cerebro_admin [OPTIONS] -m <metric_name> [-r | -u | -p | -s]\n"
"Usage: cerebro_admin [OPTIONS] -m <metric_name> [-r | -u | -p | -s]\n"
"\n"
"OPTIONS:\n"
" -h Print help and exit\n"
" -v Print version and exit\n"
" -h Print help and exit\n"
" -v Print version and exit\n"
" -m STRING Specify the metric name\n"
" -r Register the metric name\n"
" -u Unregister the metric name\n"
Expand Down
12 changes: 6 additions & 6 deletions src/cerebro-stat/cerebro-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ static void
_usage(void)
{
fprintf(stderr,
"Usage: cerebro-stat [OPTIONS] -m <metric_name>\n"
"or cerebro-stat [OPTIONS] -l\n"
"Usage: cerebro-stat [OPTIONS] -m <metric_name>\n"
"or cerebro-stat [OPTIONS] -l\n"
"or cerebro-stat [OPTIONS] -e <event_name>\n"
"or cerebro-stat [OPTIONS] -z\n"
"\n"
"OPTIONS:\n"
" -h Print help and exit\n"
" -v Print version and exit\n"
" -o STRING Cerebro server hostname\n"
" -p INT Cerebro server port\n"
" -h Print help and exit\n"
" -v Print version and exit\n"
" -o STRING Cerebro server hostname\n"
" -p INT Cerebro server port\n"
" -m STRING Output metric data for the specified metric\n"
" -l List all available metrics that can be queried\n"
" -U Only output metrics from up nodes\n"
Expand Down
2 changes: 1 addition & 1 deletion src/cerebrod/cerebrod.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,5 @@ main(int argc, char **argv)
for (;;)
sleep(INT_MAX);

return 0; /* NOT REACHED */
return 0; /* NOT REACHED */
}
48 changes: 24 additions & 24 deletions src/cerebrod/cerebrod_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ _usage(void)
"-v --version Output Version\n"
"-c --config_file Specify alternate config file\n"
"-d --debug Turn on debugging and run daemon\n"
" in foreground\n");
" in foreground\n");
exit(0);
}

Expand Down Expand Up @@ -500,23 +500,23 @@ _cerebrod_config_error_check_network_interface(char *network_interface)
if (network_interface && strchr(network_interface, '.'))
{
if (strchr(network_interface, '/'))
{
char *ipaddr_cpy = Strdup(network_interface);
char *tok;
{
char *ipaddr_cpy = Strdup(network_interface);
char *tok;

tok = strtok(ipaddr_cpy, "/");
if (!Inet_pton(AF_INET, tok, &addr_temp))
cerebro_err_exit("network interface IP address '%s' invalid",
tok = strtok(ipaddr_cpy, "/");
if (!Inet_pton(AF_INET, tok, &addr_temp))
cerebro_err_exit("network interface IP address '%s' invalid",
network_interface);

Free(ipaddr_cpy);
}
Free(ipaddr_cpy);
}
else
{
if (!Inet_pton(AF_INET, network_interface, &addr_temp))
cerebro_err_exit("network interface IP address '%s' invalid",
{
if (!Inet_pton(AF_INET, network_interface, &addr_temp))
cerebro_err_exit("network interface IP address '%s' invalid",
network_interface);
}
}
}
}

Expand Down Expand Up @@ -1032,26 +1032,26 @@ _cerebrod_configuration_data_error_check(void)

/* Check all interfaces */
for(ptr = buf; ptr < buf + ifc.ifc_len;)
{
struct sockaddr_in *sinptr;
int len;
{
struct sockaddr_in *sinptr;
int len;

ifr = (struct ifreq *)ptr;
ifr = (struct ifreq *)ptr;

len = _get_ifr_len(ifr);
len = _get_ifr_len(ifr);

ptr += sizeof(ifr->ifr_name) + len;
ptr += sizeof(ifr->ifr_name) + len;

sinptr = (struct sockaddr_in *)&ifr->ifr_addr;
sinptr = (struct sockaddr_in *)&ifr->ifr_addr;

if (!memcmp((void *)&addr_temp,
(void *)&sinptr->sin_addr,
sizeof(struct in_addr)))
{
found_interface++;
break;
found_interface++;
break;
}
}
}

Free(buf);
Close(fd);
Expand Down Expand Up @@ -1082,7 +1082,7 @@ _cerebrod_configuration_data_error_check(void)
}

if (conf.metric_server_port == conf.event_server_port)
cerebro_err_exit("metric server port '%d' cannot be identical "
cerebro_err_exit("metric server port '%d' cannot be identical "
"to event server port", conf.metric_server_port);
}

Expand Down
4 changes: 2 additions & 2 deletions src/cerebrod/cerebrod_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ cerebrod_daemon_init(void)
int i;

pid = Fork();
if (pid != 0) /* Terminate Parent */
if (pid != 0) /* Terminate Parent */
exit(0);

setsid();

Signal(SIGHUP, SIG_IGN);

pid = Fork();
if (pid != 0) /* Terminate 1st Child */
if (pid != 0) /* Terminate 1st Child */
exit(0);

Chdir("/");
Expand Down
2 changes: 1 addition & 1 deletion src/cerebrod/cerebrod_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define CEREBROD_DBG(msg) \
do { \
if (conf.debug) \
cerebro_err_debug msg; \
cerebro_err_debug msg; \
} while(0)

#endif /* !CEREBRO_DEBUG */
Expand Down
2 changes: 1 addition & 1 deletion src/cerebrod/cerebrod_event_node_timeout_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ cerebrod_event_node_timeout_monitor(void *arg)

}

return NULL; /* NOT REACHED */
return NULL; /* NOT REACHED */
}

#endif /* !WITH_CEREBROD_SPEAKER_ONLY */
4 changes: 2 additions & 2 deletions src/cerebrod/cerebrod_event_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ cerebrod_event_queue_monitor(void *arg)

List_destroy(temp_event_queue);

return NULL; /* NOT REACHED */
return NULL; /* NOT REACHED */
}

/*
Expand Down Expand Up @@ -1222,7 +1222,7 @@ cerebrod_event_server(void *arg)
Free(pfds);
}

return NULL; /* NOT REACHED */
return NULL; /* NOT REACHED */
}

#endif /* !WITH_CEREBROD_SPEAKER_ONLY */
16 changes: 8 additions & 8 deletions src/cerebrod/cerebrod_event_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@ cerebrod_event_modules_setup(void)

event_module_timeouts = List_create((ListDelF)_cerebrod_event_module_timeout_data_destroy);
event_module_timeout_index = Hash_create(event_module_count,
(hash_key_f)hash_key_string,
(hash_cmp_f)strcmp,
(hash_del_f)list_destroy);
(hash_key_f)hash_key_string,
(hash_cmp_f)strcmp,
(hash_del_f)list_destroy);

for (i = 0; i < event_module_count; i++)
{
Expand Down Expand Up @@ -754,9 +754,9 @@ cerebrod_event_modules_update(const char *nodename,
Pthread_mutex_unlock(&(el->event_list_lock));

while ((event_module = list_next(itr)))
{
Pthread_mutex_lock(&event_module->event_lock);
if ((rv = event_module_metric_update(event_handle,
{
Pthread_mutex_lock(&event_module->event_lock);
if ((rv = event_module_metric_update(event_handle,
event_module->index,
nodename,
metric_name,
Expand All @@ -773,8 +773,8 @@ cerebrod_event_modules_update(const char *nodename,
cerebrod_queue_event(event, event_module->index);

loop_next:
Pthread_mutex_unlock(&event_module->event_lock);
}
Pthread_mutex_unlock(&event_module->event_lock);
}

Pthread_mutex_lock(&(el->event_list_lock));
List_iterator_destroy(itr);
Expand Down
24 changes: 12 additions & 12 deletions src/cerebrod/cerebrod_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ _listener_setup_socket(int num)

optlen = sizeof(struct ip_mreqn);
if (setsockopt(fd, SOL_IP, IP_ADD_MEMBERSHIP, &imr, optlen) < 0)
{
CEREBROD_ERR(("setsockopt: %s", strerror(errno)));
{
CEREBROD_ERR(("setsockopt: %s", strerror(errno)));
goto cleanup;
}
}
}

/* For quick start/restart */
Expand Down Expand Up @@ -625,23 +625,23 @@ cerebrod_listener(void *arg)

/* No packet read */
if (recv_len <= 0)
continue;
continue;

if (recv_len >= CEREBRO_MAX_PACKET_LEN)
{
CEREBROD_DBG(("received truncated packet"));
CEREBROD_DBG(("received truncated packet"));
continue;
}

if (_cerebrod_message_check_version(buf, recv_len) < 0)
{
CEREBROD_DBG(("received invalid version packet"));
CEREBROD_DBG(("received invalid version packet"));
continue;
}

if (!(msg = _cerebrod_message_unmarshall(buf, recv_len)))
{
CEREBROD_DBG(("received unmarshallable packet"));
CEREBROD_DBG(("received unmarshallable packet"));
continue;
}

Expand Down Expand Up @@ -679,11 +679,11 @@ cerebrod_listener(void *arg)
in_cluster_flag = 1;

if (!in_cluster_flag)
{
CEREBROD_DBG(("received non-cluster packet: %s", nodename_buf));
{
CEREBROD_DBG(("received non-cluster packet: %s", nodename_buf));
cerebrod_message_destroy(msg);
continue;
}
continue;
}

memset(nodename_key, '\0', CEREBRO_MAX_NODENAME_LEN+1);

Expand Down Expand Up @@ -760,7 +760,7 @@ cerebrod_listener(void *arg)
cerebrod_message_destroy(msg);
}

return NULL; /* NOT REACHED */
return NULL; /* NOT REACHED */
}

#endif /* !WITH_CEREBROD_SPEAKER_ONLY */
20 changes: 10 additions & 10 deletions src/cerebrod/cerebrod_listener_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,11 @@ _metric_data_update(struct cerebrod_node_data *nd,
{
/* Re-hash if our hash is getting too small */
if ((nd->metric_data_count + 1) > (nd->metric_data_size*2))
cerebrod_rehash(&nd->metric_data,
&nd->metric_data_size,
LISTENER_DATA_METRIC_DATA_INCREMENT,
nd->metric_data_count,
&nd->node_data_lock);
cerebrod_rehash(&nd->metric_data,
&nd->metric_data_size,
LISTENER_DATA_METRIC_DATA_INCREMENT,
nd->metric_data_count,
&nd->node_data_lock);

md = metric_data_create(metric_name);
Hash_insert(nd->metric_data, md->metric_name, md);
Expand Down Expand Up @@ -630,11 +630,11 @@ cerebrod_listener_data_update(char *nodename,
{
/* Re-hash if our hash is getting too small */
if ((listener_data_numnodes + 1) > (listener_data_size*2))
cerebrod_rehash(&listener_data,
&listener_data_size,
LISTENER_DATA_SIZE_INCREMENT,
listener_data_numnodes,
&listener_data_lock);
cerebrod_rehash(&listener_data,
&listener_data_size,
LISTENER_DATA_SIZE_INCREMENT,
listener_data_numnodes,
&listener_data_lock);

nd = _cerebrod_node_data_create_and_init(nodename);
Hash_insert(listener_data, nd->nodename, nd);
Expand Down
2 changes: 1 addition & 1 deletion src/cerebrod/cerebrod_metric_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ cerebrod_metric_controller(void *arg)
Pthread_attr_destroy(&attr);
}

return NULL; /* NOT REACHED */
return NULL; /* NOT REACHED */
}

#endif /* !WITH_CEREBROD_SPEAKER_ONLY */
4 changes: 2 additions & 2 deletions src/cerebrod/cerebrod_metric_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ _metric_server_respond_with_error(int fd, int32_t version, u_int32_t err_code)

assert(fd >= 0
&& err_code >= CEREBRO_METRIC_SERVER_PROTOCOL_ERR_VERSION_INVALID
&& err_code <= CEREBRO_METRIC_SERVER_PROTOCOL_ERR_INTERNAL_ERROR);
&& err_code <= CEREBRO_METRIC_SERVER_PROTOCOL_ERR_INTERNAL_ERROR);

memset(&res, '\0', CEREBRO_METRIC_SERVER_ERR_RESPONSE_LEN);
res.version = version;
Expand Down Expand Up @@ -1034,7 +1034,7 @@ cerebrod_metric_server(void *arg)
Pthread_attr_destroy(&attr);
}

return NULL; /* NOT REACHED */
return NULL; /* NOT REACHED */
}

#endif /* !WITH_CEREBROD_SPEAKER_ONLY */
22 changes: 11 additions & 11 deletions src/cerebrod/cerebrod_monitor_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,17 @@ cerebrod_monitor_modules_update(const char *nodename,
Pthread_mutex_unlock(&(ml->monitor_list_lock));

while ((monitor_module = list_next(itr)))
{
Pthread_mutex_lock(&monitor_module->monitor_lock);
monitor_module_metric_update(monitor_handle,
monitor_module->index,
nodename,
metric_name,
mm->metric_value_type,
mm->metric_value_len,
mm->metric_value);
Pthread_mutex_unlock(&monitor_module->monitor_lock);
}
{
Pthread_mutex_lock(&monitor_module->monitor_lock);
monitor_module_metric_update(monitor_handle,
monitor_module->index,
nodename,
metric_name,
mm->metric_value_type,
mm->metric_value_len,
mm->metric_value);
Pthread_mutex_unlock(&monitor_module->monitor_lock);
}

Pthread_mutex_lock(&(ml->monitor_list_lock));
List_iterator_destroy(itr);
Expand Down
Loading

0 comments on commit cca0af3

Please sign in to comment.