summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Split real code from lib/MiddleWare/Plugin.h into Plugin.cpp.Denys Vlasenko2009-08-071-1/+1
| | | | | | 30k smaller code. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix bug 54: make abrt (without -d) report initialization errorsDenys Vlasenko2009-08-061-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example (strace): 10053 17:18:58.384259 close(0) = 0 10053 17:18:58.384293 open("/dev/null", O_RDWR) = 0 child is created: 10053 17:18:58.384354 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f50eea1c880) = 10054 parent sleeps, child initializes: 10053 17:18:58.384678 nanosleep({0, 100000000}, <unfinished ...> 10054 17:18:58.384751 setsid() = 10054 10054 17:18:58.384794 close(1) = 0 10054 17:18:58.384828 close(2) = 0 10054 17:18:58.384870 dup(0) = 1 10054 17:18:58.384901 dup(0) = 2 10054 17:18:58.385099 open("/usr/app/abrt-TEST/var/etc/abrt/abrt.conf", O_RDONLY) = 3 ... 10054 17:18:58.449108 inotify_init() = 4 10054 17:18:58.449148 inotify_add_watch(4, "/usr/app/abrt-TEST/var/cache/abrt", IN_CREATE) = 1 10054 17:18:58.449228 fstat(4, {st_mode=S_IFDIR|0600, st_size=0, ...}) = 0 10054 17:18:58.449288 fcntl(4, F_GETFL) = 0 (flags O_RDONLY) child: initialization is done, it signals parent: 10054 17:18:58.449346 getppid() = 10053 10054 17:18:58.449380 kill(10053, SIGTERM) = 0 10054 17:18:58.449427 write(1, "Debug: Running...\n"..., 18 <unfinished ...> 10053 17:18:58.449447 <... nanosleep resumed> 0) = ? ERESTART_RESTARTBLOCK (To be restarted) 10054 17:18:58.449470 <... write resumed> ) = 18 10054 17:18:58.449494 open("/usr/app/abrt-TEST/var/run/abrt.lock", O_RDWR|O_CREAT, 0640 <unfinished ...> 10053 17:18:58.449517 --- SIGTERM (Terminated) @ 0 (0) --- 10054 17:18:58.449565 <... open resumed> ) = 5 10053 17:18:58.449583 rt_sigreturn(0xf <unfinished ...> 10054 17:18:58.449607 fcntl(5, F_SETLK, {type=F_WRLCK, whence=SEEK_CUR, start=0, len=0} <unfinished ...> sleep(100ms) is interrupted: 10053 17:18:58.449629 <... rt_sigreturn resumed> ) = -1 EINTR (Interrupted system call) 10054 17:18:58.449664 <... fcntl resumed> ) = 0 10054 17:18:58.449688 unlink("/usr/app/abrt-TEST/var/run/abrt.pid" <unfinished ...> parent exits 0 because it got TERM which means child is ok: 10053 17:18:58.449713 exit_group(0) = ? ... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* silly whitespace fixDenys Vlasenko2009-08-061-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Merge branch 'master' of ssh://vda@git.fedorahosted.org/git/abrtDenys Vlasenko2009-08-063-1/+18
|\
| * Merge branch 'master' of ssh://git.fedorahosted.org/git/abrtJiri Moskovcak2009-08-065-0/+322
| |\
| * \ Merge branch 'master' of ssh://git.fedorahosted.org/git/abrtJiri Moskovcak2009-08-0615-150/+1575
| |\ \ | | | | | | | | | | | | | | | | Conflicts: lib/CommLayer/DBusServerProxy.h
| * | | DBUS: added method GetPluginsInfo()Jiri Moskovcak2009-08-062-0/+17
| | | |
| * | | PYHOOK: re-raise the exception, so the hook doesn't change the default ↵Jiri Moskovcak2009-08-061-1/+1
| | | | | | | | | | | | | | | | behaviour.
* | | | fix vda's breakage: coredumps should be 644, not 600Denys Vlasenko2009-08-061-1/+5
| |_|/ |/| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | | move lib/MiddleWare/{ABRTPlugin,DynamicLibrary}.* to src/Daemon/Denys Vlasenko2009-08-065-0/+322
| |/ |/|
* | fix a case when we print a warning twice.Denys Vlasenko2009-08-062-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | dynamic_cast<> seems to be misbehaving. Disabling it for now.Denys Vlasenko2009-08-061-4/+4
| | | | | | | | | | | | abrt daemon is SEGVing without this Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | move lib/MiddleWare/PluginManager.* -> src/Daemon/PluginManager.*Denys Vlasenko2009-08-063-0/+444
| | | | | | | | | | | | This reduces code size by 14k. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | style cleanups in preparation for PluginManager moveDenys Vlasenko2009-08-061-13/+14
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | move huge inlines out of DBusClientProxy.h to DBusClientProxy.cppDenys Vlasenko2009-08-061-8/+17
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | forgotten "git add"Denys Vlasenko2009-08-062-0/+964
| |
* | moving MiddleWare.{h,cpp} from lib/MiddleWare/ to src/Daemon/Denys Vlasenko2009-08-061-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | prepare makefiles for code movement between dirs. no code changesDenys Vlasenko2009-08-061-0/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | trailing whitespace removal. no code changesDenys Vlasenko2009-08-068-38/+49
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | CDebugDump::Create(pDir, pUID): make 2nd param uid_t, not stringDenys Vlasenko2009-08-051-1/+1
| |
* | Hooks/CCpp.cpp: don't dump executables with "/abrt" substring in the nameDenys Vlasenko2009-08-051-37/+56
| | | | | | | | | | | | some cleanups and abrtlib work crept in too... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | open with O_CREAT must have 3 args, fixing thatDenys Vlasenko2009-08-051-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | simplify C/C++ hookDenys Vlasenko2009-08-051-75/+48
|/ | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* made some functions staticDenys Vlasenko2009-08-042-7/+10
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove redundant virtual destructors definitionsDenys Vlasenko2009-08-041-3/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dumpoops: hopefully fix KerneloopsScanner plugin usageDenys Vlasenko2009-08-042-4/+34
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add error checks on lstat calls; add handling of DT_UNKNOWNDenys Vlasenko2009-08-041-14/+20
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* GUI: minor fix to center the error dialog on parent.Jiri Moskovcak2009-08-041-1/+2
|
* GUI: added error dialog if creating report fails.Jiri Moskovcak2009-08-041-1/+1
|
* use vasprintf in SetIconTooltip instead of open-coding itDenys Vlasenko2009-08-041-32/+30
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* abrt-applet: reset SIGCHLD before launching abrt-guiDenys Vlasenko2009-08-041-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* abrt-applet: set SIGCHLD to SIG_IGN to prevent zombies from guiDenys Vlasenko2009-08-044-64/+70
| | | | | | | Also, running abrt-gui via popen is definiely wrong. We were leaking a FILE! fixed now. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* simplify parameter/return value passing for boolsDenys Vlasenko2009-08-032-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* DBus: Many fixes to client -> cli works again, changed JobDone notificationJiri Moskovcak2009-08-035-39/+60
|
* small fixes to dumpoopsDenys Vlasenko2009-07-311-1/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* dumpoops: a new tool, requested by AntonDenys Vlasenko2009-07-312-1/+60
| | | | | | Now it segfaults, next commit will fix it Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* KerneloopsReporter: plug a leak in writefunctionDenys Vlasenko2009-07-312-2/+2
| | | | | | Also some preparatory cleanups for future dumpoops patch are included Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* using more x-functionsDenys Vlasenko2009-07-312-24/+16
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* style fixes, no code changesDenys Vlasenko2009-07-311-40/+36
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* add utility functionsDenys Vlasenko2009-07-301-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logging machinery provided by this patch consists of several functions: +extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); +extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); +extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); +extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); +/* This is a macro since it collides with log() from math.h */ +#undef log +#define log(...) error_msg(__VA_ARGS__) They are taking printf-style format strings. perror_msg_xxx functions append an errno string after the message: "xxx xxx xxx: No such file or directory" if errno is != 0. xxx_and_die functions do not return. All functions also ensure that the message ends with "\n", meaning that you do not need to add it into the message, but if you do, an extra "\n" will not be added. All functions ensure that the string is written in a single write() call, thus if two processes output to the same terminal or file, messages don't get intermingled. Ordinarily, messages go to the stderr. By setting global variable "logmode" to LOGMODE_SYSLOG or LOGMODE_NONE, they can be sent to syslog or be suppressed. Standard setting is LOGMODE_STDIO. LOGMODE_STDIO + LOGMODE_SYSLOG works too. Usually it is set by main() as needed, and then you can fearlessly use [p]error_msg[_and_die]() and be sure that message goes to the right place. +enum { + LOGMODE_NONE = 0, + LOGMODE_STDIO = (1 << 0), + LOGMODE_SYSLOG = (1 << 1), + LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO, +}; +extern int logmode; Exit code of xxx_and_die variants is controlled by the global variable +extern int xfunc_error_retval; By default it is = 1. Logging infrastructure uses a few other functions, which I find useful on their own, and since I discussed them with Zdenek and he thinks that they may be useful too, they are included in the patch also. The first group is "malloc or die" group: +void* malloc_or_warn(size_t size); +void* xmalloc(size_t size); +void* xrealloc(void *ptr, size_t size); +void* xzalloc(size_t size); +char* xstrdup(const char *s); +char* xstrndup(const char *s, int n); They are basically versions of malloc etc which exit on failure. The next group are simple I/O wrappers: +extern ssize_t safe_read(int fd, void *buf, size_t count); +extern ssize_t full_read(int fd, void *buf, size_t count); +extern void xread(int fd, void *buf, size_t count); +extern ssize_t safe_write(int fd, const void *buf, size_t count); +extern ssize_t full_write(int fd, const void *buf, size_t count); safe_xxx deal with the fact that read and write operations may "fail" with EINTR and in many cases we want to just repeat the operation. full_xxx deal with the fact that read and write are not guaranteed to read or write exact amount, they may to transfer less bytes. In this case we need to loop. The next group are the "x functions": +extern void xwrite(int fd, const void *buf, size_t count); +extern void xwrite_str(int fd, const char *str); +void xpipe(int filedes[2]); +void xdup2(int from, int to); +off_t xlseek(int fd, off_t offset, int whence); +void xsetenv(const char *key, const char *value); +int xsocket(int domain, int type, int protocol); +void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); +void xlisten(int s, int backlog); +ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, socklen_t tolen); +void xstat(const char *name, struct stat *stat_buf); +void xmove_fd(int from, int to); +char* xasprintf(const char *format, ...); They are similar to xmalloc in a sense that they exit on the failure. Most of them closely resemble corresponding libc functions. xmove_fd() is a wrapper for typical idiom "if (fd1!=fd2) dup2(fd1,fd2)", with error checking on dup2 failure added. xasprintf() is a "strcat on steroids". It's a printf-like function which returns a malloced string. In my experience, it is surprisingly useful: it makes complex concatenations easy in C. All these functions are declared in a new header, inc/abrtlib.h. It also contains a list of #includes: +#include <ctype.h> +#include <dirent.h> +#include <errno.h> +#include <fcntl.h> +#include <inttypes.h> +#include <setjmp.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> +#include <stddef.h> +#include <string.h> +#include <sys/poll.h> +#include <sys/mman.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <termios.h> +#include <time.h> +#include <unistd.h> +/* Try to pull in PATH_MAX */ +#include <limits.h> +#include <sys/param.h> +#ifndef PATH_MAX +# define PATH_MAX 256 +#endif +#include <pwd.h> +#include <grp.h> The rationale to do so is that these headers are pretty standard, and by having them included in this one file, we won't need to add #includes into many .c[pp] files later. The slowdown from gcc parsing these headers even if they are not needed is not worth spending time on optimizing out. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* GUI: Added detection whether daemon is running (gui disables itself)Jiri Moskovcak2009-07-282-29/+48
|
* Applet: Added detection whether daemon is runningJiri Moskovcak2009-07-283-10/+70
|
* Be more paranoid about /proc/.../core_patternDenys Vlasenko2009-07-251-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fixing whitespace damage, no code changesDenys Vlasenko2009-07-251-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* added forgotten "throw" keywordsDenys Vlasenko2009-07-221-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Merge branch 'master' of ssh://git.fedorahosted.org/git/abrtJiri Moskovcak2009-07-221-17/+16
|\
| * fix several resource leaks on error pathsDenys Vlasenko2009-07-221-17/+16
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | PyHook: removed forgotten debug outputJiri Moskovcak2009-07-221-1/+0
| |
* | Applet: more fixes to work if configure was run with non-default prefixJiri Moskovcak2009-07-223-2/+7
| |
* | Daemon: threading fixesJiri Moskovcak2009-07-222-16/+32
| |