What can cause gettimerid () to fail by setting errno to ENOSPC (undocumented)?

I am using AIX 6.1. The program I use (and participate in the development) contains calls to the C library function gettimerid().

The problem I am facing is that the calls gettimerid()started interrupting with an error, maybe once a day, returning -1 (indicating an error), and when I check errnoit was set to ENOSPC(28d), which means " There is no free space on the device. "

According to the AIX documentation , it ENOSPCdoes not appear as one of the possible return values, leaving me confused as to what this means.

As far as I know, this does not require any file system space, but I checked the unused file space and the use of inode file systems, and this seemed to be good with a lot of available, and as far as I can tell there is a lot of free memory ( although there may be some limit to this particular process, which I don’t know about if that matters), so I’m not sure what could lead to a return ENOSPCas a result gettimerid().

Code example:

static timer_t TimerId;

if ( ( TimerId = gettimerid(TIMEOFDAY, 0) ) < 0 )
{
  printf( "gettimerid fail [timer id=%d, errno=%d]", TimerId, errno );
}

Result:

gettimerid fail [timer id=-1, errno=28]

Does anyone know what might cause this return code from gettimerid()on AIX?

+4
source share
1 answer

This may be caused by retrieving the timer TIMEOFDAYwithout calling reltimeridbetween them. As an example, to call it:

 while( 1 )
 {
   timer_t TimerId;
   if( ( TimerId = gettimerid( TIMEOFDAY, 0 ) ) < 0 )
   {
     printf( "gettimerid failed: %d\n", errno );
     break;
   }
   else
     printf( "gettimerid OK: %d\n", TimerId );
 }

:

gettimerid OK: 5
gettimerid OK: 6
gettimerid OK: 7
gettimerid OK: 8
gettimerid failed: 28

ENOSPC errno.

+2

Source: https://habr.com/ru/post/1692312/


All Articles