~ubuntu-branches/ubuntu/maverick/postfix/maverick-security

« back to all changes in this revision

Viewing changes to src/util/vstream.h

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, Wietse Venema, LaMont Jones
  • Date: 2009-06-03 14:17:08 UTC
  • mfrom: (1.1.22 upstream)
  • Revision ID: james.westby@ubuntu.com-20090603141708-o9u59xlor7nmd2x1
[Wietse Venema]

* New upstream release: 2.6.2~rc1

[LaMont Jones]

* move postfix-add-{filter,policy} manpages to section 8, and deliver
* provide: default-mta on ubuntu

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
typedef ssize_t (*VSTREAM_FN) (int, void *, size_t, int, void *);
34
34
typedef int (*VSTREAM_WAITPID_FN) (pid_t, WAIT_STATUS_T *, int);
35
35
 
 
36
#ifdef NO_SIGSETJMP
 
37
#define VSTREAM_JMP_BUF jmp_buf
 
38
#else
 
39
#define VSTREAM_JMP_BUF sigjmp_buf
 
40
#endif
 
41
 
36
42
typedef struct VSTREAM {
37
43
    VBUF    buf;                        /* generic intelligent buffer */
38
44
    int     fd;                         /* file handle, no 256 limit */
48
54
    pid_t   pid;                        /* vstream_popen/close() */
49
55
    VSTREAM_WAITPID_FN waitpid_fn;      /* vstream_popen/close() */
50
56
    int     timeout;                    /* read/write timout */
51
 
    jmp_buf *jbuf;                      /* exception handling */
 
57
    VSTREAM_JMP_BUF *jbuf;              /* exception handling */
52
58
    struct timeval iotime;              /* time of last fill/flush */
53
59
    /* At bottom for Postfix 2.4 binary compatibility. */
54
60
    ssize_t req_bufsize;                /* write buffer size */
148
154
extern VSTREAM *vstream_vfprintf(VSTREAM *, const char *, va_list);
149
155
 
150
156
extern ssize_t vstream_peek(VSTREAM *);
 
157
extern ssize_t vstream_bufstat(VSTREAM *, int);
 
158
 
 
159
#define VSTREAM_BST_FLAG_IN             (1<<0)
 
160
#define VSTREAM_BST_FLAG_OUT            (1<<1)
 
161
#define VSTREAM_BST_FLAG_PEND           (1<<2)
 
162
 
 
163
#define VSTREAM_BST_MASK_DIR    (VSTREAM_BST_FLAG_IN | VSTREAM_BST_FLAG_OUT)
 
164
#define VSTREAM_BST_IN_PEND     (VSTREAM_BST_FLAG_IN | VSTREAM_BST_FLAG_PEND)
 
165
#define VSTREAM_BST_OUT_PEND    (VSTREAM_BST_FLAG_OUT | VSTREAM_BST_FLAG_PEND)
 
166
 
 
167
#define vstream_peek(vp) vstream_bufstat((vp), VSTREAM_BST_IN_PEND)
151
168
 
152
169
 /*
153
170
  * Exception handling. We use pointer to jmp_buf to avoid a lot of unused
154
171
  * baggage for streams that don't need this functionality.
 
172
  * 
 
173
  * XXX sigsetjmp()/siglongjmp() save and restore the signal mask which can
 
174
  * avoid surprises in code that manipulates signals, but unfortunately some
 
175
  * systems have bugs in their implementation.
155
176
  */
 
177
#ifdef NO_SIGSETJMP
156
178
#define vstream_setjmp(stream)          setjmp((stream)->jbuf[0])
157
179
#define vstream_longjmp(stream, val)    longjmp((stream)->jbuf[0], (val))
 
180
#else
 
181
#define vstream_setjmp(stream)          sigsetjmp((stream)->jbuf[0], 1)
 
182
#define vstream_longjmp(stream, val)    siglongjmp((stream)->jbuf[0], (val))
 
183
#endif
158
184
 
159
185
 /*
160
186
  * Tweaks and workarounds.