util.c (1a0fda2b547365c9453523592a445dfe21266d4b) util.c (ba00ec3d539f213abbda3a45ef8c539306cac098)
1/*
2 * Copyright (c) 1998-2007, 2009 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
1/*
2 * Copyright (c) 1998-2007, 2009 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
16SM_RCSID("@(#)$Id: util.c,v 8.416 2009/12/18 17:05:26 ca Exp $")
16SM_RCSID("@(#)$Id: util.c,v 8.425 2012/03/03 00:10:43 ca Exp $")
17
18#include <sm/sendmail.h>
19#include <sysexits.h>
20#include <sm/xtrap.h>
21
22/*
23** NEWSTR -- Create a copy of a C string
24**

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

2633 }
2634 else if (type == PROC_QUEUE_CHILD && !WIFSTOPPED(st) &&
2635 ProcListVec[i].proc_other > -1)
2636 {
2637 /* restart this persistent runner */
2638 mark_work_group_restart(ProcListVec[i].proc_other, st);
2639 }
2640 else if (type == PROC_QUEUE)
17
18#include <sm/sendmail.h>
19#include <sysexits.h>
20#include <sm/xtrap.h>
21
22/*
23** NEWSTR -- Create a copy of a C string
24**

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

2633 }
2634 else if (type == PROC_QUEUE_CHILD && !WIFSTOPPED(st) &&
2635 ProcListVec[i].proc_other > -1)
2636 {
2637 /* restart this persistent runner */
2638 mark_work_group_restart(ProcListVec[i].proc_other, st);
2639 }
2640 else if (type == PROC_QUEUE)
2641 {
2641 CurRunners -= ProcListVec[i].proc_count;
2642 CurRunners -= ProcListVec[i].proc_count;
2643
2644 /* CHK_CUR_RUNNERS() can't be used here: uses syslog() */
2645 if (CurRunners < 0)
2646 CurRunners = 0;
2647 }
2642}
2643
2644/*
2645** PROC_LIST_CLEAR -- clear the process list
2646**
2647** Parameters:
2648** none.
2649**

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

2697 if (kill(pid, 0) < 0)
2698 {
2699 if (LogLevel > 3)
2700 sm_syslog(LOG_DEBUG, CurEnv->e_id,
2701 "proc_list_probe: lost pid %d",
2702 (int) ProcListVec[i].proc_pid);
2703 ProcListVec[i].proc_pid = NO_PID;
2704 SM_FREE_CLR(ProcListVec[i].proc_task);
2648}
2649
2650/*
2651** PROC_LIST_CLEAR -- clear the process list
2652**
2653** Parameters:
2654** none.
2655**

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

2703 if (kill(pid, 0) < 0)
2704 {
2705 if (LogLevel > 3)
2706 sm_syslog(LOG_DEBUG, CurEnv->e_id,
2707 "proc_list_probe: lost pid %d",
2708 (int) ProcListVec[i].proc_pid);
2709 ProcListVec[i].proc_pid = NO_PID;
2710 SM_FREE_CLR(ProcListVec[i].proc_task);
2711
2712 if (ProcListVec[i].proc_type == PROC_QUEUE)
2713 {
2714 CurRunners -= ProcListVec[i].proc_count;
2715 CHK_CUR_RUNNERS("proc_list_probe", i,
2716 ProcListVec[i].proc_count);
2717 }
2718
2705 CurChildren--;
2706 }
2707 else
2708 {
2709 ++children;
2710 }
2711 }
2712 if (CurChildren < 0)

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

2847 if (hostaddr->sa.sa_family == AF_INET6 &&
2848 IN6_ARE_ADDR_EQUAL(&(hostaddr->sin6.sin6_addr),
2849 &(ProcListVec[i].proc_hostaddr.sin6.sin6_addr)))
2850 n++;
2851#endif /* NETINET6 */
2852 }
2853 return n;
2854}
2719 CurChildren--;
2720 }
2721 else
2722 {
2723 ++children;
2724 }
2725 }
2726 if (CurChildren < 0)

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

2861 if (hostaddr->sa.sa_family == AF_INET6 &&
2862 IN6_ARE_ADDR_EQUAL(&(hostaddr->sin6.sin6_addr),
2863 &(ProcListVec[i].proc_hostaddr.sin6.sin6_addr)))
2864 n++;
2865#endif /* NETINET6 */
2866 }
2867 return n;
2868}
2869