What does "shmat() failure, error 0x18" mean on a Solaris system?

This solution addresses the following error message on Solaris systems:

RTIOsapiSharedMemorySegment_attach:OS shmat() failure, error 0X18 
NDDS_Transport_Shmem_attach_writer:failed to initialize shared memory resourcesegment for key 0x4020d0

Error message 0x18 on a Solaris system means that the number of shared memory segments attached to your application is greater than the limit set on your system.

One way to avoid this error is to increase the number of shared memory segments for the system. On a Solaris 8 system, the limit is set in the parameter shmsys:shminfo_shmseg in /etc/system; the default limit is 6.

For example, you can change the line to:

set shmsys:shminfo_shmseg=64

Warning: be very careful when setting values in /etc/system, because it can make the system unbootable. Refer to the Solaris Kernel Tunable Parameters Reference Manual on how to tune the Solaris kernel.

The other option is to turn off shared memory altogether, if you do not need it. For example, the following code enables only UDPv4: 

DDS_DomainParticipantQos participant_qos; 
participant_qos.transport_builtin.mask = DDS_TRANSPORTBUILTIN_UDPv4; 
participant = DDSTheParticipantFactory->create_participant(domainId, 
                                                           NULL /* listener */, 

Reference: Solaris 8 Kernel Tunable Parameters Reference Manual: System V Shared Memory