00001 #ifndef H_RPMSQ
00002 #define H_RPMSQ
00003
00009 #include <rpm/rpmsw.h>
00010 #include <signal.h>
00011 #if defined(_RPMSQ_INTERNAL)
00012 #include <pthread.h>
00013 #endif
00014
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018
00021 typedef struct rpmsig_s * rpmsig;
00022
00025 typedef struct rpmsqElem * rpmsq;
00026
00033 #ifdef SA_SIGINFO
00034 typedef void (*rpmsqAction_t) (int signum, void * info, void * context);
00035 #else
00036 typedef void (*rpmsqAction_t) (int signum);
00037 #endif
00038
00039 extern int _rpmsq_debug;
00040
00041
00042 #if defined(_RPMSQ_INTERNAL)
00043
00046 struct rpmsqElem {
00047 struct rpmsqElem * q_forw;
00048 struct rpmsqElem * q_back;
00049 pid_t child;
00050 volatile pid_t reaped;
00051 volatile int status;
00052 struct rpmop_s op;
00053 rpmtime_t ms_scriptlets;
00054 int reaper;
00055 int pipes[2];
00056 void * id;
00057 pthread_mutex_t mutex;
00058 pthread_cond_t cond;
00059 };
00060 #endif
00061
00068 int rpmsqIsCaught(int signum);
00069
00076 #ifdef SA_SIGINFO
00077 void rpmsqAction(int signum, void * info, void * context);
00078 #else
00079 void rpmsqAction(int signum);
00080 #endif
00081
00088 int rpmsqEnable(int signum, rpmsqAction_t handler);
00089
00095 pid_t rpmsqFork(rpmsq sq);
00096
00102 pid_t rpmsqWait(rpmsq sq);
00103
00110 void * rpmsqThread(void * (*start) (void * arg), void * arg);
00111
00117 int rpmsqJoin(void * thread);
00118
00124 int rpmsqThreadEqual(void * thread);
00125
00129 int rpmsqExecve (const char ** argv);
00130
00131 #ifdef __cplusplus
00132 }
00133 #endif
00134
00135 #endif