[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpm-cvs
Subject:    [CVS] RPM: rpm-5_4: rpm/rpmio/ rpmsq.c rpmsq.h rpmutil.h
From:       "Jeff Johnson" <jbj () rpm5 ! org>
Date:       2014-09-29 11:04:01
Message-ID: 20140929110401.39D297BA48 () rpm5 ! org
[Download RAW message or body]

  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   29-Sep-2014 13:04:00
  Branch: rpm-5_4                          Handle: 2014092911040000

  Modified files:           (Branch: rpm-5_4)
    rpm/rpmio               rpmsq.c rpmsq.h rpmutil.h

  Log:
    - rpmsq: haul out splint trash, prototype TM_ATOMIC insque/remque.

  Summary:
    Revision    Changes     Path
    1.42.6.6    +47 -228    rpm/rpmio/rpmsq.c
    1.14.6.4    +13 -55     rpm/rpmio/rpmsq.h
    1.1.2.3     +18 -18     rpm/rpmio/rpmutil.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsq.c
  ============================================================================
  $ cvs diff -u -r1.42.6.5 -r1.42.6.6 rpmsq.c
  --- rpm/rpmio/rpmsq.c	24 Sep 2014 13:03:04 -0000	1.42.6.5
  +++ rpm/rpmio/rpmsq.c	29 Sep 2014 11:04:00 -0000	1.42.6.6
  @@ -4,119 +4,6 @@
   
   #include "system.h"
   
  -#if defined(__LCLINT__)
  -#define	_BITS_SIGTHREAD_H	/* XXX avoid __sigset_t heartburn. */
  -
  -/*@-incondefs -protoparammatch@*/
  -/*@-exportheader@*/
  -/*@constant int SA_SIGINFO@*/
  -extern int sighold(int sig)
  -	/*@globals errno, systemState @*/;
  -extern int sigignore(int sig)
  -	/*@globals errno, systemState @*/;
  -extern int sigpause(int sig)
  -	/*@globals errno, systemState @*/;
  -extern int sigrelse(int sig)
  -	/*@globals errno, systemState @*/;
  -extern void (*sigset(int sig, void (*disp)(int)))(int)
  -	/*@globals errno, systemState @*/;
  -
  -struct qelem;
  -extern	void __insque(struct qelem * __elem, struct qelem * __prev)
  -	/*@modifies  __elem, __prev @*/;
  -extern	void __remque(struct qelem * __elem)
  -	/*@modifies  __elem @*/;
  -
  -extern pthread_t pthread_self(void)
  -	/*@*/;
  -extern int pthread_equal(pthread_t t1, pthread_t t2)
  -	/*@*/;
  -
  -extern int pthread_create(/*@out@*/ pthread_t *restrict thread,
  -		const pthread_attr_t *restrict attr,
  -		void *(*start_routine)(void*), void *restrict arg)
  -	/*@modifies *thread @*/;
  -extern int pthread_join(pthread_t thread, /*@out@*/ void **value_ptr)
  -	/*@modifies *value_ptr @*/;
  -
  -extern int pthread_setcancelstate(int state, /*@out@*/ int *oldstate)
  -	/*@globals internalState @*/
  -	/*@modifies *oldstate, internalState @*/;
  -extern int pthread_setcanceltype(int type, /*@out@*/ int *oldtype)
  -	/*@globals internalState @*/
  -	/*@modifies *oldtype, internalState @*/;
  -extern void pthread_testcancel(void)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  -extern void pthread_cleanup_pop(int execute)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  -extern void pthread_cleanup_push(void (*routine)(void*), void *arg)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  -extern void _pthread_cleanup_pop(/*@out@*/ struct _pthread_cleanup_buffer \
                *__buffer, int execute)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  -extern void _pthread_cleanup_push(/*@out@*/ struct _pthread_cleanup_buffer \
                *__buffer, void (*routine)(void*), /*@out@*/ void *arg)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  -
  -extern int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *attr, errno, internalState @*/;
  -extern int pthread_mutexattr_init(/*@out@*/ pthread_mutexattr_t *attr)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *attr, errno, internalState @*/;
  -
  -int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict attr,
  -		/*@out@*/ int *restrict type)
  -	/*@modifies *type @*/;
  -int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *attr, errno, internalState @*/;
  -
  -extern int pthread_mutex_destroy(pthread_mutex_t *mutex)
  -	/*@modifies *mutex @*/;
  -extern int pthread_mutex_init(/*@out@*/ pthread_mutex_t *restrict mutex,
  -		/*@null@*/ const pthread_mutexattr_t *restrict attr)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *mutex, errno, internalState @*/;
  -
  -extern int pthread_mutex_lock(pthread_mutex_t *mutex)
  -	/*@globals errno @*/
  -	/*@modifies *mutex, errno @*/;
  -extern int pthread_mutex_trylock(pthread_mutex_t *mutex)
  -	/*@globals errno @*/
  -	/*@modifies *mutex, errno @*/;
  -extern int pthread_mutex_unlock(pthread_mutex_t *mutex)
  -	/*@globals errno @*/
  -	/*@modifies *mutex, errno @*/;
  -
  -extern int pthread_cond_destroy(pthread_cond_t *cond)
  -	/*@modifies *cond @*/;
  -extern int pthread_cond_init(/*@out@*/ pthread_cond_t *restrict cond,
  -		const pthread_condattr_t *restrict attr)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *cond, errno, internalState @*/;
  -
  -extern int pthread_cond_timedwait(pthread_cond_t *restrict cond,
  -		pthread_mutex_t *restrict mutex,
  -		const struct timespec *restrict abstime)
  -	/*@modifies *cond, *mutex @*/;
  -extern int pthread_cond_wait(pthread_cond_t *restrict cond,
  -		pthread_mutex_t *restrict mutex)
  -	/*@modifies *cond, *mutex @*/;
  -extern int pthread_cond_broadcast(pthread_cond_t *cond)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *cond, errno, internalState @*/;
  -extern int pthread_cond_signal(pthread_cond_t *cond)
  -	/*@globals errno, internalState @*/
  -	/*@modifies *cond, errno, internalState @*/;
  -
  -/*@=exportheader@*/
  -/*@=incondefs =protoparammatch@*/
  -#endif
  -
   #include <signal.h>
   #if !defined(__QNX__)
   #  include <sys/signal.h>
  @@ -168,29 +55,31 @@
   #define sigpause(sig) __RPM_sigpause(sig)
   #endif
   
  -/* portability fallback for insque(3)/remque(3) */
   #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__QNX__)
   struct qelem {
  -  struct qelem *q_forw;
  -  struct qelem *q_back;
  +    struct qelem *q_forw;
  +    struct qelem *q_back;
  +    char q_data[1];
   };
  +#endif
   
   static void __insque(struct qelem * elem, struct qelem * pred)
   {
  -  elem -> q_forw = pred -> q_forw;
  -  pred -> q_forw -> q_back = elem;
  -  elem -> q_back = pred;
  -  pred -> q_forw = elem;
  +  RPM_GNUC_TM_ATOMIC {
  +    elem -> q_forw = pred -> q_forw;
  +    pred -> q_forw -> q_back = elem;
  +    elem -> q_back = pred;
  +    pred -> q_forw = elem;
  +  }
   }
  -#define	insque(_e, _p)	__insque((_e), (_p))
   
  -static	void __remque(struct qelem * elem)
  -{
  -  elem -> q_forw -> q_back = elem -> q_back;
  -  elem -> q_back -> q_forw = elem -> q_forw;
  +static void __remque(struct qelem * elem)
  +{
  +  RPM_GNUC_TM_ATOMIC {
  +    elem -> q_forw -> q_back = elem -> q_back;
  +    elem -> q_back -> q_forw = elem -> q_forw;
  +  }
   }
  -#define	remque(_e)	__remque(_e)
  -#endif
   
   #if defined(WITH_PTHREADS)
   
  @@ -202,17 +91,12 @@
   # endif
   
   #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
  -/*@unchecked@*/
   static pthread_mutex_t rpmsigTbl_lock = PTHREAD_MUTEX_INITIALIZER;
   #else
  -/*@unchecked@*/
  -/*@-type@*/
   static pthread_mutex_t rpmsigTbl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
  -/*@=type@*/
   #endif
   
  -/*@-macromatchname@*/
  -#define	DO_LOCK()	/*@-retvalint@*/pthread_mutex_lock(&rpmsigTbl_lock)/*@=retvalint@*/;
  +#define	DO_LOCK()	pthread_mutex_lock(&rpmsigTbl_lock)
   #define	DO_UNLOCK()	pthread_mutex_unlock(&rpmsigTbl_lock);
   #define	INIT_LOCK()	\
       {	pthread_mutexattr_t attr; \
  @@ -232,38 +116,31 @@
       (void) pthread_setcanceltype ((__oldtype), &(__oldtype));
   
   #define	SAME_THREAD(_a, _b)	pthread_equal(((pthread_t)_a), ((pthread_t)_b))
  -/*@-macromatchname@*/
   
   #define ME() __tid2vp(pthread_self())
  -/*@shared@*/
   static void *__tid2vp(pthread_t tid)
  -	/*@*/
   {
  -    union { pthread_t tid; /*@shared@*/ void *vp; } u;
  +    union { pthread_t tid; void *vp; } u;
       u.tid = tid;
       return u.vp;
   }
   
  -#else
  +#else	/* WITH_PTHREADS */
   
  -/*@-macromatchname@*/
   #define	DO_LOCK() (0)
   #define	DO_UNLOCK() (0)
   #define	INIT_LOCK()
  -#define	ADD_REF(__tbl)	/*@-noeffect@*/ (0) /*@=noeffect@*/
  -#define	SUB_REF(__tbl)	/*@-noeffect@*/ (0) /*@=noeffect@*/
  +#define	ADD_REF(__tbl)	(0)
  +#define	SUB_REF(__tbl)	(0)
   #define	CLEANUP_HANDLER(__handler, __arg, __oldtypeptr)
   #define	CLEANUP_RESET(__execute, __oldtype)
   
   #define	SAME_THREAD(_a, _b)	(42)
  -/*@=macromatchname@*/
   
   #define ME() __pid2vp(getpid())
  -/*@shared@*/
   static void *__pid2vp(pid_t pid)
  -	/*@*/
   {
  -    union { pid_t pid; /*@shared@*/ void *vp; } u;
  +    union { pid_t pid; void *vp; } u;
       u.pid = pid;
       return u.vp;
   }
  @@ -275,20 +152,13 @@
   
   #include "debug.h"
   
  -#define	_RPMSQ_DEBUG	0
  -/*@unchecked@*/
  -int _rpmsq_debug = _RPMSQ_DEBUG;
  +int _rpmsq_debug;
  +#define	SPEW(_list)	if (_rpmsq_debug) fprintf _list
   
   /* XXX __OpenBSD__ insque(3) needs rock->q_forw initialized. */
  -/*@unchecked@*/
  -/*@-fullinitblock @*/
   static struct rpmsqElem rpmsqRock = { &rpmsqRock, NULL };
  -/*@=fullinitblock @*/
   
  -/*@-compmempass@*/
  -/*@unchecked@*/
   rpmsq rpmsqQueue = &rpmsqRock;
  -/*@=compmempass@*/
   
   int rpmsqInsert(void * elem, void * prev)
   {
  @@ -296,25 +166,20 @@
       int ret = -1;
   
       if (sq != NULL) {
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "    Insert(%p): %p\n", ME(), sq);
  -#endif
  +SPEW((stderr, "    Insert(%p): %p\n", ME(), sq));
   	ret = sighold(SIGCHLD);
   	if (ret == 0) {
   	    sq->child = 0;
   	    sq->reaped = 0;
   	    sq->status = 0;
  -	   /* ==> Set to 1 to catch SIGCHLD, set to 0 to use waitpid(2).  */
  +	    /* ==> Set to 1 to catch SIGCHLD, set to 0 to use waitpid(2).  */
   	    sq->reaper = 1;
   	    sq->pipes[0] = sq->pipes[1] = -1;
   
   	    sq->id = ME();
  -/*@-noeffect@*/
  -	    insque(elem, (prev != NULL ? prev : rpmsqQueue));
  -/*@=noeffect@*/
  +	    __insque(elem, (prev != NULL ? prev : rpmsqQueue));
  +	  }
   	    ret = sigrelse(SIGCHLD);
  -	}
       }
       return ret;
   }
  @@ -326,15 +191,11 @@
   
       if (elem != NULL) {
   
  -#ifdef _RPMSQ_DEBUG
   if (_rpmsq_debug)
  -fprintf(stderr, "    Remove(%p): %p\n", ME(), sq);
  -#endif
  +SPEW((stderr, "    Remove(%p): %p\n", ME(), sq));
   	ret = sighold (SIGCHLD);
   	if (ret == 0) {
  -/*@-noeffect@*/
  -	    remque(elem);
  -/*@=noeffect@*/
  +	    __remque(elem);
   	    sq->id = NULL;
   	    if (sq->pipes[1] > 0)	ret = close(sq->pipes[1]);
   	    if (sq->pipes[0] > 0)	ret = close(sq->pipes[0]);
  @@ -350,11 +211,8 @@
       return ret;
   }
   
  -/*@unchecked@*/
   sigset_t rpmsqCaught;
   
  -/*@unchecked@*/
  -/*@-fullinitblock@*/
   static struct rpmsig_s {
       int signum;
       void (*handler) (int signum, void * info, void * context);
  @@ -383,19 +241,17 @@
       { SIGXFSZ,	rpmsqAction },
   #define	rpmsigTbl_sigxfsz	(&rpmsigTbl[7])		/* XXX unused */
   #endif
  -#endif
  +#endif	/* NOTYET */
   
       { -1,	NULL },
   };
  -/*@=fullinitblock@*/
   
   int rpmsqIsCaught(int signum)
   {
       return sigismember(&rpmsqCaught, signum);
   }
   
  -void rpmsqAction(int signum, /*@unused@*/ void * info,
  -		/*@unused@*/ void * context)
  +void rpmsqAction(int signum, void * info, void * context)
   {
       int save = errno;
       rpmsig tbl;
  @@ -415,9 +271,8 @@
   
   		/* XXX errno set to ECHILD/EINVAL/EINTR. */
   		if (reaped <= 0)
  -		    /*@innerbreak@*/ break;
  +		    break;
   
  -		/* XXX insque(3)/remque(3) are dequeue, not ring. */
   		for (sq = rpmsqQueue->q_forw;
   		     sq != NULL && sq != rpmsqQueue;
   		     sq = sq->q_forw)
  @@ -425,27 +280,25 @@
   		    int ret;
   
   		    if (sq->child != reaped)
  -			/*@innercontinue@*/ continue;
  +			continue;
   		    sq->reaped = reaped;
   		    sq->status = status;
   
   		    ret = close(sq->pipes[1]);	sq->pipes[1] = -1;
   
  -		    /*@innerbreak@*/ break;
  +		    break;
   		}
   	    }
  -	    /*@switchbreak@*/ break;
  +	    break;
   	default:
  -	    /*@switchbreak@*/ break;
  +	    break;
   	}
   	break;
       }
       errno = save;
   }
   
  -int rpmsqEnable(int signum, /*@null@*/ rpmsqAction_t handler)
  -	/*@globals rpmsigTbl @*/
  -	/*@modifies rpmsigTbl @*/
  +int rpmsqEnable(int signum, rpmsqAction_t handler)
   {
       int tblsignum = (signum >= 0 ? signum : -signum);
       struct sigaction sa;
  @@ -506,10 +359,7 @@
   
       if (sq->reaper) {
   	xx = rpmsqInsert(sq, NULL);
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "    Enable(%p): %p\n", ME(), sq);
  -#endif
  +SPEW((stderr, "    Enable(%p): %p\n", ME(), sq));
   	xx = rpmsqEnable(SIGCHLD, NULL);
       }
   
  @@ -534,19 +384,13 @@
   	xx = close(sq->pipes[0]);
   	sq->pipes[0] = sq->pipes[1] = -1;
   
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "     Child(%p): %p child %d\n", ME(), sq, (int)getpid());
  -#endif
  +SPEW((stderr, "     Child(%p): %p child %d\n", ME(), sq, (int)getpid()));
   
       } else {				/* Parent. */
   
   	sq->child = pid;
   
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "    Parent(%p): %p child %d\n", ME(), sq, (int)sq->child);
  -#endif
  +SPEW((stderr, "    Parent(%p): %p child %d\n", ME(), sq, (int)sq->child));
   
       }
   
  @@ -562,8 +406,6 @@
    * @return		0 on success
    */
   static int rpmsqWaitUnregister(rpmsq sq)
  -	/*@globals fileSystem, internalState @*/
  -	/*@modifies sq, fileSystem, internalState @*/
   {
       int nothreads = 0;
       int ret = 0;
  @@ -586,7 +428,6 @@
       (void) rpmswEnter(&sq->op, -1);
   
       /* Wait for handler to receive SIGCHLD. */
  -    /*@-infloops@*/
       while (ret == 0 && sq->reaped != sq->child) {
   	if (nothreads)
   	    /* Note that sigpause re-enables SIGCHLD. */
  @@ -603,27 +444,20 @@
   	    xx = sighold(SIGCHLD);
   	}
       }
  -    /*@=infloops@*/
   
       /* Accumulate stopwatch time spent waiting, potential performance gain. */
       sq->ms_scriptlets += rpmswExit(&sq->op, -1)/1000;
   
       xx = sigrelse(SIGCHLD);
   
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "      Wake(%p): %p child %d reaper %d ret %d\n", ME(), sq, \
                (int)sq->child, sq->reaper, ret);
  -#endif
  +SPEW((stderr, "      Wake(%p): %p child %d reaper %d ret %d\n", ME(), sq, \
(int)sq->child, sq->reaper, ret));  
       /* Remove processed SIGCHLD item from queue. */
       xx = rpmsqRemove(sq);
   
       /* Disable SIGCHLD handler on refcount == 0. */
       xx = rpmsqEnable(-SIGCHLD, NULL);
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "   Disable(%p): %p\n", ME(), sq);
  -#endif
  +SPEW((stderr, "   Disable(%p): %p\n", ME(), sq));
   
       return ret;
   }
  @@ -631,10 +465,7 @@
   pid_t rpmsqWait(rpmsq sq)
   {
   
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "      Wait(%p): %p child %d reaper %d\n", ME(), sq, \
                (int)sq->child, sq->reaper);
  -#endif
  +SPEW((stderr, "      Wait(%p): %p child %d reaper %d\n", ME(), sq, (int)sq->child, \
sq->reaper));  
       if (sq->reaper) {
   	(void) rpmsqWaitUnregister(sq);
  @@ -646,16 +477,10 @@
   	} while (reaped >= 0 && reaped != sq->child);
   	sq->reaped = reaped;
   	sq->status = status;
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "   Waitpid(%p): %p child %d reaped %d\n", ME(), sq, \
                (int)sq->child, (int)sq->reaped);
  -#endif
  +SPEW((stderr, "   Waitpid(%p): %p child %d reaped %d\n", ME(), sq, (int)sq->child, \
(int)sq->reaped));  }
   
  -#ifdef _RPMSQ_DEBUG
  -if (_rpmsq_debug)
  -fprintf(stderr, "      Fini(%p): %p child %d status 0x%x\n", ME(), sq, \
                (int)sq->child, sq->status);
  -#endif
  +SPEW((stderr, "      Fini(%p): %p child %d status 0x%x\n", ME(), sq, \
(int)sq->child, sq->status));  
       return sq->reaped;
   }
  @@ -706,8 +531,6 @@
   #if defined(WITH_PTHREADS)
   static void
   sigchld_cancel (void *arg)
  -	/*@globals rpmsigTbl, fileSystem, internalState @*/
  -	/*@modifies rpmsigTbl, fileSystem, internalState @*/
   {
       pid_t child = *(pid_t *) arg;
       pid_t result;
  @@ -733,8 +556,6 @@
    */
   int
   rpmsqExecve (const char ** argv)
  -	/*@globals rpmsigTbl @*/
  -	/*@modifies rpmsigTbl @*/
   {
   #if defined(WITH_PTHREADS)
       int oldtype;
  @@ -747,7 +568,7 @@
       int xx;
   
   #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
  -	INIT_LOCK ();
  +    INIT_LOCK ();
   #endif
   
       xx = DO_LOCK ();
  @@ -772,9 +593,7 @@
   	goto out;
       }
   
  -/*@-sysunrecog@*/
       CLEANUP_HANDLER(sigchld_cancel, &pid, &oldtype);
  -/*@=sysunrecog@*/
   
       pid = fork ();
       if (pid < (pid_t) 0) {		/* fork failed.  */
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsq.h
  ============================================================================
  $ cvs diff -u -r1.14.6.3 -r1.14.6.4 rpmsq.h
  --- rpm/rpmio/rpmsq.h	27 Sep 2014 15:51:24 -0000	1.14.6.3
  +++ rpm/rpmio/rpmsq.h	29 Sep 2014 11:04:00 -0000	1.14.6.4
  @@ -3,18 +3,13 @@
   
   /** \ingroup rpmio
    * \file rpmio/rpmsq.h
  - *
    */
   
   #include <unistd.h>
   #include <rpmsw.h>
   
  -/**
  - */
   typedef struct rpmsig_s * rpmsig;
   
  -/**
  - */
   typedef struct rpmsqElem * rpmsq;
   
   /**
  @@ -23,13 +18,9 @@
    * @param info		(siginfo_t) signal info
    * @param context	signal context
    */
  -typedef void (*rpmsqAction_t) (int signum, void * info, void * context)
  -	/*@*/;
  +typedef void (*rpmsqAction_t) (int signum, void * info, void * context);
   
  -/*@-redecl@*/
  -/*@unchecked@*/
   extern int _rpmsq_debug;
  -/*@=redecl@*/
   
   #if defined(_RPMSQ_INTERNAL)
   /**
  @@ -45,17 +36,12 @@
       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). */
   };
   #endif
   
  -/*@-exportlocal@*/
  -/*@unchecked@*/
   extern rpmsq rpmsqQueue;
  -/*@=exportlocal@*/
   
  -/*@unchecked@*/
   extern sigset_t rpmsqCaught;
   
   #ifdef __cplusplus
  @@ -68,22 +54,14 @@
    * @param prev		previous node from queue
    * @return		0 on success
    */
  -/*@-exportlocal@*/
  -int rpmsqInsert(/*@null@*/ void * elem, /*@null@*/ void * prev)
  -	/*@globals rpmsqQueue, systemState @*/
  -	/*@modifies elem, prev, rpmsqQueue, systemState @*/;
  -/*@=exportlocal@*/
  +int rpmsqInsert(void * elem, void * prev);
   
   /**
    * Remove node from queue.
    * @param elem		node to link
    * @return		0 on success
    */
  -/*@-exportlocal@*/
  -int rpmsqRemove(/*@null@*/ void * elem)
  -	/*@globals fileSystem, internalState @*/
  -	/*@modifies elem, fileSystem, internalState @*/;
  -/*@=exportlocal@*/
  +int rpmsqRemove(void * elem);
   
   /** \ingroup rpmsq
    * Test if given signal has been caught (while signals blocked).
  @@ -91,8 +69,7 @@
    * @param signum        signal to test for
    * @return              1 if caught, 0 if not and -1 on error
    */
  -int rpmsqIsCaught(int signum)
  -	/*@*/;
  +int rpmsqIsCaught(int signum);
   
   /**
    * Default signal handler.
  @@ -100,12 +77,7 @@
    * @param info		(siginfo_t) signal info
    * @param context	signal context
    */
  -/*@-exportlocal@*/
  -void rpmsqAction(int signum, void * info, void * context)
  -	/*@globals rpmsqCaught, rpmsqQueue, errno, fileSystem, internalState @*/
  -	/*@modifies rpmsqCaught, rpmsqQueue, errno,
  -		fileSystem, internalState @*/;
  -/*@=exportlocal@*/
  +void rpmsqAction(int signum, void * info, void * context);
   
   /**
    * Enable or disable a signal handler.
  @@ -113,27 +85,21 @@
    * @param handler	sa_sigaction handler (or NULL to use rpmsqHandler())
    * @return		no. of refs, -1 on error
    */
  -int rpmsqEnable(int signum, /*@null@*/ rpmsqAction_t handler)
  -	/*@globals rpmsqCaught, rpmsqQueue, fileSystem, internalState @*/
  -	/*@modifies rpmsqCaught, rpmsqQueue, fileSystem, internalState @*/;
  +int rpmsqEnable(int signum, rpmsqAction_t handler);
   
   /**
    * Fork a child process.
    * @param sq		scriptlet queue element
    * @return		fork(2) pid
    */
  -pid_t rpmsqFork(rpmsq sq)
  -	/*@globals fileSystem, internalState @*/
  -	/*@modifies sq, fileSystem, internalState @*/;
  +pid_t rpmsqFork(rpmsq sq);
   
   /**
    * Wait for child process to be reaped.
    * @param sq		scriptlet queue element
    * @return		reaped child pid
    */
  -pid_t rpmsqWait(rpmsq sq)
  -	/*@globals fileSystem, internalState @*/
  -	/*@modifies sq, fileSystem, internalState @*/;
  +pid_t rpmsqWait(rpmsq sq);
   
   /**
    * Call a function in a thread.
  @@ -141,35 +107,27 @@
    * @param arg		function argument
    * @return		thread pointer (NULL on error)
    */
  -void * rpmsqThread(void * (*start) (void * arg), void * arg)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  +void * rpmsqThread(void * (*start) (void * arg), void * arg);
   
   /**
    * Wait for thread to terminate.
    * @param thread	thread
    * @return		0 on success
    */
  -int rpmsqJoin(/*@null@*/ void * thread)
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  +int rpmsqJoin(void * thread);
   
   /**
    * Compare thread with current thread.
    * @param thread	thread
    * @return		0 if not equal
    */
  -int rpmsqThreadEqual(/*@null@*/ void * thread)
  -	RPM_GNUC_CONST
  -	/*@globals internalState @*/
  -	/*@modifies internalState @*/;
  +int rpmsqThreadEqual(void * thread)
  +	RPM_GNUC_CONST;
   
   /**
    * Execute a command, returning its status.
    */
  -int rpmsqExecve (const char ** argv)
  -	/*@globals fileSystem, internalState @*/
  -	/*@modifies fileSystem, internalState @*/;
  +int rpmsqExecve (const char ** argv);
   
   #ifdef __cplusplus
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmutil.h
  ============================================================================
  $ cvs diff -u -r1.1.2.2 -r1.1.2.3 rpmutil.h
  --- rpm/rpmio/rpmutil.h	28 Sep 2014 19:31:11 -0000	1.1.2.2
  +++ rpm/rpmio/rpmutil.h	29 Sep 2014 11:04:00 -0000	1.1.2.3
  @@ -106,25 +106,25 @@
   #endif
   
   #if !__clang__ &&  __GNUC__ == 4 && __GNUC_MINOR__ >= 7	/* XXX gud enuf? */
  -#  define RPM_GNUC_STM_SAFE	__attribute__((transaction_safe))
  -#  define RPM_GNUC_STM_PURE	__attribute__((transaction_pure))
  -#  define RPM_GNUC_STM_CALLABLE	__attribute__((transaction_callable))
  -#  define RPM_GNUC_STM_UNSAFE	__attribute__((transaction_unsafe))
  -#  define RPM_GNUC_STM_MAYCANCEL __attribute__((transaction_may_cancel_outer))
  -#  define RPM_GNUC_STM_WRAP(func) __attribute__((transaction_wrap(func)))
  -#  define RPM_GNUC_STM_ATOMIC	__transaction_atomic
  -#  define RPM_GNUC_STM_RELAXED	__transaction_relaxed
  -#  define RPM_GNUC_STM_CANCEL	__transaction_cancel	/* XXX [[outer]] */
  +#  define RPM_GNUC_TM_SAFE	__attribute__((transaction_safe))
  +#  define RPM_GNUC_TM_PURE	__attribute__((transaction_pure))
  +#  define RPM_GNUC_TM_CALLABLE	__attribute__((transaction_callable))
  +#  define RPM_GNUC_TM_UNSAFE	__attribute__((transaction_unsafe))
  +#  define RPM_GNUC_TM_MAYCANCEL __attribute__((transaction_may_cancel_outer))
  +#  define RPM_GNUC_TM_WRAP(func) __attribute__((transaction_wrap(func)))
  +#  define RPM_GNUC_TM_ATOMIC	__transaction_atomic	/* XXX [[outer]] */
  +#  define RPM_GNUC_TM_RELAXED	__transaction_relaxed
  +#  define RPM_GNUC_TM_CANCEL	__transaction_cancel	/* XXX [[outer]] */
   #else
  -#  define RPM_GNUC_STM_SAFE
  -#  define RPM_GNUC_STM_PURE
  -#  define RPM_GNUC_STM_CALLABLE
  -#  define RPM_GNUC_STM_UNSAFE
  -#  define RPM_GNUC_STM_MAYCANCEL
  -#  define RPM_GNUC_STM_WRAP(func)
  -#  define RPM_GNUC_STM_ATOMIC
  -#  define RPM_GNUC_STM_RELAXED
  -#  define RPM_GNUC_STM_CANCEL
  +#  define RPM_GNUC_TM_SAFE
  +#  define RPM_GNUC_TM_PURE
  +#  define RPM_GNUC_TM_CALLABLE
  +#  define RPM_GNUC_TM_UNSAFE
  +#  define RPM_GNUC_TM_MAYCANCEL
  +#  define RPM_GNUC_TM_WRAP(func)
  +#  define RPM_GNUC_TM_ATOMIC
  +#  define RPM_GNUC_TM_RELAXED
  +#  define RPM_GNUC_TM_CANCEL
   #endif
   
   
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic