This avoids wasting getpid() calls in a lot of places...
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
#include "replace.h"
#include "system/locale.h"
+#include <tevent.h>
#include "lib/util/samba_util.h"
#include "lib/util/debug.h"
int pid;
} generate_unique_u64_state;
- int pid = getpid();
+ int pid = tevent_cached_getpid();
if (unlikely(pid != generate_unique_u64_state.pid)) {
generate_unique_u64_state = (struct generate_unique_u64_state) {
#include "replace.h"
#include <talloc.h>
+#include <tevent.h>
#include "system/network.h"
#include "system/filesys.h"
#include "system/locale.h"
if ((ret != -1) &&
(lock.l_type != F_UNLCK) &&
(lock.l_pid != 0) &&
- (lock.l_pid != getpid())) {
+ (lock.l_pid != tevent_cached_getpid())) {
DEBUG(3,("fcntl_lock: fd %d is locked by pid %d\n",fd,(int)lock.l_pid));
return true;
}