rpmsq.h
Go to the documentation of this file.

    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, siginfo_t * info, void * context);
    00035 #else
    00036 typedef void (*rpmsqAction_t) (int signum);
    00037 #endif
    00038
    00039 /* XXX make this fully opaque? */
    00040 #if defined(_RPMSQ_INTERNAL)
    00041
    00044 struct rpmsqElem {
    00045     struct rpmsqElem * q_forw;
    00046     struct rpmsqElem * q_back;
    00047     pid_t child;
    00048     volatile pid_t reaped;
    00049     volatile int status;
    00050     struct rpmop_s op;
    00051     rpmtime_t ms_scriptlets;
    00052     int reaper;
    00053     int pipes[2];
    00054     void * id;
    00055     pthread_mutex_t mutex;
    00056     pthread_cond_t cond;
    00057 };
    00058 #endif /* _RPMSQ_INTERNAL */
    00059
    00066 int rpmsqIsCaught(int signum);
    00067
    00074 #ifdef SA_SIGINFO
    00075 void rpmsqAction(int signum, siginfo_t * info, void * context);
    00076 #else
    00077 void rpmsqAction(int signum);
    00078 #endif
    00079
    00086 int rpmsqEnable(int signum, rpmsqAction_t handler);
    00087
    00093 pid_t rpmsqFork(rpmsq sq);
    00094
    00100 pid_t rpmsqWait(rpmsq sq);
    00101
    00102 #ifdef __cplusplus
    00103 }
    00104 #endif
    00105
    00106 #endif  /* H_RPMSQ */