*
*/
-#include <pthread.h>
-#include <signal.h>
-#include <sys/signal.h>
-#include <search.h> /* XXX insque(3)/remque(3) protos. */
-
#include <rpmsw.h>
+/**
+ */
typedef struct rpmsig_s * rpmsig;
+/**
+ */
typedef struct rpmsqElem * rpmsq;
-typedef void (*rpmsqAction_t) (int signum, siginfo_t *info, void *context)
+/**
+ * Default signal handler prototype.
+ * @param signum signal number
+ * @param info (siginfo_t) signal info
+ * @param context signal context
+ */
+typedef void (*rpmsqAction_t) (int signum, void * info, void * context)
/*@*/;
/*@-redecl@*/
pid_t child; /*!< Currently running child. */
volatile pid_t reaped; /*!< Reaped waitpid(3) return. */
volatile int status; /*!< Reaped waitpid(3) status. */
- struct rpmsw_s begin; /*!< Start time. */
- rpmtime_t msecs; /*!< Instance duration (msecs). */
- rpmtime_t script_msecs; /*!< Accumulated script duration (msecs). */
+ struct rpmop_s op; /*!< Scriptlet operation timestamp; */
+ rpmtime_t ms_scriptlets; /*!< Accumulated script duration (msecs). */
int reaper; /*!< Register SIGCHLD handler? */
int pipes[2]; /*!< Parent/child interlock. */
+/*@shared@*/
void * id; /*!< Blocking thread id (pthread_t). */
pthread_mutex_t mutex; /*!< Signal delivery to thread condvar. */
pthread_cond_t cond;
};
+/*@-exportlocal@*/
/*@unchecked@*/
extern rpmsq rpmsqQueue;
+/*@=exportlocal@*/
/*@unchecked@*/
extern sigset_t rpmsqCaught;
#endif
/**
+ * Insert node into from queue.
+ * @param elem node to link
+ * @param prev previous node from queue
+ * @return 0 on success
*/
+/*@-exportlocal@*/
int rpmsqInsert(/*@null@*/ void * elem, /*@null@*/ void * prev)
- /*@globals rpmsqQueue @*/
- /*@modifies elem, rpmsqQueue @*/;
+ /*@globals systemState @*/
+ /*@modifies elem, prev, systemState @*/;
+/*@=exportlocal@*/
/**
+ * Remove node from queue.
+ * @param elem node to link
+ * @return 0 on success
*/
+/*@-exportlocal@*/
int rpmsqRemove(/*@null@*/ void * elem)
- /*@modifies elem @*/;
+ /*@globals fileSystem, internalState @*/
+ /*@modifies elem, fileSystem, internalState @*/;
+/*@=exportlocal@*/
/**
+ * Default signal handler.
+ * @param signum signal number
+ * @param info (siginfo_t) signal info
+ * @param context signal context
*/
-void rpmsqAction(int signum, siginfo_t * info, void * context)
- /*@globals rpmsqCaught, fileSystem @*/
- /*@modifies rpmsqCaught, fileSystem @*/;
+/*@-exportlocal@*/
+void rpmsqAction(int signum, void * info, void * context)
+ /*@globals rpmsqCaught, rpmsqQueue, errno, fileSystem @*/
+ /*@modifies rpmsqCaught, rpmsqQueue, errno, fileSystem @*/;
+/*@=exportlocal@*/
/**
* Enable or disable a signal handler.
* @return no. of refs, -1 on error
*/
int rpmsqEnable(int signum, /*@null@*/ rpmsqAction_t handler)
- /*@globals rpmsqCaught, fileSystem, internalState @*/
- /*@modifies rpmsqCaught, fileSystem, internalState @*/;
+ /*@globals rpmsqCaught, rpmsqQueue, fileSystem, internalState @*/
+ /*@modifies rpmsqCaught, rpmsqQueue, fileSystem, internalState @*/;
/**
* Fork a child process.
/*@modifies sq, fileSystem, internalState @*/;
/**
- * Call a function in a thread synchronously.
+ * Call a function in a thread.
* @param start function
* @param arg function argument
+ * @return thread pointer (NULL on error)
+ */
+void * rpmsqThread(void * (*start) (void * arg), void * arg)
+ /*@globals internalState @*/
+ /*@modifies internalState @*/;
+
+/**
+ * Wait for thread to terminate.
+ * @param thread thread
* @return 0 on success
*/
-int rpmsqThread(void * (*start) (void * arg), void * arg)
- /*@globals fileSystem, internalState @*/
- /*@modifies fileSystem, internalState @*/;
+int rpmsqJoin(/*@null@*/ void * thread)
+ /*@globals internalState @*/
+ /*@modifies internalState @*/;
+
+/**
+ * Compare thread with current thread.
+ * @param thread thread
+ * @return 0 if not equal
+ */
+int rpmsqThreadEqual(/*@null@*/ void * thread)
+ /*@globals internalState @*/
+ /*@modifies internalState @*/;
/**
* Execute a command, returning its status.
*/
int rpmsqExecve (const char ** argv)
- /*@*/;
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/;
#ifdef __cplusplus
}