00001 #ifndef H_RPMSQ
00002 #define H_RPMSQ
00003 
00009 #include <rpm/rpmsw.h>
00010 #include <signal.h>
00011 
00012 #ifdef __cplusplus
00013 extern "C" {
00014 #endif
00015 
00018 typedef struct rpmsig_s * rpmsig;
00019 
00022 typedef struct rpmsqElem * rpmsq;
00023 
00030 #ifdef SA_SIGINFO
00031 typedef void (*rpmsqAction_t) (int signum, void * info, void * context);
00032 #else
00033 typedef void (*rpmsqAction_t) (int signum);
00034 #endif
00035 
00036 extern int _rpmsq_debug;
00037 
00038 
00039 #if defined(_RPMSQ_INTERNAL)
00040 
00043 struct rpmsqElem {
00044     struct rpmsqElem * q_forw;  
00045     struct rpmsqElem * q_back;
00046     pid_t child;                
00047     volatile pid_t reaped;      
00048     volatile int status;        
00049     struct rpmop_s op;          
00050     rpmtime_t ms_scriptlets;    
00051     int reaper;                 
00052     int pipes[2];               
00053     void * id;                  
00054     pthread_mutex_t mutex;      
00055     pthread_cond_t cond;
00056 };
00057 #endif 
00058 
00065 int rpmsqIsCaught(int signum);
00066 
00073 #ifdef SA_SIGINFO
00074 void rpmsqAction(int signum, void * info, void * context);
00075 #else
00076 void rpmsqAction(int signum);
00077 #endif
00078 
00085 int rpmsqEnable(int signum, rpmsqAction_t handler);
00086 
00092 pid_t rpmsqFork(rpmsq sq);
00093 
00099 pid_t rpmsqWait(rpmsq sq);
00100 
00107 void * rpmsqThread(void * (*start) (void * arg), void * arg);
00108 
00114 int rpmsqJoin(void * thread);
00115 
00121 int rpmsqThreadEqual(void * thread);
00122 
00126 int rpmsqExecve (const char ** argv);
00127 
00128 #ifdef __cplusplus
00129 }
00130 #endif
00131 
00132 #endif