[CVS] RPM: rpm-5_4: rpm/ CHANGES rpm/rpmio/ librpmio.vers msqio.c rpmi...
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 25-May-2017 22:02:13 Branch: rpm-5_4 Handle: 2017052520021201 Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/rpmio librpmio.vers msqio.c rpmio.c rpmmsq.h tmq.c xzdio.c Log: - msqio: add fopencookie wrapper. Summary: RevisionChanges Path 1.3501.2.560+1 -0 rpm/CHANGES 2.199.2.80 +6 -0 rpm/rpmio/librpmio.vers 1.1.2.10+350 -112 rpm/rpmio/msqio.c 1.230.2.50 +14 -6 rpm/rpmio/rpmio.c 1.1.2.9 +11 -18 rpm/rpmio/rpmmsq.h 1.1.2.9 +98 -71 rpm/rpmio/tmq.c 1.14.4.6+6 -4 rpm/rpmio/xzdio.c patch -p0 <<'@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.3501.2.559 -r1.3501.2.560 CHANGES --- rpm/CHANGES 24 May 2017 06:03:18 - 1.3501.2.559 +++ rpm/CHANGES 25 May 2017 20:02:12 - 1.3501.2.560 @@ -1,4 +1,5 @@ 5.4.17 -> 5.4.18: +- jbj: msqio: add fopencookie wrapper. - jbj: msqio: add condvar to get rid of racy timeouts (loopback mode only). - jbj: msqio: make peace with O_NONBLOCK. - jbj: msqio: permit POSIX/SysV message queue coexistence, default is POSIX. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/librpmio.vers $ cvs diff -u -r2.199.2.79 -r2.199.2.80 librpmio.vers --- rpm/rpmio/librpmio.vers 22 May 2017 13:30:42 - 2.199.2.79 +++ rpm/rpmio/librpmio.vers 25 May 2017 20:02:13 - 2.199.2.80 @@ -598,6 +598,8 @@ rpmioMcheckCheckAll; rpmioMprobe; rpmioNewPool; +rpmioOflags; +rpmioOflagsPoptTable; rpmioParse; rpmioPFree; rpmioPipeOutput; @@ -734,10 +736,14 @@ msqio; rpmmsqClose; rpmmsqCtl; +rpmmsqDeliver; rpmmsqDump; +rpmmsqFdopen; +rpmmsqFlush; rpmmsqFree; rpmmsqNew; rpmmsqNotify; +rpmmsqOpen; rpmmsqReader; rpmmsqRecv; rpmmsqSend; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/msqio.c $ cvs diff -u -r1.1.2.9 -r1.1.2.10 msqio.c --- rpm/rpmio/msqio.c 24 May 2017 06:03:18 - 1.1.2.9 +++ rpm/rpmio/msqio.c 25 May 2017 20:02:13 - 1.1.2.10 @@ -28,6 +28,7 @@ #include "debug.h" int _rpmmsq_debug; + #define F_ISSET(_f, _FLAG) ((_f) & RPMMSQ_FLAGS_##_FLAG) #define MSQF_ISSET(_FLAG) F_ISSET(msq->flags, _FLAG) @@ -50,12 +51,204 @@ GENfree(rpmmsq) #endif /* __cplusplus */ +/* === */ +#if defined(WITH_MQ) +static inline +mqd_t __mq_open(const char *name, int oflag, mode_t mode, + struct mq_attr *attr) +{ +rpmmsq msq = NULL; +mqd_t mqdes = mq_open(name, oflag, mode, attr); +SPEW((stderr, "<--\t%s(%s,0x%x,0%o,%p) qid %d\n", "mq_open", name, oflag, mode, attr, mqdes)); +return mqdes; +} + +static inline +int __mq_notify(mqd_t mqdes, const struct sigevent *sevp) +{ +rpmmsq msq = NULL; +int rc = mq_notify(mqdes, sevp); +SPEW((stderr, "<--\t%s(0x%x,%p) rc %d\n", "mq_notify", mqdes, sevp, rc)); +return rc; +} + +static inline +int __mq_send(mqd_t mqdes, const char *msg_ptr, + size_t msg_len, unsigned int msg_prio) +{ +rpmmsq msq = NULL; +int ncmax = 32; +int nc = 0; +const char * buf = msg_ptr; +size_t count = msg_len; +unsigned int prio = msg_prio; +int rc; + +rc = mq_send(mqdes, msg_ptr, msg_len, msg_prio); +if (rc == 0) { + /* Ensure printable. */ + for (nc = 0; nc < ncmax; nc++) { + if (nc < (int)count && isprint(buf[nc])) + continue; + break; + } +} +SPEW((stderr, "<--\t%s(0x%x,%p[%lu],%u) rc %d\t\t\t\"%.*s\"\n", "mq_send", mqdes, buf, (unsigned long)count, prio, rc, nc, buf)); +return rc; +} + +static inline +ssize_t __mq_receive(mqd_t mqdes, char *msg_ptr, + size_t msg_len, unsigned int *msg_prio) +{ +rpmmsq msq = NULL; +int ncmax = 32; +int nc = 0; +char * buf = msg_ptr; +size_t count = msg_len; +unsigned int *priop = msg_prio; +unsigned int prio = *msg_prio; +ssize_t rc; + +rc = mq_receive(mqdes, msg_ptr, msg_len, msg_prio); +if (rc >= 0) {
[CVS] RPM: rpm-5_4: rpm/ CHANGES rpm/rpmio/ librpmio.vers msqio.c rpmi...
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 21-May-2017 07:30:35 Branch: rpm-5_4 Handle: 2017052105303500 Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/rpmio librpmio.vers msqio.c rpmio.c rpmmsq.h tmq.c Log: - msqio: add (and prefer) POSIX message queues (if available). Summary: RevisionChanges Path 1.3501.2.554+4 -3 rpm/CHANGES 2.199.2.78 +1 -0 rpm/rpmio/librpmio.vers 1.1.2.4 +192 -48rpm/rpmio/msqio.c 1.230.2.48 +11 -7 rpm/rpmio/rpmio.c 1.1.2.4 +12 -3 rpm/rpmio/rpmmsq.h 1.1.2.4 +6 -0 rpm/rpmio/tmq.c patch -p0 <<'@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.3501.2.553 -r1.3501.2.554 CHANGES --- rpm/CHANGES 20 May 2017 19:21:07 - 1.3501.2.553 +++ rpm/CHANGES 21 May 2017 05:30:35 - 1.3501.2.554 @@ -1,7 +1,8 @@ 5.4.17 -> 5.4.18: -- jbj: rpmmsq: permit building --without-msq. -- jbj: rpmmsq: add per-executable and per-rpm message queue id's. -- jbj: rpmmsq: use pool allocation. permit queue deletion. +- jbj: msqio: add (and prefer) POSIX message queues (if available). +- jbj: msqio: permit building --without-msq. +- jbj: msqio: add per-executable and per-rpm message queue id's. +- jbj: rmsqio: use pool allocation. permit queue deletion. - jbj: rpmio: add ".msqio" to send/receive SysV messages. - jbj: rpmsw: use clock_gettime (if available). - jbj: poptALL: spew info for rpm itself with -vv. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/librpmio.vers $ cvs diff -u -r2.199.2.77 -r2.199.2.78 librpmio.vers --- rpm/rpmio/librpmio.vers 20 May 2017 19:21:07 - 2.199.2.77 +++ rpm/rpmio/librpmio.vers 21 May 2017 05:30:35 - 2.199.2.78 @@ -737,6 +737,7 @@ rpmmsqDump; rpmmsqFree; rpmmsqNew; +rpmmsqNotify; rpmmsqRead; rpmmsqWrite; _nix; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/msqio.c $ cvs diff -u -r1.1.2.3 -r1.1.2.4 msqio.c --- rpm/rpmio/msqio.c 20 May 2017 19:21:07 - 1.1.2.3 +++ rpm/rpmio/msqio.c 21 May 2017 05:30:35 - 1.1.2.4 @@ -5,14 +5,17 @@ #include "system.h" -#if defined(WITH_MSQ) +#if defined(WITH_MQ) || defined(WITH_MSQ) #if defined(HAVE_SYS_MSG_H) # include #endif #if defined(HAVE_SYS_IPC_H) # include #endif -#endif /* WITH_MSQ */ +#if defined(HAVE_MQUEUE_H) +# include +#endif +#endif /* WITH_MQ */ #include "rpmio_internal.h" #include @@ -38,9 +41,12 @@ { rpmmsq msq = (rpmmsq) _msq; if (msq) { - msq->key = 0; - msq->perms = 0; + msq->flags = 0; + msq->qname = _free(msq->qname); msq->qid = 0; + msq->oflags = 0; + msq->omode = 0; + msq->key = 0; msq->mtype = 0; } } @@ -75,35 +81,95 @@ assert(fmode != NULL); /* XXX return NULL instead? */ msq->qid = -1; -#if defined(WITH_MSQ) const char * s = fmode; int c; -int perms = 0664; +int oflags = 0; +int omode = 0664; switch ((c = *s++)) { -case 'a':perms |= IPC_CREAT; break; -case 'w':perms |= IPC_CREAT; break; +case 'a': + oflags = O_WRONLY | O_CREAT | O_APPEND; + omode |= IPC_CREAT; + break; +case 'w': + oflags = O_WRONLY | O_CREAT | O_TRUNC; + omode |= IPC_CREAT; + break; +case 'r': + oflags = O_RDONLY; + break; } while ((c = *s++) != 0) { switch (c) { - case '.': break; - case '+': continue; - case 'x': perms |= IPC_EXCL; continue; - default:continue; + case '.': + break; + case '+': + oflags &= ~(O_RDONLY|O_WRONLY); + oflags |= O_RDWR; + continue; + break; + case 'c': /* XXX no cancel */ + continue; + break; + case 'm': /* XXX mmap */ + continue; + break; + case 'e': /* O_CLOEXEC */ + oflags |= O_CLOEXEC; + continue; + break; + case 'n': /* XXX O_NONBLOCK */ + oflags |= O_NONBLOCK; + contin
[CVS] RPM: rpm-5_4: rpm/ CHANGES rpm/rpmio/ librpmio.vers msqio.c rpmi...
RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 20-May-2017 18:30:10 Branch: rpm-5_4 Handle: 2017052016301000 Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/rpmio librpmio.vers msqio.c rpmio.c rpmmsq.h tmq.c Log: - rpmmsq: use pool allocation. permit queue deletion. Summary: RevisionChanges Path 1.3501.2.552+1 -0 rpm/CHANGES 2.199.2.76 +1 -0 rpm/rpmio/librpmio.vers 1.1.2.2 +60 -70 rpm/rpmio/msqio.c 1.230.2.47 +2 -0 rpm/rpmio/rpmio.c 1.1.2.2 +26 -61 rpm/rpmio/rpmmsq.h 1.1.2.2 +7 -6 rpm/rpmio/tmq.c patch -p0 <<'@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.3501.2.551 -r1.3501.2.552 CHANGES --- rpm/CHANGES 20 May 2017 13:40:40 - 1.3501.2.551 +++ rpm/CHANGES 20 May 2017 16:30:10 - 1.3501.2.552 @@ -1,4 +1,5 @@ 5.4.17 -> 5.4.18: +- jbj: rpmmsq: use pool allocation. permit queue deletion. - jbj: rpmio: add ".msqio" to send/receive SysV messages. - jbj: rpmsw: use clock_gettime (if available). - jbj: poptALL: spew info for rpm itself with -vv. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/librpmio.vers $ cvs diff -u -r2.199.2.75 -r2.199.2.76 librpmio.vers --- rpm/rpmio/librpmio.vers 20 May 2017 13:40:40 - 2.199.2.75 +++ rpm/rpmio/librpmio.vers 20 May 2017 16:30:10 - 2.199.2.76 @@ -730,6 +730,7 @@ rpmmrbRunFile; _rpmmsq_debug; msqio; +rpmmsqClose; rpmmsqCtl; rpmmsqDump; rpmmsqFree; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/msqio.c $ cvs diff -u -r1.1.2.1 -r1.1.2.2 msqio.c --- rpm/rpmio/msqio.c 20 May 2017 13:40:40 - 1.1.2.1 +++ rpm/rpmio/msqio.c 20 May 2017 16:30:10 - 1.1.2.2 @@ -17,106 +17,85 @@ int _rpmmsq_debug; +#define SPEW(_list) if (_rpmmsq_debug || _rpmio_debug) fprintf _list + #define MSQONLY(fd) assert(fdGetIo(fd) == bzdio) -const char * rpmmsqStrerror(rpmmsq msq) -{ -return __FUNCTION__; /* XXX */ -} +#ifdef __cplusplus +GENfree(rpmmsq) +#endif /* __cplusplus */ -void rpmmsqClose(rpmmsq msq, int abort, const char ** errmsq) +static void rpmmsqFini(void *_msq) { -if (_rpmmsq_debug) - rpmmsqDump(__FUNCTION__, msq); +rpmmsq msq = (rpmmsq) _msq; +if (msq) { + msq->key = 0; + msq->perms = 0; + msq->qid = 0; + msq->mtype = 0; +} } -rpmmsq rpmmsqFree(rpmmsq msq, int abort) -{ -if (msq && abort) - rpmmsqCtl(msq, IPC_RMID, NULL); -return rpmmsqFini(msq); -} +RPMIOPOOL_MODULE(msq) -rpmmsq rpmmsqNew(const char * path, const char * fmode, int fdno) +rpmmsq rpmmsqNew(const char * path, const char * fmode, int fdno, int flags) { -rpmmsq msq; -mode_t flags = 0; -int perms = 0644; +rpmmsq msq = rpmmsqGetPool(_rpmmsqPool); +int perms = 0664; const char * s = fmode; int c; assert(fmode != NULL); /* XXX return NULL instead? */ switch ((c = *s++)) { -case 'a': - flags = O_WRONLY | O_CREAT | O_APPEND; - perms |= IPC_CREAT; - break; -case 'w': - flags = O_WRONLY | O_CREAT | O_TRUNC; - perms |= IPC_CREAT; - break; -case 'r': - flags = O_RDONLY; - break; +case 'a':perms |= IPC_CREAT; break; +case 'w':perms |= IPC_CREAT; break; } while ((c = *s++) != 0) { switch (c) { - case '.': - break; - case '+': - flags &= ~(O_RDONLY|O_WRONLY); - flags |= O_RDWR; - continue; - break; - case 'x': - flags |= O_EXCL; - perms |= IPC_EXCL; - continue; - break; - default: - continue; - break; + case '.': break; + case '+': continue; + case 'x': perms |= IPC_EXCL; continue; + default:continue; } break; } -int _projid = 42; -long _mtype = getpid(); /* XXX single queue, multiple processes. */ -msq = rpmmsqInit(path, _projid, _mtype, perms); +msq->key = path && *path + ? ftok(path, 42) +