~ubuntu-branches/ubuntu/trusty/rsyslog/trusty

« back to all changes in this revision

Viewing changes to runtime/nsdsel_ptcp.c

  • Committer: Dave Walker (Daviey)
  • Author(s): Scott Moser
  • Date: 2011-06-17 20:59:38 UTC
  • mfrom: (36.1.8 oneiric.merge)
  • Revision ID: davewalker@ubuntu.com-20110617205938-pfkizxz2wsgzi2ot
Tags: 5.8.1-1ubuntu1
* Resynchronise with Debian (LP: #794230).  Remaining changes:
  - Run as rsyslog:rsyslog, set $FileOwner to syslog
  - Replace init script with debian/rsyslog.upstart.
  - debian/rsyslog.logrotate: Use reload command to restart rsyslog
  - debian/rsyslog.conf: enable $RepeatedMsgReduction 
    to avoid bloating the syslog file (LP #453444)
  - Add debian/rsyslog.dmesg.upstart to save initial dmesg into a file.
    Install it in debian/rules.
  - debian/50-default.conf: set of default rules for syslog (forwarded to
    Debian #603160). remove file in postrm on purge. manage with ucf.
  - debian/rules: build with LDFLAGS=""
* Dropped:
  - debian/control: Bump build-dependency on debhelper
    debian now depends on dh >= 8
* New upstream release.
* Bump Standards-Version to 3.9.2. No further changes.
* Enable and install impstats module. (Closes: #620114)
* Update logcheck rule. (Closes: #616659)
* debian/rsyslog.init: Set correct compat level (5).
* The way rsyslog processes SIGHUP has changed. It no longer does a reload
  of its configuration, but simply closes all open files. To apply a changed
  configuration, rsyslogd needs to be restarted now.
  - Drop "reload" action from debian/rsyslog.init, map "force-reload" to
    "restart". (Closes: #580897)
  - Add "rotate" action to debian/rsyslog.init which sends SIGHUP to
    rsyslogd. Use that in debian/rsyslog.logrotate. (Closes: #626365)
  - Update debian/rsyslog-mysql.postinst and rsyslog-pgsql.postinst to use
    restart instead of reload.
  - Add a NEWS file explaining the changed SIGHUP handling.
* New upstream stable release.
* New upstream release.
  - Properly handle ANSI SQL strings in ompgsql. (Closes: #600479)
* New upstream release.
* debian/patches/02-pmaixforwardedfrom_type_nokeep.patch
  - Remove, merged upstream.
* debian/patches/03-epoll_create1-fallback.patch
  - Remove, merged upstream.
* debian/patches/03-epoll_create1-fallback.patch
  - If epoll_create1() is not available during runtime, fall back to
    epoll_create(). This fixes remote syslog when runnig rsyslog on a
    lenny kernel. (Closes: #617996)
* New upstream release.
* debian/rsyslog.links
  - Create symlink for rsyslog.service in multi-user.target.wants so rsyslog
    is enabled by default when using systemd.
* debian/patches/02-pmaixforwardedfrom_type_nokeep.patch
  - Fix build failure in aixforwardedfrom parser module by setting the
    module type to NOKEEP.
* debian/rsyslog.preinst
  - Remove old rsyslog.socket symlink from sockets.target.wants on upgrades
    as rsyslog uses syslog.socket now which is provided by systemd.
* debian/rsyslog.install
  - Stop installing rsyslog.socket.
* New upstream release.
* New upstream release.
  - Fix regression in imuxsock plugin which did no longer sanitize received
    messages. This makes 02-cleanup-trailing-lf.patch obsolete and also
    fixes the SQL syntax errors in the mysql output if the input contained
    NUL bytes. Closes: #614061
* Enable and install omprog output plugin. Closes: #552095
* Improve package description. Closes: #612948
  Thanks to Justin B Rye for the patch.
* debian/patches/02-cleanup-trailing-lf.patch
  - Fix regression in imuxsock plugin which did not remove a trailing LF
    anymore. Patch cherry-picked from upstream Git. Closes: #612829
* New upstream release.
* Enable and install parser modules.
* New upstream release.
* Upload to unstable.
* debian/patches/02-typo_fix_equation_sign.patch
  - Removed, merged upstream.
* debian/patches/03-atomic_operations.patch
  - Removed, merged upstream.
* debian/patches/03-atomic_operations.patch
  - Fix build failures on platforms which don't have 64 bit atomic
    operations. Patch cherry-picked from upstream Git. Closes: #600930
* New upstream development release.
* Remove patches, merged upstream
  - debian/patches/02-install_also_rsyslog_socket.patch
  - debian/patches/02-tls_loop_fix.patch
* debian/patches/02-typo_fix_equation_sign.patch
  - Fix small typo ("equation sign"). Closes: #575589
* debian/rsyslog.postinst
  - Remove pre-lenny migration code to rotate old log files from sysklogd.
* New upstream development release.
* debian/rsyslog.install
  - Install omruleset.so plugin: http://www.rsyslog.com/doc/omruleset.html
* debian/rsyslog.default
  - Start rsyslogd with native -c5 mode.
* Install systemd unit files which allow to run rsyslog in socket activation
  mode when systemd is used.
* debian/patches/02-install_also_rsyslog_socket.patch
  - When enabling rsyslog.service also enable rsyslog.socket. Patch
    cherry-picked from upstream Git.
* Bump debhelper compatibility level to 8. Update Build-Depends accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include "errmsg.h"
37
37
#include "nsd_ptcp.h"
38
38
#include "nsdsel_ptcp.h"
 
39
#include "unlimited_select.h"
39
40
 
40
41
/* static data */
41
42
DEFobjStaticHelpers
47
48
 */
48
49
BEGINobjConstruct(nsdsel_ptcp) /* be sure to specify the object type also in END macro! */
49
50
        pThis->maxfds = 0;
 
51
#ifdef USE_UNLIMITED_SELECT
 
52
        pThis->pReadfds = calloc(1, glbl.GetFdSetSize());
 
53
        pThis->pWritefds = calloc(1, glbl.GetFdSetSize());
 
54
#else
50
55
        FD_ZERO(&pThis->readfds);
51
56
        FD_ZERO(&pThis->writefds);
 
57
#endif
52
58
ENDobjConstruct(nsdsel_ptcp)
53
59
 
54
60
 
55
61
/* destructor for the nsdsel_ptcp object */
56
62
BEGINobjDestruct(nsdsel_ptcp) /* be sure to specify the object type also in END and CODESTART macros! */
57
63
CODESTARTobjDestruct(nsdsel_ptcp)
 
64
#ifdef USE_UNLIMITED_SELECT
 
65
        freeFdSet(pThis->pReadfds);
 
66
        freeFdSet(pThis->pWritefds);
 
67
#endif
58
68
ENDobjDestruct(nsdsel_ptcp)
59
69
 
60
70
 
65
75
        DEFiRet;
66
76
        nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
67
77
        nsd_ptcp_t *pSock = (nsd_ptcp_t*) pNsd;
 
78
#ifdef USE_UNLIMITED_SELECT
 
79
        fd_set *pReadfds = pThis->pReadfds;
 
80
        fd_set *pWritefds = pThis->pWritefds;
 
81
#else
 
82
        fd_set *pReadfds = &pThis->readfds;
 
83
        fd_set *pWritefds = &pThis->writefds;
 
84
#endif
68
85
 
69
86
        ISOBJ_TYPE_assert(pSock, nsd_ptcp);
70
87
        ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
71
88
 
72
89
        switch(waitOp) {
73
90
                case NSDSEL_RD:
74
 
                        FD_SET(pSock->sock, &pThis->readfds);
 
91
                        FD_SET(pSock->sock, pReadfds);
75
92
                        break;
76
93
                case NSDSEL_WR:
77
 
                        FD_SET(pSock->sock, &pThis->writefds);
 
94
                        FD_SET(pSock->sock, pWritefds);
78
95
                        break;
79
96
                case NSDSEL_RDWR:
80
 
                        FD_SET(pSock->sock, &pThis->readfds);
81
 
                        FD_SET(pSock->sock, &pThis->writefds);
 
97
                        FD_SET(pSock->sock, pReadfds);
 
98
                        FD_SET(pSock->sock, pWritefds);
82
99
                        break;
83
100
        }
84
101
 
98
115
        DEFiRet;
99
116
        int i;
100
117
        nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
 
118
#ifdef USE_UNLIMITED_SELECT
 
119
        fd_set *pReadfds = pThis->pReadfds;
 
120
        fd_set *pWritefds = pThis->pWritefds;
 
121
#else
 
122
        fd_set *pReadfds = &pThis->readfds;
 
123
        fd_set *pWritefds = &pThis->writefds;
 
124
#endif
101
125
 
102
126
        ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
103
127
        assert(piNumReady != NULL);
106
130
                // TODO: name in dbgprintf!
107
131
                dbgprintf("--------<NSDSEL_PTCP> calling select, active fds (max %d): ", pThis->maxfds);
108
132
                for(i = 0; i <= pThis->maxfds; ++i)
109
 
                        if(FD_ISSET(i, &pThis->readfds) || FD_ISSET(i, &pThis->writefds))
 
133
                        if(FD_ISSET(i, pReadfds) || FD_ISSET(i, pWritefds))
110
134
                                dbgprintf("%d ", i);
111
135
                dbgprintf("\n");
112
136
        }
113
137
 
114
138
        /* now do the select */
115
 
        *piNumReady = select(pThis->maxfds+1, &pThis->readfds, &pThis->writefds, NULL, NULL);
 
139
        *piNumReady = select(pThis->maxfds+1, pReadfds, pWritefds, NULL, NULL);
116
140
 
117
141
        RETiRet;
118
142
}
125
149
        DEFiRet;
126
150
        nsdsel_ptcp_t *pThis = (nsdsel_ptcp_t*) pNsdsel;
127
151
        nsd_ptcp_t *pSock = (nsd_ptcp_t*) pNsd;
 
152
#ifdef USE_UNLIMITED_SELECT
 
153
        fd_set *pReadfds = pThis->pReadfds;
 
154
        fd_set *pWritefds = pThis->pWritefds;
 
155
#else
 
156
        fd_set *pReadfds = &pThis->readfds;
 
157
        fd_set *pWritefds = &pThis->writefds;
 
158
#endif
128
159
 
129
160
        ISOBJ_TYPE_assert(pThis, nsdsel_ptcp);
130
161
        ISOBJ_TYPE_assert(pSock, nsd_ptcp);
132
163
 
133
164
        switch(waitOp) {
134
165
                case NSDSEL_RD:
135
 
                        *pbIsReady = FD_ISSET(pSock->sock, &pThis->readfds);
 
166
                        *pbIsReady = FD_ISSET(pSock->sock, pReadfds);
136
167
                        break;
137
168
                case NSDSEL_WR:
138
 
                        *pbIsReady = FD_ISSET(pSock->sock, &pThis->writefds);
 
169
                        *pbIsReady = FD_ISSET(pSock->sock, pWritefds);
139
170
                        break;
140
171
                case NSDSEL_RDWR:
141
 
                        *pbIsReady =   FD_ISSET(pSock->sock, &pThis->readfds)
142
 
                                     | FD_ISSET(pSock->sock, &pThis->writefds);
 
172
                        *pbIsReady =   FD_ISSET(pSock->sock, pReadfds)
 
173
                                     | FD_ISSET(pSock->sock, pWritefds);
143
174
                        break;
144
175
        }
145
176