x11 session end detection

This commit is contained in:
dockes 2006-12-23 13:07:21 +00:00
parent 1a1f97a745
commit 43bf0beb52
8 changed files with 1700 additions and 13 deletions

1647
src/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -226,6 +226,10 @@ cd ..
##################### End QT detection
### X11: this is needed for the session monitoring code (in recollindex -m)
AC_PATH_XTRA
#echo X_CFLAGS "'$X_CFLAGS'" X_PRE_LIBS "'$X_PRE_LIBS'" X_LIBS "'$X_LIBS'" X_EXTRA_LIBS "'$X_EXTRA_LIBS'"
# We have to expand prefix in here, couldn't find a way to do it inside
# the qt gui .pro file or Makefile. This just means that you can't change
# prefix at build time. It works at install time because we dont' use the
@ -235,6 +239,10 @@ test "X$m_prefix" = "XNONE" && m_prefix=/usr/local
m_datadir=${m_prefix}/share
QTRECOLL_DATADIR=${m_datadir}/recoll
AC_SUBST(X_CFLAGS)
AC_SUBST(X_PRE_LIBS)
AC_SUBST(X_LIBS)
AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(INCICONV)
AC_SUBST(LIBICONV)
AC_SUBST(LIBXAPIAN)

View File

@ -10,7 +10,9 @@ RECOLLINDEX_OBJS= recollindex.o rclmonrcv.o rclmonprc.o $(BIGLIB) $(MIMELIB)
recollindex : $(RECOLLINDEX_OBJS)
$(CXX) $(ALL_CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \
$(BSTATIC) $(LIBXAPIAN) $(LIBICONV) $(BDYNAMIC) \
$(LIBFAM) $(LIBSYS)
$(LIBFAM) \
$(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) \
$(LIBSYS)
recollindex.o : recollindex.cpp
$(CXX) $(ALL_CXXFLAGS) -c -o recollindex.o $<
rclmonrcv.o : rclmonrcv.cpp

View File

@ -2,7 +2,7 @@
#ifdef RCL_MONITOR
#ifndef lint
static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.8 2006-12-21 10:08:07 dockes Exp $ (C) 2006 J.F.Dockes";
static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.9 2006-12-23 13:07:21 dockes Exp $ (C) 2006 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -38,6 +38,7 @@ static char rcsid[] = "@(#$Id: rclmonprc.cpp,v 1.8 2006-12-21 10:08:07 dockes Ex
#include "debuglog.h"
#include "indexer.h"
#include "pathut.h"
#include "x11mon.h"
typedef map<string, RclMonEvent> queue_type;
@ -161,9 +162,23 @@ extern int stopindexing;
bool RclMonEventQueue::ok()
{
if (m_data == 0)
if (m_data == 0) {
LOGDEB(("RclMonEventQueue: not ok: bad state\n"));
return false;
return !stopindexing && m_data->m_ok;
}
if (!x11IsAlive()) {
LOGDEB(("RclMonEventQueue: not ok: x11\n"));
return false;
}
if (stopindexing) {
LOGDEB(("RclMonEventQueue: not ok: stop request\n"));
return false;
}
if (!m_data->m_ok) {
LOGDEB(("RclMonEventQueue: not ok: end from rcv\n"));
return false;
}
return true;
}
void RclMonEventQueue::setTerminate()

View File

@ -8,8 +8,8 @@ LIBS = librcl.a
all: $(LIBS)
OBJS = rclaspell.o rclconfig.o rclinit.o textsplit.o unacpp.o csguess.o indexer.o mimetype.o htmlparse.o myhtmlparse.o mimehandler.o internfile.o mh_exec.o mh_html.o mh_mail.o mh_mbox.o mh_text.o docseq.o history.o sortseq.o pathhash.o rcldb.o searchdata.o stemdb.o base64.o conftree.o copyfile.o debuglog.o execmd.o fstreewalk.o idfile.o md5.o mimeparse.o pathut.o readfile.o smallut.o transcode.o wipedir.o
DEPS = rclaspell.dep.stamp rclconfig.dep.stamp rclinit.dep.stamp textsplit.dep.stamp unacpp.dep.stamp csguess.dep.stamp indexer.dep.stamp mimetype.dep.stamp htmlparse.dep.stamp myhtmlparse.dep.stamp mimehandler.dep.stamp internfile.dep.stamp mh_exec.dep.stamp mh_html.dep.stamp mh_mail.dep.stamp mh_mbox.dep.stamp mh_text.dep.stamp docseq.dep.stamp history.dep.stamp sortseq.dep.stamp pathhash.dep.stamp rcldb.dep.stamp searchdata.dep.stamp stemdb.dep.stamp base64.dep.stamp conftree.dep.stamp copyfile.dep.stamp debuglog.dep.stamp execmd.dep.stamp fstreewalk.dep.stamp idfile.dep.stamp md5.dep.stamp mimeparse.dep.stamp pathut.dep.stamp readfile.dep.stamp smallut.dep.stamp transcode.dep.stamp wipedir.dep.stamp
OBJS = rclaspell.o rclconfig.o rclinit.o textsplit.o unacpp.o csguess.o indexer.o mimetype.o htmlparse.o myhtmlparse.o mimehandler.o internfile.o mh_exec.o mh_html.o mh_mail.o mh_mbox.o mh_text.o docseq.o history.o sortseq.o pathhash.o rcldb.o searchdata.o stemdb.o base64.o conftree.o copyfile.o debuglog.o execmd.o fstreewalk.o idfile.o md5.o mimeparse.o pathut.o readfile.o smallut.o transcode.o wipedir.o x11mon.o
DEPS = rclaspell.dep.stamp rclconfig.dep.stamp rclinit.dep.stamp textsplit.dep.stamp unacpp.dep.stamp csguess.dep.stamp indexer.dep.stamp mimetype.dep.stamp htmlparse.dep.stamp myhtmlparse.dep.stamp mimehandler.dep.stamp internfile.dep.stamp mh_exec.dep.stamp mh_html.dep.stamp mh_mail.dep.stamp mh_mbox.dep.stamp mh_text.dep.stamp docseq.dep.stamp history.dep.stamp sortseq.dep.stamp pathhash.dep.stamp rcldb.dep.stamp searchdata.dep.stamp stemdb.dep.stamp base64.dep.stamp conftree.dep.stamp copyfile.dep.stamp debuglog.dep.stamp execmd.dep.stamp fstreewalk.dep.stamp idfile.dep.stamp md5.dep.stamp mimeparse.dep.stamp pathut.dep.stamp readfile.dep.stamp smallut.dep.stamp transcode.dep.stamp wipedir.dep.stamp x11mon.dep.stamp
librcl.a : $(DEPS) $(OBJS) unac.o
ar ru librcl.a $(OBJS) unac.o
@ -93,6 +93,8 @@ transcode.o : ../utils/transcode.cpp
$(CXX) $(ALL_CXXFLAGS) -c ../utils/transcode.cpp
wipedir.o : ../utils/wipedir.cpp
$(CXX) $(ALL_CXXFLAGS) -c ../utils/wipedir.cpp
x11mon.o : ../utils/x11mon.cpp
$(CXX) $(ALL_CXXFLAGS) -c ../utils/x11mon.cpp
depend: $(DEPS)
clean:
rm -f $(OBJS) $(LIBS) $(DEPS) unac.o
@ -213,6 +215,9 @@ transcode.dep.stamp : ../utils/transcode.cpp
wipedir.dep.stamp : ../utils/wipedir.cpp
$(CXX) -M $(ALL_CXXFLAGS) ../utils/wipedir.cpp > wipedir.dep
touch wipedir.dep.stamp
x11mon.dep.stamp : ../utils/x11mon.cpp
$(CXX) -M $(ALL_CXXFLAGS) ../utils/x11mon.cpp > x11mon.dep
touch x11mon.dep.stamp
include rclaspell.dep
include rclconfig.dep
include rclinit.dep
@ -251,3 +256,4 @@ include readfile.dep
include smallut.dep
include transcode.dep
include wipedir.dep
include x11mon.dep

View File

@ -42,6 +42,7 @@ ${depth}/utils/readfile.cpp \
${depth}/utils/smallut.cpp \
${depth}/utils/transcode.cpp \
${depth}/utils/wipedir.cpp \
${depth}/utils/x11mon.cpp \
"

View File

@ -7,11 +7,16 @@ INCICONV=@INCICONV@
LIBFAM = @LIBFAM@
X_CFLAGS=@X_CFLAGS@
X_PRE_LIBS=@X_PRE_LIBS@
X_LIBS=@X_LIBS@
X_EXTRA_LIBS=@X_EXTRA_LIBS@
prefix = @prefix@
datadir = @datadir@
RECOLL_DATADIR = ${datadir}/recoll
LOCALCXXFLAGS = $(INCICONV) $(XAPIANCXXFLAGS) \
LOCALCXXFLAGS = $(INCICONV) $(XAPIANCXXFLAGS) $(X_CFLAGS) \
-DRECOLL_DATADIR=\"$(RECOLL_DATADIR)\" @DEFS@
CXXFLAGS = -g -O2 -Wall -Wno-unused

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.13 2006-12-16 15:31:51 dockes Exp $ (C) 2004 J.F.Dockes";
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.14 2006-12-23 13:07:21 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -91,15 +91,20 @@ TempFileInternal::TempFileInternal(const string& suffix)
return;
}
if (!mktemp(cp)) {
// Yes using mkstemp this way is awful (bot the suffix adding and
// using mkstemp() just to avoid the warnings)
int fd;
if ((fd = mkstemp(cp)) < 0) {
free(cp);
m_reason = "maketmpdir: mktemp failed\n";
m_reason = "maketmpdir: mkstemp failed\n";
return;
}
}
close(fd);
unlink(cp);
filename = cp;
free(cp);
// Yea not right
m_filename = filename + suffix;
if (close(open(m_filename.c_str(), O_CREAT|O_EXCL, 0600)) != 0) {
m_reason = string("Could not open/create") + m_filename;