Postfix3.3.1
マクロ定義 | 関数 | 変数
vstream.c ファイル
#include <sys_defs.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include "mymalloc.h"
#include "msg.h"
#include "vbuf_print.h"
#include "iostuff.h"
#include "vstring.h"
#include "vstream.h"

[ソースコード]

マクロ定義

#define VSTREAM_STATIC(v)   ((v) >= VSTREAM_IN && (v) <= VSTREAM_ERR)
 
#define VSTREAM_ACC_MASK(f)   ((f) & (O_APPEND | O_WRONLY | O_RDWR))
 
#define VSTREAM_CAN_READ(f)
 
#define VSTREAM_CAN_WRITE(f)
 
#define VSTREAM_BUF_COUNT(bp, n)   ((bp)->flags & VSTREAM_FLAG_READ ? -(n) : (n))
 
#define VSTREAM_BUF_AT_START(bp)
 
#define VSTREAM_BUF_AT_OFFSET(bp, offset)
 
#define VSTREAM_BUF_AT_END(bp)
 
#define VSTREAM_BUF_ZERO(bp)
 
#define VSTREAM_BUF_ACTIONS(bp, get_action, put_action, space_action)
 
#define VSTREAM_SAVE_STATE(stream, buffer, filedes)
 
#define VSTREAM_RESTORE_STATE(stream, buffer, filedes)
 
#define VSTREAM_FORK_STATE(stream, buffer, filedes)
 
#define VSTREAM_FLAG_READ_DOUBLE   (VSTREAM_FLAG_READ | VSTREAM_FLAG_DOUBLE)
 
#define VSTREAM_FLAG_WRITE_DOUBLE   (VSTREAM_FLAG_WRITE | VSTREAM_FLAG_DOUBLE)
 
#define VSTREAM_FFLUSH_SOME(stream)   vstream_fflush_some((stream), (stream)->buf.len - (stream)->buf.cnt)
 
#define VSTREAM_SUB_TIME(x, y, z)
 
#define VSTREAM_TRUNCATE(count, base)   (((count) / (base)) * (base))
 
#define VSTREAM_ROUNDUP(count, base)   VSTREAM_TRUNCATE(count + base - 1, base)
 
#define VSTREAM_MAYBE_PURGE_WRITE(d, b)
 
#define VSTREAM_MAYBE_PURGE_READ(d, b)
 
#define SWAP(type, a, b)   do { type temp = (a); (a) = (b); (b) = (temp); } while (0)
 

関数

int vstream_fpurge (VSTREAM *stream, int direction)
 
off_t vstream_fseek (VSTREAM *stream, off_t offset, int whence)
 
off_t vstream_ftell (VSTREAM *stream)
 
VSTREAMvstream_fdopen (int fd, int flags)
 
VSTREAMvstream_fopen (const char *path, int flags, mode_t mode)
 
int vstream_fflush (VSTREAM *stream)
 
int vstream_fclose (VSTREAM *stream)
 
int vstream_fdclose (VSTREAM *stream)
 
VSTREAMvstream_printf (const char *fmt,...)
 
VSTREAMvstream_fprintf (VSTREAM *stream, const char *fmt,...)
 
int vstream_fputs (const char *str, VSTREAM *stream)
 
void vstream_control (VSTREAM *stream, int name,...)
 
VSTREAMvstream_vprintf (const char *format, va_list ap)
 
VSTREAMvstream_vfprintf (VSTREAM *vp, const char *format, va_list ap)
 
ssize_t vstream_bufstat (VSTREAM *vp, int command)
 
ssize_t vstream_peek (VSTREAM *vp)
 
const char * vstream_peek_data (VSTREAM *vp)
 

変数

VSTREAM vstream_fstd []
 

マクロ定義詳解

#define SWAP (   type,
  a,
 
)    do { type temp = (a); (a) = (b); (b) = (temp); } while (0)
#define VSTREAM_ACC_MASK (   f)    ((f) & (O_APPEND | O_WRONLY | O_RDWR))

vstream.c523 行目に定義があります。

#define VSTREAM_BUF_ACTIONS (   bp,
  get_action,
  put_action,
  space_action 
)
値:
{ \
(bp)->get_ready = (get_action); \
(bp)->put_ready = (put_action); \
(bp)->space = (space_action); \
}

vstream.c555 行目に定義があります。

#define VSTREAM_BUF_AT_END (   bp)
値:
{ \
(bp)->cnt = 0; \
(bp)->ptr = (bp)->data + (bp)->len; \
}

vstream.c544 行目に定義があります。

#define VSTREAM_BUF_AT_OFFSET (   bp,
  offset 
)
値:
{ \
(bp)->ptr = (bp)->data + (offset); \
(bp)->cnt = VSTREAM_BUF_COUNT(bp, (bp)->len - (offset)); \
}
#define VSTREAM_BUF_COUNT(bp, n)
Definition: vstream.c:531

vstream.c539 行目に定義があります。

#define VSTREAM_BUF_AT_START (   bp)
値:
{ \
(bp)->cnt = VSTREAM_BUF_COUNT((bp), (bp)->len); \
(bp)->ptr = (bp)->data; \
}
#define VSTREAM_BUF_COUNT(bp, n)
Definition: vstream.c:531

vstream.c534 行目に定義があります。

#define VSTREAM_BUF_COUNT (   bp,
 
)    ((bp)->flags & VSTREAM_FLAG_READ ? -(n) : (n))

vstream.c531 行目に定義があります。

#define VSTREAM_BUF_ZERO (   bp)
値:
{ \
(bp)->flags = 0; \
(bp)->data = (bp)->ptr = 0; \
(bp)->len = (bp)->cnt = 0; \
}

vstream.c549 行目に定義があります。

#define VSTREAM_CAN_READ (   f)
値:
(VSTREAM_ACC_MASK(f) == O_RDONLY \
|| VSTREAM_ACC_MASK(f) == O_RDWR)
#define VSTREAM_ACC_MASK(f)
Definition: vstream.c:523

vstream.c525 行目に定義があります。

#define VSTREAM_CAN_WRITE (   f)
値:
(VSTREAM_ACC_MASK(f) & O_WRONLY \
|| VSTREAM_ACC_MASK(f) & O_RDWR \
|| VSTREAM_ACC_MASK(f) & O_APPEND)
#define VSTREAM_ACC_MASK(f)
Definition: vstream.c:523

vstream.c527 行目に定義があります。

#define VSTREAM_FFLUSH_SOME (   stream)    vstream_fflush_some((stream), (stream)->buf.len - (stream)->buf.cnt)

vstream.c583 行目に定義があります。

#define VSTREAM_FLAG_READ_DOUBLE   (VSTREAM_FLAG_READ | VSTREAM_FLAG_DOUBLE)

vstream.c580 行目に定義があります。

#define VSTREAM_FLAG_WRITE_DOUBLE   (VSTREAM_FLAG_WRITE | VSTREAM_FLAG_DOUBLE)

vstream.c581 行目に定義があります。

#define VSTREAM_FORK_STATE (   stream,
  buffer,
  filedes 
)
値:
{ \
stream->buffer = stream->buf; \
stream->filedes = stream->fd; \
stream->buffer.data = stream->buffer.ptr = 0; \
stream->buffer.len = stream->buffer.cnt = 0; \
stream->buffer.flags &= ~VSTREAM_FLAG_FIXED; \
};
#define VSTREAM_FLAG_FIXED
Definition: vstream.h:78

vstream.c572 行目に定義があります。

#define VSTREAM_MAYBE_PURGE_READ (   d,
 
)
値:
#define VSTREAM_PURGE_READ
Definition: vstream.h:88
#define VSTREAM_BUF_AT_END(bp)
Definition: vstream.c:544
#define VSTREAM_MAYBE_PURGE_WRITE (   d,
 
)
値:
#define VSTREAM_BUF_AT_START(bp)
Definition: vstream.c:534
#define VSTREAM_PURGE_WRITE
Definition: vstream.h:89
#define VSTREAM_RESTORE_STATE (   stream,
  buffer,
  filedes 
)
値:
do { \
stream->buffer.flags = stream->buf.flags; \
stream->buf = stream->buffer; \
stream->fd = stream->filedes; \
} while(0)

vstream.c566 行目に定義があります。

#define VSTREAM_ROUNDUP (   count,
  base 
)    VSTREAM_TRUNCATE(count + base - 1, base)
#define VSTREAM_SAVE_STATE (   stream,
  buffer,
  filedes 
)
値:
{ \
stream->buffer = stream->buf; \
stream->filedes = stream->fd; \
}

vstream.c561 行目に定義があります。

#define VSTREAM_STATIC (   v)    ((v) >= VSTREAM_IN && (v) <= VSTREAM_ERR)

vstream.c517 行目に定義があります。

#define VSTREAM_SUB_TIME (   x,
  y,
 
)
値:
do { \
(x).tv_sec = (y).tv_sec - (z).tv_sec; \
(x).tv_usec = (y).tv_usec - (z).tv_usec; \
while ((x).tv_usec < 0) { \
(x).tv_usec += 1000000; \
(x).tv_sec -= 1; \
} \
while ((x).tv_usec >= 1000000) { \
(x).tv_usec -= 1000000; \
(x).tv_sec += 1; \
} \
} while (0)

vstream.c587 行目に定義があります。

#define VSTREAM_TRUNCATE (   count,
  base 
)    (((count) / (base)) * (base))

関数詳解

ssize_t vstream_bufstat ( VSTREAM vp,
int  command 
)

vstream.c1539 行目に定義があります。

void vstream_control ( VSTREAM stream,
int  name,
  ... 
)

vstream.c1372 行目に定義があります。

int vstream_fclose ( VSTREAM stream)

vstream.c1268 行目に定義があります。

int vstream_fdclose ( VSTREAM stream)

vstream.c1309 行目に定義があります。

VSTREAM* vstream_fdopen ( int  fd,
int  flags 
)

vstream.c1204 行目に定義があります。

int vstream_fflush ( VSTREAM stream)

vstream.c1257 行目に定義があります。

VSTREAM* vstream_fopen ( const char *  path,
int  flags,
mode_t  mode 
)

vstream.c1241 行目に定義があります。

VSTREAM* vstream_fprintf ( VSTREAM stream,
const char *  fmt,
  ... 
)

vstream.c1348 行目に定義があります。

int vstream_fpurge ( VSTREAM stream,
int  direction 
)

vstream.c1041 行目に定義があります。

int vstream_fputs ( const char *  str,
VSTREAM stream 
)

vstream.c1360 行目に定義があります。

off_t vstream_fseek ( VSTREAM stream,
off_t  offset,
int  whence 
)

vstream.c1093 行目に定義があります。

off_t vstream_ftell ( VSTREAM stream)

vstream.c1157 行目に定義があります。

ssize_t vstream_peek ( VSTREAM vp)

vstream.c1580 行目に定義があります。

const char* vstream_peek_data ( VSTREAM vp)

vstream.c1593 行目に定義があります。

VSTREAM* vstream_printf ( const char *  fmt,
  ... 
)

vstream.c1335 行目に定義があります。

VSTREAM* vstream_vfprintf ( VSTREAM vp,
const char *  format,
va_list  ap 
)

vstream.c1531 行目に定義があります。

VSTREAM* vstream_vprintf ( const char *  format,
va_list  ap 
)

vstream.c1521 行目に定義があります。

変数詳解

VSTREAM vstream_fstd[]
初期値:
= {
{{
0,
0, 0, 0, 0,
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
0,},
{{
0,
0, 0, 0, 0,
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
}, STDOUT_FILENO, (VSTREAM_RW_FN) timed_read, (VSTREAM_RW_FN) timed_write,
0,},
{{
vstream_fstd_buf, VSTREAM_BUFSIZE, VSTREAM_BUFSIZE, vstream_fstd_buf,
vstream_buf_get_ready, vstream_buf_put_ready, vstream_buf_space,
}, STDERR_FILENO, (VSTREAM_RW_FN) timed_read, (VSTREAM_RW_FN) timed_write,
}
#define VSTREAM_FLAG_WRITE
Definition: vstream.h:82
#define VBUF_FLAG_FIXED
Definition: vbuf.h:70
ssize_t timed_read(int, void *, size_t, int, void *)
Definition: timed_read.c:60
ssize_t(* VSTREAM_RW_FN)(int, void *, size_t, int, void *)
Definition: vstream.h:34
ssize_t timed_write(int, const void *, size_t, int, void *)
Definition: timed_write.c:60
#define VSTREAM_BUFSIZE
Definition: vstream.h:92

vstream.c496 行目に定義があります。