Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated support for Green Hills INTEGRITY and INTEGRITY-178 RTOS #2340

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

sonndinh
Copy link
Contributor

@sonndinh sonndinh commented Feb 28, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a new reactor option for more efficient and flexible event handling.
    • Expanded compatibility with INTEGRITY platforms, including enhancements for INTEGRITY-178B environments.
  • Bug Fixes

    • Improved error handling in data processing and system operations to enhance stability.
  • Refactor/Chores

    • Streamlined platform-specific configurations and updated development ignore patterns to optimize performance.

Copy link
Contributor

coderabbitai bot commented Feb 28, 2025

Walkthrough

The changes span multiple subsystems. The updates include additions to the .gitignore file, modifications to ACE’s CDR classes to support std::string_view, and numerous enhancements to OS, threading, signal, socket, and file I/O functions using extensive conditional compilation. INTEGRITY/INTEGRITY178B‐specific adjustments have been added in several ACE modules and configuration files. A new reactor implementation, the ACE_Single_Input_Reactor, was introduced and integrated into TAO’s resource factory. Minor test adjustments and documentation refinements were also applied.

Changes

File(s) Change Summary
.gitignore Added new file patterns (*.gpj, *.int, *.cmd, *.custom_build_rule, *.empty_html_file) and directories (.vs/, Static_Release/, Static_Debug/).
ACE/ace/CDR_* (e.g., CDR_Size.h, CDR_Size.inl, CDR_Stream.cpp, CDR_Stream.h, CDR_Stream.inl) Introduced std::string_view support and updated operator overloads to improve string handling.
ACE/ace/Asynch_Pseudo_Task.cpp, ACE/ace/Flag_Manip.cpp, ACE/ace/Malloc_Base.h, ACE/ace/OS_* (e.g., OS_NS_Thread.*, OS_NS_arpa_inet.*, OS_NS_dirent.inl, OS_NS_signal.inl, OS_NS_sys_*, OS_NS_unistd.inl, etc.) Enhanced error handling, added namespace-qualified calls, and applied conditional compilation for platform-specific behaviors (notably for INTEGRITY, INTEGRITY178B, and related environments) across threading, signals, sockets, file I/O, and time functions.
ACE/ace/Object_Manager.cpp, ACE/ace/Object_Manager.h
ACE/ace/config-integrity*.h, ACE/ace/config-macros.h, ACE/ace/os_include/*
Introduced and conditionally preallocated ACE_INTEGRITY_TSS_Impl, updated type definitions and config macros for improved INTEGRITY platform support.
ACE/ace/Single_Input_Reactor.*
TAO/tao/Strategies/advanced_resource.*
TAO/tao/default_resource.cpp
Added a new reactor component (ACE_Single_Input_Reactor) with comprehensive event, timer, and notification handling; integrated new reactor type (TAO_REACTOR_SINGLE_INPUT) into TAO’s resource factory and reactor instance management.
ACE/tests/*, ACE/ace/Task.cpp, TAO/tao/IIOP_Acceptor.cpp Minor updates including header inclusion adjustments, thread count changes in tests, and comment fixes.

Sequence Diagram(s)

sequenceDiagram
    participant Factory as TAO Resource Factory
    participant Reactor as ACE_Single_Input_Reactor
    participant ACE_Reactor as ACE_Reactor Singleton
    Factory->>Reactor: Request allocation (TAO_REACTOR_SINGLE_INPUT)
    Reactor-->>Factory: Reactor instance created
    Reactor->>ACE_Reactor: Set as current reactor instance
    ACE_Reactor-->>Factory: Reactor registered and active
Loading

Poem

Oh, I’m but a tiny coder bunny,
Hopping through fields of updated code so sunny.
Changes in strings and signals dance in the light,
With reactors born new, making day from night.
INTEGRITY dreams and TAO’s delight—
In this garden of code, everything’s just right!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mitza-oci mitza-oci self-requested a review February 28, 2025 18:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (28)
ACE/ace/OS_NS_arpa_inet.cpp (1)

102-118: Added INTEGRITY-specific implementation of inet_ntoa

The implementation correctly converts an IPv4 address from network representation to a string. This implementation is needed to support systems where the standard function is missing.

Consider removing the commented-out debug printf statement on line 109 as it's not providing value in production code.

-  // printf("Socket address %X, IP address %X.\n",addr.s_addr,ipaddr);

Also, be aware that this implementation uses a static buffer which could cause issues in multi-threaded environments. If INTEGRITY uses this in multi-threaded contexts, consider using thread-local storage or requiring callers to provide their own buffer.

ACE/ace/OS_NS_sys_socket.inl (1)

949-949: Minor cleanup of preprocessor directive.

The removal of a comment from the #endif directive makes the code cleaner and more consistent with other preprocessor directives in the file.

ACE/ace/OS_NS_arpa_inet.inl (1)

12-45: Check range bounds in custom inet_addr implementation.

The loop correctly parses up to four IP segments, but does not verify that each segment ≤ 255. Larger values (e.g., 999) will be silently included in the final address, leading to incorrect IP resolution. Consider adding a validation step:

 while (*name >= '0' && *name <= '9')
 {
   segment *= 10;
   segment += *name++ - '0';
+  if (segment > 255) {
+    valid = 0;
+    break;
+  }
 }
ACE/ace/config-integrity.h (1)

62-62: Consider a more robust fileno implementation.

The fileno macro implementation is a hack (as noted in the comment) to get Svc_Conf_l.cpp compiled. While this works, consider a more robust solution for file descriptor handling in the future to reduce technical debt.

ACE/ace/Flag_Manip.cpp (3)

24-57: Encapsulated flag manipulation logic looks clean.
The introduction of set_flags_helper() and clr_flags_helper() in an unnamed namespace is a neat way to centralize and streamline flag updates. It improves maintainability by eliminating repeated fcntl calls throughout the code. However, consider adding minimal debug logging or error handling to provide actionable diagnostics for failure cases (e.g., when fcntl returns -1), especially in production builds.


80-106: Nested preprocessor conditions may reduce readability.
Although this block correctly handles multiple edge cases (e.g., ACE_LACKS_IOCTL vs. fallback to ioctl), the nested #if and switch statements can become hard to follow as the codebase grows. Consider refactoring or documenting the logic more clearly, possibly by extracting platform-specific code into separate functions.


130-157: Ensure robust error handling for I/O calls.
Like the set-flags case, the clr_flags logic is heavily guarded by #if directives. The approach is valid, but if posix_devctl or ioctl fail, the code returns the result without further commentary. You might consider logging or capturing errno to facilitate debugging in production or test environments.

ACE/ace/config-integrity178.h (1)

117-123: Thread-specific storage emulation.
Defining ACE_HAS_TSS_EMULATION for INTEGRITY-178B is appropriate given the lack of direct TSS APIs. Keep in mind that TSS emulation may introduce additional overhead. If performance becomes a concern, investigate alternative concurrency patterns or OS-level hooks if Green Hills provides them for the 178B environment.

ACE/ace/config-integritySCA.h (2)

25-34: Commented-out macros for user/group operations.
Leaving these macros commented out (e.g., ACE_LACKS_SETEGID, ACE_LACKS_SETEUID) might cause confusion unless documented. Clarify whether developers should uncomment them if an older integrity environment truly lacks these features, or remove them entirely to avoid stale code.


92-101: Wide character function omissions.
Macros like ACE_LACKS_WCSICMP, ACE_LACKS_WCSNICMP, and ACE_LACKS_WCSDUP are common in embedded or specialized RTOS setups. If applications require wide-char functionality, consider providing stubs or alternative implementations to gracefully handle references to these functions.

ACE/ace/OS_NS_Thread.h (2)

43-48: Remove unused <map> include.
It appears <map> is no longer needed since you've opted for a static array implementation for TSS. Removing it can reduce clutter and potential confusion.

 # if defined (INTEGRITY)
 #   include "ace/Log_Msg.h"

-#   include <map>

 # endif

290-367: Minor comment grammatical fix & future expansion.

  1. Update the comment “already insert this entry” to “already inserted this entry.”
  2. If you need to support more than ACE_DEFAULT_THREADS tasks or a dynamic approach, consider using ACE’s map or a custom structure and remove the TODO in the comments.

Proposed comment fix:

-                // Earlier call has already insert this entry.
+                // An earlier call has already inserted this entry.
ACE/ace/OS_NS_Thread.cpp (2)

1567-1573: INTEGRITY-specific branch for cond_timedwait.
Currently returns ACE_NOTSUP_RETURN(-1), indicating no implementation. If you plan to support timed waits later, consider providing at least partial functionality.

If you need help implementing a partial emulation using available INTEGRITY calls, let us know.


3300-3442: New INTEGRITY namespace block for TSS workaround.
This sizable insertion for INTEGRITY/INTEGRITY-178B manages TSS via a global map and custom adapters. The strategy looks reasonable, but be sure to stress-test concurrency scenarios and memory usage.

Consider adding unit tests specifically covering corner cases such as repeated TSS sets and cross-thread resource cleanup.

ACE/ace/OS_NS_Thread.inl (8)

1445-1450: Consolidate 'not supported' code.

Under INTEGRITY, returning ACE_NOTSUP_RETURN(-1) for sema_destroy() is reasonable for now. If full semaphore cleanup becomes a requirement, consider implementing or simulating the missing operation rather than leaving it permanently unsupported.


2067-2082: Implement wait with concurrency safety.

Here, the code for INTEGRITY178B manually checks for underflow and returns -1 if the semaphore is at its limit. Please verify that race conditions where multiple tasks attempt to wait simultaneously are accounted for, and consider whether further synchronization or error handling is needed.


2281-2286: Timeout-based semaphore wait not supported.

Returning ACE_NOTSUP_RETURN(-1) indicates no timeout support for INTEGRITY in sema_wait(). If the design requires timed waits in the future, plan to integrate the appropriate OS-level calls or a custom workaround.


2401-2403: Check for partial SIG support.

This code for sigwait() on INTEGRITY is stubbed out with ACE_NOTSUP_RETURN(-1). If signals are necessary, consider emulating the behavior or gracefully ignoring them to avoid unexpected runtime issues.


2755-2757: Confirm thr_kill equivalence.

Using ::ExitTask(thr_id, (Value)signum) to emulate thr_kill is effectively forcing thread termination. Confirm that forced exit fits your cleanup model and doesn’t bypass destructors or resource deallocation, especially if signals were originally used for graceful interruption.


3210-3211: Assess yield correctness.

Replacing thr_yield() with ::Yield() can change scheduling behavior. Confirm that this implementation meets your fairness or real-time requirements, as some OS-level yields may be no-ops or exhibit unexpected side effects.


3266-3270: Thread mutex init stub.

The code ignores attributes such as lock_type, name, or extended parameters. If external components rely on specialized mutex attributes, consider implementing them for more fine-grained synchronization control.


3312-3316: Add extended mutex attribute support if needed.

Similar to the previous stub, this code discards the lock attributes. If advanced concurrency or debugging features become essential, revisit this area for a more comprehensive initialization approach.

ACE/ace/Single_Input_Reactor.cpp (4)

12-16: Prefer explicit boolean.

initialized() returns 1, although the return type is effectively boolean. Consider returning true to avoid confusion and to make the intent clearer.


17-20: Clarify meaning of size.

size() returns 1 if an event handler is set, otherwise 0. For readability, consider returning a strictly unsigned integer (0 or 1), or rename the method to reflect that it indicates presence or absence of a handler. If future expansions allow more handlers, refactor accordingly.


37-44: Check error indications from handle_input.

When invoking handler->handle_input(), the return code can signal closure or errors. Evaluate whether you need to handle such indications (e.g., removing the handler if it requests shutdown).


46-50: Assess concurrency with Null_Mutex.

Returning a lock adapter around ACE_Null_Mutex means no real synchronization. Confirm that no parallel threads will concurrently call methods that could interfere with each other or disrupt reactor state.

ACE/ace/Single_Input_Reactor.h (2)

1-12: Expand documentation on limitations.

The top comment clarifies the single-input nature but may not fully describe other constraints like lack of notification or timeout handling. Document these limitations thoroughly so that users don’t accidentally rely on unsupported features.


164-166: Potential future extensions.

Currently, only one ACE_Event_Handler_var is stored. If your use case evolves to handle multiple input sources or more complex logic, this approach must be revisited to avoid significant refactoring later.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6baf9ab and 4688527.

📒 Files selected for processing (45)
  • .gitignore (2 hunks)
  • ACE/ace/ACE.inl (2 hunks)
  • ACE/ace/Asynch_Pseudo_Task.cpp (1 hunks)
  • ACE/ace/CDR_Size.h (2 hunks)
  • ACE/ace/CDR_Size.inl (3 hunks)
  • ACE/ace/CDR_Stream.cpp (3 hunks)
  • ACE/ace/CDR_Stream.h (3 hunks)
  • ACE/ace/CDR_Stream.inl (3 hunks)
  • ACE/ace/Flag_Manip.cpp (2 hunks)
  • ACE/ace/Malloc_Base.h (1 hunks)
  • ACE/ace/OS_NS_Thread.cpp (19 hunks)
  • ACE/ace/OS_NS_Thread.h (3 hunks)
  • ACE/ace/OS_NS_Thread.inl (23 hunks)
  • ACE/ace/OS_NS_arpa_inet.cpp (1 hunks)
  • ACE/ace/OS_NS_arpa_inet.inl (2 hunks)
  • ACE/ace/OS_NS_dirent.inl (3 hunks)
  • ACE/ace/OS_NS_fcntl.cpp (1 hunks)
  • ACE/ace/OS_NS_signal.inl (6 hunks)
  • ACE/ace/OS_NS_stdlib.cpp (2 hunks)
  • ACE/ace/OS_NS_sys_select.inl (1 hunks)
  • ACE/ace/OS_NS_sys_socket.inl (3 hunks)
  • ACE/ace/OS_NS_sys_stat.inl (4 hunks)
  • ACE/ace/OS_NS_sys_utsname.cpp (1 hunks)
  • ACE/ace/OS_NS_time.h (1 hunks)
  • ACE/ace/OS_NS_unistd.inl (11 hunks)
  • ACE/ace/Object_Manager.cpp (1 hunks)
  • ACE/ace/Object_Manager.h (2 hunks)
  • ACE/ace/Service_Config.cpp (1 hunks)
  • ACE/ace/Single_Input_Reactor.cpp (1 hunks)
  • ACE/ace/Single_Input_Reactor.h (1 hunks)
  • ACE/ace/Task.cpp (1 hunks)
  • ACE/ace/ace.mpc (1 hunks)
  • ACE/ace/config-integrity-common.h (1 hunks)
  • ACE/ace/config-integrity.h (1 hunks)
  • ACE/ace/config-integrity178.h (1 hunks)
  • ACE/ace/config-integritySCA.h (7 hunks)
  • ACE/ace/config-macros.h (2 hunks)
  • ACE/ace/os_include/os_fcntl.h (1 hunks)
  • ACE/ace/os_include/sys/os_types.h (1 hunks)
  • ACE/tests/Dynamic_Priority_Test.cpp (1 hunks)
  • ACE/tests/Task_Test.cpp (1 hunks)
  • TAO/tao/IIOP_Acceptor.cpp (1 hunks)
  • TAO/tao/Strategies/advanced_resource.cpp (3 hunks)
  • TAO/tao/Strategies/advanced_resource.h (1 hunks)
  • TAO/tao/default_resource.cpp (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • TAO/tao/IIOP_Acceptor.cpp
  • ACE/ace/Task.cpp
  • ACE/ace/OS_NS_sys_select.inl
🧰 Additional context used
🪛 Cppcheck (2.10-2)
ACE/ace/Single_Input_Reactor.cpp

[error] 21-21: There is an unknown macro here somewhere. Configuration is required. If ACE_BEGIN_VERSIONED_NAMESPACE_DECL is a macro then please configure it.

(unknownMacro)

⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
  • GitHub Check: ubuntu-20.04 clang++-11
  • GitHub Check: ubuntu-20.04 clang++-10
  • GitHub Check: VS2022Release64
  • GitHub Check: VS2022Debug64
  • GitHub Check: VS2022WChar
  • GitHub Check: VS2019Debug64Cxx20
  • GitHub Check: VS2019Debug64Cxx17
  • GitHub Check: VS2019Release32
  • GitHub Check: VS2019Debug32
  • GitHub Check: VS2019Release64
  • GitHub Check: VS2019Debug64
  • GitHub Check: macos-14-C++
  • GitHub Check: windows-2019 vs2019
  • GitHub Check: VS2019WChar
  • GitHub Check: MINGW64-gcc
  • GitHub Check: alpine-3.18
  • GitHub Check: ubuntu-20.04 g++-10
  • GitHub Check: macos-13-C++
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (99)
ACE/ace/ace.mpc (1)

220-220: Looks good: New Single_Input_Reactor source added correctly

The addition of Single_Input_Reactor.cpp to the source files list is properly placed in alphabetical order within the file list, maintaining the project's organization.

ACE/tests/Task_Test.cpp (1)

125-125: Fixed thread count is more appropriate for cross-platform testing

Changing from ACE_MAX_THREADS to a fixed value of 3 is a good approach for consistent testing across different platforms, especially when adding support for RTOS environments where thread resources might be more constrained.

.gitignore (2)

20-24: Appropriate additions for INTEGRITY environment files

These new file patterns (*.gpj, *.int, *.cmd, etc.) appear to be specific to the Green Hills INTEGRITY development environment and should be ignored in version control.


40-42: Build directories properly added to ignore list

Adding these Visual Studio and static build directories ensures that build artifacts don't get accidentally committed to the repository.

ACE/ace/os_include/os_fcntl.h (1)

102-103: Platform-specific nonblock definition for INTEGRITY178B

This addition correctly handles the INTEGRITY178B-specific case for non-blocking operations by defining ACE_NONBLOCK as 1, which is essential for proper I/O operations on this platform.

ACE/ace/ACE.inl (2)

219-223: Added Green Hills INTEGRITY support to socket operations.

The change adds the __ghs__ macro check alongside existing ACE_WIN32 and ACE_MQX macros to use ACE_OS::send instead of ACE_OS::write for Green Hills INTEGRITY RTOS. This properly extends the platform-specific I/O abstraction while maintaining backward compatibility.


229-233: Added Green Hills INTEGRITY support to socket operations.

Similar to the send operation, this change adds the __ghs__ macro check to use ACE_OS::recv instead of ACE_OS::read for Green Hills INTEGRITY RTOS. The implementation correctly maintains platform-specific socket behavior.

ACE/ace/os_include/sys/os_types.h (1)

66-67: Added INTEGRITY support for large file offset type.

The change adds INTEGRITY to the platforms where ACE_LOFF_T is defined as long long. This ensures consistent large file offset handling across different RTOS platforms.

ACE/tests/Dynamic_Priority_Test.cpp (1)

50-52: Added INTEGRITY support to test header inclusion.

The change extends the conditional inclusion of ace/OS_NS_string.h to include cases where the INTEGRITY macro is defined, similar to the existing support for VXWORKS. This appropriately maintains consistent behavior for string operations across different RTOSes.

ACE/ace/Malloc_Base.h (1)

189-191:

✅ Verification successful

Added conditional exception handling for Green Hills environment.

The change wraps the std::bad_alloc exception in a conditional check for ACE_NO_GHS_EXCEPT, allowing memory allocation failures to be handled differently when necessary for Green Hills INTEGRITY RTOS, which may have different exception handling requirements.

Run the following to check for similar exception handling patterns:


🏁 Script executed:

#!/bin/bash
# Check for similar exception handling patterns in the codebase
echo "Looking for similar exception handling patterns..."
rg -A 3 "defined \(ACE_NO_GHS_EXCEPT\)" --type cpp

Length of output: 1425


Conditional Exception Handling for Green Hills Environment Confirmed

The pattern in ACE/ace/Malloc_Base.h is consistent with similar exception handling found in ACE/ace/CDR_Stream.cpp. The check for !defined(ACE_NO_GHS_EXCEPT) properly guards the use of std::bad_alloc to accommodate the differences in Green Hills INTEGRITY RTOS exception handling. No further changes are necessary.

  • Location: ACE/ace/Malloc_Base.h (Lines 189-191)
  • Context: The code uses a conditional compilation directive to enable exception throwing for memory allocation failure only when ACE_NO_GHS_EXCEPT is not defined.
  • Consistency: Similar patterns are verified in ACE/ace/CDR_Stream.cpp.
ACE/ace/Asynch_Pseudo_Task.cpp (1)

52-54: Use ACE_OS namespace for signal functions - good change!

The change to use ACE_OS::sigemptyset and ACE_OS::sigaddset instead of direct system calls improves platform independence. This is consistent with ACE's design philosophy of providing abstraction layers for system calls, and particularly important for supporting INTEGRITY RTOS platforms.

TAO/tao/Strategies/advanced_resource.h (1)

68-68: Added new TAO_REACTOR_SINGLE_INPUT enum value

The addition of this new reactor type is appropriate for extending the reactor selection mechanism. This cleanly extends the enum without disrupting existing values, maintaining backward compatibility.

Based on the PR objectives, this change appears to be part of adding Green Hills INTEGRITY support, likely by enabling a reactor implementation that works well on this platform.

ACE/ace/OS_NS_time.h (1)

130-135: Improved handling of potential difftime macro

This change improves platform compatibility by addressing cases where difftime might be defined as a macro, similar to how other time functions are handled in this file. The pattern matches other helper functions in the same file (ace_asctime_r_helper, etc.).

The change follows the established pattern in this file where potentially macro-defined time functions are used and then undefined to avoid naming conflicts, enhancing compatibility with the INTEGRITY platform.

ACE/ace/Object_Manager.cpp (1)

242-245: Appropriate INTEGRITY RTOS support added.

The added code correctly preallocates the ACE_INTEGRITY_TSS_Impl object for the INTEGRITY and INTEGRITY-178 RTOS platforms. The conditional compilation guards ensure this code only activates when necessary (INTEGRITY defined, TSS emulation enabled, and no thread-specific storage).

ACE/ace/OS_NS_dirent.inl (3)

25-27: Enhanced error handling for closedir on platforms lacking this functionality.

This addition properly handles the case where ACE_LACKS_CLOSEDIR is defined but none of the other platform-specific conditions are met, preventing compiler warnings about unused parameters.


44-46: Improved platform compatibility for opendir.

The added code enhances error handling when ACE_LACKS_OPENDIR is defined by marking the parameter as unused and returning the appropriate error indicator. This provides better support for platforms like INTEGRITY RTOS that may not support standard directory operations.


64-66: Consistent error handling for readdir function.

This change follows the same pattern as the other directory functions, adding proper error handling when ACE_LACKS_READDIR is defined. Marking the parameter as unused prevents compiler warnings, and returning ACE_NOTSUP_RETURN(0) correctly indicates the operation is not supported.

TAO/tao/default_resource.cpp (2)

794-794: Proper reactor instance management.

Setting the global reactor instance ensures that other parts of the system can access this reactor through ACE_Reactor::instance(). This is important for proper functioning in environments like INTEGRITY RTOS.


801-801: Clean reactor instance shutdown.

Setting the reactor instance to null during cleanup is crucial to avoid dangling pointers and ensure proper shutdown sequence. This change prevents potential issues when the application terminates on the INTEGRITY platform.

ACE/ace/Object_Manager.h (2)

43-45: Forward declaration for INTEGRITY TSS implementation.

This forward declaration is appropriately guarded by the same preprocessor conditions as the implementation in Object_Manager.cpp, ensuring consistency across the codebase for INTEGRITY RTOS support.


306-308: INTEGRITY TSS enum value added to Object_Manager.

Adding the ACE_INTEGRITY_TSS_IMPL enum value to the Preallocated_Object enumeration, with consistent preprocessor guards, correctly completes the integration of INTEGRITY TSS support in the object manager's preallocation system.

ACE/ace/CDR_Size.h (2)

82-84: Excellent addition of std::string_view support with proper conditional compilation.

The new write_string_view method is correctly guarded by the ACE_LACKS_STD_STRING_VIEW preprocessor directive, allowing the codebase to support std::string_view when available while maintaining backward compatibility with platforms that don't support it yet.


237-240: Well-implemented << operator overload for std::string_view.

This operator overload is consistently guarded with the same preprocessor directive as the method implementation, ensuring proper behavior across all platforms.

ACE/ace/OS_NS_stdlib.cpp (3)

1199-1206: Good platform-specific adaptation for INTEGRITY.

The implementation correctly handles the __progname variable differently for INTEGRITY platforms, making it a mutable pointer with const_cast<char *> rather than a const char*. The conditional compilation with nested checks for INTEGRITY and ACE_USES_GHS_ISIMPPC is appropriate.


1223-1227: Consistent INTEGRITY handling in setprogname_emulation.

The modification to use const_cast for INTEGRITY is consistent with the variable declaration change. This allows the INTEGRITY implementation to modify the program name when needed.


1229-1233: Consistent implementation for the else branch.

The modifications consistently apply the same pattern to both branches of the conditional, ensuring uniform behavior across different code paths.

ACE/ace/OS_NS_sys_socket.inl (1)

138-141: Good error handling for systems lacking socket close functionality.

This change adds proper error handling for platforms that lack the close function for sockets via the ACE_LACKS_CLOSE directive. The implementation correctly uses the ACE_UNUSED_ARG and ACE_NOTSUP_RETURN macros for consistent error reporting.

ACE/ace/CDR_Stream.cpp (3)

1710-1721: Good defensive programming with memory allocation

Adding exception handling here is a good practice to gracefully handle memory allocation failures when resizing the string. This makes the code more robust on platforms where exceptions are supported.


1770-1781: Consistent error handling for memory allocation

Good implementation of memory allocation error handling for wstring, matching the pattern used in the string handling implementation and maintaining consistency throughout the codebase.


1790-1801: Proper exception handling for the second wstring resize case

The exception handling is correctly implemented in this second case where the wstring is resized in a different code path. This ensures consistent behavior regardless of which branch the code follows.

ACE/ace/OS_NS_fcntl.cpp (2)

109-114: Clear handling for systems that lack open support

Good implementation for systems where open is not available. The code properly marks all arguments as unused and returns an appropriate error code.


116-119: Simplified file opening for INTEGRITY178B

The specialized handling for INTEGRITY178B provides a simpler and more direct path to the underlying open call, which is good for maintainability.

ACE/ace/Service_Config.cpp (1)

302-306: Simplified signal handling initialization

Removing the complex signal handler registration while keeping the reactor initialization is a good simplification. This reduces platform-specific code and potential issues with signal handling, which is particularly beneficial for the Green Hills INTEGRITY RTOS.

ACE/ace/OS_NS_sys_utsname.cpp (3)

217-225: Robust error handling for gethostname functionality

Good defensive programming by adding a check for systems that lack gethostname and validating the input parameter. These changes prevent potential crashes or undefined behavior.


226-232: Updated system identification for INTEGRITY-178B

Proper support for INTEGRITY-178B with specific version information. This enhances platform detection capabilities and provides accurate system information.


233-237: Updated version information for standard INTEGRITY

The version update for standard INTEGRITY ensures the system information remains current and accurate. Using a consistent approach for both INTEGRITY variations makes the code more maintainable.

ACE/ace/CDR_Stream.inl (2)

371-380: Well-implemented support for std::string_view

The addition of the write_string_view method properly handles string views by extracting the length and data pointer. The conditional compilation ensures backward compatibility with environments lacking std::string_view support.


399-406: Consistent implementation of operator<< for string_view

The operator overload follows the same pattern as the existing string operators, ensuring consistent behavior across different string types.

ACE/ace/CDR_Size.inl (2)

155-164: Good implementation of write_string_view for ACE_SizeCDR

The implementation correctly handles std::string_view by using its size() and data() methods, properly checking for empty views. Matches the implementation pattern used in ACE_OutputCDR.


413-420: Consistent operator<< overload for string_view

The operator implementation correctly delegates to the write_string_view method, maintaining the same pattern as other operator<< overloads in this class.

ACE/ace/config-integrity-common.h (1)

1-182: Comprehensive configuration for INTEGRITY RTOS

This new file provides a thorough set of configuration macros for the INTEGRITY operating system. The implementation includes:

  1. Detailed specification of missing features via ACE_LACKS_* macros
  2. Proper definition of available features via ACE_HAS_* macros
  3. Thread priority settings customized for INTEGRITY
  4. Appropriate header inclusions and type definitions

The conditional section for ACE_NO_GHS_LIBIO (lines 158-178) provides good flexibility for environments without the INTEGRITY-178 Low-Level I/O Library.

ACE/ace/config-macros.h (2)

523-523: Updated comment for INTEGRITY support

The comment now correctly references INTEGRITY instead of pSoS, consistent with the PR's objective of updating INTEGRITY RTOS support.


534-539: Added INTEGRITY-specific thread function return type

The implementation defines ACE_THR_FUNC_RETURN as int for INTEGRITY, with clear documentation explaining why this is needed. The comment explains how this is used by ACE's internal thread adapter function but ignored by the actual entry point passed to INTEGRITY's Task calls.

ACE/ace/CDR_Stream.h (3)

60-63: Provide tests for std::string_view inclusion.

Including <string_view> and conditionally compiling it under #if !defined(ACE_LACKS_STD_STRING_VIEW) is a good approach. To ensure robust integration, consider adding tests (perhaps in a dedicated test suite) that confirm this header is properly found and that all string-view related functionality compiles and runs in both supported and fallback scenarios.


291-293: Confirm correct usage and implementation of write_string_view.

The newly introduced write_string_view method is guarded by #if !defined (ACE_LACKS_STD_STRING_VIEW), which is consistent with the new conditional compilation approach. Ensure you have a corresponding definition and usage tests. It would be prudent to confirm no overlap or ambiguity arises with existing write methods for std::string.


1447-1450: Evaluate potential overload conflicts for operator<<(std::string_view).

Adding an operator<< for std::string_view is valuable for modern C++ usage. However, check for potential overload ambiguities if there's already an operator<< for std::string. Verify that calls with literals or other string-like types do not inadvertently resolve to the wrong overload.

ACE/ace/OS_NS_signal.inl (6)

73-74: Clarify INTEGRITY and ACE_LACKS_POSIX handling for sigaction.

The fallback path returns with ACE_NOTSUP_RETURN(-1) when both INTEGRITY and ACE_LACKS_POSIX are defined. This is consistent with a platform lacking complete POSIX signal APIs. If the macro detection has edge cases, consider documenting them more explicitly to avoid confusion.


88-93: Consistent fallback for ACE_LACKS_SIGADDSET.

Returning -1 with not supported is consistent. Just ensure that all callers handle the -1 return path gracefully, especially if signals are crucial for the calling logic.


114-118: Consistent fallback for ACE_LACKS_SIGDELSET.

Same pattern of skipping functionality and returning -1. Confirm that is the intended design and that no caller expects partial behavior.


139-142: Consistent fallback for ACE_LACKS_SIGEMPTYSET.

Again, returning -1 for unsupported. Ensure test coverage exists for these edge macros.


158-161: Consistent fallback for ACE_LACKS_SIGFILLSET.

Behavior matches the other signal-set macros. No immediate concerns; maintain a uniform approach throughout the codebase.


177-181: Consistent fallback for ACE_LACKS_SIGISMEMBER.

Returning -1 is consistent with the pattern. This completes the granularity of checking each individual signal-set function.

ACE/ace/OS_NS_arpa_inet.inl (1)

55-67: Validate coverage for inet_ntoa fallback case.

The conditional block #if !(defined (INTEGRITY) && defined (ACE_LACKS_INET_NTOA)) ensures standard inet_ntoa usage if available. Ensure that any custom fallback implementation in ACE/ace/OS_NS_arpa_inet.cpp is exercised by platform-specific tests, especially on INTEGRITY.

ACE/ace/OS_NS_unistd.inl (3)

1048-1050: Special case handling for INTEGRITY's sysconf implementation.

The addition of a specific INTEGRITY case for sysconf is a good improvement that returns a predefined page size rather than an error code, making the platform more usable.


957-967: Enhanced sleep() implementation for platforms lacking select.

Good enhancement to properly handle platforms where select() is not available by marking arguments as unused and returning the appropriate error code.

Also applies to: 969-977


112-115: Consistent error handling for unsupported operations.

The changes follow a consistent and robust pattern for handling unsupported operations across multiple functions (chdir, rmdir, close, ftruncate, getcwd, lseek, read, write). This approach properly marks unused arguments and returns appropriate error codes, improving platform compatibility.

Also applies to: 137-140, 172-174, 375-376, 387-390, 666-670, 717-721, 1192-1196

ACE/ace/config-integrity.h (3)

6-74: Well-structured configuration for INTEGRITY RTOS support.

This configuration file appropriately identifies POSIX limitations in the INTEGRITY environment and provides necessary workarounds. The comprehensive list of ACE_LACKS_* macros aligns with the error handling changes in implementation files, creating a cohesive approach to INTEGRITY support.


19-23: Intentional TSS emulation for compatibility with INTEGRITY-178.

Good design decision to use thread-specific storage emulation even though INTEGRITY supports TSS natively. The comment clearly explains this is for compatibility with INTEGRITY-178, which helps future maintainers understand this deliberate choice.


12-15: Effective workaround for UserException name conflict.

The ORBEXPRESS macro definition prevents header conflicts with INTEGRITY's UserException, showing attention to detail in handling integration challenges between the frameworks.

ACE/ace/OS_NS_sys_stat.inl (1)

22-25: Consistent error handling for unsupported file operations.

The changes follow the same robust pattern seen in other files, marking unused arguments and returning appropriate error codes for unsupported operations. This enhances platform compatibility while maintaining clean code that won't generate compiler warnings.

Also applies to: 68-69, 155-157, 203-204

TAO/tao/Strategies/advanced_resource.cpp (3)

28-28: Header inclusion for new reactor implementation.

The header inclusion for Single_Input_Reactor follows the same pattern as other reactor headers, maintaining consistency in the codebase.


200-201: Command-line option for the new Single_Input_Reactor.

The command-line argument handling for "single_input" follows the same pattern as other reactor types, ensuring consistency in how the application is configured.


479-481:

✅ Verification successful

Simple instantiation of the new reactor.

The instantiation of ACE_Single_Input_Reactor is notably simpler than other reactors, which take several arguments. Verify that this simpler instantiation is intentional and whether additional configuration parameters should be passed.


🏁 Script executed:

#!/bin/bash
# Check if ACE_Single_Input_Reactor constructor takes parameters
grep -A 10 "ACE_Single_Input_Reactor::" ACE/ace/Single_Input_Reactor.cpp | grep -E "ACE_Single_Input_Reactor\s*\("

Length of output: 114


I'll generate an additional verification script to search for the constructor definition of ACE_Single_Input_Reactor across both header and source files to ensure we capture any signature with parameters. This will help us confirm whether the simple instantiation is intentional.


🏁 Script executed:

#!/bin/bash
echo "Searching for the constructor definition in cpp files:"
grep -R "ACE_Single_Input_Reactor::ACE_Single_Input_Reactor(" -n .

echo "Searching for the class declaration in header files:"
grep -R "class ACE_Single_Input_Reactor" -n .

Length of output: 445


Verification Outcome: Minimal Instantiation Confirmed

After further investigation, the search for a parameterized constructor in both source and header files revealed that ACE_Single_Input_Reactor is declared in the header without any constructor signature indicating additional parameters. This suggests that its simple instantiation in advanced_resource.cpp is intentional. Ensure that any reactor-specific configuration that might be required is handled elsewhere (if applicable).

ACE/ace/Flag_Manip.cpp (2)

60-79: Conditional logic for non-blocking on GHS simulator is consistent.
When ACE_USES_GHS_ISIMPPC is defined, the code short-circuits for the ACE_NONBLOCK flag and otherwise delegates to the helper function when available. This approach is consistent with the simulator’s known limitations. The switch statement is concise and aligns with existing patterns in ACE for platform-specific overrides.


116-129: Consistent conditional handling for clearing flags.
Similar to the set_flags approach, returning 0 for ACE_NONBLOCK under ACE_USES_GHS_ISIMPPC keeps the simulator happy while other flags route to clr_flags_helper(). This maintains consistency across the code and prevents attempts to clear unsupported flags.

ACE/ace/config-integrity178.h (4)

1-19: Header guard and RTOS version macro introduced successfully.
Defining INTEGRITY178B and including config-integrity-common.h here is a suitable approach for distinguishing this specialized variant of INTEGRITY. Ensure all dependent build scripts and project files properly reference this new header to activate the correct macros.


23-73: Extensive POSIX omission macros.
By grouping many “LACKS” macros under #if defined ACE_LACKS_POSIX, you accurately communicate the features unavailable in INTEGRITY-178B. However, a large number of omitted calls may hide partially supported features. If partial support evolves, consider splitting these definitions or verifying them more granularly to reduce potential confusion down the road.


75-106: Selective network stack exclusion.
Under ACE_NO_GHNET178_LIBNET, you’re correctly disabling higher-level network utilities while retaining basic socket functions through libsocket.a. This helps keep the build minimal on resource-constrained RTOS targets. Ensure that any TAO or ACE features requiring these omitted utilities are conditionally excluded to avoid linker errors or unresolved symbols.


108-116: C++17 and POSIX feature macros.
Marking out ACE_LACKS_STD_STRING_VIEW aligns with the known limitations of this platform’s standard library. Double-check other C++17 capabilities like std::optional or std::filesystem if you plan on using them in the future, as they might also be missing.

ACE/ace/config-integritySCA.h (4)

3-16: Updated header guard and RTOS version reference.
Renaming the guard to ACE_CONFIG_INTEGRITYSCA_H and updating references to version 11.4.x clarifies the intended environment. This reduces confusion for users migrating from older ACE_INT_CONFIG_H references. The new comments effectively convey that POSIX APIs are available.


35-50: Exception and standard library features.
Enabling C++ exception support (ACE_HAS_EXCEPTIONS) and the standard library ensures broader compatibility with modern C++ patterns. Confirm that the GHS compiler for this INTEGRITY version also supports these exception features thoroughly, as partial exceptions can lead to unexpected behavior.


190-191: Namespace usage and RCSID toggling.
Defining ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB and disabling ACE_USE_RCSID is a standard housekeeping measure. There should not be any adverse effects, but verify that third-party code using RCS strings or relying on non-namespace calls is unaffected.


228-228: End of header guard.
Everything is properly closed out with #endif. No concerns here.

ACE/ace/OS_NS_Thread.h (3)

233-267: Definitions for INTEGRITY look consistent.
These type and macro definitions cleanly extend thread abstractions to INTEGRITY. The code is logically consistent, and using a counting semaphore initialized with 1 as a mutex aligns with other ACE patterns on platforms lacking dedicated mutex APIs.


268-273: Forward declarations are straightforward.
Forward declaring thread_mutex_lock and thread_mutex_unlock inside ACE_OS is clear. Please confirm that the definitions in the corresponding .cpp file match these signatures.


274-289: RAII LockGuard implementation is good.
This simple struct properly enforces a lock/unlock sequence. Consider adding error checking if thread_mutex_lock can fail, but if the environment guarantees success, this is fine.

ACE/ace/OS_NS_Thread.cpp (13)

204-210: Use of named mutex guard improves clarity.
The newly introduced guard variable clarifies the scope of the lock and makes the code more readable. No functional issues found.


215-220: Consistent naming for recursive mutex guard.
Same improvement as above: readability is enhanced with a named guard. Everything looks good.


256-260: Minor clarity improvement by naming the guard.
The change to a named ACE_OS_Recursive_Thread_Mutex_Guard instance is consistent with the preceding segments. No concerns noted.


273-277: No issues with guard instantiation.
Naming the guard here, too, seems consistent with the approach in the other TSS Emulation methods.


1154-1158: Adding INTEGRITY to the conditional block.
Extending the existing #if defined (ACE_VXWORKS) || defined (ACE_MQX) condition to include INTEGRITY looks correct. Ensures the same semaphore-based flow is used.


1178-1180: Condition variable destruction logic extended for INTEGRITY.
Including INTEGRITY in the #elif ensures proper handling in cond_destroy. The code is consistent with the other platforms.


1228-1230: INTEGRITY condition-object initialization check.
Similarly including INTEGRITY in the cond_init path for waiters_done_ respects the existing pattern for VxWorks and MQX.


1258-1260: Wide-char condition init now covers INTEGRITY.
This mirrors the logic in the non-wide version and is consistent with the approach for other platforms.


1925-1934: mutex_init: Introducing INTEGRITY branch.
The new branch for INTEGRITY is consistent with the existing pattern for VxWorks. Ensuring the correct semaphore or handle is created looks fine.


1975-1976: mutex_destroy: INTEGRITY branch calling sema_destroy.
Destroying the semaphore for the INTEGRITY path is consistent with the rest of the code. Change looks straightforward.


2070-2072: mutex_lock for INTEGRITY uses WaitForSemaphore.
This mirrors the approach taken for VxWorks (semTake). Implementation appears correct.


3925-4057: thr_create logic for INTEGRITY and INTEGRITY-178B.
The custom calls (e.g., SetupTask vs. CommonCreateTask) and dynamic stack usage are valid approaches. Just ensure the deallocation path is robust for tasks that exit unexpectedly and that stack management is thoroughly tested.

Please verify that tasks created this way are properly cleaned up under all exit conditions (normal and abnormal).


4221-4282: thr_join for INTEGRITY.
This implementation uses a global map of semaphores to sync with the joined thread’s exit. The logic is coherent. No immediate concerns beyond ensuring the map is pruned properly on all exit paths.

ACE/ace/OS_NS_Thread.inl (8)

1-1: Cppcheck unknown macro warning.

The static analysis tool reports an unknown macro for ACE_BEGIN_VERSIONED_NAMESPACE_DECL. This is a known ACE macro. No functional code change is required; please adjust the static analysis configuration to recognize it.


23-25: Clarify conditional usage for INTEGRITY TSS.

These lines add a specific conditional block for the INTEGRITY OS when using TSS emulation. Ensure that all references to ACE_INTEGRITY_TSS_Impl are linked in the build and that the code is tested for multi-thread scenarios, as TSS typically involves concurrency complexities.


54-57: Consider verifying pointer validity.

When retrieving ACE_INTEGRITY_TSS_Impl* obj, confirm it is not null before dereferencing. If ACE_INTEGRITY_TSS_IMPL were not allocated, accessing obj->get() could lead to undefined behavior.


1749-1756: Check for concurrency edge cases.

Calling ::CreateSemaphore(count, s) sets up the semaphore on INTEGRITY. Ensure the system call’s parameters align with intended concurrency semantics, including the maximum possible count and the initial count. Otherwise, resource limits may be unintentionally exceeded or underutilized.


1894-1895: Confirm ReleaseSemaphore usage.

When using ::ReleaseSemaphore(*s), verify that its return value Success consistently denotes full success. Ensure the function’s behavior matches typical semaphore post semantics, particularly regarding potential error conditions.


2000-2001: Validate trylock semantics.

In sema_trywait(), returning 0 for Success or -1 otherwise should match a non-blocking semaphore acquisition. Confirm it aligns with the broader ACE expectations on a “try” operation.


2555-2560: Ensure priority retrieval logic is robust.

The GetActivePriority() call might be subject to range constraints. Ensure that special or idle threads cannot produce unexpected values, and confirm no off-by-one scenarios arise for maximum or minimum priorities.


3172-3173: Verify thread halt approach.

::HaltTask(target_thread) may be irreversible, effectively killing the thread. If the intent is a suspend/resume model, investigate whether INTEGRITY offers a different call for true suspension.

ACE/ace/Single_Input_Reactor.cpp (1)

22-35: Validate handle registration.

register_handler simply overwrites event_handler_ and disables non-blocking. Confirm there is no existing handler to prevent overwriting, and ensure that the handle is valid. Also, consider the lifecycle if multiple registrations inadvertently occur without removal.

ACE/ace/Single_Input_Reactor.h (1)

13-67: Review placeholders in reactor methods.

Most methods return a default value or 0. Confirm they won't be unexpectedly called by other ACE/TAO components (e.g., timers, signals), as it could yield silent failures or missing functionality.

Comment on lines +479 to +481
case TAO_REACTOR_SINGLE_INPUT:
ACE_NEW_RETURN (impl, ACE_Single_Input_Reactor, 0);
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

No platform-specific checks for ACE_Single_Input_Reactor.

Unlike other reactor implementations (like WFMO or Dev_Poll) that have platform-specific guards, the Single_Input_Reactor doesn't have any conditional compilation directives. Verify that this reactor type is indeed intended to be available on all platforms.


🏁 Script executed:

#!/bin/bash
# Check for any platform-specific limitations in the Single_Input_Reactor implementation
grep -E "#if|#ifdef|#ifndef" -A 2 ACE/ace/Single_Input_Reactor.h | grep -E "ACE_WIN32|ACE_HAS_|ACE_LACKS_"

Length of output: 125


Platform-Specific Check Required for ACE_Single_Input_Reactor

The header file for ACE_Single_Input_Reactor contains an #ifdef ACE_WIN32 directive, indicating it’s intended for Windows platforms. However, in TAO/tao/Strategies/advanced_resource.cpp (lines 479–481), the reactor is instantiated unconditionally. Please:

  • Confirm whether TAO_REACTOR_SINGLE_INPUT is meant to be available on all platforms.
  • If it’s Windows-specific, wrap the instantiation with the appropriate #ifdef ACE_WIN32/#endif to prevent build issues on unsupported platforms.
  • Alternatively, adjust or document the behavior if non-Windows platforms are to support this reactor.

#define ACE_LACKS_CUSERID
#define ACE_NEEDS_HUGE_THREAD_STACKSIZE 0x5000
#define fileno(file) ((file)->io_channel) //Hack to get Svc_Conf_l.cpp compiled
#define ACE_HAS_ATTR_SETSCHED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Hacky redefinition of fileno.
Using a macro-based hack for fileno(file) to reference (file)->io_channel can be fragile. If the underlying library changes or if file is no longer a pointer to an appropriate structure, this could break. Consider wrapping this in a function or clarifying the assumptions behind this hack for future maintainers.

Comment on lines +2331 to +2347
# elif defined (INTEGRITY)
// Make sure the semaphore's value does not exceed its initial value, which is 1.
// This guards against incorrect unlocks from threads without holding the lock.
// This, however, does not prevent a race when two or more threads call this function
// simultaneously and the calls to GetSemaphoreValue and ReleaseSemaphore interleave.
// In that case, the semaphore's value could raise to above 1.
// So, only call unlock when know for sure the thread is holding the lock!
SignedValue curr_val;
if (::GetSemaphoreValue (*m, &curr_val) != Success)
return -1;

if (curr_val == 1)
{
errno = EPERM;
return -1;
}
return ::ReleaseSemaphore (*m) == Success ? 0 : -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Potential concurrency race in mutex_unlock for INTEGRITY.
While this code checks if the semaphore’s value is already at 1 to avoid incrementing it further, multiple threads calling mutex_unlock in tight succession might still cause a race (the calls to GetSemaphoreValue() and ReleaseSemaphore() can interleave). This can break mutex logic if multiple unlocks occur without proper ownership checks.

To strengthen reliability, consider tracking lock ownership or adding atomic checks via a more robust approach (e.g., the OS’s built-in mutex mechanism if available).

@@ -17,6 +17,11 @@
*S_T.inl
*.bmak
*.recipe
*.gpj
*.int
*.cmd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmd is a common extension for windows batch files. There is one in the tree, though I don't think it's important. I'm not sure what we can do about this if integrity is using it though.

Copy link
Member

@mitza-oci mitza-oci Feb 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to add *.cmd to ignores in this PR. In general, we could remove all tool-specific files from .gitignore and let each user configure their own .git/info/exclude or similar.

@mitza-oci
Copy link
Member

Since #2339 was recently merged, you may want an explicit merge from the master branch to pick up the updates to the CI configuration

@@ -1,3 +1,4 @@

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

@@ -47,7 +47,7 @@
#include "ace/High_Res_Timer.h"
#include "ace/Sched_Params.h"

#if defined (VXWORKS)
#if defined (VXWORKS) || defined (INTEGRITY)
# include "ace/OS_NS_string.h"
#endif /* VXWORKS */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif /* VXWORKS */
#endif

@@ -216,7 +216,7 @@ ACE::sendv_n (ACE_HANDLE handle,
ACE_INLINE ssize_t
ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
{
#if defined (ACE_WIN32) || defined (ACE_MQX)
#if defined (ACE_WIN32) || defined (ACE_MQX) || defined (__ghs__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following convention, shouldn't macros like __ghs__ and INTEGRITY have their own ACE_* counterparts?

@@ -1707,14 +1707,18 @@ ACE_InputCDR::read_string (std::string& x)
// the memory is allocated.
if (len > 0 && len <= this->length())
{
#if !defined (ACE_NO_GHS_EXCEPT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming this macro is new, maybe it could have a better name? Like ACE_LACKS_EXCEPTIONS or ACE_LACKS_STD_EXCEPTIONS? I don't know what the platform supports, so I don't know what I'm the scope of this is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does integrity handle a resize error? Shouldn't be there some alternative code instead to handle the error cases?


struct StackInfo
{
StackInfo () : id(0), occupied(false) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use uniform initialization to simplify this

private:
struct TaskInfo
{
TaskInfo () : id(0), tss_base(0), valid(false) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uniform initialization would simplify this

@@ -20,8 +20,10 @@ closedir (ACE_DIR *d)
delete d;
# elif defined (ACE_HAS_WCLOSEDIR_EQUIVALENT) && defined (ACE_USES_WCHAR)
ACE_HAS_WCLOSEDIR_EQUIVALENT (d);
# else /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
# elif !defined (ACE_LACKS_CLOSEDIR) /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find it more readable when you first would check defined (ACE_LACKS_CLOSEDIR), and the normal case in the else part

#define ACE_LACKS_SYS_SHM_H
#define ACE_LACKS_TERMIOS_H
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there maybe any other parts that could be cleaned because some lacks macros are not used anymore (integrity maybe the last to need a certain workaround)?

@@ -122,7 +122,7 @@ run_main (int, ACE_TCHAR *[])
// Set the thread hook!
ACE_Thread_Hook::thread_hook (new My_Thread_Hook);

int n_threads = ACE_MAX_THREADS;
int n_threads = 3; //ACE_MAX_THREADS;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to revert?

@@ -791,12 +791,14 @@ TAO_Default_Resource_Factory::get_reactor ()
else
this->dynamically_allocated_reactor_ = true;

ACE_Reactor::instance (reactor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look a good thing to just replace the singleton reactor with the one created by TAO, something to revert, also reclaim

@@ -171,9 +187,12 @@ extern "C"
#define ACE_LACKS_READLINK
#define ACE_LACKS_GETPPID
#define NSIG (SIGRTMAX+1)
#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
#define ACE_USE_RCSID 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACE_USE_RCSID is not used anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants