r3445: made the gtk tooks use minimal includes. This approximately halves the
authorAndrew Tridgell <tridge@samba.org>
Mon, 1 Nov 2004 23:37:12 +0000 (23:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:12 +0000 (13:05 -0500)
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

18 files changed:
source/build/tests/fcntl_lock.c
source/build/tests/fcntl_lock64.c
source/gtk/common/gtk-smb.c
source/gtk/common/gtk-smb.h
source/gtk/common/select.c
source/gtk/config.m4
source/gtk/tools/gepdump.c
source/gtk/tools/gregedit.c
source/gtk/tools/gwcrontab.c
source/gtk/tools/gwsam.c
source/gtk/tools/gwsam_user.c
source/include/includes.h
source/include/system/wait.h [new file with mode: 0644]
source/lib/replace.c
source/lib/signal.c
source/lib/system.c
source/lib/tdb/tools/tdbtorture.c
source/torture/torture.c

index 3dc12a389739fbeb6cce4d87a2e9b1b961c2f86d..089c3c84241d1e07170d5a4f1334d52c3de4d0e2 100644 (file)
 
 #include <errno.h>
 
-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
index e5ecd88fd0444af79108cc335c382d5f27bac323..913580cd24121e22148d95e192e3be5c78ac042b 100644 (file)
 
 #include <errno.h>
 
-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 */
index 9553827cd01a1e7804daf96d86ed425e5ad485b8..9806c8903f6926e06b9f74b9b11507754bc68e71 100644 (file)
@@ -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) 
 {
index 6e82678c75783f8930d648c80694fd9373483ec4..90209d671f69f200c2979ec4bff06c166d62dc63 100644 (file)
@@ -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
index bab21d38fe24ad99eb5c2738809fe2fb149de8d5..d5d0d6cac4fde317b76a0476cbe8772a672bc590 100644 (file)
@@ -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 */
 
index 6be4bf11bc39a3ae295c7deb31307f6608003ac1..d4ecd82c4279ff92bba71c616d586634ebc903d1 100644 (file)
@@ -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)
+
index c5c378c4656957b7533c739f8579f73c805e5e35..52e6bdad7db4f27852046463510ff4b6843fd3fb 100644 (file)
@@ -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);
   
index 0f9689220a7e661686a816f980a9f27d29e6d84a..d7a1e44ad11c86b6509056e39117654bfea51df5 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "gtk/common/select.h"
 #include "gtk/common/gtk-smb.h"
 
 GtkWidget *openfilewin;
index f06b4fcbe8cad5e52079ee731c499f444c4edf11..38e4e11103c1671fc19964f99324cb61d911f8d4 100644 (file)
@@ -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)
 {
index 829d4d50f6a165be2da994f2b82d0f9ea5ed28e7..cf8e1d5b5fe5d2ea5b25f22755d1afcdac1ac393 100644 (file)
@@ -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");
index 0c5c355b10b8b55deb13d073dcbe30c15b51139c..394324280e862ea02984ca93620113f3b47f2ad5 100644 (file)
@@ -20,6 +20,7 @@
 */
 
 #include "includes.h"
+#include "gtk/common/select.h"
 #include "gtk/common/gtk-smb.h"
 
 
index a9198dbc1dab24fa82a3ec7779f504bd9898f0da..192ec548fdeb12d218e5bb98b39048deb8dfd921 100644 (file)
 
 #include <signal.h>
 
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
 #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/source/include/system/wait.h b/source/include/system/wait.h
new file mode 100644 (file)
index 0000000..29e5c6f
--- /dev/null
@@ -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 <sys/wait.h>
+#endif
index 28c60130f877fd00a5a95638da95bc45b22a7d8e..c2180a168ff7d3301a613002ede1de469b8ec193 100644 (file)
@@ -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 */
+}
index 00fc2146390c1942a65ee1d59731ffcd5e58b990..bff4b91c1a04fea64a57f2d4af833d67afd20bea 100644 (file)
@@ -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)
                ;
 
        /*
index 2baa412622e9e36034fb1a437835cfda177778ef..906219bd91d052bb8b13a4ba065db58f5817027b 100644 (file)
@@ -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;
 }
+
index 005a2713af2874d2b0bf5e4c77b520245529d432..95eb71281cf8592d7c6e311ea2b13df37f492966 100644 (file)
@@ -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<NPROC-1;i++) {
                        int status;
-                       if (waitpid(pids[i+1], &status, 0) != pids[i+1]) {
+                       if (sys_waitpid(pids[i+1], &status, 0) != pids[i+1]) {
                                printf("failed to wait for %d\n",
                                       (int)pids[i+1]);
                                exit(1);
index 4eab4e1ecc3891c1603d91ceaf27c03cbfe4e37d..15ecd02923fac46fafa10a7038bc9b4873bb3dc5 100644 (file)
@@ -2379,7 +2379,7 @@ double torture_create_procs(BOOL (*fn)(struct smbcli_state *, int), BOOL *result
 
        for (i=0;i<torture_nprocs;i++) {
                int ret;
-               while ((ret=waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ;
+               while ((ret=sys_waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ;
                if (ret == -1 || WEXITSTATUS(status) != 0) {
                        *result = False;
                }