[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] patch:MiNT:KM_FREE



Am 13.12.2009, 23:39 Uhr, schrieb Alan Hourihane <alanh@fairlite.co.uk>:

I'd like something a little more robust than just using a filename.

Robust for not loading the same again or robust to free the correct module?

Regarding the second: The caller-proc is secure as long as it loads one km at the same time with that name.

I don't kwow how to tell run_km to return a pid or similar.

Regarding the first I've come to another conclusion:

The module should decide if it wants to be more than one time in memory.
In the case of XaAES this is not the case.

It checks this now:

  /* test if already running */
  if( p_semaphore( SEMGET, XA_SEM, 0 ) != EBADARG )
  {
    display("XaAES already running!" );
    /* release */
    p_semaphore( SEMRELEASE, XA_SEM, 0 );
    return 1;
  }
  /* create semaphore, gets released by kernel at exit */
  p_semaphore( SEMCREATE, XA_SEM, 0 );


So the test in module.c is rather obsolete, but for traditional XaAES
it's better than nothing and it has to be removed when there are other kms
that are able to have more instances.

BTW: Are there public defines for the mode-argument to p_semaphore anywhere?

-Helmut