app: add log output when attaching/detaching shared memory

Also put the call to shmdt() out of the IPC_RMID_DEFERRED_RELEASE ifdef.
This commit is contained in:
Michael Natterer 2010-02-10 19:24:40 +01:00
parent 034bd0427f
commit 74c01d7a10
3 changed files with 15 additions and 6 deletions

View File

@ -48,7 +48,8 @@ gimp_log_init (void)
{ "shadow-tiles", GIMP_LOG_SHADOW_TILES },
{ "scale", GIMP_LOG_SCALE },
{ "wm", GIMP_LOG_WM },
{ "floating-selection", GIMP_LOG_FLOATING_SELECTION }
{ "floating-selection", GIMP_LOG_FLOATING_SELECTION },
{ "shm", GIMP_LOG_SHM }
};
/* g_parse_debug_string() has special treatment of the string 'help',

View File

@ -32,7 +32,8 @@ typedef enum
GIMP_LOG_SHADOW_TILES = 1 << 8,
GIMP_LOG_SCALE = 1 << 9,
GIMP_LOG_WM = 1 << 10,
GIMP_LOG_FLOATING_SELECTION = 1 << 11
GIMP_LOG_FLOATING_SELECTION = 1 << 11,
GIMP_LOG_SHM = 1 << 12
} GimpLogFlags;
@ -85,6 +86,7 @@ void gimp_logv (const gchar *function,
#define SCALE GIMP_LOG_SCALE
#define WM GIMP_LOG_WM
#define FLOATING_SELECTION GIMP_LOG_FLOATING_SELECTION
#define SHM GIMP_LOG_SHM
#if 0 /* last resort */
# define GIMP_LOG /* nothing => no varargs, no log */

View File

@ -68,6 +68,8 @@
#include "gimppluginshm.h"
#include "gimp-log.h"
#define TILE_MAP_SIZE (TILE_WIDTH * TILE_HEIGHT * 4)
@ -234,6 +236,10 @@ gimp_plug_in_shm_new (void)
g_slice_free (GimpPlugInShm, shm);
shm = NULL;
}
else
{
GIMP_LOG (SHM, "attached shared memory segment ID = %d", shm->shm_ID);
}
return shm;
}
@ -248,12 +254,11 @@ gimp_plug_in_shm_free (GimpPlugInShm *shm)
#if defined (USE_SYSV_SHM)
shmdt (shm->shm_addr);
#ifndef IPC_RMID_DEFERRED_RELEASE
shmdt (shm->shm_addr);
shmctl (shm->shm_ID, IPC_RMID, NULL);
#else
shmdt (shm->shm_addr);
#endif /* IPC_RMID_DEFERRED_RELEASE */
#endif
#elif defined(USE_WIN32_SHM)
@ -273,6 +278,7 @@ gimp_plug_in_shm_free (GimpPlugInShm *shm)
#endif
GIMP_LOG (SHM, "detached shared memory segment ID = %d", shm->shm_ID);
}
g_slice_free (GimpPlugInShm, shm);