Deleted Added
full compact
queue.c (110560) queue.c (111823)
1/*
1/*
2 * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
2 * Copyright (c) 1998-2003 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
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
16SM_RCSID("@(#)$Id: queue.c,v 8.863.2.22 2002/12/19 18:00:39 ca Exp $")
16SM_RCSID("@(#)$Id: queue.c,v 8.863.2.28 2003/02/11 17:17:22 ca Exp $")
17
18#include <dirent.h>
19
17
18#include <dirent.h>
19
20#if SM_CONF_SHM
21# include <sm/shm.h>
22#endif /* SM_CONF_SHM */
23
24# define RELEASE_QUEUE (void) 0
25# define ST_INODE(st) (st).st_ino
26
27
28/*
29** Historical notes:
30** QF_VERSION == 4 was sendmail 8.10/8.11 without _FFR_QUEUEDELAY
31** QF_VERSION == 5 was sendmail 8.10/8.11 with _FFR_QUEUEDELAY

--- 40 unchanged lines hidden (view full) ---

72static WORK *WorkQ; /* queue of things to be done */
73static int NumWorkGroups; /* number of work groups */
74
75/*
76** DoQueueRun indicates that a queue run is needed.
77** Notice: DoQueueRun is modified in a signal handler!
78*/
79
20# define RELEASE_QUEUE (void) 0
21# define ST_INODE(st) (st).st_ino
22
23
24/*
25** Historical notes:
26** QF_VERSION == 4 was sendmail 8.10/8.11 without _FFR_QUEUEDELAY
27** QF_VERSION == 5 was sendmail 8.10/8.11 with _FFR_QUEUEDELAY

--- 40 unchanged lines hidden (view full) ---

68static WORK *WorkQ; /* queue of things to be done */
69static int NumWorkGroups; /* number of work groups */
70
71/*
72** DoQueueRun indicates that a queue run is needed.
73** Notice: DoQueueRun is modified in a signal handler!
74*/
75
80static bool volatile DoQueueRun; /* non-interrupt time queue run needed */
76static bool volatile DoQueueRun; /* non-interrupt time queue run needed */
81
82/*
83** Work group definition structure.
84** Each work group contains one or more queue groups. This is done
85** to manage the number of queue group runners active at the same time
86** to be within the constraints of MaxQueueChildren (if it is set).
87** The number of queue groups that can be run on the next work run
88** is kept track of. The queue groups are run in a round robin.

--- 1597 unchanged lines hidden (view full) ---

1686 }
1687 if (tTd(63, 100))
1688 sm_syslog(LOG_DEBUG, NOQID,
1689 "runqueue %s dowork(%s)",
1690 qid_printqueue(w->w_qgrp, w->w_qdir),
1691 w->w_name + 2);
1692
1693 (void) dowork(w->w_qgrp, w->w_qdir, w->w_name + 2,
77
78/*
79** Work group definition structure.
80** Each work group contains one or more queue groups. This is done
81** to manage the number of queue group runners active at the same time
82** to be within the constraints of MaxQueueChildren (if it is set).
83** The number of queue groups that can be run on the next work run
84** is kept track of. The queue groups are run in a round robin.

--- 1597 unchanged lines hidden (view full) ---

1682 }
1683 if (tTd(63, 100))
1684 sm_syslog(LOG_DEBUG, NOQID,
1685 "runqueue %s dowork(%s)",
1686 qid_printqueue(w->w_qgrp, w->w_qdir),
1687 w->w_name + 2);
1688
1689 (void) dowork(w->w_qgrp, w->w_qdir, w->w_name + 2,
1694 ForkQueueRuns , false, e);
1690 ForkQueueRuns, false, e);
1695 errno = 0;
1696 }
1697 sm_free(w->w_name); /* XXX */
1698 if (w->w_host != NULL)
1699 sm_free(w->w_host); /* XXX */
1700 sm_free((char *) w); /* XXX */
1701 sequenceno += skip; /* next sequence number */
1702#if SM_HEAP_CHECK

--- 1738 unchanged lines hidden (view full) ---

3441 }
3442 else
3443 {
3444 /*
3445 ** Initialize exception stack and default exception
3446 ** handler for child process.
3447 */
3448
1691 errno = 0;
1692 }
1693 sm_free(w->w_name); /* XXX */
1694 if (w->w_host != NULL)
1695 sm_free(w->w_host); /* XXX */
1696 sm_free((char *) w); /* XXX */
1697 sequenceno += skip; /* next sequence number */
1698#if SM_HEAP_CHECK

--- 1738 unchanged lines hidden (view full) ---

3437 }
3438 else
3439 {
3440 /*
3441 ** Initialize exception stack and default exception
3442 ** handler for child process.
3443 */
3444
3449
3450 /* Reset global flags */
3451 RestartRequest = NULL;
3452 RestartWorkGroup = false;
3453 ShutdownRequest = NULL;
3454 PendingSignal = 0;
3455 CurrentPid = getpid();
3456 sm_exc_newthread(fatal_error);
3457

--- 170 unchanged lines hidden (view full) ---

3628 }
3629 else
3630 {
3631 /*
3632 ** Initialize exception stack and default exception
3633 ** handler for child process.
3634 */
3635
3445 /* Reset global flags */
3446 RestartRequest = NULL;
3447 RestartWorkGroup = false;
3448 ShutdownRequest = NULL;
3449 PendingSignal = 0;
3450 CurrentPid = getpid();
3451 sm_exc_newthread(fatal_error);
3452

--- 170 unchanged lines hidden (view full) ---

3623 }
3624 else
3625 {
3626 /*
3627 ** Initialize exception stack and default exception
3628 ** handler for child process.
3629 */
3630
3636
3637 /* Reset global flags */
3638 RestartRequest = NULL;
3639 RestartWorkGroup = false;
3640 ShutdownRequest = NULL;
3641 PendingSignal = 0;
3642 CurrentPid = getpid();
3643 sm_exc_newthread(fatal_error);
3644

--- 3072 unchanged lines hidden (view full) ---

6717 ** All queue directories must be (first level) subdirectories
6718 ** of the basedir. The basedir is the QueueDir
6719 ** without wildcards, but with trailing /
6720 */
6721
6722 hashval = 0;
6723 errno = 0;
6724 len = sm_strlcpy(basedir, QueueDir, sizeof basedir);
3631 /* Reset global flags */
3632 RestartRequest = NULL;
3633 RestartWorkGroup = false;
3634 ShutdownRequest = NULL;
3635 PendingSignal = 0;
3636 CurrentPid = getpid();
3637 sm_exc_newthread(fatal_error);
3638

--- 3072 unchanged lines hidden (view full) ---

6711 ** All queue directories must be (first level) subdirectories
6712 ** of the basedir. The basedir is the QueueDir
6713 ** without wildcards, but with trailing /
6714 */
6715
6716 hashval = 0;
6717 errno = 0;
6718 len = sm_strlcpy(basedir, QueueDir, sizeof basedir);
6725 if (len >= sizeof basedir)
6719
6720 /* Provide space for trailing '/' */
6721 if (len >= sizeof basedir - 1)
6726 {
6727 syserr("QueueDirectory: path too long: %d, max %d",
6722 {
6723 syserr("QueueDirectory: path too long: %d, max %d",
6728 len, (int) sizeof basedir);
6724 len, (int) sizeof basedir - 1);
6729 ExitStat = EX_CONFIG;
6730 return;
6731 }
6732 SM_ASSERT(len > 0);
6733 if (basedir[len - 1] == '*')
6734 {
6735 char *cp;
6736

--- 1900 unchanged lines hidden ---
6725 ExitStat = EX_CONFIG;
6726 return;
6727 }
6728 SM_ASSERT(len > 0);
6729 if (basedir[len - 1] == '*')
6730 {
6731 char *cp;
6732

--- 1900 unchanged lines hidden ---