diff options
| author | Karel Klic <kklic@redhat.com> | 2009-10-12 11:46:13 +0200 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2009-10-12 11:46:13 +0200 |
| commit | a41deef57d58ddcce264900885d94df37d23bff4 (patch) | |
| tree | 1b2975c952b3179dab1e09e4d3609fcfcf02d610 /src/Daemon | |
| parent | 691fd95d03763f803e499dba06c8caecb279427f (diff) | |
| parent | b88494a1bbfc8871642fe117d893f2970f543a1b (diff) | |
| download | abrt-a41deef57d58ddcce264900885d94df37d23bff4.tar.gz abrt-a41deef57d58ddcce264900885d94df37d23bff4.tar.xz abrt-a41deef57d58ddcce264900885d94df37d23bff4.zip | |
Merge branch 'master' of git://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/Daemon')
| -rw-r--r-- | src/Daemon/CommLayerServer.h | 1 | ||||
| -rw-r--r-- | src/Daemon/CommLayerServerDBus.cpp | 23 | ||||
| -rw-r--r-- | src/Daemon/CommLayerServerDBus.h | 1 | ||||
| -rw-r--r-- | src/Daemon/CommLayerServerSocket.h | 1 | ||||
| -rw-r--r-- | src/Daemon/CrashWatcher.cpp | 12 | ||||
| -rw-r--r-- | src/Daemon/CrashWatcher.h | 4 | ||||
| -rw-r--r-- | src/Daemon/Daemon.cpp | 14 | ||||
| -rw-r--r-- | src/Daemon/MiddleWare.cpp | 14 | ||||
| -rw-r--r-- | src/Daemon/MiddleWare.h | 1 |
9 files changed, 31 insertions, 40 deletions
diff --git a/src/Daemon/CommLayerServer.h b/src/Daemon/CommLayerServer.h index aface8a..6ede581 100644 --- a/src/Daemon/CommLayerServer.h +++ b/src/Daemon/CommLayerServer.h @@ -15,7 +15,6 @@ class CCommLayerServer { /* just stubs to be called when not implemented in specific comm layer */ virtual void Crash(const std::string& progname, const std::string& uid) {} virtual void JobDone(const char* pDest, const char* pUUID) = 0; - virtual void JobStarted(const char* pDest) {}; virtual void QuotaExceed(const char* str) {} virtual void Update(const std::string& pMessage, const char* peer, uint64_t pJobID) {}; diff --git a/src/Daemon/CommLayerServerDBus.cpp b/src/Daemon/CommLayerServerDBus.cpp index 1085d80..fc28a12 100644 --- a/src/Daemon/CommLayerServerDBus.cpp +++ b/src/Daemon/CommLayerServerDBus.cpp @@ -69,18 +69,6 @@ void CCommLayerServerDBus::QuotaExceed(const char* str) send_flush_and_unref(msg); } -void CCommLayerServerDBus::JobStarted(const char* peer) -{ - DBusMessage* msg = new_signal_msg("JobStarted", peer); - uint64_t nJobID = uint64_t(pthread_self()); - dbus_message_append_args(msg, - DBUS_TYPE_STRING, &peer, /* TODO: redundant parameter, remove from API */ - DBUS_TYPE_UINT64, &nJobID, /* TODO: redundant parameter, remove from API */ - DBUS_TYPE_INVALID); - VERB2 log("Sending signal JobStarted('%s',%llx)", peer, (unsigned long long)nJobID); - send_flush_and_unref(msg); -} - void CCommLayerServerDBus::JobDone(const char* peer, const char* pUUID) { DBusMessage* msg = new_signal_msg("JobDone", peer); @@ -156,6 +144,13 @@ static int handle_CreateReport(DBusMessage* call, DBusMessage* reply) dbus_message_iter_init(call, &in_iter); const char* pUUID; r = load_val(&in_iter, pUUID); + if (r != ABRT_DBUS_MORE_FIELDS) + { + error_msg("dbus call %s: parameter type mismatch", __func__ + 7); + return -1; + } + int32_t force; + r = load_val(&in_iter, force); if (r != ABRT_DBUS_LAST_FIELD) { error_msg("dbus call %s: parameter type mismatch", __func__ + 7); @@ -164,7 +159,7 @@ static int handle_CreateReport(DBusMessage* call, DBusMessage* reply) const char* sender; long unix_uid = get_remote_uid(call, &sender); - if (CreateReportThread(pUUID, to_string(unix_uid).c_str(), sender) != 0) + if (CreateReportThread(pUUID, to_string(unix_uid).c_str(), force, sender) != 0) return -1; /* can't create thread (err msg is already logged) */ dbus_message_append_args(reply, @@ -189,7 +184,7 @@ static int handle_GetJobResult(DBusMessage* call, DBusMessage* reply) } long unix_uid = get_remote_uid(call); - map_crash_report_t report = GetJobResult(pUUID, to_string(unix_uid).c_str()); + map_crash_report_t report = GetJobResult(pUUID, to_string(unix_uid).c_str(), /*force:*/ 0); DBusMessageIter out_iter; dbus_message_iter_init_append(reply, &out_iter); diff --git a/src/Daemon/CommLayerServerDBus.h b/src/Daemon/CommLayerServerDBus.h index 06fb15d..7b2e31d 100644 --- a/src/Daemon/CommLayerServerDBus.h +++ b/src/Daemon/CommLayerServerDBus.h @@ -12,7 +12,6 @@ class CCommLayerServerDBus /* DBus signal senders */ virtual void Crash(const std::string& progname, const std::string& uid); - virtual void JobStarted(const char* pDest); virtual void JobDone(const char* pDest, const char* pUUID); virtual void QuotaExceed(const char* str); diff --git a/src/Daemon/CommLayerServerSocket.h b/src/Daemon/CommLayerServerSocket.h index f598841..baca195 100644 --- a/src/Daemon/CommLayerServerSocket.h +++ b/src/Daemon/CommLayerServerSocket.h @@ -31,5 +31,4 @@ class CCommLayerServerSocket : public CCommLayerServer virtual bool DeleteDebugDump(const std::string& pUUID, const std::string& pSender); virtual void Crash(const std::string& arg1); - virtual void JobStarted(const char* pDest) {}; }; diff --git a/src/Daemon/CrashWatcher.cpp b/src/Daemon/CrashWatcher.cpp index 5cc9dc7..94fb9d7 100644 --- a/src/Daemon/CrashWatcher.cpp +++ b/src/Daemon/CrashWatcher.cpp @@ -109,7 +109,7 @@ vector_crash_infos_t GetCrashInfos(const std::string &pUID) * CreateReport dbus call already did all the processing, and we just retrieve * the result from dump directory, which is fast. */ -map_crash_report_t GetJobResult(const char* pUUID, const char* pUID) +map_crash_report_t GetJobResult(const char* pUUID, const char* pUID, int force) { map_crash_info_t crashReport; @@ -118,7 +118,7 @@ map_crash_report_t GetJobResult(const char* pUUID, const char* pUID) * g_pPluginManager->GetDatabase(g_settings_sDatabase); * which is unsafe wrt concurrent updates to g_pPluginManager state. */ - mw_result_t res = CreateCrashReport(pUUID, pUID, crashReport); + mw_result_t res = CreateCrashReport(pUUID, pUID, force, crashReport); switch (res) { case MW_OK: @@ -144,14 +144,13 @@ typedef struct thread_data_t { pthread_t thread_id; char* UUID; char* UID; + int force; char* peer; } thread_data_t; static void* create_report(void* arg) { thread_data_t *thread_data = (thread_data_t *) arg; - g_pCommLayer->JobStarted(thread_data->peer); - /* Client name is per-thread, need to set it */ set_client_name(thread_data->peer); @@ -159,7 +158,7 @@ static void* create_report(void* arg) { /* "GetJobResult" is a bit of a misnomer */ log("Creating report..."); - map_crash_info_t crashReport = GetJobResult(thread_data->UUID, thread_data->UID); + map_crash_info_t crashReport = GetJobResult(thread_data->UUID, thread_data->UID, thread_data->force); g_pCommLayer->JobDone(thread_data->peer, thread_data->UUID); } catch (CABRTException& e) @@ -187,11 +186,12 @@ static void* create_report(void* arg) /* Bogus value. pthreads require us to return void* */ return NULL; } -int CreateReportThread(const char* pUUID, const char* pUID, const char* pSender) +int CreateReportThread(const char* pUUID, const char* pUID, int force, const char* pSender) { thread_data_t *thread_data = (thread_data_t *)xzalloc(sizeof(thread_data_t)); thread_data->UUID = xstrdup(pUUID); thread_data->UID = xstrdup(pUID); + thread_data->force = force; thread_data->peer = xstrdup(pSender); //TODO: do we need this? //pthread_attr_t attr; diff --git a/src/Daemon/CrashWatcher.h b/src/Daemon/CrashWatcher.h index 00bb4d5..d8c7c28 100644 --- a/src/Daemon/CrashWatcher.h +++ b/src/Daemon/CrashWatcher.h @@ -49,8 +49,8 @@ class CCrashWatcher }; vector_crash_infos_t GetCrashInfos(const std::string &pUID); -int CreateReportThread(const char* pUUID, const char* pUID, const char* pSender); -map_crash_report_t GetJobResult(const char* pUUID, const char* pUID); +int CreateReportThread(const char* pUUID, const char* pUID, int force, const char* pSender); +map_crash_report_t GetJobResult(const char* pUUID, const char* pUID, int force); bool DeleteDebugDump(const std::string& pUUID, const std::string& pUID); #endif /*CRASHWATCHER_H_*/ diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index cbcf697..d1ab188 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -50,10 +50,9 @@ * - GetCrashInfos(): returns a vector_crash_infos_t (vector_map_vector_string_t) * of crashes for given uid * v[N]["executable"/"uid"/"kernel"/"backtrace"][N] = "contents" - * - CreateReport(UUID): starts creating a report for /var/cache/abrt/DIR with this UUID. + * - CreateReport(UUID,force): starts creating a report for /var/cache/abrt/DIR with this UUID. * Returns job id (uint64). - * Emits JobStarted(client_dbus_ID,job_id) dbus signal. - * After it returns, when report creation thread has finished, + * After thread returns, when report creation thread has finished, * JobDone(client_dbus_ID,UUID) dbus signal is emitted. * - GetJobResult(UUID): returns map_crash_report_t (map_vector_string_t) * - Report(map_crash_report_t (map_vector_string_t[, map_map_string_t])): @@ -71,8 +70,6 @@ * * DBus signals we emit: * - Crash(progname,uid) - a new crash occurred (new /var/cache/abrt/DIR is found) - * - JobStarted(client_dbus_ID,job_id) - see CreateReport above. - * Sent as unicast to the client which did CreateReport. * - JobDone(client_dbus_ID,UUID) - see CreateReport above. * Sent as unicast to the client which did CreateReport. * - Warning(msg,job_id) @@ -81,9 +78,8 @@ * If set_client_name(NULL) was done, they are not sent. * * TODO: - * - API does not really need JobStarted dbus signal at all, and JobDone signal - * does not need to pass any parameters - out clients never sent multiple - * CreateReport's. + * - JobDone signal does not need to pass any parameters + * - our clients never send multiple CreateReport's. */ @@ -153,7 +149,7 @@ static double GetDirSize(const std::string &pPath, std::string *worst_dir = NULL if (worst_dir && strcmp(excluded, ep->d_name) != 0) { /* Calculate "weighted" size and age - /* w = sz_kbytes * age_mins */ + * w = sz_kbytes * age_mins */ sz /= 1024; long age = (time(NULL) - stats.st_mtime) / 60; if (age > 0) diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp index b05dbb6..05abc9b 100644 --- a/src/Daemon/MiddleWare.cpp +++ b/src/Daemon/MiddleWare.cpp @@ -163,15 +163,17 @@ static std::string GetGlobalUUID(const std::string& pAnalyzer, * @param pDebugDumpPath A debugdump dir containing all necessary data. */ static void CreateReport(const std::string& pAnalyzer, - const std::string& pDebugDumpDir) + const std::string& pDebugDumpDir, + int force) { CAnalyzer* analyzer = g_pPluginManager->GetAnalyzer(pAnalyzer); - analyzer->CreateReport(pDebugDumpDir); + analyzer->CreateReport(pDebugDumpDir, force); } mw_result_t CreateCrashReport(const std::string& pUUID, - const std::string& pUID, - map_crash_report_t& pCrashReport) + const std::string& pUID, + int force, + map_crash_report_t& pCrashReport) { VERB2 log("CreateCrashReport('%s','%s',result)", pUUID.c_str(), pUID.c_str()); @@ -185,7 +187,7 @@ mw_result_t CreateCrashReport(const std::string& pUUID, } if (pUUID == "" || row.m_sUUID != pUUID) { - warn_client("CreateCrashReport(): UUID '"+pUUID+"' is not in database."); + warn_client("CreateCrashReport(): UUID '"+pUUID+"' is not in database"); return MW_IN_DB_ERROR; } @@ -211,7 +213,7 @@ mw_result_t CreateCrashReport(const std::string& pUUID, dd.Close(); VERB3 log(" CreateReport('%s')", analyzer.c_str()); - CreateReport(analyzer, row.m_sDebugDumpDir); + CreateReport(analyzer, row.m_sDebugDumpDir, force); gUUID = GetGlobalUUID(analyzer, row.m_sDebugDumpDir); VERB3 log(" GetGlobalUUID:'%s'", gUUID.c_str()); diff --git a/src/Daemon/MiddleWare.h b/src/Daemon/MiddleWare.h index bc80952..fab822f 100644 --- a/src/Daemon/MiddleWare.h +++ b/src/Daemon/MiddleWare.h @@ -65,6 +65,7 @@ void LoadOpenGPGPublicKey(const char* key); */ mw_result_t CreateCrashReport(const std::string& pUUID, const std::string& pUID, + int force, map_crash_report_t& pCrashReport); /** * Activates particular action plugin. |
