lib/util: Clean up includes for blocking.c
authorMartin Schwenke <martin@meltin.net>
Mon, 22 Sep 2014 08:14:53 +0000 (18:14 +1000)
committerJeremy Allison <jra@samba.org>
Fri, 3 Oct 2014 22:11:20 +0000 (00:11 +0200)
Add blocking.h.  Allows standalone compile without external
includes.h.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/util/blocking.c
lib/util/blocking.h [new file with mode: 0644]
lib/util/samba_util.h
lib/util/wscript_build

index 157804a5be52731633e7b48223ed801557b23a54..358eda092a69c085c49abef68327c5f2468301df 100644 (file)
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "includes.h"
+#include "replace.h"
 #include "system/network.h"
 #include "system/filesys.h"
 #include "system/locale.h"
+#include "blocking.h"
 #undef malloc
 #undef strcasecmp
 #undef strncasecmp
diff --git a/lib/util/blocking.h b/lib/util/blocking.h
new file mode 100644 (file)
index 0000000..017e424
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Andrew Tridgell 1992-1998
+   Copyright (C) Jeremy Allison 2001-2002
+   Copyright (C) Simo Sorce 2001
+   Copyright (C) Jim McDonough (jmcd@us.ibm.com)  2003.
+   Copyright (C) James J Myers 2003
+
+   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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _SAMBA_BLOCKING_H_
+#define _SAMBA_BLOCKING_H_
+
+#include <stdbool.h>
+
+int set_blocking(int fd, bool set);
+bool smb_set_close_on_exec(int fd);
+
+#endif /* _SAMBA_BLOCKING_H_ */
index e9de6fae226de9c4a2d7b76cd9cca375b5b98e90..35eef421af88f87d3fd784e6cd9003315ca05b46 100644 (file)
@@ -649,18 +649,7 @@ _PUBLIC_ bool directory_create_or_exist_strict(const char *dname,
                                               uid_t uid,
                                               mode_t dir_perms);
 
-/**
- Set a fd into blocking/nonblocking mode. Uses POSIX O_NONBLOCK if available,
- else
-  if SYSV use O_NDELAY
-  if BSD use FNDELAY
-**/
-_PUBLIC_ int set_blocking(int fd, bool set);
-
-/**
-   set close on exec on a file descriptor if available
- **/
-_PUBLIC_ bool smb_set_close_on_exec(int fd);
+#include "blocking.h"
 
 /**
  Sleep for a specified number of milliseconds.
index d7e5b03e62c7179a2f8b6c34bacbd466eb2d365c..9bdf8121f7eb4850e2c3e24a528ce4c484c01e74 100755 (executable)
@@ -42,7 +42,7 @@ bld.SAMBA_LIBRARY('samba-util',
                     tevent_debug.c util_process.c memcache.c''',
                   deps='DYNCONFIG time-basic close-low-fd samba-debug tini tiniparser socket-blocking',
                   public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd-daemon',
-                  public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h idtree.h idtree_random.h',
+                  public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h idtree.h idtree_random.h blocking.h',
                   header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
                   local_include=False,
                   vnum='0.0.1',