42 #include "qplatformdefs.h" 50 #ifndef QT_NO_SHAREDMEMORY 51 #include <sys/types.h> 61 #endif // QT_NO_SHAREDMEMORY 64 #include "private/qcore_unix_p.h" 66 #ifndef QT_NO_SHAREDMEMORY 75 systemSemaphore(
QString()), lockedByMe(false),
117 #ifdef QSHAREDMEMORY_DEBUG 154 if (-1 == unix_key) {
174 #endif // QT_POSIX_IPC 176 #endif // QT_NO_SHAREDMEMORY 178 #if !(defined(QT_NO_SHAREDMEMORY) && defined(QT_NO_SYSTEMSEMAPHORE)) 213 #endif // QT_NO_SHAREDMEMORY && QT_NO_SYSTEMSEMAPHORE 215 #ifndef QT_NO_SHAREDMEMORY 237 bool createdFile = built == 1;
247 if (-1 == shmget(unix_key, size, 0600 | IPC_CREAT | IPC_EXCL)) {
293 #endif // QT_POSIX_IPC 310 if ((
void*) - 1 ==
memory) {
318 if (!shmctl(
id, IPC_STAT, &shmid_ds)) {
319 size = (int)shmid_ds.shm_segsz;
348 if (QT_FSTAT(
hand, &st) == -1) {
365 #endif // QT_POSIX_IPC 374 if (-1 == shmdt(
memory)) {
390 int id = shmget(unix_key, 0, 0400);
393 struct shmid_ds shmid_ds;
394 if (0 != shmctl(
id, IPC_STAT, &shmid_ds)) {
403 if (shmid_ds.shm_nattch == 0) {
405 if (-1 == shmctl(
id, IPC_RMID, &shmid_ds)) {
431 if (QT_FSTAT(
hand, &st) == 0) {
433 shm_nattch = st.st_nlink - 2;
437 if (shm_nattch == 0) {
442 #endif // QT_POSIX_IPC 449 #endif // QT_NO_SHAREDMEMORY
#define QT_END_NAMESPACE
This macro expands to.
QSharedMemory::SharedMemoryError error
#define EINTR_LOOP(var, cmd)
The QByteArray class provides an array of bytes.
void setErrorString(const QString &function)
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static int qt_safe_close(int fd)
The QString class provides a Unicode character string.
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
HANDLE handle()
If not already made create the handle used for accessing the shared memory.
bool attach(QSharedMemory::AccessMode mode)
static int createUnixKeyFile(const QString &fileName)
Creates the unix file if needed.
const char * constData() const
Returns a pointer to the data stored in the byte array.
#define QT_NO_SYSTEMSEMAPHORE
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
#define st(var, type, card)
The QSharedMemory class provides access to a shared memory segment.
bool remove()
Removes the file specified by fileName().
static QByteArray encodeName(const QString &fileName)
By default, this function converts fileName to the local 8-bit encoding determined by the user's loca...
static QString makePlatformSafeKey(const QString &key, const QString &prefix=QLatin1String("qipc_sharedmemory_"))
Generate a string from the key which can be any unicode string into the subset that the win/unix kern...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)