mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-16 07:47:00 +00:00
getdata: use correct file caching advice
The POSIX_FADV_NOREUSE is more appropriate considering dhcpd-pools may need cache, but not necessarily. Reference: http://lwn.net/Articles/449420/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
7c872ef8d7
commit
20ec1c2b42
1 changed files with 6 additions and 6 deletions
|
|
@ -73,12 +73,12 @@ int parse_leases(void)
|
|||
err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file);
|
||||
}
|
||||
#ifdef HAVE_POSIX_FADVISE
|
||||
# ifdef POSIX_FADV_WILLNEED
|
||||
if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_WILLNEED) != 0) {
|
||||
# ifdef POSIX_FADV_NOREUSE
|
||||
if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_NOREUSE) != 0) {
|
||||
err(EXIT_FAILURE, "parse_leases: fadvise %s",
|
||||
config.dhcpdlease_file);
|
||||
}
|
||||
# endif /* POSIX_FADV_WILLNEED */
|
||||
# endif /* POSIX_FADV_NOREUSE */
|
||||
# ifdef POSIX_FADV_SEQUENTIAL
|
||||
if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) {
|
||||
err(EXIT_FAILURE, "parse_leases: fadvise %s",
|
||||
|
|
@ -215,11 +215,11 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
if (dhcpd_config == NULL) {
|
||||
err(EXIT_FAILURE, "parse_config: %s", config_file);
|
||||
}
|
||||
#ifdef POSIX_FADV_WILLNEED
|
||||
if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_WILLNEED) != 0) {
|
||||
#ifdef POSIX_FADV_NOREUSE
|
||||
if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) {
|
||||
err(EXIT_FAILURE, "parse_config: fadvise %s", config_file);
|
||||
}
|
||||
#endif /* POSIX_FADV_WILLNEED */
|
||||
#endif /* POSIX_FADV_NOREUSE */
|
||||
#ifdef POSIX_FADV_SEQUENTIAL
|
||||
if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) {
|
||||
err(EXIT_FAILURE, "parse_config: fadvise %s", config_file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue