Remove all C++ variable definitions from the <blink>C</blink> code !!!
This commit was SVN r957.
Этот коммит содержится в:
родитель
4e5be3a5d2
Коммит
be14710283
@ -68,13 +68,14 @@ static inline mca_ptl_proc_t* mca_ptl_array_get_index(mca_ptl_array_t* array, si
|
|||||||
|
|
||||||
static inline mca_ptl_proc_t* mca_ptl_array_get_next(mca_ptl_array_t* array)
|
static inline mca_ptl_proc_t* mca_ptl_array_get_next(mca_ptl_array_t* array)
|
||||||
{
|
{
|
||||||
|
mca_ptl_proc_t* ptl_proc;
|
||||||
#if LAM_ENABLE_DEBUG
|
#if LAM_ENABLE_DEBUG
|
||||||
if(array->ptl_size == 0) {
|
if(array->ptl_size == 0) {
|
||||||
lam_output(0, "mca_ptl_array_get_next: invalid array size");
|
lam_output(0, "mca_ptl_array_get_next: invalid array size");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
mca_ptl_proc_t* ptl_proc = &array->ptl_procs[array->ptl_index++];
|
ptl_proc = &array->ptl_procs[array->ptl_index++];
|
||||||
if(array->ptl_index == array->ptl_size)
|
if(array->ptl_index == array->ptl_size)
|
||||||
array->ptl_index = 0;
|
array->ptl_index = 0;
|
||||||
return ptl_proc;
|
return ptl_proc;
|
||||||
|
@ -37,6 +37,7 @@ void mca_pml_teg_send_request_schedule(mca_ptl_base_send_request_t* req)
|
|||||||
* size, then go ahead and give the rest of the message to this PTL.
|
* size, then go ahead and give the rest of the message to this PTL.
|
||||||
*/
|
*/
|
||||||
size_t bytes_to_frag;
|
size_t bytes_to_frag;
|
||||||
|
int rc;
|
||||||
if(num_ptl == num_ptl_avail || bytes_remaining < ptl->ptl_min_frag_size)
|
if(num_ptl == num_ptl_avail || bytes_remaining < ptl->ptl_min_frag_size)
|
||||||
bytes_to_frag = bytes_remaining;
|
bytes_to_frag = bytes_remaining;
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ void mca_pml_teg_send_request_schedule(mca_ptl_base_send_request_t* req)
|
|||||||
bytes_to_frag = bytes_remaining;
|
bytes_to_frag = bytes_remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc = ptl->ptl_send(ptl, ptl_proc->ptl_peer, req, bytes_to_frag, 0);
|
rc = ptl->ptl_send(ptl, ptl_proc->ptl_peer, req, bytes_to_frag, 0);
|
||||||
if(rc == LAM_SUCCESS)
|
if(rc == LAM_SUCCESS)
|
||||||
bytes_remaining = req->super.req_length - req->req_offset;
|
bytes_remaining = req->super.req_length - req->req_offset;
|
||||||
}
|
}
|
||||||
|
@ -139,9 +139,9 @@ void mca_ptl_tcp_recv_frag_return(struct mca_ptl_t* ptl, struct mca_ptl_tcp_recv
|
|||||||
void mca_ptl_tcp_send_frag_return(struct mca_ptl_t* ptl, struct mca_ptl_tcp_send_frag_t* frag)
|
void mca_ptl_tcp_send_frag_return(struct mca_ptl_t* ptl, struct mca_ptl_tcp_send_frag_t* frag)
|
||||||
{
|
{
|
||||||
if(lam_list_get_size(&mca_ptl_tcp_module.tcp_pending_acks)) {
|
if(lam_list_get_size(&mca_ptl_tcp_module.tcp_pending_acks)) {
|
||||||
THREAD_LOCK(&mca_ptl_tcp_module.tcp_lock);
|
|
||||||
mca_ptl_tcp_recv_frag_t* pending = (mca_ptl_tcp_recv_frag_t*)
|
mca_ptl_tcp_recv_frag_t* pending = (mca_ptl_tcp_recv_frag_t*)
|
||||||
lam_list_remove_first(&mca_ptl_tcp_module.tcp_pending_acks);
|
lam_list_remove_first(&mca_ptl_tcp_module.tcp_pending_acks);
|
||||||
|
THREAD_LOCK(&mca_ptl_tcp_module.tcp_lock);
|
||||||
if(NULL == pending) {
|
if(NULL == pending) {
|
||||||
THREAD_UNLOCK(&mca_ptl_tcp_module.tcp_lock);
|
THREAD_UNLOCK(&mca_ptl_tcp_module.tcp_lock);
|
||||||
lam_free_list_return(&mca_ptl_tcp_module.tcp_send_frags, (lam_list_item_t*)frag);
|
lam_free_list_return(&mca_ptl_tcp_module.tcp_send_frags, (lam_list_item_t*)frag);
|
||||||
|
@ -217,6 +217,8 @@ static int mca_ptl_tcp_module_create_instances(void)
|
|||||||
static int mca_ptl_tcp_module_create_listen(void)
|
static int mca_ptl_tcp_module_create_listen(void)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
|
struct sockaddr_in inaddr;
|
||||||
|
lam_socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||||
|
|
||||||
/* create a listen socket for incoming connections */
|
/* create a listen socket for incoming connections */
|
||||||
mca_ptl_tcp_module.tcp_listen_sd = socket(AF_INET, SOCK_STREAM, 0);
|
mca_ptl_tcp_module.tcp_listen_sd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
@ -226,7 +228,6 @@ static int mca_ptl_tcp_module_create_listen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* bind to all addresses and dynamically assigned port */
|
/* bind to all addresses and dynamically assigned port */
|
||||||
struct sockaddr_in inaddr;
|
|
||||||
memset(&inaddr, 0, sizeof(inaddr));
|
memset(&inaddr, 0, sizeof(inaddr));
|
||||||
inaddr.sin_family = AF_INET;
|
inaddr.sin_family = AF_INET;
|
||||||
inaddr.sin_addr.s_addr = INADDR_ANY;
|
inaddr.sin_addr.s_addr = INADDR_ANY;
|
||||||
@ -238,7 +239,6 @@ static int mca_ptl_tcp_module_create_listen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* resolve system assignend port */
|
/* resolve system assignend port */
|
||||||
lam_socklen_t addrlen = sizeof(struct sockaddr_in);
|
|
||||||
if(getsockname(mca_ptl_tcp_module.tcp_listen_sd, (struct sockaddr*)&inaddr, &addrlen) < 0) {
|
if(getsockname(mca_ptl_tcp_module.tcp_listen_sd, (struct sockaddr*)&inaddr, &addrlen) < 0) {
|
||||||
lam_output(0, "mca_ptl_tcp_module_init: getsockname() failed with errno=%d", errno);
|
lam_output(0, "mca_ptl_tcp_module_init: getsockname() failed with errno=%d", errno);
|
||||||
return LAM_ERROR;
|
return LAM_ERROR;
|
||||||
@ -281,7 +281,7 @@ static int mca_ptl_tcp_module_create_listen(void)
|
|||||||
|
|
||||||
static int mca_ptl_tcp_module_exchange(void)
|
static int mca_ptl_tcp_module_exchange(void)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i, rc;
|
||||||
size_t size = mca_ptl_tcp_module.tcp_num_ptls * sizeof(mca_ptl_tcp_addr_t);
|
size_t size = mca_ptl_tcp_module.tcp_num_ptls * sizeof(mca_ptl_tcp_addr_t);
|
||||||
mca_ptl_tcp_addr_t *addrs = malloc(size);
|
mca_ptl_tcp_addr_t *addrs = malloc(size);
|
||||||
for(i=0; i<mca_ptl_tcp_module.tcp_num_ptls; i++) {
|
for(i=0; i<mca_ptl_tcp_module.tcp_num_ptls; i++) {
|
||||||
@ -290,7 +290,7 @@ static int mca_ptl_tcp_module_exchange(void)
|
|||||||
addrs[i].addr_port = mca_ptl_tcp_module.tcp_listen_port;
|
addrs[i].addr_port = mca_ptl_tcp_module.tcp_listen_port;
|
||||||
addrs[i].addr_inuse = 0;
|
addrs[i].addr_inuse = 0;
|
||||||
}
|
}
|
||||||
int rc = mca_base_modex_send(&mca_ptl_tcp_module.super.ptlm_version, addrs, size);
|
rc = mca_base_modex_send(&mca_ptl_tcp_module.super.ptlm_version, addrs, size);
|
||||||
free(addrs);
|
free(addrs);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -389,6 +389,7 @@ static void mca_ptl_tcp_module_accept(void)
|
|||||||
lam_socklen_t addrlen = sizeof(struct sockaddr_in);
|
lam_socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
int sd = accept(mca_ptl_tcp_module.tcp_listen_sd, (struct sockaddr*)&addr, &addrlen);
|
int sd = accept(mca_ptl_tcp_module.tcp_listen_sd, (struct sockaddr*)&addr, &addrlen);
|
||||||
|
lam_event_t* event;
|
||||||
if(sd < 0) {
|
if(sd < 0) {
|
||||||
if(errno == EINTR)
|
if(errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
@ -398,7 +399,7 @@ static void mca_ptl_tcp_module_accept(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* wait for receipt of peers process identifier to complete this connection */
|
/* wait for receipt of peers process identifier to complete this connection */
|
||||||
lam_event_t* event = malloc(sizeof(lam_event_t));
|
event = malloc(sizeof(lam_event_t));
|
||||||
lam_event_set(event, sd, LAM_EV_READ|LAM_EV_PERSIST, mca_ptl_tcp_module_recv_handler, event);
|
lam_event_set(event, sd, LAM_EV_READ|LAM_EV_PERSIST, mca_ptl_tcp_module_recv_handler, event);
|
||||||
lam_event_add(event, 0);
|
lam_event_add(event, 0);
|
||||||
}
|
}
|
||||||
@ -415,6 +416,8 @@ static void mca_ptl_tcp_module_recv_handler(int sd, short flags, void* user)
|
|||||||
uint32_t size;
|
uint32_t size;
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
lam_socklen_t addr_len = sizeof(addr);
|
lam_socklen_t addr_len = sizeof(addr);
|
||||||
|
int retval;
|
||||||
|
mca_ptl_tcp_proc_t* ptl_proc;
|
||||||
|
|
||||||
/* accept new connections on the listen socket */
|
/* accept new connections on the listen socket */
|
||||||
if(mca_ptl_tcp_module.tcp_listen_sd == sd) {
|
if(mca_ptl_tcp_module.tcp_listen_sd == sd) {
|
||||||
@ -425,7 +428,7 @@ static void mca_ptl_tcp_module_recv_handler(int sd, short flags, void* user)
|
|||||||
free(user);
|
free(user);
|
||||||
|
|
||||||
/* recv the size of the process identifier */
|
/* recv the size of the process identifier */
|
||||||
int retval = recv(sd, &size, sizeof(size), 0);
|
retval = recv(sd, &size, sizeof(size), 0);
|
||||||
if(retval == 0) {
|
if(retval == 0) {
|
||||||
close(sd);
|
close(sd);
|
||||||
return;
|
return;
|
||||||
@ -453,7 +456,7 @@ static void mca_ptl_tcp_module_recv_handler(int sd, short flags, void* user)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* lookup the corresponding process */
|
/* lookup the corresponding process */
|
||||||
mca_ptl_tcp_proc_t* ptl_proc = mca_ptl_tcp_proc_lookup(guid, size);
|
ptl_proc = mca_ptl_tcp_proc_lookup(guid, size);
|
||||||
if(NULL == ptl_proc) {
|
if(NULL == ptl_proc) {
|
||||||
lam_output(0, "mca_ptl_tcp_module_recv_handler: unable to locate process");
|
lam_output(0, "mca_ptl_tcp_module_recv_handler: unable to locate process");
|
||||||
close(sd);
|
close(sd);
|
||||||
|
@ -332,6 +332,8 @@ static int mca_ptl_tcp_peer_recv_connect_ack(mca_ptl_base_peer_t* ptl_peer)
|
|||||||
static int mca_ptl_tcp_peer_start_connect(mca_ptl_base_peer_t* ptl_peer)
|
static int mca_ptl_tcp_peer_start_connect(mca_ptl_base_peer_t* ptl_peer)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
int flags;
|
||||||
|
struct sockaddr_in peer_addr;
|
||||||
ptl_peer->peer_sd = socket(AF_INET, SOCK_STREAM, 0);
|
ptl_peer->peer_sd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
if (ptl_peer->peer_sd < 0) {
|
if (ptl_peer->peer_sd < 0) {
|
||||||
ptl_peer->peer_retries++;
|
ptl_peer->peer_retries++;
|
||||||
@ -342,7 +344,6 @@ static int mca_ptl_tcp_peer_start_connect(mca_ptl_base_peer_t* ptl_peer)
|
|||||||
mca_ptl_tcp_peer_event_init(ptl_peer, ptl_peer->peer_sd);
|
mca_ptl_tcp_peer_event_init(ptl_peer, ptl_peer->peer_sd);
|
||||||
|
|
||||||
/* setup the socket as non-blocking */
|
/* setup the socket as non-blocking */
|
||||||
int flags;
|
|
||||||
if((flags = fcntl(ptl_peer->peer_sd, F_GETFL, 0)) < 0) {
|
if((flags = fcntl(ptl_peer->peer_sd, F_GETFL, 0)) < 0) {
|
||||||
lam_output(0, "mca_ptl_tcp_peer_connect: fcntl(F_GETFL) failed with errno=%d\n", errno);
|
lam_output(0, "mca_ptl_tcp_peer_connect: fcntl(F_GETFL) failed with errno=%d\n", errno);
|
||||||
} else {
|
} else {
|
||||||
@ -352,7 +353,6 @@ static int mca_ptl_tcp_peer_start_connect(mca_ptl_base_peer_t* ptl_peer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* start the connect - will likely fail with EINPROGRESS */
|
/* start the connect - will likely fail with EINPROGRESS */
|
||||||
struct sockaddr_in peer_addr;
|
|
||||||
peer_addr.sin_family = AF_INET;
|
peer_addr.sin_family = AF_INET;
|
||||||
peer_addr.sin_addr = ptl_peer->peer_addr->addr_inet;
|
peer_addr.sin_addr = ptl_peer->peer_addr->addr_inet;
|
||||||
peer_addr.sin_port = ptl_peer->peer_addr->addr_port;
|
peer_addr.sin_port = ptl_peer->peer_addr->addr_port;
|
||||||
|
@ -109,7 +109,7 @@ void mca_ptl_tcp_send_frag_init(
|
|||||||
bool mca_ptl_tcp_send_frag_handler(mca_ptl_tcp_send_frag_t* frag, int sd)
|
bool mca_ptl_tcp_send_frag_handler(mca_ptl_tcp_send_frag_t* frag, int sd)
|
||||||
{
|
{
|
||||||
int cnt=-1;
|
int cnt=-1;
|
||||||
size_t i;
|
size_t i, num_vecs;
|
||||||
|
|
||||||
/* non-blocking write, but continue if interrupted */
|
/* non-blocking write, but continue if interrupted */
|
||||||
while(cnt < 0) {
|
while(cnt < 0) {
|
||||||
@ -131,7 +131,7 @@ bool mca_ptl_tcp_send_frag_handler(mca_ptl_tcp_send_frag_t* frag, int sd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if the write didn't complete - update the iovec state */
|
/* if the write didn't complete - update the iovec state */
|
||||||
size_t num_vecs = frag->frag_vec_cnt;
|
num_vecs = frag->frag_vec_cnt;
|
||||||
for(i=0; i<num_vecs; i++) {
|
for(i=0; i<num_vecs; i++) {
|
||||||
if(cnt >= (int)frag->frag_vec_ptr->iov_len) {
|
if(cnt >= (int)frag->frag_vec_ptr->iov_len) {
|
||||||
cnt -= frag->frag_vec_ptr->iov_len;
|
cnt -= frag->frag_vec_ptr->iov_len;
|
||||||
|
@ -389,6 +389,7 @@ void *lam_fmp_get_mem_segment(lam_fixed_mpool_t *pool,
|
|||||||
ssize_t len_to_alloc;
|
ssize_t len_to_alloc;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
lam_memseg_t *tmp_seg;
|
lam_memseg_t *tmp_seg;
|
||||||
|
void *tmp_ptr;
|
||||||
|
|
||||||
/* return if pool can't be used */
|
/* return if pool can't be used */
|
||||||
if ( !pool->fmp_pool_ok_to_use )
|
if ( !pool->fmp_pool_ok_to_use )
|
||||||
@ -481,7 +482,7 @@ void *lam_fmp_get_mem_segment(lam_fixed_mpool_t *pool,
|
|||||||
len_to_alloc = 4 * (length + alignment);
|
len_to_alloc = 4 * (length + alignment);
|
||||||
if (len_to_alloc < pool->fmp_min_alloc_size)
|
if (len_to_alloc < pool->fmp_min_alloc_size)
|
||||||
len_to_alloc = 2 * pool->fmp_min_alloc_size;
|
len_to_alloc = 2 * pool->fmp_min_alloc_size;
|
||||||
void *tmp_ptr =
|
tmp_ptr =
|
||||||
lam_zero_alloc(len_to_alloc, MMAP_SHARED_PROT, MMAP_SHARED_FLAGS);
|
lam_zero_alloc(len_to_alloc, MMAP_SHARED_PROT, MMAP_SHARED_FLAGS);
|
||||||
if ( !tmp_ptr )
|
if ( !tmp_ptr )
|
||||||
{
|
{
|
||||||
|
@ -45,16 +45,16 @@ static lam_list_t lam_if_list;
|
|||||||
|
|
||||||
static int lam_ifinit(void)
|
static int lam_ifinit(void)
|
||||||
{
|
{
|
||||||
if (lam_list_get_size(&lam_if_list) > 0)
|
|
||||||
return LAM_SUCCESS;
|
|
||||||
|
|
||||||
char buff[1024];
|
char buff[1024];
|
||||||
char *ptr;
|
char *ptr;
|
||||||
struct ifconf ifconf;
|
struct ifconf ifconf;
|
||||||
|
int sd;
|
||||||
ifconf.ifc_len = sizeof(buff);
|
ifconf.ifc_len = sizeof(buff);
|
||||||
ifconf.ifc_buf = buff;
|
ifconf.ifc_buf = buff;
|
||||||
|
|
||||||
int sd;
|
if (lam_list_get_size(&lam_if_list) > 0)
|
||||||
|
return LAM_SUCCESS;
|
||||||
|
|
||||||
if((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
if((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||||
lam_output(0, "lam_ifinit: socket() failed with errno=%d\n", errno);
|
lam_output(0, "lam_ifinit: socket() failed with errno=%d\n", errno);
|
||||||
return LAM_ERROR;
|
return LAM_ERROR;
|
||||||
@ -201,11 +201,11 @@ int lam_ifnametoindex(const char* if_name)
|
|||||||
int lam_ifaddrtoname(const char* if_addr, char* if_name, int length)
|
int lam_ifaddrtoname(const char* if_addr, char* if_name, int length)
|
||||||
{
|
{
|
||||||
lam_if_t* intf;
|
lam_if_t* intf;
|
||||||
|
in_addr_t inaddr = inet_addr(if_addr);
|
||||||
int rc = lam_ifinit();
|
int rc = lam_ifinit();
|
||||||
if(rc != LAM_SUCCESS)
|
if(rc != LAM_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
in_addr_t inaddr = inet_addr(if_addr);
|
|
||||||
if(inaddr == INADDR_ANY) {
|
if(inaddr == INADDR_ANY) {
|
||||||
struct hostent *h = gethostbyname(if_addr);
|
struct hostent *h = gethostbyname(if_addr);
|
||||||
if(h == 0) {
|
if(h == 0) {
|
||||||
@ -245,9 +245,10 @@ int lam_ifcount()
|
|||||||
|
|
||||||
int lam_ifbegin()
|
int lam_ifbegin()
|
||||||
{
|
{
|
||||||
|
lam_if_t *intf;
|
||||||
if(lam_ifinit() != LAM_SUCCESS)
|
if(lam_ifinit() != LAM_SUCCESS)
|
||||||
return (-1);
|
return (-1);
|
||||||
lam_if_t *intf = (lam_if_t*)lam_list_get_first(&lam_if_list);
|
intf = (lam_if_t*)lam_list_get_first(&lam_if_list);
|
||||||
if(intf != 0)
|
if(intf != 0)
|
||||||
return intf->if_index;
|
return intf->if_index;
|
||||||
return (-1);
|
return (-1);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user