summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/util.c
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2009-11-08 21:40:06 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2009-11-08 21:40:06 +0000
commit0dfe9b155ae3af80cc0cd39fb4c62e8dd6d2db28 (patch)
tree0a1a6b3248ea8a8426e96d81dc154e66ec6f23c3 /usr.sbin/smtpd/util.c
parent2783b9e7a388c4dd94479d27f871f1d3af90d142 (diff)
- make aliases expansion use a rb tree instead of a tail queue, the code
doesn't take advantage of the new structure yet, but this was a needed change for upcoming improvements. - introduce aliasestree_{lookup,insert,remove} to the aliases api - rename queue_generate_id() to generate_uid() and move it to utils.c as it is used all over the place and not only in queue tree idea discussed with jacekm@, if you update rebuild aliases db, make clean and flush queue
Diffstat (limited to 'usr.sbin/smtpd/util.c')
-rw-r--r--usr.sbin/smtpd/util.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 806e46ad908..a7af7b6dbd8 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.28 2009/11/08 19:38:26 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.29 2009/11/08 21:40:05 gilles Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -432,3 +432,20 @@ path_dup(struct path *path)
return pathp;
}
+
+u_int64_t
+generate_uid(void)
+{
+ u_int64_t id;
+ struct timeval tp;
+
+ if (gettimeofday(&tp, NULL) == -1)
+ fatal("generate_uid: time");
+
+ id = (u_int32_t)tp.tv_sec;
+ id <<= 32;
+ id |= (u_int32_t)tp.tv_usec;
+ usleep(1);
+
+ return (id);
+}