queue.c (159609) | queue.c (161389) |
---|---|
1/* 2 * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15#include <sm/sem.h> 16 | 1/* 2 * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers. 3 * All rights reserved. 4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 5 * Copyright (c) 1988, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * By using this file, you agree to the terms and conditions set 9 * forth in the LICENSE file which can be found at the top level of 10 * the sendmail distribution. 11 * 12 */ 13 14#include <sendmail.h> 15#include <sm/sem.h> 16 |
17SM_RCSID("@(#)$Id: queue.c,v 8.954 2006/04/22 01:07:00 ca Exp $") | 17SM_RCSID("@(#)$Id: queue.c,v 8.954.2.5 2006/07/31 21:44:18 ca Exp $") |
18 19#include <dirent.h> 20 21# define RELEASE_QUEUE (void) 0 22# define ST_INODE(st) (st).st_ino 23 24# define sm_file_exists(errno) ((errno) == EEXIST) 25 --- 2615 unchanged lines hidden (view full) --- 2641 qid_printqueue(qgrp, qdir), d->d_name); 2642 wn--; 2643 continue; 2644 } 2645 2646 /* avoid work if possible */ 2647 if ((QueueSortOrder == QSO_BYFILENAME || 2648 QueueSortOrder == QSO_BYMODTIME || | 18 19#include <dirent.h> 20 21# define RELEASE_QUEUE (void) 0 22# define ST_INODE(st) (st).st_ino 23 24# define sm_file_exists(errno) ((errno) == EEXIST) 25 --- 2615 unchanged lines hidden (view full) --- 2641 qid_printqueue(qgrp, qdir), d->d_name); 2642 wn--; 2643 continue; 2644 } 2645 2646 /* avoid work if possible */ 2647 if ((QueueSortOrder == QSO_BYFILENAME || 2648 QueueSortOrder == QSO_BYMODTIME || |
2649 QueueSortOrder == QSO_NONE || |
|
2649 QueueSortOrder == QSO_RANDOM) && 2650 QueueLimitQuarantine == NULL && 2651 QueueLimitSender == NULL && 2652 QueueLimitRecipient == NULL) 2653 { 2654 w->w_qgrp = qgrp; 2655 w->w_qdir = qdir; 2656 w->w_name = newstr(d->d_name); --- 3650 unchanged lines hidden (view full) --- 6307 if (stat(path, &st) < 0) 6308 { 6309 syserr("cannot stat queue directory %s", path); 6310 return FSF_STAT_FAIL; 6311 } 6312 for (i = 0; i < NumFileSys; ++i) 6313 { 6314 if (FILE_SYS_DEV(i) == st.st_dev) | 2650 QueueSortOrder == QSO_RANDOM) && 2651 QueueLimitQuarantine == NULL && 2652 QueueLimitSender == NULL && 2653 QueueLimitRecipient == NULL) 2654 { 2655 w->w_qgrp = qgrp; 2656 w->w_qdir = qdir; 2657 w->w_name = newstr(d->d_name); --- 3650 unchanged lines hidden (view full) --- 6308 if (stat(path, &st) < 0) 6309 { 6310 syserr("cannot stat queue directory %s", path); 6311 return FSF_STAT_FAIL; 6312 } 6313 for (i = 0; i < NumFileSys; ++i) 6314 { 6315 if (FILE_SYS_DEV(i) == st.st_dev) |
6316 { 6317 /* 6318 ** Make sure the file system (FS) name is set: 6319 ** even though the source code indicates that 6320 ** FILE_SYS_DEV() is only set below, it could be 6321 ** set via shared memory, hence we need to perform 6322 ** this check/assignment here. 6323 */ 6324 6325 if (NULL == FILE_SYS_NAME(i)) 6326 FILE_SYS_NAME(i) = name; |
|
6315 return i; | 6327 return i; |
6328 } |
|
6316 } 6317 if (i >= MAXFILESYS) 6318 { 6319 syserr("too many queue file systems (%d max)", MAXFILESYS); 6320 return FSF_TOO_MANY; 6321 } 6322 if (!add) 6323 return FSF_NOT_FOUND; --- 77 unchanged lines hidden (view full) --- 6401filesys_update() 6402{ 6403 int i; 6404 long avail, blksize; 6405 time_t now; 6406 static time_t nextupdate = 0; 6407 6408#if SM_CONF_SHM | 6329 } 6330 if (i >= MAXFILESYS) 6331 { 6332 syserr("too many queue file systems (%d max)", MAXFILESYS); 6333 return FSF_TOO_MANY; 6334 } 6335 if (!add) 6336 return FSF_NOT_FOUND; --- 77 unchanged lines hidden (view full) --- 6414filesys_update() 6415{ 6416 int i; 6417 long avail, blksize; 6418 time_t now; 6419 static time_t nextupdate = 0; 6420 6421#if SM_CONF_SHM |
6409 /* only the daemon updates this structure */ 6410 if (ShmId == SM_SHM_NO_ID || DaemonPid != CurrentPid) | 6422 if (ShmId != SM_SHM_NO_ID && DaemonPid != CurrentPid) |
6411 return; 6412#endif /* SM_CONF_SHM */ 6413 now = curtime(); 6414 if (now < nextupdate) 6415 return; 6416 nextupdate = now + FILESYS_UPDATE_INTERVAL; 6417 for (i = 0; i < NumFileSys; ++i) 6418 { --- 2432 unchanged lines hidden --- | 6423 return; 6424#endif /* SM_CONF_SHM */ 6425 now = curtime(); 6426 if (now < nextupdate) 6427 return; 6428 nextupdate = now + FILESYS_UPDATE_INTERVAL; 6429 for (i = 0; i < NumFileSys; ++i) 6430 { --- 2432 unchanged lines hidden --- |