author | Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM> |
Wed, 27 Apr 2016 22:46:14 -0700 | |
changeset 5869 | d4a72a69caa0 |
permissions | -rw-r--r-- |
5869
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
1 |
# Developed in-house. Submitted upstream |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
2 |
# https://sourceforge.net/p/net-snmp/bugs/2587/ |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
3 |
# Need to use forkall() to fork all the threads. Otherwise the threads |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
4 |
# for FM MIB etc will not be spawned causing failures during snmpwalk |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
5 |
--- net-snmp/snmplib/system.c Tue Oct 9 15:28:58 2012 |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
6 |
+++ net-snmp/snmplib/system.c Mon Dec 2 23:36:52 2013 |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
7 |
@@ -283,7 +283,7 @@ |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
8 |
* Fork to return control to the invoking process and to |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
9 |
* guarantee that we aren't a process group leader. |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
10 |
*/ |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
11 |
- i = fork(); |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
12 |
+ i = forkall(); |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
13 |
if (i != 0) { |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
14 |
/* Parent. */ |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
15 |
DEBUGMSGT(("daemonize","first fork returned %d.\n", i)); |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
16 |
@@ -305,7 +305,7 @@ |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
17 |
/* |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
18 |
* Fork to let the process/session group leader exit. |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
19 |
*/ |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
20 |
- if ((i = fork()) != 0) { |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
21 |
+ if ((i = forkall()) != 0) { |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
22 |
DEBUGMSGT(("daemonize","second fork returned %d.\n", i)); |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
23 |
if(i == -1) { |
d4a72a69caa0
17949399 net-snmp does not replicate all threads to the daemon process
Gowtham Thommandra <Gowtham.Thommandra@Oracle.COM>
parents:
diff
changeset
|
24 |
snmp_log(LOG_ERR,"second fork failed (errno %d) in " |