From f20f1f994ac375ab96cc8a38075b99aa20041b3f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 1 Nov 2004 23:37:12 +0000 Subject: r3445: made the gtk tooks use minimal includes. This approximately halves the total include lines in compiling C files in Samba (the .gch file is now 5M instead of 12M) This also gets rid of the silly gtk compile warning for non-gtk code (This used to be commit 8ebd20cf551c8c1fad98ec723d91873fa202b85a) --- source4/build/tests/fcntl_lock.c | 9 --------- source4/build/tests/fcntl_lock64.c | 9 --------- source4/gtk/common/gtk-smb.c | 3 ++- source4/gtk/common/gtk-smb.h | 19 +++++++++++++++++++ source4/gtk/common/select.c | 3 ++- source4/gtk/config.m4 | 2 ++ source4/gtk/tools/gepdump.c | 3 ++- source4/gtk/tools/gregedit.c | 1 + source4/gtk/tools/gwcrontab.c | 3 ++- source4/gtk/tools/gwsam.c | 5 +++-- source4/gtk/tools/gwsam_user.c | 1 + source4/include/includes.h | 5 ----- source4/include/system/wait.h | 25 +++++++++++++++++++++++++ source4/lib/replace.c | 10 ++++++++++ source4/lib/signal.c | 2 +- source4/lib/system.c | 2 ++ source4/lib/tdb/tools/tdbtorture.c | 2 +- source4/torture/torture.c | 2 +- 18 files changed, 74 insertions(+), 32 deletions(-) create mode 100644 source4/include/system/wait.h (limited to 'source4') diff --git a/source4/build/tests/fcntl_lock.c b/source4/build/tests/fcntl_lock.c index 3dc12a3897..089c3c8424 100644 --- a/source4/build/tests/fcntl_lock.c +++ b/source4/build/tests/fcntl_lock.c @@ -22,15 +22,6 @@ #include -static int sys_waitpid(pid_t pid,int *status,int options) -{ -#ifdef HAVE_WAITPID - return waitpid(pid,status,options); -#else /* USE_WAITPID */ - return wait4(pid, status, options, NULL); -#endif /* USE_WAITPID */ -} - #define DATA "conftest.fcntl" #ifndef SEEK_SET diff --git a/source4/build/tests/fcntl_lock64.c b/source4/build/tests/fcntl_lock64.c index e5ecd88fd0..913580cd24 100644 --- a/source4/build/tests/fcntl_lock64.c +++ b/source4/build/tests/fcntl_lock64.c @@ -18,15 +18,6 @@ #include -static int sys_waitpid(pid_t pid,int *status,int options) -{ -#ifdef HAVE_WAITPID - return waitpid(pid,status,options); -#else /* USE_WAITPID */ - return wait4(pid, status, options, NULL); -#endif /* USE_WAITPID */ -} - #define DATA "conftest.fcntl64" /* lock a byte range in a open file */ diff --git a/source4/gtk/common/gtk-smb.c b/source4/gtk/common/gtk-smb.c index 9553827cd0..9806c8903f 100644 --- a/source4/gtk/common/gtk-smb.c +++ b/source4/gtk/common/gtk-smb.c @@ -20,7 +20,8 @@ */ #include "includes.h" -#include "gtk-smb.h" +#include "gtk/common/select.h" +#include "gtk/common/gtk-smb.h" void gtk_show_werror(GtkWidget *win, WERROR err) { diff --git a/source4/gtk/common/gtk-smb.h b/source4/gtk/common/gtk-smb.h index 6e82678c75..90209d671f 100644 --- a/source4/gtk/common/gtk-smb.h +++ b/source4/gtk/common/gtk-smb.h @@ -59,4 +59,23 @@ struct _GtkRpcBindingDialogClass #endif +/* subsystem prototypes */ +GtkWidget *create_gtk_samba_about_dialog (const char *appname); +void gtk_show_ntstatus(GtkWidget *win, NTSTATUS status); +GtkWidget *gtk_rpc_binding_dialog_new (BOOL nocredentials, struct sam_pipe *sam_pipe); +GType gtk_rpc_binding_dialog_get_type (void); +struct dcerpc_binding *gtk_rpc_binding_dialog_get_binding(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx); +GtkWidget *gtk_select_host_dialog_new (struct sam_pipe *sam_pipe, BOOL nocredentials); +const char *gtk_select_host_dialog_get_host (GtkSelectHostDialog *d); +GType gtk_select_host_dialog_get_type (void); +void gtk_show_werror(GtkWidget *win, WERROR err); +const char *gtk_rpc_binding_dialog_get_binding_string(GtkRpcBindingDialog *d, TALLOC_CTX *mem_ctx); +const char *gtk_rpc_binding_dialog_get_username(GtkRpcBindingDialog *d); +const char *gtk_rpc_binding_dialog_get_password(GtkRpcBindingDialog *d); +const char *gtk_rpc_binding_dialog_get_host(GtkRpcBindingDialog *d); +GtkWidget *gtk_select_domain_dialog_new (struct dcerpc_pipe *sam_pipe); +GType gtk_select_domain_dialog_get_type (void); +struct policy_handle gtk_select_domain_dialog_get_handle(GtkSelectDomainDialog *d); + + #endif diff --git a/source4/gtk/common/select.c b/source4/gtk/common/select.c index bab21d38fe..d5d0d6cac4 100644 --- a/source4/gtk/common/select.c +++ b/source4/gtk/common/select.c @@ -21,7 +21,8 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_samr.h" -#include "gtk-smb.h" +#include "gtk/common/select.h" +#include "gtk/common/gtk-smb.h" /* GtkSelectDomainDialog */ diff --git a/source4/gtk/config.m4 b/source4/gtk/config.m4 index 6be4bf11bc..d4ecd82c42 100644 --- a/source4/gtk/config.m4 +++ b/source4/gtk/config.m4 @@ -16,8 +16,10 @@ if test t$SMB_EXT_LIB_ENABLE_gtk = tYES; then AC_DEFINE(HAVE_GTK, 1, [Whether GTK+ is available]) fi +SMB_SUBSYSTEM_NOPROTO(GTKSMB) SMB_SUBSYSTEM_MK(GTKSMB,gtk/config.mk) SMB_BINARY_MK(gregedit,gtk/config.mk) SMB_BINARY_MK(gwcrontab,gtk/config.mk) SMB_BINARY_MK(gwsam,gtk/config.mk) SMB_BINARY_MK(gepdump,gtk/config.mk) + diff --git a/source4/gtk/tools/gepdump.c b/source4/gtk/tools/gepdump.c index c5c378c465..52e6bdad7d 100644 --- a/source4/gtk/tools/gepdump.c +++ b/source4/gtk/tools/gepdump.c @@ -21,6 +21,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_epmapper.h" +#include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" /* @@ -278,7 +279,7 @@ static GtkWidget* create_mainwindow (void) gtk_tree_view_append_column(GTK_TREE_VIEW(tree_eps), curcol); - store_eps = gtk_tree_store_new(2, GTK_TYPE_STRING, GTK_TYPE_STRING); + store_eps = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(tree_eps), GTK_TREE_MODEL(store_eps)); g_object_unref(store_eps); diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c index 0f9689220a..d7a1e44ad1 100644 --- a/source4/gtk/tools/gregedit.c +++ b/source4/gtk/tools/gregedit.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" GtkWidget *openfilewin; diff --git a/source4/gtk/tools/gwcrontab.c b/source4/gtk/tools/gwcrontab.c index f06b4fcbe8..38e4e11103 100644 --- a/source4/gtk/tools/gwcrontab.c +++ b/source4/gtk/tools/gwcrontab.c @@ -21,6 +21,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_atsvc.h" +#include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" struct dcerpc_pipe *at_pipe = NULL; @@ -79,7 +80,7 @@ static void on_job_select(GtkTreeSelection *sel, } -void +static void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data) { diff --git a/source4/gtk/tools/gwsam.c b/source4/gtk/tools/gwsam.c index 829d4d50f6..cf8e1d5b5f 100644 --- a/source4/gtk/tools/gwsam.c +++ b/source4/gtk/tools/gwsam.c @@ -21,6 +21,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_samr.h" +#include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" struct policy_handle sam_handle; @@ -157,12 +158,12 @@ static void connect_sam(void) } -void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data) +static void on_connect_activate (GtkMenuItem *menuitem, gpointer user_data) { connect_sam(); } -void on_disconnect_activate (GtkMenuItem *menuitem, gpointer user_data) +static void on_disconnect_activate (GtkMenuItem *menuitem, gpointer user_data) { gtk_widget_set_sensitive (mnu_disconnect, FALSE); gtk_window_set_title (GTK_WINDOW (mainwin), "User Manager"); diff --git a/source4/gtk/tools/gwsam_user.c b/source4/gtk/tools/gwsam_user.c index 0c5c355b10..394324280e 100644 --- a/source4/gtk/tools/gwsam_user.c +++ b/source4/gtk/tools/gwsam_user.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" diff --git a/source4/include/includes.h b/source4/include/includes.h index a9198dbc1d..192ec548fd 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -161,9 +161,6 @@ #include -#ifdef HAVE_SYS_WAIT_H -#include -#endif #ifdef HAVE_CTYPE_H #include #endif @@ -521,8 +518,6 @@ extern int errno; #include "registry.h" #include "rap.h" #include "ldap_server/ldap_server.h" -#include "gtk/common/gtk-smb.h" -#include "gtk/common/select.h" #include "libnet/libnet.h" #include "utils/net/net.h" diff --git a/source4/include/system/wait.h b/source4/include/system/wait.h new file mode 100644 index 0000000000..29e5c6fe66 --- /dev/null +++ b/source4/include/system/wait.h @@ -0,0 +1,25 @@ +/* + Unix SMB/CIFS implementation. + + waitpid system include wrappers + + Copyright (C) Andrew Tridgell 2004 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifdef HAVE_SYS_WAIT_H +#include +#endif diff --git a/source4/lib/replace.c b/source4/lib/replace.c index 28c60130f8..c2180a168f 100644 --- a/source4/lib/replace.c +++ b/source4/lib/replace.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "system/wait.h" void replace_dummy(void); void replace_dummy(void) {} @@ -546,3 +547,12 @@ int get_time_zone(time_t t) return i; } #endif + +int sys_waitpid(pid_t pid,int *status,int options) +{ +#ifdef HAVE_WAITPID + return waitpid(pid,status,options); +#else /* USE_WAITPID */ + return wait4(pid, status, options, NULL); +#endif /* USE_WAITPID */ +} diff --git a/source4/lib/signal.c b/source4/lib/signal.c index 00fc214639..bff4b91c1a 100644 --- a/source4/lib/signal.c +++ b/source4/lib/signal.c @@ -27,7 +27,7 @@ static void sig_cld(int signum) { - while (waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0) + while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0) ; /* diff --git a/source4/lib/system.c b/source4/lib/system.c index 2baa412622..906219bd91 100644 --- a/source4/lib/system.c +++ b/source4/lib/system.c @@ -21,6 +21,7 @@ #include "includes.h" #include "system/network.h" +#include "system/wait.h" /* The idea is that this file will eventually have wrappers around all @@ -555,3 +556,4 @@ struct ipv4_addr sys_inet_makeaddr(int net, int host) in2.s_addr = in.s_addr; return in2; } + diff --git a/source4/lib/tdb/tools/tdbtorture.c b/source4/lib/tdb/tools/tdbtorture.c index 005a2713af..95eb71281c 100644 --- a/source4/lib/tdb/tools/tdbtorture.c +++ b/source4/lib/tdb/tools/tdbtorture.c @@ -217,7 +217,7 @@ static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, if (getpid() == pids[0]) { for (i=0;i