Postfix3.3.1
総合概要
データ構造
ファイル
ファイル一覧
大域各種
postfix-3.3.1
src
global
mbox_conf.c
[詳解]
1
/*++
2
/* NAME
3
/* mbox_conf 3
4
/* SUMMARY
5
/* mailbox lock configuration
6
/* SYNOPSIS
7
/* #include <mbox_conf.h>
8
/*
9
/* int mbox_lock_mask(string)
10
/* const char *string;
11
/*
12
/* ARGV *mbox_lock_names()
13
/* DESCRIPTION
14
/* The functions in this module translate between external
15
/* mailbox locking method names and internal representations.
16
/*
17
/* mbox_lock_mask() translates a string with locking method names
18
/* into a bit mask. Names are separated by comma or whitespace.
19
/* The following gives the method names and corresponding bit
20
/* mask value:
21
/* .IP "flock (MBOX_FLOCK_LOCK)"
22
/* Use flock() style lock after opening the file. This is the mailbox
23
/* locking method traditionally used on BSD-ish systems (including
24
/* Ultrix and SunOS). It is not suitable for remote file systems.
25
/* .IP "fcntl (MBOX_FCNTL_LOCK)"
26
/* Use fcntl() style lock after opening the file. This is the mailbox
27
/* locking method on System-V-ish systems (Solaris, AIX, IRIX, HP-UX).
28
/* This method is supposed to work for remote systems, but often
29
/* has problems.
30
/* .IP "dotlock (MBOX_DOT_LOCK)"
31
/* Create a lock file with the name \fIfilename\fB.lock\fR. This
32
/* method pre-dates kernel locks. This works with remote file systems,
33
/* modulo cache coherency problems.
34
/* .PP
35
/* mbox_lock_names() returns an array with the names of available
36
/* mailbox locking methods. The result should be given to argv_free().
37
/* DIAGNOSTICS
38
/* Fatal errors: undefined locking method name.
39
/* LICENSE
40
/* .ad
41
/* .fi
42
/* The Secure Mailer license must be distributed with this software.
43
/* AUTHOR(S)
44
/* Wietse Venema
45
/* IBM T.J. Watson Research
46
/* P.O. Box 704
47
/* Yorktown Heights, NY 10598, USA
48
/*--*/
49
50
/* System library. */
51
52
#include <
sys_defs.h
>
53
54
/* Utility library. */
55
56
#include <
name_mask.h
>
57
#include <
argv.h
>
58
59
/* Global library. */
60
61
#include <
mail_params.h
>
62
#include <
mbox_conf.h
>
63
64
/*
65
* The table with available mailbox locking methods. Some systems have
66
* flock() locks; all POSIX-compatible systems have fcntl() locks. Even
67
* though some systems do not use dotlock files by default (4.4BSD), such
68
* locks can be necessary when accessing mailbox files over NFS.
69
*/
70
static
const
NAME_MASK
mbox_mask[] = {
71
#ifdef HAS_FLOCK_LOCK
72
"flock"
,
MBOX_FLOCK_LOCK
,
73
#endif
74
#ifdef HAS_FCNTL_LOCK
75
"fcntl"
,
MBOX_FCNTL_LOCK
,
76
#endif
77
"dotlock"
,
MBOX_DOT_LOCK
,
78
0,
79
};
80
81
/* mbox_lock_mask - translate mailbox lock names to bit mask */
82
83
int
mbox_lock_mask
(
const
char
*
string
)
84
{
85
return
(
name_mask
(
VAR_MAILBOX_LOCK
, mbox_mask,
string
));
86
}
87
88
/* mbox_lock_names - return available mailbox lock method names */
89
90
ARGV
*
mbox_lock_names
(
void
)
91
{
92
const
NAME_MASK
*np;
93
ARGV
*
argv
;
94
95
argv =
argv_alloc
(2);
96
for
(np = mbox_mask; np->
name
!= 0; np++)
97
argv_add
(argv, np->
name
,
ARGV_END
);
98
argv_terminate
(argv);
99
return
(argv);
100
}
ARGV_END
#define ARGV_END
Definition:
argv.h:52
ARGV
Definition:
argv.h:17
mbox_conf.h
ARGV::argv
char ** argv
Definition:
argv.h:20
argv_add
void argv_add(ARGV *argvp,...)
Definition:
argv.c:197
argv_alloc
ARGV * argv_alloc(ssize_t len)
Definition:
argv.c:149
name_mask.h
MBOX_DOT_LOCK
#define MBOX_DOT_LOCK
Definition:
mbox_conf.h:24
MBOX_FLOCK_LOCK
#define MBOX_FLOCK_LOCK
Definition:
mbox_conf.h:22
NAME_MASK
Definition:
name_mask.h:22
NAME_MASK::name
const char * name
Definition:
name_mask.h:23
mbox_lock_mask
int mbox_lock_mask(const char *string)
Definition:
mbox_conf.c:83
MBOX_FCNTL_LOCK
#define MBOX_FCNTL_LOCK
Definition:
mbox_conf.h:23
name_mask
#define name_mask(tag, table, str)
Definition:
name_mask.h:49
sys_defs.h
mail_params.h
VAR_MAILBOX_LOCK
#define VAR_MAILBOX_LOCK
Definition:
mail_params.h:626
argv.h
mbox_lock_names
ARGV * mbox_lock_names(void)
Definition:
mbox_conf.c:90
argv_terminate
void argv_terminate(ARGV *argvp)
Definition:
argv.c:242
2018年11月10日(土) 18時59分38秒作成 - Postfix3.3.1 / 構成:
1.8.9.1