From 4d82f69f884c0c9105d7c1cc53a1235e26222fbc Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Wed, 31 Dec 2008 21:24:25 -0800 Subject: s3: Fix caller of print_fsp_open --- source3/modules/onefs_open.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/modules/onefs_open.c b/source3/modules/onefs_open.c index a4a317d905..a86d39948d 100644 --- a/source3/modules/onefs_open.c +++ b/source3/modules/onefs_open.c @@ -1,8 +1,8 @@ /* * Unix SMB/CIFS implementation. * - * This file began with some code from source3/smbd/open.c and modified it to - * work with ifs_createfile. + * This file began with some code from source3/smbd/open.c and has been + * modified it work with ifs_createfile. * * ifs_createfile is a CIFS-specific syscall for opening/files and * directories. It adds support for: @@ -459,7 +459,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn, DEBUG(10, ("onefs_open_file_ntcreate: printer open fname=%s\n", fname)); - return print_fsp_open(req, conn, fname, req->vuid, fsp); + return print_fsp_open(req, conn, fname, req->vuid, fsp, psbuf); } if (!parent_dirname(talloc_tos(), fname, &parent_dir, &newname)) { -- cgit From 74ea79cb8fa42b1bc13ac2bd9450beb13ad1cd5e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Jan 2009 13:28:38 +0100 Subject: The Tru64 shell doesn't like (*) in a case statement --- source3/autogen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/autogen.sh b/source3/autogen.sh index 61316a8f70..1a33eb22cc 100755 --- a/source3/autogen.sh +++ b/source3/autogen.sh @@ -4,11 +4,11 @@ while true; do case $1 in - (--version-file) + --version-file) VERSION_FILE=$2 shift 2 ;; - (*) + *) break ;; esac -- cgit From e551f43b4b690d92cbf00a510e6c79a497d91464 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Jan 2009 18:16:42 +0100 Subject: Remove two pointless globals --- source3/lib/ldb/tools/ldbadd.c | 13 ++++++------- source3/lib/ldb/tools/ldbmodify.c | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/source3/lib/ldb/tools/ldbadd.c b/source3/lib/ldb/tools/ldbadd.c index 4dde2a1ef5..155395e065 100644 --- a/source3/lib/ldb/tools/ldbadd.c +++ b/source3/lib/ldb/tools/ldbadd.c @@ -35,8 +35,6 @@ #include "ldb/include/includes.h" #include "ldb/tools/cmdline.h" -static int failures; - static void usage(void) { printf("Usage: ldbadd \n"); @@ -53,7 +51,8 @@ static void usage(void) /* add records from an opened file */ -static int process_file(struct ldb_context *ldb, FILE *f, int *count) +static int process_file(struct ldb_context *ldb, FILE *f, int *count, + int *failures) { struct ldb_ldif *ldif; int ret = LDB_SUCCESS; @@ -71,7 +70,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) if (ret != LDB_SUCCESS) { fprintf(stderr, "ERR: \"%s\" on DN %s\n", ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn)); - failures++; + (*failures)++; } else { (*count)++; } @@ -86,7 +85,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) int main(int argc, const char **argv) { struct ldb_context *ldb; - int i, ret=0, count=0; + int i, ret=0, count=0, failures=0; struct ldb_cmdline *options; ldb_global_init(); @@ -96,7 +95,7 @@ int main(int argc, const char **argv) options = ldb_cmdline_process(ldb, argc, argv, usage); if (options->argc == 0) { - ret = process_file(ldb, stdin, &count); + ret = process_file(ldb, stdin, &count, &failures); } else { for (i=0;iargc;i++) { const char *fname = options->argv[i]; @@ -106,7 +105,7 @@ int main(int argc, const char **argv) perror(fname); exit(1); } - ret = process_file(ldb, f, &count); + ret = process_file(ldb, f, &count, &failures); fclose(f); } } diff --git a/source3/lib/ldb/tools/ldbmodify.c b/source3/lib/ldb/tools/ldbmodify.c index 368b4cf996..f12387a8f6 100644 --- a/source3/lib/ldb/tools/ldbmodify.c +++ b/source3/lib/ldb/tools/ldbmodify.c @@ -35,8 +35,6 @@ #include "ldb/include/includes.h" #include "ldb/tools/cmdline.h" -static int failures; - static void usage(void) { printf("Usage: ldbmodify \n"); @@ -52,7 +50,8 @@ static void usage(void) /* process modifies for one file */ -static int process_file(struct ldb_context *ldb, FILE *f, int *count) +static int process_file(struct ldb_context *ldb, FILE *f, int *count, + int *failures) { struct ldb_ldif *ldif; int ret = LDB_SUCCESS; @@ -73,7 +72,7 @@ static int process_file(struct ldb_context *ldb, FILE *f, int *count) if (ret != LDB_SUCCESS) { fprintf(stderr, "ERR: \"%s\" on DN %s\n", ldb_errstring(ldb), ldb_dn_linearize(ldb, ldif->msg->dn)); - failures++; + (*failures)++; } else { (*count)++; } @@ -87,6 +86,7 @@ int main(int argc, const char **argv) { struct ldb_context *ldb; int count=0; + int failures=0; int i, ret=LDB_SUCCESS; struct ldb_cmdline *options; @@ -97,7 +97,7 @@ int main(int argc, const char **argv) options = ldb_cmdline_process(ldb, argc, argv, usage); if (options->argc == 0) { - ret = process_file(ldb, stdin, &count); + ret = process_file(ldb, stdin, &count, &failures); } else { for (i=0;iargc;i++) { const char *fname = options->argv[i]; @@ -107,7 +107,7 @@ int main(int argc, const char **argv) perror(fname); exit(1); } - ret = process_file(ldb, f, &count); + ret = process_file(ldb, f, &count, &failures); } } -- cgit From bf34e998f967a2e9c3528b61a825569378b480af Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Jan 2009 19:47:40 +0100 Subject: fix some nonempty blank lines --- source3/libsmb/smb_share_modes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c index 16b3b10925..7d363f5d8b 100644 --- a/source3/libsmb/smb_share_modes.c +++ b/source3/libsmb/smb_share_modes.c @@ -1,7 +1,7 @@ /* Samba share mode database library external interface library. Used by non-Samba products needing access to the Samba share mode db. - + Copyright (C) Jeremy Allison 2005 - 2006 sharemodes_procid functions (C) Copyright (C) Volker Lendecke 2005 @@ -9,17 +9,17 @@ ** NOTE! The following LGPL license applies to this module only. ** This does NOT imply that all of Samba is released ** under the LGPL - + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . */ @@ -115,7 +115,7 @@ int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx, { return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(dev, ino)); } - + int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx, uint64_t dev, uint64_t ino) -- cgit From 707a5a41b5818b7a59027d16abdce9f57be9cdcd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Jan 2009 19:55:20 +0100 Subject: Remove a global variable --- source3/libsmb/smb_share_modes.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c index 7d363f5d8b..af3f7b0dd5 100644 --- a/source3/libsmb/smb_share_modes.c +++ b/source3/libsmb/smb_share_modes.c @@ -92,16 +92,16 @@ int smb_share_mode_db_close(struct smbdb_ctx *db_ctx) return ret; } -static TDB_DATA get_locking_key(uint64_t dev, uint64_t ino) +static TDB_DATA get_locking_key(struct locking_key *lk, uint64_t dev, + uint64_t ino) { - static struct locking_key lk; TDB_DATA ld; - memset(&lk, '\0', sizeof(struct locking_key)); - lk.dev = (SMB_DEV_T)dev; - lk.inode = (SMB_INO_T)ino; - ld.dptr = (uint8 *)&lk; - ld.dsize = sizeof(lk); + memset(lk, '\0', sizeof(*lk)); + lk->dev = (SMB_DEV_T)dev; + lk->inode = (SMB_INO_T)ino; + ld.dptr = (uint8 *)lk; + ld.dsize = sizeof(*lk); return ld; } @@ -113,14 +113,17 @@ int smb_lock_share_mode_entry(struct smbdb_ctx *db_ctx, uint64_t dev, uint64_t ino) { - return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(dev, ino)); + struct locking_key lk; + return tdb_chainlock(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino)); } int smb_unlock_share_mode_entry(struct smbdb_ctx *db_ctx, uint64_t dev, uint64_t ino) { - return tdb_chainunlock(db_ctx->smb_tdb, get_locking_key(dev, ino)); + struct locking_key lk; + return tdb_chainunlock(db_ctx->smb_tdb, + get_locking_key(&lk, dev, ino)); } /* @@ -172,6 +175,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx, struct smb_share_mode_entry **pp_list, unsigned char *p_delete_on_close) { + struct locking_key lk; TDB_DATA db_data; struct smb_share_mode_entry *list = NULL; int num_share_modes = 0; @@ -183,7 +187,7 @@ int smb_get_share_mode_entries(struct smbdb_ctx *db_ctx, *pp_list = NULL; *p_delete_on_close = 0; - db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(dev, ino)); + db_data = tdb_fetch(db_ctx->smb_tdb, get_locking_key(&lk, dev, ino)); if (!db_data.dptr) { return 0; } @@ -258,7 +262,8 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx, const char *filename) /* Must be relative utf8 path. */ { TDB_DATA db_data; - TDB_DATA locking_key = get_locking_key(dev, ino); + struct locking_key lk; + TDB_DATA locking_key = get_locking_key(&lk, dev, ino); int orig_num_share_modes = 0; struct locking_data *ld = NULL; /* internal samba db state. */ struct share_mode_entry *shares = NULL; @@ -371,7 +376,8 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx, const struct smb_share_mode_entry *del_entry) { TDB_DATA db_data; - TDB_DATA locking_key = get_locking_key(dev, ino); + struct locking_key lk; + TDB_DATA locking_key = get_locking_key(&lk, dev, ino); int orig_num_share_modes = 0; struct locking_data *ld = NULL; /* internal samba db state. */ struct share_mode_entry *shares = NULL; @@ -473,7 +479,8 @@ int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx, const struct smb_share_mode_entry *new_entry) { TDB_DATA db_data; - TDB_DATA locking_key = get_locking_key(dev, ino); + struct locking_key lk; + TDB_DATA locking_key = get_locking_key(&lk, dev, ino); int num_share_modes = 0; struct locking_data *ld = NULL; /* internal samba db state. */ struct share_mode_entry *shares = NULL; -- cgit From 7458111ea4cf33b2a093e5edfb3b42ebfdc330c5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Jan 2009 22:05:03 +0100 Subject: Fix bug 5913. Never seen this to be a problem, but it doesn't hurt either :-) --- source3/lib/ldb/include/ldb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/ldb/include/ldb.h b/source3/lib/ldb/include/ldb.h index 0a745742d9..3891c1c6a3 100644 --- a/source3/lib/ldb/include/ldb.h +++ b/source3/lib/ldb/include/ldb.h @@ -991,7 +991,7 @@ int ldb_search(struct ldb_context *ldb, const struct ldb_dn *base, enum ldb_scope scope, const char *expression, - const char * const *attrs, struct ldb_result **res); + const char * const *attrs, struct ldb_result **_res); /* * a useful search function where you can easily define the expression and -- cgit From 8b81e7c7c65f3923aaa7a366733000517b44756e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 09:44:53 +0100 Subject: Happy New Year! metze --- source3/include/smb.h | 2 +- source4/smbd/server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/include/smb.h b/source3/include/smb.h index a8a2d98154..3253773903 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -27,7 +27,7 @@ #define _SMB_H /* logged when starting the various Samba daemons */ -#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2008" +#define COPYRIGHT_STARTUP_MESSAGE "Copyright Andrew Tridgell and the Samba Team 1992-2009" #if defined(LARGE_SMB_OFF_T) diff --git a/source4/smbd/server.c b/source4/smbd/server.c index c1683a48dc..1eb3e42501 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -266,7 +266,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ umask(0); DEBUG(0,("%s version %s started.\n", binary_name, SAMBA_VERSION_STRING)); - DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2008\n")); + DEBUGADD(0,("Copyright Andrew Tridgell and the Samba Team 1992-2009\n")); if (sizeof(uint16_t) < 2 || sizeof(uint32_t) < 4 || sizeof(uint64_t) < 8) { DEBUG(0,("ERROR: Samba is not configured correctly for the word size on your machine\n")); -- cgit From 308dbca653ce1d689b75f9b781237c67df4233a8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 17 Dec 2008 18:56:34 +0100 Subject: packaging(RHEL): fix build of [u]mount.cifs mount.cifs is now built by make everything. And it needs extra objects anyways (mtab.o), which is why the build of mount.cifs failed. Michael (cherry picked from commit 96c811cf222be5463a6705feae73d6215685c5f1) Signed-off-by: Michael Adam --- packaging/RHEL/samba.spec.tmpl | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packaging/RHEL/samba.spec.tmpl b/packaging/RHEL/samba.spec.tmpl index 92030fcd6b..64f8988a5f 100644 --- a/packaging/RHEL/samba.spec.tmpl +++ b/packaging/RHEL/samba.spec.tmpl @@ -178,12 +178,6 @@ fi make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" %{?_smp_mflags} \ all modules pam_smbpass -## build the cifs fs mount helper -cd client -gcc -o mount.cifs $RPM_OPT_FLAGS -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE mount.cifs.c -gcc -o umount.cifs $RPM_OPT_FLAGS -D_GNU_SOURCE -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE umount.cifs.c -cd .. - # Remove some permission bits to avoid to many dependencies cd .. find examples docs -type f | xargs -r chmod -x @@ -238,8 +232,8 @@ install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba install -m755 setup/smbprint $RPM_BUILD_ROOT%{_bindir} install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf -install -m755 source/client/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs -install -m755 source/client/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs +install -m755 bin/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs +install -m755 bin/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir} /bin/rm $RPM_BUILD_ROOT%{_sbindir}/*mount.cifs -- cgit From 71c74725bce403e36e4dc38287802c95b8d4de66 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 17 Dec 2008 22:27:39 +0100 Subject: packaging(RHEL): fix typo in [u]mount.cifs installation Michael (cherry picked from commit 835108bcf84a5f47f46d237c7a93c572348125a1) Signed-off-by: Michael Adam --- packaging/RHEL/samba.spec.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/RHEL/samba.spec.tmpl b/packaging/RHEL/samba.spec.tmpl index 64f8988a5f..f674e8386c 100644 --- a/packaging/RHEL/samba.spec.tmpl +++ b/packaging/RHEL/samba.spec.tmpl @@ -232,8 +232,8 @@ install -m644 setup/samba.pamd $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/samba install -m755 setup/smbprint $RPM_BUILD_ROOT%{_bindir} install -m644 setup/smbusers $RPM_BUILD_ROOT%{_sysconfdir}/samba/smbusers install -m644 setup/smb.conf $RPM_BUILD_ROOT%{_sysconfdir}/samba/smb.conf -install -m755 bin/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs -install -m755 bin/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs +install -m755 source/bin/mount.cifs $RPM_BUILD_ROOT/sbin/mount.cifs +install -m755 source/bin/umount.cifs $RPM_BUILD_ROOT/sbin/umount.cifs install -m755 source/script/mksmbpasswd.sh $RPM_BUILD_ROOT%{_bindir} /bin/rm $RPM_BUILD_ROOT%{_sbindir}/*mount.cifs -- cgit From c033ea562669a2d28da53b3dbe566cdb7d26d43e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 2 Jan 2009 14:51:06 +0100 Subject: Revert "s3:idmap: Remove passd check from idmap_backends_unixid_to_sid()." This reverts commit 45db33e73262d8e195a46fb96405dfb3dc43d6bc. --- source3/winbindd/idmap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index 6be55ef03c..38cc0d0c0a 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -735,6 +735,15 @@ NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id) maps[0] = id; maps[1] = NULL; + if (sid_check_is_in_builtin(id->sid) + || (sid_check_is_in_our_domain(id->sid))) { + dom = idmap_init_passdb_domain(NULL); + if (dom == NULL) { + return NT_STATUS_NONE_MAPPED; + } + return dom->methods->unixids_to_sids(dom, maps); + } + dom = idmap_find_domain(domname); if (dom == NULL) { return NT_STATUS_NONE_MAPPED; -- cgit From 13248e8917015435c8979535531484344e3f2262 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 2 Jan 2009 14:51:23 +0100 Subject: Revert "s:Fix uid_to_sid mapping when the idmap cache is empty." This reverts commit 9a9b64dbdfce4414ada22d4f882c8c757b5813e1. --- source3/winbindd/idmap.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index 38cc0d0c0a..aaba7e53ee 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -735,13 +735,14 @@ NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id) maps[0] = id; maps[1] = NULL; - if (sid_check_is_in_builtin(id->sid) - || (sid_check_is_in_our_domain(id->sid))) { - dom = idmap_init_passdb_domain(NULL); - if (dom == NULL) { - return NT_STATUS_NONE_MAPPED; - } - return dom->methods->unixids_to_sids(dom, maps); + /* + * Always give passdb a chance first + */ + + dom = idmap_init_passdb_domain(NULL); + if ((dom != NULL) + && NT_STATUS_IS_OK(dom->methods->unixids_to_sids(dom, maps))) { + return NT_STATUS_OK; } dom = idmap_find_domain(domname); -- cgit From 76d53e7648869bbdc83be1e07941467019b96321 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 2 Jan 2009 14:53:26 +0100 Subject: Alternative fix for 45db33e73 and 0d443ae7931 Simo is right, we need to ask passdb first. At least this fixes a nasty to find NT_STATUS_ACCESS_DENIED problem in the build farm for the test run I just did on host "opi". Michael, can you re-check if this also fixes the error you found, leading to the two fixes? Thanks, Volker --- source3/winbindd/idmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index aaba7e53ee..ca07f230ab 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -741,7 +741,8 @@ NTSTATUS idmap_backends_unixid_to_sid(const char *domname, struct id_map *id) dom = idmap_init_passdb_domain(NULL); if ((dom != NULL) - && NT_STATUS_IS_OK(dom->methods->unixids_to_sids(dom, maps))) { + && NT_STATUS_IS_OK(dom->methods->unixids_to_sids(dom, maps)) + && id->status == ID_MAPPED) { return NT_STATUS_OK; } -- cgit From 96266d2f50b2f68e29c811908efecb78895e49bd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:22:18 +0100 Subject: pidl: add dummy element for empty unions This hopefully fixes the build on Solaris and IRIX. metze --- pidl/lib/Parse/Pidl/Samba4/Header.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pidl/lib/Parse/Pidl/Samba4/Header.pm b/pidl/lib/Parse/Pidl/Samba4/Header.pm index 94e1efbfe4..0411466c82 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Header.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Header.pm @@ -183,14 +183,20 @@ sub HeaderUnion($$;$) return if (not defined($union->{ELEMENTS})); pidl " {\n"; $tab_depth++; + my $needed = 0; foreach my $e (@{$union->{ELEMENTS}}) { if ($e->{TYPE} ne "EMPTY") { if (! defined $done{$e->{NAME}}) { HeaderElement($e); } $done{$e->{NAME}} = 1; + $needed++; } } + if (!$needed) { + # sigh - some compilers don't like empty structures + pidl tabs()."int _dummy_element;\n"; + } $tab_depth--; pidl "}"; -- cgit From ec1e831bd8791e7b2c373f1119e1d3e33b06e152 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:26:00 +0100 Subject: librpc/gen_ndr: rerun make idl_full after pidl changes metze --- librpc/gen_ndr/named_pipe_auth.h | 1 + 1 file changed, 1 insertion(+) diff --git a/librpc/gen_ndr/named_pipe_auth.h b/librpc/gen_ndr/named_pipe_auth.h index 5f4ba9afb1..8f2446e564 100644 --- a/librpc/gen_ndr/named_pipe_auth.h +++ b/librpc/gen_ndr/named_pipe_auth.h @@ -19,6 +19,7 @@ struct named_pipe_auth_req { }/* [gensize,public] */; union named_pipe_auth_rep_info { + int _dummy_element; }/* [switch_type(uint32)] */; struct named_pipe_auth_rep { -- cgit From a54c558ca6e6eee1c16817bfb9d9b7dcabd578b8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 17:52:14 +0100 Subject: Revert "s4 winbind: Avoid a "discards const" compiler warning." This reverts commit dd8d4b6fd178df6847052dac207a4aafc0697d71. s3call->response.extra_data.data is a pointer and no fstring! metze --- source4/winbind/wb_samba3_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index 6cad76b08b..ea3050503d 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -115,8 +115,8 @@ NTSTATUS wbsrv_samba3_priv_pipe_dir(struct wbsrv_samba3_call *s3call) { const char *path = s3call->wbconn->listen_socket->service->priv_socket_path; s3call->response.result = WINBINDD_OK; - WBSRV_SAMBA3_SET_STRING(s3call->response.extra_data.data, path); - + s3call->response.extra_data.data = path; + s3call->response.length += strlen(path) + 1; return NT_STATUS_OK; } -- cgit From 0e95c9a1eb82a50281c94b226fbae2ac3210e5f5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 18:10:26 +0100 Subject: Revert "s4 winbind: Copy SID to avoid "discard const" warning" This reverts commit 102028ec722d942d7f91eb92e8da4f1480d140d1. state->ctx is the composite_context, which is a temporary context! metze --- source4/winbind/wb_init_domain.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index 637cf10bb7..5953474c52 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -402,8 +402,7 @@ static void init_domain_recv_samr(struct composite_context *ctx) talloc_steal(state->domain->libnet_ctx->samr.pipe, state->domain->samr_binding); state->domain->libnet_ctx->samr.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; state->domain->libnet_ctx->samr.name = state->domain->info->name; - state->domain->libnet_ctx->samr.sid = dom_sid_dup(state->ctx, - state->domain->info->sid); + state->domain->libnet_ctx->samr.sid = state->domain->info->sid; composite_done(state->ctx); } -- cgit From 54c0f626f51c33245ae8f7778cc6ad6b48ae0f93 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:06:31 +0100 Subject: s4:pyregistry: use tevent_context_init() metze --- source4/lib/registry/pyregistry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c index 2d2f2fb685..357305c4de 100644 --- a/source4/lib/registry/pyregistry.c +++ b/source4/lib/registry/pyregistry.c @@ -357,7 +357,7 @@ static PyObject *py_open_ldb_file(PyObject *self, PyObject *args, PyObject *kwar session_info = NULL; /* FIXME */ result = reg_open_ldb_file(NULL, location, session_info, credentials, - event_context_init(NULL), lp_ctx, &key); + tevent_context_init(NULL), lp_ctx, &key); PyErr_WERROR_IS_ERR_RAISE(result); return py_talloc_import(&PyHiveKey, key); -- cgit From 3f8f99eaecf7a07126969594c41c00392b85cefd Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 12:06:39 +0100 Subject: s4:tevent: move event_context_find() to tevent_s4.c metze --- lib/tevent/tevent.c | 18 ------------------ source4/lib/events/tevent_s4.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index e45a690c33..130bfaa665 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -290,21 +290,3 @@ int event_loop_wait(struct tevent_context *ev) { return ev->ops->loop_wait(ev); } - -/* - find an event context that is a parent of the given memory context, - or create a new event context as a child of the given context if - none is found - - This should be used in preference to event_context_init() in places - where you would prefer to use the existing event context if possible - (which is most situations) -*/ -struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx) -{ - struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context); - if (ev == NULL) { - ev = event_context_init(mem_ctx); - } - return ev; -} diff --git a/source4/lib/events/tevent_s4.c b/source4/lib/events/tevent_s4.c index b3de7e667a..e50ff57e90 100644 --- a/source4/lib/events/tevent_s4.c +++ b/source4/lib/events/tevent_s4.c @@ -70,3 +70,20 @@ struct tevent_context *s4_event_context_init(TALLOC_CTX *mem_ctx) return ev; } +/* + find an event context that is a parent of the given memory context, + or create a new event context as a child of the given context if + none is found + + This should be used in preference to event_context_init() in places + where you would prefer to use the existing event context if possible + (which is most situations) +*/ +struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx) +{ + struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context); + if (ev == NULL) { + ev = event_context_init(mem_ctx); + } + return ev; +} -- cgit From 25387d89427d1cc79c80d4915ecc00100712be87 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 15:33:23 +0100 Subject: s4:lib/events: deprecate event_context_find() metze --- source4/lib/events/events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/lib/events/events.h b/source4/lib/events/events.h index 698ff2919b..1b2dbde32b 100644 --- a/source4/lib/events/events.h +++ b/source4/lib/events/events.h @@ -3,5 +3,5 @@ #define TEVENT_COMPAT_DEFINES 1 #include <../lib/tevent/tevent.h> struct tevent_context *s4_event_context_init(TALLOC_CTX *mem_ctx); -struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx); +struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx) _DEPRECATED_; #endif /* __LIB_EVENTS_H__ */ -- cgit From 0ffed7d992a50bff5f3bc89447418ed485dbccb0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 12:53:05 +0100 Subject: tevent: use libreplace headers instead of system headers metze --- lib/tevent/tevent_aio.c | 5 +++-- lib/tevent/tevent_epoll.c | 2 +- lib/tevent/tevent_signal.c | 3 +-- lib/tevent/tevent_timed.c | 5 +---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c index 746e96060b..46a5d3d6fc 100644 --- a/lib/tevent/tevent_aio.c +++ b/lib/tevent/tevent_aio.c @@ -30,12 +30,13 @@ this is _very_ experimental code */ -#include "system/filesys.h" #include "replace.h" +#include "system/filesys.h" +#include "system/network.h" +#include "system/select.h" #include "tevent.h" #include "tevent_internal.h" #include "tevent_util.h" -#include #include #define MAX_AIO_QUEUE_DEPTH 100 diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index 1ce666462c..ab07515f10 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -23,10 +23,10 @@ #include "replace.h" #include "system/filesys.h" #include "system/network.h" +#include "system/select.h" #include "tevent.h" #include "tevent_internal.h" #include "tevent_util.h" -#include struct epoll_event_context { /* a pointer back to the generic event_context */ diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index bb50480dd7..fdd7070625 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -19,10 +19,9 @@ along with this program. If not, see . */ -#include #include "replace.h" #include "system/filesys.h" -#include "system/select.h" +#include "system/wait.h" #include "tevent.h" #include "tevent_internal.h" #include "tevent_util.h" diff --git a/lib/tevent/tevent_timed.c b/lib/tevent/tevent_timed.c index ce3fc8eb00..4ad457221e 100644 --- a/lib/tevent/tevent_timed.c +++ b/lib/tevent/tevent_timed.c @@ -20,11 +20,8 @@ along with this program. If not, see . */ -#include -#include #include "replace.h" -#include "system/filesys.h" -#include "system/select.h" +#include "system/time.h" #include "tevent.h" #include "tevent_internal.h" #include "tevent_util.h" -- cgit From 8bdc947993dd29d0480675464d548134c6f71ea7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 11:17:00 +0100 Subject: tevent: rename event_set_default_backend() => tevent_set_default_backend() metze --- lib/tevent/tevent.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 130bfaa665..94d71d490d 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -65,7 +65,7 @@ struct event_ops_list { /* list of registered event backends */ static struct event_ops_list *event_backends = NULL; -static char *event_default_backend = NULL; +static char *tevent_default_backend = NULL; /* register an events backend @@ -94,10 +94,11 @@ bool event_register_backend(const char *name, const struct event_ops *ops) /* set the default event backend */ -void event_set_default_backend(const char *backend) +void tevent_set_default_backend(const char *backend) { - if (event_default_backend) free(event_default_backend); - event_default_backend = strdup(backend); + talloc_free(tevent_default_backend); + tevent_default_backend = talloc_strdup(talloc_autofree_context(), + backend); } /* @@ -177,7 +178,7 @@ struct tevent_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char event_backend_init(); if (name == NULL) { - name = event_default_backend; + name = tevent_default_backend; } if (name == NULL) { name = "standard"; -- cgit From d33b6aeff3ff0220c16211936043934cfa3ec71b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 11:32:29 +0100 Subject: tevent: rename event_loop_* => tevent_loop_* metze --- lib/tevent/tevent.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 94d71d490d..563a6522a5 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -47,8 +47,8 @@ After that you can add/remove events that you are interested in using event_add_*() and talloc_free() - Finally, you call event_loop_wait_once() to block waiting for one of the - events to occor or event_loop_wait() which will loop + Finally, you call tevent_loop_wait_once() to block waiting for one of the + events to occor or tevent_loop_wait() which will loop forever. */ @@ -279,7 +279,7 @@ struct signal_event *event_add_signal(struct tevent_context *ev, TALLOC_CTX *mem /* do a single event loop using the events defined in ev */ -int event_loop_once(struct tevent_context *ev) +int tevent_loop_once(struct tevent_context *ev) { return ev->ops->loop_once(ev); } @@ -287,7 +287,7 @@ int event_loop_once(struct tevent_context *ev) /* return on failure or (with 0) if all fd events are removed */ -int event_loop_wait(struct tevent_context *ev) +int tevent_loop_wait(struct tevent_context *ev) { return ev->ops->loop_wait(ev); } -- cgit From 7db63990698563fd5d32698cb7988358cf5ab247 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 11:36:52 +0100 Subject: tevent: rename event_[s|g]et_fd_flags => tevent_fd_[s|g]et_flags metze --- lib/tevent/tevent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 563a6522a5..4c87ef5f73 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -233,7 +233,7 @@ struct aio_event *event_add_aio(struct tevent_context *ev, /* return the fd event flags */ -uint16_t event_get_fd_flags(struct tevent_fd *fde) +uint16_t tevent_fd_get_flags(struct tevent_fd *fde) { if (!fde) return 0; return fde->event_ctx->ops->get_fd_flags(fde); @@ -242,7 +242,7 @@ uint16_t event_get_fd_flags(struct tevent_fd *fde) /* set the fd event flags */ -void event_set_fd_flags(struct tevent_fd *fde, uint16_t flags) +void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags) { if (!fde) return; fde->event_ctx->ops->set_fd_flags(fde, flags); -- cgit From 0a73e8b334d2b9f5e8032c685d78b6425a9fa5e7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 11:30:00 +0100 Subject: tevent: rename event_context_init* => tevent_context_init*() metze --- lib/tevent/tevent.c | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 4c87ef5f73..0b4a3cd5b7 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -41,7 +41,7 @@ handler to get another event. To setup a set of events you first need to create a event_context - structure using the function event_context_init(); This returns a + structure using the function tevent_context_init(); This returns a 'struct tevent_context' that you use in all subsequent calls. After that you can add/remove events that you are interested in @@ -57,36 +57,36 @@ #include "tevent_internal.h" #include "tevent_util.h" -struct event_ops_list { - struct event_ops_list *next, *prev; +struct tevent_ops_list { + struct tevent_ops_list *next, *prev; const char *name; - const struct event_ops *ops; + const struct tevent_ops *ops; }; /* list of registered event backends */ -static struct event_ops_list *event_backends = NULL; +static struct tevent_ops_list *tevent_backends = NULL; static char *tevent_default_backend = NULL; /* register an events backend */ -bool event_register_backend(const char *name, const struct event_ops *ops) +bool event_register_backend(const char *name, const struct tevent_ops *ops) { - struct event_ops_list *e; + struct tevent_ops_list *e; - for (e = event_backends; e != NULL; e = e->next) { + for (e = tevent_backends; e != NULL; e = e->next) { if (0 == strcmp(e->name, name)) { /* already registered, skip it */ return true; } } - e = talloc(talloc_autofree_context(), struct event_ops_list); + e = talloc(talloc_autofree_context(), struct tevent_ops_list); if (e == NULL) return false; e->name = name; e->ops = ops; - DLIST_ADD(event_backends, e); + DLIST_ADD(tevent_backends, e); return true; } @@ -104,7 +104,7 @@ void tevent_set_default_backend(const char *backend) /* initialise backends if not already done */ -static void event_backend_init(void) +static void tevent_backend_init(void) { events_select_init(); events_standard_init(); @@ -119,14 +119,14 @@ static void event_backend_init(void) /* list available backends */ -const char **event_backend_list(TALLOC_CTX *mem_ctx) +const char **tevent_backend_list(TALLOC_CTX *mem_ctx) { const char **list = NULL; - struct event_ops_list *e; + struct tevent_ops_list *e; - event_backend_init(); + tevent_backend_init(); - for (e=event_backends;e;e=e->next) { + for (e=tevent_backends;e;e=e->next) { list = ev_str_list_add(list, e->name); } @@ -144,10 +144,10 @@ const char **event_backend_list(TALLOC_CTX *mem_ctx) This function is for allowing third-party-applications to hook in gluecode to their own event loop code, so that they can make async usage of our client libs - NOTE: use event_context_init() inside of samba! + NOTE: use tevent_context_init() inside of samba! */ -static struct tevent_context *event_context_init_ops(TALLOC_CTX *mem_ctx, - const struct event_ops *ops) +static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx, + const struct tevent_ops *ops) { struct tevent_context *ev; int ret; @@ -171,11 +171,12 @@ static struct tevent_context *event_context_init_ops(TALLOC_CTX *mem_ctx, call, and all subsequent calls pass this event_context as the first element. Event handlers also receive this as their first argument. */ -struct tevent_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char *name) +struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx, + const char *name) { - struct event_ops_list *e; + struct tevent_ops_list *e; - event_backend_init(); + tevent_backend_init(); if (name == NULL) { name = tevent_default_backend; @@ -184,9 +185,9 @@ struct tevent_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char name = "standard"; } - for (e=event_backends;e;e=e->next) { + for (e=tevent_backends;e;e=e->next) { if (strcmp(name, e->name) == 0) { - return event_context_init_ops(mem_ctx, e->ops); + return tevent_context_init_ops(mem_ctx, e->ops); } } return NULL; @@ -198,9 +199,9 @@ struct tevent_context *event_context_init_byname(TALLOC_CTX *mem_ctx, const char call, and all subsequent calls pass this event_context as the first element. Event handlers also receive this as their first argument. */ -struct tevent_context *event_context_init(TALLOC_CTX *mem_ctx) +struct tevent_context *tevent_context_init(TALLOC_CTX *mem_ctx) { - return event_context_init_byname(mem_ctx, NULL); + return tevent_context_init_byname(mem_ctx, NULL); } /* -- cgit From d9529a331afaf1c82b24becc1d0d245e19d518aa Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 13:35:32 +0100 Subject: tevent: rename event_register_backend() => tevent_register_backend() And fix the callers and there init functions. metze --- lib/tevent/tevent.c | 10 +++++----- lib/tevent/tevent_aio.c | 6 +++--- lib/tevent/tevent_epoll.c | 6 +++--- lib/tevent/tevent_internal.h | 10 +++++----- lib/tevent/tevent_select.c | 7 +++---- lib/tevent/tevent_standard.c | 6 +++--- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 0b4a3cd5b7..676a3dc398 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -70,7 +70,7 @@ static char *tevent_default_backend = NULL; /* register an events backend */ -bool event_register_backend(const char *name, const struct tevent_ops *ops) +bool tevent_register_backend(const char *name, const struct tevent_ops *ops) { struct tevent_ops_list *e; @@ -106,13 +106,13 @@ void tevent_set_default_backend(const char *backend) */ static void tevent_backend_init(void) { - events_select_init(); - events_standard_init(); + tevent_select_init(); + tevent_standard_init(); #if HAVE_EVENTS_EPOLL - events_epoll_init(); + tevent_epoll_init(); #endif #if HAVE_LINUX_AIO - events_aio_init(); + tevent_aio_init(); #endif } diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c index 46a5d3d6fc..8d25791bea 100644 --- a/lib/tevent/tevent_aio.c +++ b/lib/tevent/tevent_aio.c @@ -549,7 +549,7 @@ static struct aio_event *aio_event_add_aio(struct tevent_context *ev, return ae; } -static const struct event_ops aio_event_ops = { +static const struct tevent_ops aio_event_ops = { .context_init = aio_event_context_init, .add_fd = aio_event_add_fd, .add_aio = aio_event_add_aio, @@ -561,8 +561,8 @@ static const struct event_ops aio_event_ops = { .loop_wait = aio_event_loop_wait, }; -bool events_aio_init(void) +bool tevent_aio_init(void) { - return event_register_backend("aio", &aio_event_ops); + return tevent_register_backend("aio", &aio_event_ops); } diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index ab07515f10..1f853e60f1 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -465,7 +465,7 @@ static int epoll_event_loop_wait(struct tevent_context *ev) return 0; } -static const struct event_ops epoll_event_ops = { +static const struct tevent_ops epoll_event_ops = { .context_init = epoll_event_context_init, .add_fd = epoll_event_add_fd, .get_fd_flags = epoll_event_get_fd_flags, @@ -476,7 +476,7 @@ static const struct event_ops epoll_event_ops = { .loop_wait = epoll_event_loop_wait, }; -bool events_epoll_init(void) +bool tevent_epoll_init(void) { - return event_register_backend("epoll", &epoll_event_ops); + return tevent_register_backend("epoll", &epoll_event_ops); } diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index 2d6909da36..a439c62743 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -132,7 +132,7 @@ struct tevent_context { }; -bool event_register_backend(const char *name, const struct tevent_ops *ops); +bool tevent_register_backend(const char *name, const struct tevent_ops *ops); bool ev_timeval_is_zero(const struct timeval *tv); struct tevent_timer *common_event_add_timed(struct tevent_context *, @@ -151,11 +151,11 @@ struct tevent_signal *common_event_add_signal(struct tevent_context *ev, int common_event_check_signal(struct tevent_context *ev); -bool events_standard_init(void); -bool events_select_init(void); +bool tevent_standard_init(void); +bool tevent_select_init(void); #if HAVE_EVENTS_EPOLL -bool events_epoll_init(void); +bool tevent_epoll_init(void); #endif #if HAVE_LINUX_AIO -bool events_aio_init(void); +bool tevent_aio_init(void); #endif diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c index 3e72ce4943..103e5ac1fa 100644 --- a/lib/tevent/tevent_select.c +++ b/lib/tevent/tevent_select.c @@ -284,7 +284,7 @@ static int select_event_loop_wait(struct tevent_context *ev) return select_ev->exit_code; } -static const struct event_ops select_event_ops = { +static const struct tevent_ops select_event_ops = { .context_init = select_event_context_init, .add_fd = select_event_add_fd, .get_fd_flags = select_event_get_fd_flags, @@ -295,8 +295,7 @@ static const struct event_ops select_event_ops = { .loop_wait = select_event_loop_wait, }; -bool events_select_init(void) +bool tevent_select_init(void) { - return event_register_backend("select", &select_event_ops); + return tevent_register_backend("select", &select_event_ops); } - diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index 1c99408b8d..1c60fc0167 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -588,7 +588,7 @@ static int std_event_loop_wait(struct tevent_context *ev) return std_ev->exit_code; } -static const struct event_ops std_event_ops = { +static const struct tevent_ops std_event_ops = { .context_init = std_event_context_init, .add_fd = std_event_add_fd, .get_fd_flags = std_event_get_fd_flags, @@ -600,8 +600,8 @@ static const struct event_ops std_event_ops = { }; -bool events_standard_init(void) +bool tevent_standard_init(void) { - return event_register_backend("standard", &std_event_ops); + return tevent_register_backend("standard", &std_event_ops); } -- cgit From b12e78e64517d423aefecc84f23499b13aedd734 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 13:39:26 +0100 Subject: tevent: use HAVE_EPOLL instead of HAVE_EVENTS_EPOLL metze --- lib/tevent/libtevent.m4 | 2 -- lib/tevent/tevent.c | 4 ++-- lib/tevent/tevent_internal.h | 4 ++-- lib/tevent/tevent_standard.c | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4 index 30105d9bef..24cdd8c27f 100644 --- a/lib/tevent/libtevent.m4 +++ b/lib/tevent/libtevent.m4 @@ -26,8 +26,6 @@ if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x TEVENT_OBJ="$TEVENT_OBJ tevent_epoll.o" SMB_ENABLE(TEVENT_EPOLL,YES) AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available]) - #TODO: remove HAVE_EVENTS_EPOLL and use HAVE_EPOLL - AC_DEFINE(HAVE_EVENTS_EPOLL, 1, [Whether epoll available]) # check for native Linux AIO interface AC_CHECK_HEADERS(libaio.h) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 676a3dc398..f79e4cefb5 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -108,10 +108,10 @@ static void tevent_backend_init(void) { tevent_select_init(); tevent_standard_init(); -#if HAVE_EVENTS_EPOLL +#ifdef HAVE_EPOLL tevent_epoll_init(); #endif -#if HAVE_LINUX_AIO +#ifdef HAVE_LINUX_AIO tevent_aio_init(); #endif } diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index a439c62743..b654e4b500 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -153,9 +153,9 @@ int common_event_check_signal(struct tevent_context *ev); bool tevent_standard_init(void); bool tevent_select_init(void); -#if HAVE_EVENTS_EPOLL +#ifdef HAVE_EPOLL bool tevent_epoll_init(void); #endif -#if HAVE_LINUX_AIO +#ifdef HAVE_LINUX_AIO bool tevent_aio_init(void); #endif diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index 1c60fc0167..7abb695d89 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -30,7 +30,7 @@ #include "replace.h" #include "system/filesys.h" #include "system/network.h" -#include "system/select.h" /* needed for HAVE_EVENTS_EPOLL */ +#include "system/select.h" #include "tevent.h" #include "tevent_util.h" #include "tevent_internal.h" @@ -64,7 +64,7 @@ struct std_event_context { }; /* use epoll if it is available */ -#if HAVE_EVENTS_EPOLL +#if HAVE_EPOLL /* called when a epoll call fails, and we should fallback to using select -- cgit From 49acf9799aab288b4e585295eb7c44a719973945 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 11:44:17 +0100 Subject: tevent: make tevent_add_*() macros arround _tevent_add_*() This passes some additional debug information into the events system to make it easier to find bugs. metze --- lib/tevent/tevent.c | 53 ++++++++++++++++++++++++++---------------- lib/tevent/tevent.h | 66 +++++++++++++++++++++++++++++++++++------------------ 2 files changed, 77 insertions(+), 42 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index f79e4cefb5..fd44838a98 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -45,7 +45,7 @@ 'struct tevent_context' that you use in all subsequent calls. After that you can add/remove events that you are interested in - using event_add_*() and talloc_free() + using tevent_add_*() and talloc_free() Finally, you call tevent_loop_wait_once() to block waiting for one of the events to occor or tevent_loop_wait() which will loop @@ -208,12 +208,17 @@ struct tevent_context *tevent_context_init(TALLOC_CTX *mem_ctx) add a fd based event return NULL on failure (memory allocation error) - if flags contains EVENT_FD_AUTOCLOSE then the fd will be closed when + if flags contains TEVENT_FD_AUTOCLOSE then the fd will be closed when the returned fd_event context is freed */ -struct tevent_fd *event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, event_fd_handler_t handler, - void *private_data) +struct tevent_fd *_tevent_add_fd(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + int fd, + uint16_t flags, + tevent_fd_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { return ev->ops->add_fd(ev, mem_ctx, fd, flags, handler, private_data); } @@ -221,11 +226,13 @@ struct tevent_fd *event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, /* add a disk aio event */ -struct aio_event *event_add_aio(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - struct iocb *iocb, - event_aio_handler_t handler, - void *private_data) +struct tevent_aio *_tevent_add_aio(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + struct iocb *iocb, + tevent_aio_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { if (ev->ops->add_aio == NULL) return NULL; return ev->ops->add_aio(ev, mem_ctx, iocb, handler, private_data); @@ -250,13 +257,16 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags) } /* - add a timed event + add a timer event return NULL on failure */ -struct tevent_timer *event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - struct timeval next_event, - event_timed_handler_t handler, - void *private_data) +struct tevent_timer *_tevent_add_timer(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + struct timeval next_event, + tevent_timer_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { return ev->ops->add_timer(ev, mem_ctx, next_event, handler, private_data); } @@ -268,11 +278,14 @@ struct tevent_timer *event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ return NULL on failure */ -struct signal_event *event_add_signal(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int signum, - int sa_flags, - event_signal_handler_t handler, - void *private_data) +struct tevent_signal *_tevent_add_signal(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + int signum, + int sa_flags, + tevent_signal_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { return ev->ops->add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data); } diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index f626de9d12..fd6b613b9d 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -51,30 +51,52 @@ struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx, const cha const char **tevent_backend_list(TALLOC_CTX *mem_ctx); void tevent_set_default_backend(const char *backend); -struct tevent_fd *tevent_add_fd(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - tevent_fd_handler_t handler, - void *private_data); - -struct tevent_timer *tevent_add_timer(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - struct timeval next_event, - tevent_timer_handler_t handler, - void *private_data); - -struct tevent_signal *tevent_add_signal(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - int signum, int sa_flags, - tevent_signal_handler_t handler, - void *private_data); +struct tevent_fd *_tevent_add_fd(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + int fd, + uint16_t flags, + tevent_fd_handler_t handler, + void *private_data, + const char *handler_name, + const char *location); +#define tevent_add_fd(ev, mem_ctx, fd, flags, handler, private_data) \ + _tevent_add_fd(ev, mem_ctx, fd, flags, handler, private_data, \ + #handler, __location__) + +struct tevent_timer *_tevent_add_timer(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + struct timeval next_event, + tevent_timer_handler_t handler, + void *private_data, + const char *handler_name, + const char *location); +#define tevent_add_timer(ev, mem_ctx, next_event, handler, private_data) \ + _tevent_add_timer(ev, mem_ctx, next_event, handler, private_data, \ + #handler, __location__); + +struct tevent_signal *_tevent_add_signal(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + int signum, + int sa_flags, + tevent_signal_handler_t handler, + void *private_data, + const char *handler_name, + const char *location); +#define tevent_add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data) \ + _tevent_add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data, \ + #handler, __location__) struct iocb; -struct tevent_aio *tevent_add_aio(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - struct iocb *iocb, - tevent_aio_handler_t handler, - void *private_data); +struct tevent_aio *_tevent_add_aio(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + struct iocb *iocb, + tevent_aio_handler_t handler, + void *private_data, + const char *handler_name, + const char *location); +#define tevent_add_aio(ev, mem_ctx, iocb, handler, private_data) \ + _tevent_add_aio(ev, mem_ctx, iocb, handler, private_data, \ + #handler, __location__); int tevent_loop_once(struct tevent_context *ev); int tevent_loop_wait(struct tevent_context *ev); -- cgit From 227f799dee4e59479612bcb3dc96231589515051 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 13:26:32 +0100 Subject: tevent: pass down handler_name and location to the backend layer metze --- lib/tevent/tevent.c | 12 +++++--- lib/tevent/tevent_aio.c | 46 +++++++++++++++++-------------- lib/tevent/tevent_epoll.c | 22 +++++++++------ lib/tevent/tevent_internal.h | 65 ++++++++++++++++++++++++++++++-------------- lib/tevent/tevent_select.c | 22 +++++++++------ lib/tevent/tevent_signal.c | 41 ++++++++++++++++------------ lib/tevent/tevent_standard.c | 26 ++++++++++-------- lib/tevent/tevent_timed.c | 22 +++++++++------ 8 files changed, 154 insertions(+), 102 deletions(-) diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index fd44838a98..9319177646 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -220,7 +220,8 @@ struct tevent_fd *_tevent_add_fd(struct tevent_context *ev, const char *handler_name, const char *location) { - return ev->ops->add_fd(ev, mem_ctx, fd, flags, handler, private_data); + return ev->ops->add_fd(ev, mem_ctx, fd, flags, handler, private_data, + handler_name, location); } /* @@ -235,7 +236,8 @@ struct tevent_aio *_tevent_add_aio(struct tevent_context *ev, const char *location) { if (ev->ops->add_aio == NULL) return NULL; - return ev->ops->add_aio(ev, mem_ctx, iocb, handler, private_data); + return ev->ops->add_aio(ev, mem_ctx, iocb, handler, private_data, + handler_name, location); } /* @@ -268,7 +270,8 @@ struct tevent_timer *_tevent_add_timer(struct tevent_context *ev, const char *handler_name, const char *location) { - return ev->ops->add_timer(ev, mem_ctx, next_event, handler, private_data); + return ev->ops->add_timer(ev, mem_ctx, next_event, handler, private_data, + handler_name, location); } /* @@ -287,7 +290,8 @@ struct tevent_signal *_tevent_add_signal(struct tevent_context *ev, const char *handler_name, const char *location) { - return ev->ops->add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data); + return ev->ops->add_signal(ev, mem_ctx, signum, sa_flags, handler, private_data, + handler_name, location); } /* diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c index 8d25791bea..f3045fbf97 100644 --- a/lib/tevent/tevent_aio.c +++ b/lib/tevent/tevent_aio.c @@ -67,11 +67,11 @@ struct aio_event_context { pid_t pid; }; -struct aio_event { +struct tevent_aio { struct tevent_context *event_ctx; struct iocb iocb; void *private_data; - event_aio_handler_t handler; + tevent_aio_handler_t handler; }; /* @@ -261,7 +261,7 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval if (aio_ev->epoll_fd == -1) return -1; if (aio_ev->ev->num_signal_handlers && - common_event_check_signal(aio_ev->ev)) { + tevent_common_check_signal(aio_ev->ev)) { return 0; } @@ -279,14 +279,14 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval if (ret == -EINTR) { if (aio_ev->ev->num_signal_handlers) { - common_event_check_signal(aio_ev->ev); + tevent_common_check_signal(aio_ev->ev); } return 0; } if (ret == 0 && tvalp) { /* we don't care about a possible delay here */ - common_event_loop_timer_delay(aio_ev->ev); + tevent_common_loop_timer_delay(aio_ev->ev); return 0; } @@ -297,8 +297,8 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval switch (finished->aio_lio_opcode) { case IO_CMD_PWRITE: case IO_CMD_PREAD: { - struct aio_event *ae = talloc_get_type(finished->data, - struct aio_event); + struct tevent_aio *ae = talloc_get_type(finished->data, + struct tevent_aio); if (ae) { talloc_set_destructor(ae, NULL); ae->handler(ae->event_ctx, ae, @@ -412,9 +412,11 @@ static int aio_event_fd_destructor(struct tevent_fd *fde) return NULL on failure (memory allocation error) */ static struct tevent_fd *aio_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - event_fd_handler_t handler, - void *private_data) + int fd, uint16_t flags, + tevent_fd_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data, struct aio_event_context); @@ -430,6 +432,8 @@ static struct tevent_fd *aio_event_add_fd(struct tevent_context *ev, TALLOC_CTX fde->flags = flags; fde->handler = handler; fde->private_data = private_data; + fde->handler_name = handler_name; + fde->location = location; fde->additional_flags = 0; fde->additional_data = NULL; @@ -480,7 +484,7 @@ static int aio_event_loop_once(struct tevent_context *ev) struct aio_event_context); struct timeval tval; - tval = common_event_loop_timer_delay(ev); + tval = tevent_common_loop_timer_delay(ev); if (ev_timeval_is_zero(&tval)) { return 0; } @@ -509,7 +513,7 @@ static int aio_event_loop_wait(struct tevent_context *ev) /* called when a disk IO event needs to be cancelled */ -static int aio_destructor(struct aio_event *ae) +static int aio_destructor(struct tevent_aio *ae) { struct tevent_context *ev = ae->event_ctx; struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data, @@ -521,16 +525,18 @@ static int aio_destructor(struct aio_event *ae) } /* submit an aio disk IO event */ -static struct aio_event *aio_event_add_aio(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - struct iocb *iocb, - event_aio_handler_t handler, - void *private_data) +static struct tevent_aio *aio_event_add_aio(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + struct iocb *iocb, + tevent_aio_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { struct aio_event_context *aio_ev = talloc_get_type(ev->additional_data, struct aio_event_context); struct iocb *iocbp; - struct aio_event *ae = talloc(mem_ctx?mem_ctx:ev, struct aio_event); + struct tevent_aio *ae = talloc(mem_ctx?mem_ctx:ev, struct tevent_aio); if (ae == NULL) return NULL; ae->event_ctx = ev; @@ -555,8 +561,8 @@ static const struct tevent_ops aio_event_ops = { .add_aio = aio_event_add_aio, .get_fd_flags = aio_event_get_fd_flags, .set_fd_flags = aio_event_set_fd_flags, - .add_timer = common_event_add_timed, - .add_signal = common_event_add_signal, + .add_timer = tevent_common_add_timer, + .add_signal = tevent_common_add_signal, .loop_once = aio_event_loop_once, .loop_wait = aio_event_loop_wait, }; diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index 1f853e60f1..d2703eda6c 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -258,14 +258,14 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval } if (epoll_ev->ev->num_signal_handlers && - common_event_check_signal(epoll_ev->ev)) { + tevent_common_check_signal(epoll_ev->ev)) { return 0; } ret = epoll_wait(epoll_ev->epoll_fd, events, MAXEVENTS, timeout); if (ret == -1 && errno == EINTR && epoll_ev->ev->num_signal_handlers) { - if (common_event_check_signal(epoll_ev->ev)) { + if (tevent_common_check_signal(epoll_ev->ev)) { return 0; } } @@ -277,7 +277,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval if (ret == 0 && tvalp) { /* we don't care about a possible delay here */ - common_event_loop_timer_delay(epoll_ev->ev); + tevent_common_loop_timer_delay(epoll_ev->ev); return 0; } @@ -371,9 +371,11 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde) return NULL on failure (memory allocation error) */ static struct tevent_fd *epoll_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - event_fd_handler_t handler, - void *private_data) + int fd, uint16_t flags, + tevent_fd_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data, struct epoll_event_context); @@ -389,6 +391,8 @@ static struct tevent_fd *epoll_event_add_fd(struct tevent_context *ev, TALLOC_CT fde->flags = flags; fde->handler = handler; fde->private_data = private_data; + fde->handler_name = handler_name; + fde->location = location; fde->additional_flags = 0; fde->additional_data = NULL; @@ -439,7 +443,7 @@ static int epoll_event_loop_once(struct tevent_context *ev) struct epoll_event_context); struct timeval tval; - tval = common_event_loop_timer_delay(ev); + tval = tevent_common_loop_timer_delay(ev); if (ev_timeval_is_zero(&tval)) { return 0; } @@ -470,8 +474,8 @@ static const struct tevent_ops epoll_event_ops = { .add_fd = epoll_event_add_fd, .get_fd_flags = epoll_event_get_fd_flags, .set_fd_flags = epoll_event_set_fd_flags, - .add_timer = common_event_add_timed, - .add_signal = common_event_add_signal, + .add_timer = tevent_common_add_timer, + .add_signal = tevent_common_add_signal, .loop_once = epoll_event_loop_once, .loop_wait = epoll_event_loop_wait, }; diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index b654e4b500..408136dc71 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -30,7 +30,9 @@ struct tevent_ops { TALLOC_CTX *mem_ctx, int fd, uint16_t flags, tevent_fd_handler_t handler, - void *private_data); + void *private_data, + const char *handler_name, + const char *location); uint16_t (*get_fd_flags)(struct tevent_fd *fde); void (*set_fd_flags)(struct tevent_fd *fde, uint16_t flags); @@ -39,19 +41,25 @@ struct tevent_ops { TALLOC_CTX *mem_ctx, struct timeval next_event, tevent_timer_handler_t handler, - void *private_data); + void *private_data, + const char *handler_name, + const char *location); /* disk aio event functions */ struct tevent_aio *(*add_aio)(struct tevent_context *ev, TALLOC_CTX *mem_ctx, struct iocb *iocb, tevent_aio_handler_t handler, - void *private_data); + void *private_data, + const char *handler_name, + const char *location); /* signal functions */ struct tevent_signal *(*add_signal)(struct tevent_context *ev, TALLOC_CTX *mem_ctx, int signum, int sa_flags, tevent_signal_handler_t handler, - void *private_data); + void *private_data, + const char *handler_name, + const char *location); /* loop functions */ int (*loop_once)(struct tevent_context *ev); @@ -66,6 +74,9 @@ struct tevent_fd { tevent_fd_handler_t handler; /* this is private for the specific handler */ void *private_data; + /* this is for debugging only! */ + const char *handler_name; + const char *location; /* this is private for the events_ops implementation */ uint16_t additional_flags; void *additional_data; @@ -78,6 +89,9 @@ struct tevent_timer { tevent_timer_handler_t handler; /* this is private for the specific handler */ void *private_data; + /* this is for debugging only! */ + const char *handler_name; + const char *location; /* this is private for the events_ops implementation */ void *additional_data; }; @@ -85,10 +99,16 @@ struct tevent_timer { struct tevent_signal { struct tevent_signal *prev, *next; struct tevent_context *event_ctx; - tevent_signal_handler_t handler; - void *private_data; int signum; int sa_flags; + tevent_signal_handler_t handler; + /* this is private for the specific handler */ + void *private_data; + /* this is for debugging only! */ + const char *handler_name; + const char *location; + /* this is private for the events_ops implementation */ + void *additional_data; }; /* DEBUG */ @@ -135,21 +155,24 @@ struct tevent_context { bool tevent_register_backend(const char *name, const struct tevent_ops *ops); bool ev_timeval_is_zero(const struct timeval *tv); -struct tevent_timer *common_event_add_timed(struct tevent_context *, - TALLOC_CTX *, - struct timeval, - tevent_timer_handler_t, - void *); -struct timeval common_event_loop_timer_delay(struct tevent_context *); - -struct tevent_signal *common_event_add_signal(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - int signum, - int sa_flags, - tevent_signal_handler_t handler, - void *private_data); -int common_event_check_signal(struct tevent_context *ev); - +struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + struct timeval next_event, + tevent_timer_handler_t handler, + void *private_data, + const char *handler_name, + const char *location); +struct timeval tevent_common_loop_timer_delay(struct tevent_context *); + +struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + int signum, + int sa_flags, + tevent_signal_handler_t handler, + void *private_data, + const char *handler_name, + const char *location); +int tevent_common_check_signal(struct tevent_context *ev); bool tevent_standard_init(void); bool tevent_select_init(void); diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c index 103e5ac1fa..b082400a8e 100644 --- a/lib/tevent/tevent_select.c +++ b/lib/tevent/tevent_select.c @@ -116,9 +116,11 @@ static int select_event_fd_destructor(struct tevent_fd *fde) return NULL on failure (memory allocation error) */ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - event_fd_handler_t handler, - void *private_data) + int fd, uint16_t flags, + tevent_fd_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { struct select_event_context *select_ev = talloc_get_type(ev->additional_data, struct select_event_context); @@ -132,6 +134,8 @@ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_C fde->flags = flags; fde->handler = handler; fde->private_data = private_data; + fde->handler_name = handler_name; + fde->location = location; fde->additional_flags = 0; fde->additional_data = NULL; @@ -198,7 +202,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru } if (select_ev->ev->num_signal_handlers && - common_event_check_signal(select_ev->ev)) { + tevent_common_check_signal(select_ev->ev)) { return 0; } @@ -206,7 +210,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru if (selrtn == -1 && errno == EINTR && select_ev->ev->num_signal_handlers) { - common_event_check_signal(select_ev->ev); + tevent_common_check_signal(select_ev->ev); return 0; } @@ -224,7 +228,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru if (selrtn == 0 && tvalp) { /* we don't care about a possible delay here */ - common_event_loop_timer_delay(select_ev->ev); + tevent_common_loop_timer_delay(select_ev->ev); return 0; } @@ -258,7 +262,7 @@ static int select_event_loop_once(struct tevent_context *ev) struct select_event_context); struct timeval tval; - tval = common_event_loop_timer_delay(ev); + tval = tevent_common_loop_timer_delay(ev); if (ev_timeval_is_zero(&tval)) { return 0; } @@ -289,8 +293,8 @@ static const struct tevent_ops select_event_ops = { .add_fd = select_event_add_fd, .get_fd_flags = select_event_get_fd_flags, .set_fd_flags = select_event_set_fd_flags, - .add_timer = common_event_add_timed, - .add_signal = common_event_add_signal, + .add_timer = tevent_common_add_timer, + .add_signal = tevent_common_add_signal, .loop_once = select_event_loop_once, .loop_wait = select_event_loop_wait, }; diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index fdd7070625..031845927b 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -45,7 +45,7 @@ struct sigcounter { the poor design of signals means that this table must be static global */ static struct sig_state { - struct signal_event *sig_handlers[NUM_SIGNALS+1]; + struct tevent_signal *sig_handlers[NUM_SIGNALS+1]; struct sigaction *oldact[NUM_SIGNALS+1]; struct sigcounter signal_count[NUM_SIGNALS+1]; struct sigcounter got_signal; @@ -107,7 +107,7 @@ static void signal_handler_info(int signum, siginfo_t *info, void *uctx) /* destroy a signal event */ -static int signal_event_destructor(struct signal_event *se) +static int tevent_signal_destructor(struct tevent_signal *se) { se->event_ctx->num_signal_handlers--; DLIST_REMOVE(sig_state->sig_handlers[se->signum], se); @@ -140,14 +140,16 @@ static void signal_pipe_handler(struct tevent_context *ev, struct tevent_fd *fde add a signal event return NULL on failure (memory allocation error) */ -struct signal_event *common_event_add_signal(struct tevent_context *ev, - TALLOC_CTX *mem_ctx, - int signum, - int sa_flags, - event_signal_handler_t handler, - void *private_data) +struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev, + TALLOC_CTX *mem_ctx, + int signum, + int sa_flags, + tevent_signal_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { - struct signal_event *se; + struct tevent_signal *se; if (signum >= NUM_SIGNALS) { return NULL; @@ -162,15 +164,18 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev, } } - se = talloc(mem_ctx?mem_ctx:ev, struct signal_event); + se = talloc(mem_ctx?mem_ctx:ev, struct tevent_signal); if (se == NULL) return NULL; se->event_ctx = ev; - se->handler = handler; - se->private_data = private_data; se->signum = signum; se->sa_flags = sa_flags; - + se->handler = handler; + se->private_data = private_data; + se->handler_name = handler_name; + se->location = location; + se->additional_data = NULL; + /* Ensure, no matter the destruction order, that we always have a handle on the global sig_state */ if (!talloc_reference(se, sig_state)) { return NULL; @@ -208,7 +213,7 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev, DLIST_ADD(sig_state->sig_handlers[signum], se); - talloc_set_destructor(se, signal_event_destructor); + talloc_set_destructor(se, tevent_signal_destructor); /* we need to setup the pipe hack handler if not already setup */ @@ -219,8 +224,8 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev, ev_set_blocking(sig_state->pipe_hack[0], false); ev_set_blocking(sig_state->pipe_hack[1], false); } - ev->pipe_fde = event_add_fd(ev, ev, sig_state->pipe_hack[0], - EVENT_FD_READ, signal_pipe_handler, NULL); + ev->pipe_fde = tevent_add_fd(ev, ev, sig_state->pipe_hack[0], + TEVENT_FD_READ, signal_pipe_handler, NULL); } ev->num_signal_handlers++; @@ -232,7 +237,7 @@ struct signal_event *common_event_add_signal(struct tevent_context *ev, check if a signal is pending return != 0 if a signal was pending */ -int common_event_check_signal(struct tevent_context *ev) +int tevent_common_check_signal(struct tevent_context *ev) { int i; @@ -241,7 +246,7 @@ int common_event_check_signal(struct tevent_context *ev) } for (i=0;isignal_count[i]; uint32_t count = sig_count(counter); diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index 7abb695d89..05310a5864 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -266,14 +266,14 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv } if (std_ev->ev->num_signal_handlers && - common_event_check_signal(std_ev->ev)) { + tevent_common_check_signal(std_ev->ev)) { return 0; } ret = epoll_wait(std_ev->epoll_fd, events, MAXEVENTS, timeout); if (ret == -1 && errno == EINTR && std_ev->ev->num_signal_handlers) { - if (common_event_check_signal(std_ev->ev)) { + if (tevent_common_check_signal(std_ev->ev)) { return 0; } } @@ -285,7 +285,7 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv if (ret == 0 && tvalp) { /* we don't care about a possible delay here */ - common_event_loop_timer_delay(std_ev->ev); + tevent_common_loop_timer_delay(std_ev->ev); return 0; } @@ -405,9 +405,11 @@ static int std_event_fd_destructor(struct tevent_fd *fde) return NULL on failure (memory allocation error) */ static struct tevent_fd *std_event_add_fd(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - int fd, uint16_t flags, - event_fd_handler_t handler, - void *private_data) + int fd, uint16_t flags, + tevent_fd_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { struct std_event_context *std_ev = talloc_get_type(ev->additional_data, struct std_event_context); @@ -496,7 +498,7 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva } if (std_ev->ev->num_signal_handlers && - common_event_check_signal(std_ev->ev)) { + tevent_common_check_signal(std_ev->ev)) { return 0; } @@ -504,7 +506,7 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva if (selrtn == -1 && errno == EINTR && std_ev->ev->num_signal_handlers) { - common_event_check_signal(std_ev->ev); + tevent_common_check_signal(std_ev->ev); return 0; } @@ -522,7 +524,7 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva if (selrtn == 0 && tvalp) { /* we don't care about a possible delay here */ - common_event_loop_timer_delay(std_ev->ev); + tevent_common_loop_timer_delay(std_ev->ev); return 0; } @@ -556,7 +558,7 @@ static int std_event_loop_once(struct tevent_context *ev) struct std_event_context); struct timeval tval; - tval = common_event_loop_timer_delay(ev); + tval = tevent_common_loop_timer_delay(ev); if (ev_timeval_is_zero(&tval)) { return 0; } @@ -593,8 +595,8 @@ static const struct tevent_ops std_event_ops = { .add_fd = std_event_add_fd, .get_fd_flags = std_event_get_fd_flags, .set_fd_flags = std_event_set_fd_flags, - .add_timer = common_event_add_timed, - .add_signal = common_event_add_signal, + .add_timer = tevent_common_add_timer, + .add_signal = tevent_common_add_signal, .loop_once = std_event_loop_once, .loop_wait = std_event_loop_wait, }; diff --git a/lib/tevent/tevent_timed.c b/lib/tevent/tevent_timed.c index 4ad457221e..dadd360416 100644 --- a/lib/tevent/tevent_timed.c +++ b/lib/tevent/tevent_timed.c @@ -106,7 +106,7 @@ bool ev_timeval_is_zero(const struct timeval *tv) /* destroy a timed event */ -static int common_event_timed_destructor(struct tevent_timer *te) +static int tevent_common_timed_destructor(struct tevent_timer *te) { struct tevent_context *ev = talloc_get_type(te->event_ctx, struct tevent_context); @@ -114,7 +114,7 @@ static int common_event_timed_destructor(struct tevent_timer *te) return 0; } -static int common_event_timed_deny_destructor(struct tevent_timer *te) +static int tevent_common_timed_deny_destructor(struct tevent_timer *te) { return -1; } @@ -123,10 +123,12 @@ static int common_event_timed_deny_destructor(struct tevent_timer *te) add a timed event return NULL on failure (memory allocation error) */ -struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CTX *mem_ctx, - struct timeval next_event, - event_timed_handler_t handler, - void *private_data) +struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev, TALLOC_CTX *mem_ctx, + struct timeval next_event, + tevent_timer_handler_t handler, + void *private_data, + const char *handler_name, + const char *location) { struct tevent_timer *te, *last_te, *cur_te; @@ -137,6 +139,8 @@ struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CT te->next_event = next_event; te->handler = handler; te->private_data = private_data; + te->handler_name = handler_name; + te->location = location; te->additional_data = NULL; /* keep the list ordered */ @@ -152,7 +156,7 @@ struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CT DLIST_ADD_AFTER(ev->timer_events, te, last_te); - talloc_set_destructor(te, common_event_timed_destructor); + talloc_set_destructor(te, tevent_common_timed_destructor); return te; } @@ -163,7 +167,7 @@ struct tevent_timer *common_event_add_timed(struct tevent_context *ev, TALLOC_CT return the delay untill the next timed event, or zero if a timed event was triggered */ -struct timeval common_event_loop_timer_delay(struct tevent_context *ev) +struct timeval tevent_common_loop_timer_delay(struct tevent_context *ev) { struct timeval current_time = ev_timeval_zero(); struct tevent_timer *te = ev->timer_events; @@ -200,7 +204,7 @@ struct timeval common_event_loop_timer_delay(struct tevent_context *ev) */ /* deny the handler to free the event */ - talloc_set_destructor(te, common_event_timed_deny_destructor); + talloc_set_destructor(te, tevent_common_timed_deny_destructor); /* We need to remove the timer from the list before calling the * handler because in a semi-async inner event loop called from the -- cgit From d79fc2ffcd9802d927f82f014c2b13c7eb8cc873 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 14:20:37 +0100 Subject: tevent: rename events => tevent in tevent.pc metze --- lib/tevent/tevent.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tevent/tevent.pc.in b/lib/tevent/tevent.pc.in index afd9fcc279..93d0cf5d8b 100644 --- a/lib/tevent/tevent.pc.in +++ b/lib/tevent/tevent.pc.in @@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: events +Name: tevent Description: An event system library Version: @PACKAGE_VERSION@ Libs: -L${libdir} -ltevent -- cgit From 4f04b06ac2cfceddaabcbf661f9878ff69a6f01b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 13:39:56 +0100 Subject: tevent: rename ev_debug_ops => tevent_debug_ops And related changes, but we keep compat macros metze --- lib/tevent/tevent.h | 28 ++++++++++++++++++++++++++++ lib/tevent/tevent_aio.c | 3 ++- lib/tevent/tevent_debug.c | 32 +++++++++++++++++++------------- lib/tevent/tevent_epoll.c | 12 ++++++------ lib/tevent/tevent_internal.h | 18 +++++------------- lib/tevent/tevent_select.c | 4 ++-- lib/tevent/tevent_standard.c | 14 +++++++------- 7 files changed, 69 insertions(+), 42 deletions(-) diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index fd6b613b9d..f4e04355e6 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -119,6 +119,22 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags); #define TEVENT_FD_NOT_READABLE(fde) \ tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) & ~TEVENT_FD_READ) +/* DEBUG */ +enum tevent_debug_level { + TEVENT_DEBUG_FATAL, + TEVENT_DEBUG_ERROR, + TEVENT_DEBUG_WARNING, + TEVENT_DEBUG_TRACE +}; + +int tevent_set_debug(struct tevent_context *ev, + void (*debug)(void *context, + enum tevent_debug_level level, + const char *fmt, + va_list ap) PRINTF_ATTRIBUTE(3,0), + void *context); +int tevent_set_debug_stderr(struct tevent_context *ev); + /* for now always define the compat symbols */ #ifndef TEVENT_COMPAT_DEFINES #define TEVENT_COMPAT_DEFINES 1 @@ -190,6 +206,18 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags); #define EVENT_FD_NOT_READABLE(fde) \ TEVENT_FD_NOT_READABLE(fde) +#define ev_debug_level tevent_debug_level + +#define EV_DEBUG_FATAL TEVENT_DEBUG_FATAL +#define EV_DEBUG_ERROR TEVENT_DEBUG_ERROR +#define EV_DEBUG_WARNING TEVENT_DEBUG_WARNING +#define EV_DEBUG_TRACE TEVENT_DEBUG_TRACE + +#define ev_set_debug(ev, debug, context) \ + tevent_set_debug(ev, debug, context) + +#define ev_set_debug_stderr(_ev) tevent_set_debug_stderr(ev) + #endif /* TEVENT_COMPAT_DEFINES */ #endif /* __TEVENT_H__ */ diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c index f3045fbf97..f59a7505ab 100644 --- a/lib/tevent/tevent_aio.c +++ b/lib/tevent/tevent_aio.c @@ -114,7 +114,8 @@ static void epoll_check_reopen(struct aio_event_context *aio_ev) close(aio_ev->epoll_fd); aio_ev->epoll_fd = epoll_create(MAX_AIO_QUEUE_DEPTH); if (aio_ev->epoll_fd == -1) { - ev_debug(aio_ev->ev, EV_DEBUG_FATAL, "Failed to recreate epoll handle after fork\n"); + tevent_debug(aio_ev->ev, TEVENT_DEBUG_FATAL, + "Failed to recreate epoll handle after fork\n"); return; } aio_ev->pid = getpid(); diff --git a/lib/tevent/tevent_debug.c b/lib/tevent/tevent_debug.c index 4fa58534b4..841446bf6c 100644 --- a/lib/tevent/tevent_debug.c +++ b/lib/tevent/tevent_debug.c @@ -30,10 +30,12 @@ /* this allows the user to choose their own debug function */ -int ev_set_debug(struct tevent_context *ev, - void (*debug)(void *context, enum ev_debug_level level, - const char *fmt, va_list ap), - void *context) +int tevent_set_debug(struct tevent_context *ev, + void (*debug)(void *context, + enum tevent_debug_level level, + const char *fmt, + va_list ap) PRINTF_ATTRIBUTE(3,0), + void *context) { ev->debug_ops.debug = debug; ev->debug_ops.context = context; @@ -43,23 +45,26 @@ int ev_set_debug(struct tevent_context *ev, /* debug function for ev_set_debug_stderr */ -void ev_debug_stderr(void *context, enum ev_debug_level level, - const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0); -void ev_debug_stderr(void *context, enum ev_debug_level level, - const char *fmt, va_list ap) +static void tevent_debug_stderr(void *private_data, + enum tevent_debug_level level, + const char *fmt, + va_list ap) PRINTF_ATTRIBUTE(3,0); +static void tevent_debug_stderr(void *private_data, + enum tevent_debug_level level, + const char *fmt, va_list ap) { - if (level <= EV_DEBUG_WARNING) { + if (level <= TEVENT_DEBUG_WARNING) { vfprintf(stderr, fmt, ap); } } /* convenience function to setup debug messages on stderr - messages of level EV_DEBUG_WARNING and higher are printed + messages of level TEVENT_DEBUG_WARNING and higher are printed */ -int ev_set_debug_stderr(struct tevent_context *ev) +int tevent_set_debug_stderr(struct tevent_context *ev) { - return ev_set_debug(ev, ev_debug_stderr, ev); + return tevent_set_debug(ev, tevent_debug_stderr, ev); } /* @@ -70,7 +75,8 @@ int ev_set_debug_stderr(struct tevent_context *ev) * Applications using the library must decide where to * redirect debugging messages */ -void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...) +void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level, + const char *fmt, ...) { va_list ap; if (ev->debug_ops.debug == NULL) { diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index d2703eda6c..8e93004ff3 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -58,7 +58,7 @@ struct epoll_event_context { */ static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason) { - ev_debug(epoll_ev->ev, EV_DEBUG_FATAL, + tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, "%s (%s) - calling abort()\n", reason, strerror(errno)); abort(); } @@ -116,8 +116,8 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev) close(epoll_ev->epoll_fd); epoll_ev->epoll_fd = epoll_create(64); if (epoll_ev->epoll_fd == -1) { - ev_debug(epoll_ev->ev, EV_DEBUG_FATAL, - "Failed to recreate epoll handle after fork\n"); + tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, + "Failed to recreate epoll handle after fork\n"); return; } epoll_ev->pid = getpid(); @@ -176,9 +176,9 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_ event.events = epoll_map_flags(fde->flags); event.data.ptr = fde; if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event) != 0) { - ev_debug(epoll_ev->ev, EV_DEBUG_FATAL, - "epoll_del_event failed! probable early close bug (%s)\n", - strerror(errno)); + tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, + "epoll_del_event failed! probable early close bug (%s)\n", + strerror(errno)); } fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; } diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index 408136dc71..46ba1b1655 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -111,22 +111,14 @@ struct tevent_signal { void *additional_data; }; -/* DEBUG */ -enum ev_debug_level {EV_DEBUG_FATAL, EV_DEBUG_ERROR, - EV_DEBUG_WARNING, EV_DEBUG_TRACE}; - -struct ev_debug_ops { - void (*debug)(void *context, enum ev_debug_level level, +struct tevent_debug_ops { + void (*debug)(void *context, enum tevent_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0); void *context; }; -int ev_set_debug(struct tevent_context *ev, - void (*debug)(void *context, enum ev_debug_level level, - const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0), - void *context); -int ev_set_debug_stderr(struct tevent_context *ev); -void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...); +void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level, + const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); /* aio event is private to the aio backend */ struct tevent_aio; @@ -148,7 +140,7 @@ struct tevent_context { struct tevent_fd *pipe_fde; /* debugging operations */ - struct ev_debug_ops debug_ops; + struct tevent_debug_ops debug_ops; }; diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c index b082400a8e..06bc1aa0c9 100644 --- a/lib/tevent/tevent_select.c +++ b/lib/tevent/tevent_select.c @@ -220,8 +220,8 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru made readable and that should have removed the event, so this must be a bug. This is a fatal error. */ - ev_debug(select_ev->ev, EV_DEBUG_FATAL, - "ERROR: EBADF on select_event_loop_once\n"); + tevent_debug(select_ev->ev, TEVENT_DEBUG_FATAL, + "ERROR: EBADF on select_event_loop_once\n"); select_ev->exit_code = EBADF; return -1; } diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index 05310a5864..762b834952 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -71,9 +71,9 @@ struct std_event_context { */ static void epoll_fallback_to_select(struct std_event_context *std_ev, const char *reason) { - ev_debug(std_ev->ev, EV_DEBUG_FATAL, - "%s (%s) - falling back to select()\n", - reason, strerror(errno)); + tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL, + "%s (%s) - falling back to select()\n", + reason, strerror(errno)); close(std_ev->epoll_fd); std_ev->epoll_fd = -1; talloc_set_destructor(std_ev, NULL); @@ -130,8 +130,8 @@ static void epoll_check_reopen(struct std_event_context *std_ev) close(std_ev->epoll_fd); std_ev->epoll_fd = epoll_create(64); if (std_ev->epoll_fd == -1) { - ev_debug(std_ev->ev, EV_DEBUG_FATAL, - "Failed to recreate epoll handle after fork\n"); + tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL, + "Failed to recreate epoll handle after fork\n"); return; } std_ev->pid = getpid(); @@ -516,8 +516,8 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva made readable and that should have removed the event, so this must be a bug. This is a fatal error. */ - ev_debug(std_ev->ev, EV_DEBUG_FATAL, - "ERROR: EBADF on std_event_loop_once\n"); + tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL, + "ERROR: EBADF on std_event_loop_once\n"); std_ev->exit_code = EBADF; return -1; } -- cgit From 784b2dc8d02c4e5c1ae31314f08874fa57416c40 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:25:29 +0100 Subject: tevent: use TEVENT_FD_* instead of EVENT_FD_* metze --- lib/tevent/tevent_aio.c | 20 ++++++++++---------- lib/tevent/tevent_epoll.c | 24 ++++++++++++------------ lib/tevent/tevent_select.c | 10 +++++----- lib/tevent/tevent_standard.c | 32 ++++++++++++++++---------------- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c index f59a7505ab..ba798cc799 100644 --- a/lib/tevent/tevent_aio.c +++ b/lib/tevent/tevent_aio.c @@ -80,8 +80,8 @@ struct tevent_aio { static uint32_t epoll_map_flags(uint16_t flags) { uint32_t ret = 0; - if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); - if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); + if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); + if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); return ret; } @@ -148,7 +148,7 @@ static void epoll_add_event(struct aio_event_context *aio_ev, struct tevent_fd * fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; } } @@ -193,7 +193,7 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd * epoll_ctl(aio_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event); /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; } } @@ -201,8 +201,8 @@ static void epoll_mod_event(struct aio_event_context *aio_ev, struct tevent_fd * static void epoll_change_event(struct aio_event_context *aio_ev, struct tevent_fd *fde) { bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); - bool want_read = (fde->flags & EVENT_FD_READ); - bool want_write= (fde->flags & EVENT_FD_WRITE); + bool want_read = (fde->flags & TEVENT_FD_READ); + bool want_write= (fde->flags & TEVENT_FD_WRITE); if (aio_ev->epoll_fd == -1) return; @@ -328,10 +328,10 @@ static int aio_event_loop(struct aio_event_context *aio_ev, struct timeval *tval epoll_del_event(aio_ev, fde); continue; } - flags |= EVENT_FD_READ; + flags |= TEVENT_FD_READ; } - if (ep->events & EPOLLIN) flags |= EVENT_FD_READ; - if (ep->events & EPOLLOUT) flags |= EVENT_FD_WRITE; + if (ep->events & EPOLLIN) flags |= TEVENT_FD_READ; + if (ep->events & EPOLLOUT) flags |= TEVENT_FD_WRITE; if (flags) { fde->handler(aio_ev->ev, fde, flags, fde->private_data); } @@ -400,7 +400,7 @@ static int aio_event_fd_destructor(struct tevent_fd *fde) epoll_del_event(aio_ev, fde); - if (fde->flags & EVENT_FD_AUTOCLOSE) { + if (fde->flags & TEVENT_FD_AUTOCLOSE) { close(fde->fd); fde->fd = -1; } diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index 8e93004ff3..380d9461c9 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -64,13 +64,13 @@ static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason } /* - map from EVENT_FD_* to EPOLLIN/EPOLLOUT + map from TEVENT_FD_* to EPOLLIN/EPOLLOUT */ static uint32_t epoll_map_flags(uint16_t flags) { uint32_t ret = 0; - if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); - if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); + if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); + if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); return ret; } @@ -153,7 +153,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_ fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; } } @@ -201,7 +201,7 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_ } /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; } } @@ -209,8 +209,8 @@ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_ static void epoll_change_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) { bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); - bool want_read = (fde->flags & EVENT_FD_READ); - bool want_write= (fde->flags & EVENT_FD_WRITE); + bool want_read = (fde->flags & TEVENT_FD_READ); + bool want_write= (fde->flags & TEVENT_FD_WRITE); if (epoll_ev->epoll_fd == -1) return; @@ -293,7 +293,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval if (events[i].events & (EPOLLHUP|EPOLLERR)) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR; /* - * if we only wait for EVENT_FD_WRITE, we should not tell the + * if we only wait for TEVENT_FD_WRITE, we should not tell the * event handler about it, and remove the epoll_event, * as we only report errors when waiting for read events, * to match the select() behavior @@ -302,10 +302,10 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval epoll_del_event(epoll_ev, fde); continue; } - flags |= EVENT_FD_READ; + flags |= TEVENT_FD_READ; } - if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ; - if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE; + if (events[i].events & EPOLLIN) flags |= TEVENT_FD_READ; + if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE; if (flags) { fde->handler(epoll_ev->ev, fde, flags, fde->private_data); if (destruction_count != epoll_ev->destruction_count) { @@ -358,7 +358,7 @@ static int epoll_event_fd_destructor(struct tevent_fd *fde) epoll_del_event(epoll_ev, fde); - if (fde->flags & EVENT_FD_AUTOCLOSE) { + if (fde->flags & TEVENT_FD_AUTOCLOSE) { close(fde->fd); fde->fd = -1; } diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c index 06bc1aa0c9..e21b3c44b9 100644 --- a/lib/tevent/tevent_select.c +++ b/lib/tevent/tevent_select.c @@ -103,7 +103,7 @@ static int select_event_fd_destructor(struct tevent_fd *fde) DLIST_REMOVE(select_ev->fd_events, fde); select_ev->destruction_count++; - if (fde->flags & EVENT_FD_AUTOCLOSE) { + if (fde->flags & TEVENT_FD_AUTOCLOSE) { close(fde->fd); fde->fd = -1; } @@ -193,10 +193,10 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru /* setup any fd events */ for (fde = select_ev->fd_events; fde; fde = fde->next) { - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { FD_SET(fde->fd, &r_fds); } - if (fde->flags & EVENT_FD_WRITE) { + if (fde->flags & TEVENT_FD_WRITE) { FD_SET(fde->fd, &w_fds); } } @@ -239,8 +239,8 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru for (fde = select_ev->fd_events; fde; fde = fde->next) { uint16_t flags = 0; - if (FD_ISSET(fde->fd, &r_fds)) flags |= EVENT_FD_READ; - if (FD_ISSET(fde->fd, &w_fds)) flags |= EVENT_FD_WRITE; + if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ; + if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE; if (flags) { fde->handler(select_ev->ev, fde, flags, fde->private_data); if (destruction_count != select_ev->destruction_count) { diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index 762b834952..5769eac589 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -80,13 +80,13 @@ static void epoll_fallback_to_select(struct std_event_context *std_ev, const cha } /* - map from EVENT_FD_* to EPOLLIN/EPOLLOUT + map from TEVENT_FD_* to EPOLLIN/EPOLLOUT */ static uint32_t epoll_map_flags(uint16_t flags) { uint32_t ret = 0; - if (flags & EVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); - if (flags & EVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); + if (flags & TEVENT_FD_READ) ret |= (EPOLLIN | EPOLLERR | EPOLLHUP); + if (flags & TEVENT_FD_WRITE) ret |= (EPOLLOUT | EPOLLERR | EPOLLHUP); return ret; } @@ -166,7 +166,7 @@ static void epoll_add_event(struct std_event_context *std_ev, struct tevent_fd * fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; } } @@ -209,7 +209,7 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd * } /* only if we want to read we want to tell the event handler about errors */ - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; } } @@ -217,8 +217,8 @@ static void epoll_mod_event(struct std_event_context *std_ev, struct tevent_fd * static void epoll_change_event(struct std_event_context *std_ev, struct tevent_fd *fde) { bool got_error = (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR); - bool want_read = (fde->flags & EVENT_FD_READ); - bool want_write= (fde->flags & EVENT_FD_WRITE); + bool want_read = (fde->flags & TEVENT_FD_READ); + bool want_write= (fde->flags & TEVENT_FD_WRITE); if (std_ev->epoll_fd == -1) return; @@ -301,7 +301,7 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv if (events[i].events & (EPOLLHUP|EPOLLERR)) { fde->additional_flags |= EPOLL_ADDITIONAL_FD_FLAG_GOT_ERROR; /* - * if we only wait for EVENT_FD_WRITE, we should not tell the + * if we only wait for TEVENT_FD_WRITE, we should not tell the * event handler about it, and remove the epoll_event, * as we only report errors when waiting for read events, * to match the select() behavior @@ -310,10 +310,10 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv epoll_del_event(std_ev, fde); continue; } - flags |= EVENT_FD_READ; + flags |= TEVENT_FD_READ; } - if (events[i].events & EPOLLIN) flags |= EVENT_FD_READ; - if (events[i].events & EPOLLOUT) flags |= EVENT_FD_WRITE; + if (events[i].events & EPOLLIN) flags |= TEVENT_FD_READ; + if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE; if (flags) { fde->handler(std_ev->ev, fde, flags, fde->private_data); if (destruction_count != std_ev->destruction_count) { @@ -392,7 +392,7 @@ static int std_event_fd_destructor(struct tevent_fd *fde) epoll_del_event(std_ev, fde); - if (fde->flags & EVENT_FD_AUTOCLOSE) { + if (fde->flags & TEVENT_FD_AUTOCLOSE) { close(fde->fd); fde->fd = -1; } @@ -489,10 +489,10 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva /* setup any fd events */ for (fde = std_ev->fd_events; fde; fde = fde->next) { - if (fde->flags & EVENT_FD_READ) { + if (fde->flags & TEVENT_FD_READ) { FD_SET(fde->fd, &r_fds); } - if (fde->flags & EVENT_FD_WRITE) { + if (fde->flags & TEVENT_FD_WRITE) { FD_SET(fde->fd, &w_fds); } } @@ -535,8 +535,8 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva for (fde = std_ev->fd_events; fde; fde = fde->next) { uint16_t flags = 0; - if (FD_ISSET(fde->fd, &r_fds)) flags |= EVENT_FD_READ; - if (FD_ISSET(fde->fd, &w_fds)) flags |= EVENT_FD_WRITE; + if (FD_ISSET(fde->fd, &r_fds)) flags |= TEVENT_FD_READ; + if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE; if (flags) { fde->handler(std_ev->ev, fde, flags, fde->private_data); if (destruction_count != std_ev->destruction_count) { -- cgit From 2176295b02cb39945d5335d93f0c5dfe054c9b9a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:27:11 +0100 Subject: tevent: change pytevent to tevent_* metze --- lib/tevent/pytevent.c | 39 ++++++++++++++++++++------------------- lib/tevent/tests.py | 8 ++++---- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c index a969373738..3d71d78397 100644 --- a/lib/tevent/pytevent.c +++ b/lib/tevent/pytevent.c @@ -24,9 +24,9 @@ typedef struct { PyObject_HEAD struct tevent_context *ev_ctx; -} PyEventContextObject; +} PyTEventContextObject; -PyAPI_DATA(PyTypeObject) PyEventContext; +PyAPI_DATA(PyTypeObject) PyTEventContext; static PyObject *py_set_default_backend(PyObject *self, PyObject *args) { @@ -34,13 +34,13 @@ static PyObject *py_set_default_backend(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &name)) return NULL; - event_set_default_backend(name); + tevent_set_default_backend(name); return Py_None; } static PyObject *py_backend_list(PyObject *self) { - const char **backends = event_backend_list(NULL); + const char **backends = tevent_backend_list(NULL); PyObject *ret; int i, len; @@ -66,28 +66,28 @@ static PyObject *py_event_ctx_new(PyTypeObject *type, PyObject *args, PyObject * const char *kwnames[] = { "name", NULL }; char *name = NULL; struct tevent_context *ev_ctx; - PyEventContextObject *ret; + PyTEventContextObject *ret; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s", (char **)kwnames, &name)) return NULL; if (name == NULL) - ev_ctx = event_context_init(NULL); + ev_ctx = tevent_context_init(NULL); else - ev_ctx = event_context_init_byname(NULL, name); + ev_ctx = tevent_context_init_byname(NULL, name); - ret = (PyEventContextObject *)type->tp_alloc(type, 0); + ret = (PyTEventContextObject *)type->tp_alloc(type, 0); ret->ev_ctx = ev_ctx; return (PyObject *)ret; } -static PyObject *py_event_ctx_loop_once(PyEventContextObject *self) +static PyObject *py_event_ctx_loop_once(PyTEventContextObject *self) { - return PyInt_FromLong(event_loop_once(self->ev_ctx)); + return PyInt_FromLong(tevent_loop_once(self->ev_ctx)); } -static PyObject *py_event_ctx_loop_wait(PyEventContextObject *self) +static PyObject *py_event_ctx_loop_wait(PyTEventContextObject *self) { - return PyInt_FromLong(event_loop_wait(self->ev_ctx)); + return PyInt_FromLong(tevent_loop_wait(self->ev_ctx)); } static PyMethodDef py_event_ctx_methods[] = { @@ -98,16 +98,17 @@ static PyMethodDef py_event_ctx_methods[] = { { NULL } }; -static void py_event_ctx_dealloc(PyEventContextObject * self) +static void py_event_ctx_dealloc(PyTEventContextObject * self) { talloc_free(self->ev_ctx); self->ob_type->tp_free(self); } -PyTypeObject PyEventContext = { - .tp_name = "EventContext", + +PyTypeObject PyTEventContext = { + .tp_name = "TEventContext", .tp_methods = py_event_ctx_methods, - .tp_basicsize = sizeof(PyEventContextObject), + .tp_basicsize = sizeof(PyTEventContextObject), .tp_dealloc = (destructor)py_event_ctx_dealloc, .tp_flags = Py_TPFLAGS_DEFAULT, .tp_new = py_event_ctx_new, @@ -117,14 +118,14 @@ void inittevent(void) { PyObject *m; - if (PyType_Ready(&PyEventContext) < 0) + if (PyType_Ready(&PyTEventContext) < 0) return; m = Py_InitModule3("tevent", tevent_methods, "Event management."); if (m == NULL) return; - Py_INCREF(&PyEventContext); - PyModule_AddObject(m, "EventContext", (PyObject *)&PyEventContext); + Py_INCREF(&PyTEventContext); + PyModule_AddObject(m, "TEventContext", (PyObject *)&PyTEventContext); } diff --git a/lib/tevent/tests.py b/lib/tevent/tests.py index 0ec736b359..bf594a14f6 100644 --- a/lib/tevent/tests.py +++ b/lib/tevent/tests.py @@ -17,15 +17,15 @@ # along with this program. If not, see . # -import tevent as events +import tevent import unittest # Just test the bindings are there and that calling them doesn't crash # anything. -class EventTestCase(unittest.TestCase): +class TEventTestCase(unittest.TestCase): def test_create(self): - self.assertTrue(events.EventContext() is not None) + self.assertTrue(tevent.TEventContext() is not None) def test_loop_wait(self): - self.assertEquals(0, events.EventContext().loop_wait()) + self.assertEquals(0, tevent.TEventContext().loop_wait()) -- cgit From 73ef1773bebc206522b0a285573254441fc6a18a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:28:38 +0100 Subject: tevent: only provide compat macros if the caller wants them metze --- lib/tevent/tevent.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index f4e04355e6..01e79df208 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -135,11 +135,6 @@ int tevent_set_debug(struct tevent_context *ev, void *context); int tevent_set_debug_stderr(struct tevent_context *ev); -/* for now always define the compat symbols */ -#ifndef TEVENT_COMPAT_DEFINES -#define TEVENT_COMPAT_DEFINES 1 -#endif - #ifdef TEVENT_COMPAT_DEFINES #define event_context tevent_context -- cgit From 34cc50cb63a1a9e466d833de781e57b2f7c0b8ab Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 15:34:37 +0100 Subject: s4:lib/events: convert to use tevent_* functions instead of compat macros metze --- source4/lib/events/tevent_s4.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/source4/lib/events/tevent_s4.c b/source4/lib/events/tevent_s4.c index e50ff57e90..34a34a8e0b 100644 --- a/source4/lib/events/tevent_s4.c +++ b/source4/lib/events/tevent_s4.c @@ -17,38 +17,37 @@ */ #include "includes.h" -#include -#include +#include "lib/events/events.h" /* this is used to catch debug messages from events */ -static void ev_wrap_debug(void *context, enum ev_debug_level level, +static void ev_wrap_debug(void *context, enum tevent_debug_level level, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0); -static void ev_wrap_debug(void *context, enum ev_debug_level level, +static void ev_wrap_debug(void *context, enum tevent_debug_level level, const char *fmt, va_list ap) { int samba_level = -1; char *s = NULL; switch (level) { - case EV_DEBUG_FATAL: + case TEVENT_DEBUG_FATAL: samba_level = 0; break; - case EV_DEBUG_ERROR: + case TEVENT_DEBUG_ERROR: samba_level = 1; break; - case EV_DEBUG_WARNING: + case TEVENT_DEBUG_WARNING: samba_level = 2; break; - case EV_DEBUG_TRACE: + case TEVENT_DEBUG_TRACE: samba_level = 5; break; }; vasprintf(&s, fmt, ap); if (!s) return; - DEBUG(samba_level, ("events: %s\n", s)); + DEBUG(samba_level, ("tevent: %s\n", s)); free(s); } @@ -63,9 +62,9 @@ struct tevent_context *s4_event_context_init(TALLOC_CTX *mem_ctx) { struct tevent_context *ev; - ev = event_context_init_byname(mem_ctx, NULL); + ev = tevent_context_init_byname(mem_ctx, NULL); if (ev) { - ev_set_debug(ev, ev_wrap_debug, NULL); + tevent_set_debug(ev, ev_wrap_debug, NULL); } return ev; } @@ -83,7 +82,7 @@ struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx) { struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context); if (ev == NULL) { - ev = event_context_init(mem_ctx); + ev = tevent_context_init(mem_ctx); } return ev; } -- cgit From 2885a7ab6e2a44a76148380f47e2d0cde69d8b38 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:27:48 +0100 Subject: s4:selftest: report tevent tests as 'tevent.python' metze --- source4/selftest/tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh index 0a5bdf62cd..56cbacbdaf 100755 --- a/source4/selftest/tests.sh +++ b/source4/selftest/tests.sh @@ -401,7 +401,7 @@ plantest "samr.python" dc $SUBUNITRUN samba.tests.dcerpc.sam plantest "dcerpc.bare.python" dc $SUBUNITRUN samba.tests.dcerpc.bare plantest "unixinfo.python" dc $SUBUNITRUN samba.tests.dcerpc.unix plantest "samdb.python" none $SUBUNITRUN samba.tests.samdb -plantest "events.python" none PYTHONPATH="$PYTHONPATH:../lib/tevent" $SUBUNITRUN tests +plantest "tevent.python" none PYTHONPATH="$PYTHONPATH:../lib/tevent" $SUBUNITRUN tests plantest "messaging.python" none PYTHONPATH="$PYTHONPATH:lib/messaging/tests" $SUBUNITRUN bindings plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam plantest "subunit.python" none $SUBUNITRUN subunit -- cgit From 268f3e93a4dd66ce43dc53278eff01f801ba5083 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 2 Jan 2009 16:41:21 +0100 Subject: s4:lib/events: remove unused events_internal.h external users need to use tevent_internal.h anyway metze --- source4/headermap.txt | 3 --- source4/lib/events/config.mk | 2 +- source4/lib/events/events_internal.h | 5 ----- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 source4/lib/events/events_internal.h diff --git a/source4/headermap.txt b/source4/headermap.txt index d5e70a7304..c27ec2f2de 100644 --- a/source4/headermap.txt +++ b/source4/headermap.txt @@ -49,11 +49,8 @@ param/share.h: share.h ../lib/util/util_tdb.h: util_tdb.h ../lib/util/util_ldb.h: util_ldb.h ../lib/util/wrap_xattr.h: wrap_xattr.h -lib/events/events.h: events/events.h -lib/events/events_internal.h: events/events_internal.h libcli/ldap/ldap_ndr.h: ldap_ndr.h lib/events/events.h: events.h -lib/events/events_internal.h: events_internal.h ../lib/tevent/tevent.h: tevent.h ../lib/tevent/tevent_internal.h: tevent_internal.h auth/session.h: samba/session.h diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index a1b2cd218a..c07a21bc75 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -4,4 +4,4 @@ CFLAGS = -Ilib/events LIBEVENTS_OBJ_FILES = $(addprefix $(libeventssrcdir)/, tevent_s4.o) -PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h events_internal.h) +PUBLIC_HEADERS += $(addprefix $(libeventssrcdir)/, events.h) diff --git a/source4/lib/events/events_internal.h b/source4/lib/events/events_internal.h deleted file mode 100644 index 055bfe1a92..0000000000 --- a/source4/lib/events/events_internal.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __LIB_EVENTS_INTERNAL_H__ -#define __LIB_EVENTS_INTERNAL_H__ -#define TEVENT_COMPAT_DEFINES 1 -#include <../lib/tevent/tevent_internal.h> -#endif /* __LIB_EVENTS_INTERNAL_H__ */ -- cgit