|
19 | 19 | * and Technology (RIST). All rights reserved.
|
20 | 20 | * Copyright (c) 2022 Triad National Security, LLC. All rights
|
21 | 21 | * reserved.
|
| 22 | + * Copyright (c) 2025 UT-Battelle, LLC. All rights reserved. |
22 | 23 | * $COPYRIGHT$
|
23 | 24 | *
|
24 | 25 | * Additional copyrights may follow
|
@@ -419,6 +420,90 @@ int ompi_mpi_errnum_add_string(int errnum, const char *errstring, int len)
|
419 | 420 | return OMPI_SUCCESS;
|
420 | 421 | }
|
421 | 422 |
|
| 423 | +int ompi_mpi_errcode_remove(int errnum) |
| 424 | +{ |
| 425 | + int ret = OMPI_ERROR; |
| 426 | + ompi_mpi_errcode_t *errcodep = NULL; |
| 427 | + |
| 428 | + opal_mutex_lock(&errcode_lock); |
| 429 | + |
| 430 | + errcodep = (ompi_mpi_errcode_t *)opal_pointer_array_get_item(&ompi_mpi_errcodes, errnum); |
| 431 | + if ( NULL == errcodep ) { |
| 432 | + opal_mutex_unlock(&errcode_lock); |
| 433 | + return OMPI_ERROR; |
| 434 | + } |
| 435 | + |
| 436 | + /* Must have already removed estring before remove error code */ |
| 437 | + if (errcodep->errstring[0] == '\0') { |
| 438 | + if (MPI_UNDEFINED != errcodep->code) { |
| 439 | + ret = opal_pointer_array_set_item(&ompi_mpi_errcodes, errnum, NULL); |
| 440 | + if (OPAL_SUCCESS == ret) { |
| 441 | + if (errnum == ompi_mpi_errcode_lastused) { |
| 442 | + ompi_mpi_errcode_lastused--; |
| 443 | + } |
| 444 | + } |
| 445 | + } |
| 446 | + } |
| 447 | + |
| 448 | + opal_mutex_unlock(&errcode_lock); |
| 449 | + |
| 450 | + return ret; |
| 451 | +} |
| 452 | + |
| 453 | +int ompi_mpi_errclass_remove(int errclass) |
| 454 | +{ |
| 455 | + int ret = OMPI_ERROR; |
| 456 | + ompi_mpi_errcode_t *errcodep = NULL; |
| 457 | + |
| 458 | + opal_mutex_lock(&errcode_lock); |
| 459 | + |
| 460 | + errcodep = (ompi_mpi_errcode_t *)opal_pointer_array_get_item(&ompi_mpi_errcodes, errclass); |
| 461 | + if ( NULL == errcodep ) { |
| 462 | + opal_mutex_unlock(&errcode_lock); |
| 463 | + return OMPI_ERROR; |
| 464 | + } |
| 465 | + |
| 466 | + /* Must have already removed estring before remove error class */ |
| 467 | + if (errcodep->errstring[0] == '\0') { |
| 468 | + /* Must have already removed ecode before remove error class */ |
| 469 | + if (MPI_UNDEFINED == errcodep->code) { |
| 470 | + if (MPI_UNDEFINED != errcodep->cls) { |
| 471 | + ret = opal_pointer_array_set_item(&ompi_mpi_errcodes, errcodep->cls, NULL); |
| 472 | + if (OPAL_SUCCESS == ret) { |
| 473 | + if (errclass == ompi_mpi_errcode_lastused) { |
| 474 | + ompi_mpi_errcode_lastused--; |
| 475 | + } |
| 476 | + } |
| 477 | + } |
| 478 | + } |
| 479 | + } |
| 480 | + |
| 481 | + opal_mutex_unlock(&errcode_lock); |
| 482 | + |
| 483 | + return ret; |
| 484 | +} |
| 485 | + |
| 486 | +int ompi_mpi_errnum_remove_string(int errnum) |
| 487 | +{ |
| 488 | + ompi_mpi_errcode_t *errcodep = NULL; |
| 489 | + |
| 490 | + opal_mutex_lock(&errcode_lock); |
| 491 | + |
| 492 | + errcodep = (ompi_mpi_errcode_t *)opal_pointer_array_get_item(&ompi_mpi_errcodes, errnum); |
| 493 | + if ( NULL == errcodep ) { |
| 494 | + opal_mutex_unlock(&errcode_lock); |
| 495 | + return OMPI_ERROR; |
| 496 | + } |
| 497 | + |
| 498 | + if (errcodep->errstring[0] != '\0') { |
| 499 | + memset ( errcodep->errstring, 0, MPI_MAX_ERROR_STRING); |
| 500 | + } |
| 501 | + |
| 502 | + opal_mutex_unlock(&errcode_lock); |
| 503 | + |
| 504 | + return OMPI_SUCCESS; |
| 505 | +} |
| 506 | + |
422 | 507 | static void ompi_mpi_errcode_construct(ompi_mpi_errcode_t *errcode)
|
423 | 508 | {
|
424 | 509 | errcode->code = MPI_UNDEFINED;
|
|
0 commit comments