Skip to content

Commit

Permalink
better card iteration.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHenson committed Oct 18, 2023
1 parent 821552a commit 1c5b49f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion include/aws/common/system_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ AWS_COMMON_API
const struct aws_string **aws_system_environment_get_network_cards(const struct aws_system_environment *env);

AWS_COMMON_API
uint16_t aws_system_environment_get_cpu_group_for_network_card(const struct aws_system_environment *env, size_t card_index);
uint16_t aws_system_environment_get_cpu_group_for_network_card(
const struct aws_system_environment *env,
size_t card_index);

/**
* Returns the number of processors for the specified compute environment.
Expand Down
6 changes: 3 additions & 3 deletions source/linux/system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#include <aws/common/private/system_info_priv.h>

#include <ifaddrs.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_packet.h>
#include <net/ethernet.h>
#include <sys/socket.h>
#include <sys/types.h>

static bool s_is_irrelevant_interface(const struct aws_byte_cursor name) {

Expand Down Expand Up @@ -51,7 +51,7 @@ int aws_system_environment_load_platform_impl(struct aws_system_environment *env
getifaddrs(&addrs);
iterator = addrs;

while(iterator) {
while (iterator) {
if (iterator->ifa_addr && iterator->ifa_addr->sa_family == AF_PACKET) {
struct aws_string *device_name = aws_string_new_from_c_str(env->allocator, iterator->ifa_name);
struct aws_byte_cursor device_name_cur = aws_byte_cursor_from_string(device_name);
Expand Down
5 changes: 3 additions & 2 deletions source/system_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ size_t aws_system_environment_get_network_card_count(const struct aws_system_env
return aws_array_list_length(&env->str_list_network_cards);
}


const struct aws_string **aws_system_environment_get_network_cards(const struct aws_system_environment *env) {
return env->str_list_network_cards.data;
}

uint16_t aws_system_environment_get_cpu_group_for_network_card(const struct aws_system_environment *env, size_t card_index) {
uint16_t aws_system_environment_get_cpu_group_for_network_card(
const struct aws_system_environment *env,
size_t card_index) {
AWS_FATAL_ASSERT(card_index < aws_array_list_length(&env->u16_nic_to_cpu_group));

uint16_t value = 0;
Expand Down

0 comments on commit 1c5b49f

Please sign in to comment.