halt='use virGetSystemPageSize[KB] instead of sysconf(_SC_PAGESIZE)' \
$(_sc_search_regexp)
+sc_prohibit_pthread_create:
+ @prohibit='\bpthread_create\b' \
+ exclude='sc_prohibit_pthread_create' \
+ halt="avoid using 'pthread_create', use 'virThreadCreate' instead" \
+ $(_sc_search_regexp)
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
exclude_file_name_regexp--sc_prohibit_sysconf_pagesize = \
^(cfg\.mk|src/util/virutil\.c)$$
+
+exclude_file_name_regexp--sc_prohibit_pthread_create = \
+ ^(cfg\.mk|src/util/virthread\.c|tests/.*)$$
* will require that the IP address was taken from an ARP packet or an IPv4
* packet. Both flags can be set at the same time.
*/
-static void *
+static void
learnIPAddressThread(void *arg)
{
char errbuf[PCAP_ERRBUF_SIZE] = {0};
techdriver->applyDropAllRules(req->ifname);
}
- memset(&req->thread, 0x0, sizeof(req->thread));
-
VIR_DEBUG("pcap thread terminating for interface %s\n", req->ifname);
virNWFilterUnlockIface(req->ifname);
virNWFilterDeregisterLearnReq(req->ifindex);
virNWFilterIPAddrLearnReqFree(req);
-
- return 0;
}
enum howDetect howDetect)
{
int rc;
+ virThread thread;
virNWFilterIPAddrLearnReqPtr req = NULL;
virNWFilterHashTablePtr ht = NULL;
if (rc < 0)
goto err_free_req;
- if (pthread_create(&req->thread,
- NULL,
- learnIPAddressThread,
- req) != 0)
+ if (virThreadCreate(&thread,
+ false,
+ learnIPAddressThread,
+ req) != 0)
goto err_dereg_req;
return 0;