summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-01 20:21:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:11 -0500
commit652b8b34f8b326f79771b03e039cfa3c6ba3427e (patch)
tree3cecbca36a8cb70b54df76c303894c06b7d63953
parentdde06904576dfe01e9710721209650dcff228593 (diff)
downloadsamba-652b8b34f8b326f79771b03e039cfa3c6ba3427e.tar.gz
samba-652b8b34f8b326f79771b03e039cfa3c6ba3427e.tar.bz2
samba-652b8b34f8b326f79771b03e039cfa3c6ba3427e.zip
r3441: some include file cleanups and general housekeeping
(This used to be commit 73ea8ee6c268371d05cf74160f2ad451dd2ae699)
-rw-r--r--source4/client/client.c91
-rw-r--r--source4/client/clitar.c12
-rw-r--r--source4/client/smbmount.c2
-rw-r--r--source4/include/includes.h166
-rw-r--r--source4/include/rewrite.h22
-rw-r--r--source4/lib/cmdline/popt_common.c2
-rw-r--r--source4/lib/dprintf.c6
-rw-r--r--source4/lib/genrand.c4
-rw-r--r--source4/lib/pidfile.c8
-rw-r--r--source4/lib/replace.c2
-rw-r--r--source4/lib/signal.c2
-rw-r--r--source4/lib/system.c187
-rw-r--r--source4/lib/util.c42
-rw-r--r--source4/lib/util_file.c94
-rw-r--r--source4/lib/util_sock.c2
-rw-r--r--source4/lib/xfile.c4
-rw-r--r--source4/libcli/clifile.c6
-rw-r--r--source4/libcli/clitrans2.c4
-rw-r--r--source4/libcli/config.m41
-rw-r--r--source4/libcli/util/cliutil.c109
-rw-r--r--source4/ntvfs/nbench/vfs_nbench.c2
-rw-r--r--source4/ntvfs/ntvfs_dfs.c2
-rw-r--r--source4/smb_server/reply.c2
-rw-r--r--source4/torture/gentest.c2
-rw-r--r--source4/torture/locktest2.c14
-rw-r--r--source4/torture/torture_util.c9
26 files changed, 147 insertions, 650 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index bced80d596..4dd149796d 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -325,6 +325,29 @@ static int cmd_cd(const char **cmd_ptr)
}
+BOOL mask_match(struct smbcli_state *c, const char *string, char *pattern,
+ BOOL is_case_sensitive)
+{
+ fstring p2, s2;
+
+ if (strcmp(string,"..") == 0)
+ string = ".";
+ if (strcmp(pattern,".") == 0)
+ return False;
+
+ if (is_case_sensitive)
+ return ms_fnmatch(pattern, string,
+ c->transport->negotiate.protocol) == 0;
+
+ fstrcpy(p2, pattern);
+ fstrcpy(s2, string);
+ strlower(p2);
+ strlower(s2);
+ return ms_fnmatch(p2, s2, c->transport->negotiate.protocol) == 0;
+}
+
+
+
/*******************************************************************
decide if a file should be operated on
********************************************************************/
@@ -714,16 +737,16 @@ static int do_get(char *rname, const char *lname, BOOL reget)
handle = fileno(stdout);
} else {
if (reget) {
- handle = sys_open(lname, O_WRONLY|O_CREAT, 0644);
+ handle = open(lname, O_WRONLY|O_CREAT, 0644);
if (handle >= 0) {
- start = sys_lseek(handle, 0, SEEK_END);
+ start = lseek(handle, 0, SEEK_END);
if (start == -1) {
d_printf("Error seeking local file\n");
return 1;
}
}
} else {
- handle = sys_open(lname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+ handle = open(lname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
}
newhandle = True;
}
@@ -832,6 +855,22 @@ static int cmd_get(const char **cmd_ptr)
return do_get(rname, lname, False);
}
+/****************************************************************************
+ Put up a yes/no prompt.
+****************************************************************************/
+static BOOL yesno(char *p)
+{
+ pstring ans;
+ printf("%s",p);
+
+ if (!fgets(ans,sizeof(ans)-1,stdin))
+ return(False);
+
+ if (*ans == 'y' || *ans == 'Y')
+ return(True);
+
+ return(False);
+}
/****************************************************************************
do a mget operation on one file
@@ -1251,7 +1290,7 @@ static int cmd_put(const char **cmd_ptr)
dos_clean_name(rname);
{
- SMB_STRUCT_STAT st;
+ struct stat st;
/* allow '-' to represent stdin
jdblair, 24.jun.98 */
if (!file_exist(lname,&st) &&
@@ -1319,6 +1358,44 @@ static int cmd_select(const char **cmd_ptr)
return 0;
}
+/*******************************************************************
+ A readdir wrapper which just returns the file name.
+ ********************************************************************/
+static const char *readdirname(DIR *p)
+{
+ struct dirent *ptr;
+ char *dname;
+
+ if (!p)
+ return(NULL);
+
+ ptr = (struct smb_dirent *)readdir(p);
+ if (!ptr)
+ return(NULL);
+
+ dname = ptr->d_name;
+
+#ifdef NEXT2
+ if (telldir(p) < 0)
+ return(NULL);
+#endif
+
+#ifdef HAVE_BROKEN_READDIR
+ /* using /usr/ucb/cc is BAD */
+ dname = dname - 2;
+#endif
+
+ {
+ static pstring buf;
+ int len = NAMLEN(ptr);
+ memcpy(buf, dname, len);
+ buf[len] = 0;
+ dname = buf;
+ }
+
+ return(dname);
+}
+
/****************************************************************************
Recursive file matching function act as find
match must be always set to True when calling this function
@@ -1982,10 +2059,10 @@ static int cmd_newer(const char **cmd_ptr)
{
fstring buf;
BOOL ok;
- SMB_STRUCT_STAT sbuf;
+ struct stat sbuf;
ok = next_token(cmd_ptr,buf,NULL,sizeof(buf));
- if (ok && (sys_stat(buf,&sbuf) == 0)) {
+ if (ok && (stat(buf,&sbuf) == 0)) {
newer_than = sbuf.st_mtime;
DEBUG(1,("Getting files newer than %s",
asctime(localtime(&newer_than))));
@@ -2141,7 +2218,7 @@ static int cmd_reput(const char **cmd_ptr)
pstring remote_name;
fstring buf;
char *p = buf;
- SMB_STRUCT_STAT st;
+ struct stat st;
pstrcpy(remote_name, cur_dir);
pstrcat(remote_name, "\\");
diff --git a/source4/client/clitar.c b/source4/client/clitar.c
index 7a4cea4ac7..7c19204e74 100644
--- a/source4/client/clitar.c
+++ b/source4/client/clitar.c
@@ -434,7 +434,7 @@ Write two zero blocks at end of file
****************************************************************************/
static void dotareof(int f)
{
- SMB_STRUCT_STAT stbuf;
+ struct stat stbuf;
/* Two zero blocks at end of file, write out full buffer */
if (dry_run)
@@ -443,7 +443,7 @@ static void dotareof(int f)
(void) dozerobuf(f, TBLOCK);
(void) dozerobuf(f, TBLOCK);
- if (sys_fstat(f, &stbuf) == -1)
+ if (fstat(f, &stbuf) == -1)
{
DEBUG(0, ("Couldn't stat file handle\n"));
return;
@@ -1721,10 +1721,10 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
DEBUG(0,("Option N must be followed by valid file name\n"));
return 0;
} else {
- SMB_STRUCT_STAT stbuf;
+ struct stat stbuf;
extern time_t newer_than;
- if (sys_stat(argv[Optind], &stbuf) == 0) {
+ if (stat(argv[Optind], &stbuf) == 0) {
newer_than = stbuf.st_mtime;
DEBUG(1,("Getting files newer than %s",
asctime(localtime(&newer_than))));
@@ -1879,8 +1879,8 @@ int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind)
}
tarhandle=-1;
} else
- if ((tar_type=='x' && (tarhandle = sys_open(argv[Optind], O_RDONLY, 0)) == -1)
- || (tar_type=='c' && (tarhandle=sys_creat(argv[Optind], 0644)) < 0))
+ if ((tar_type=='x' && (tarhandle = open(argv[Optind], O_RDONLY, 0)) == -1)
+ || (tar_type=='c' && (tarhandle=creat(argv[Optind], 0644)) < 0))
{
DEBUG(0,("Error opening local file %s - %s\n",
argv[Optind], strerror(errno)));
diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c
index dd72672bbb..358fad6ae1 100644
--- a/source4/client/smbmount.c
+++ b/source4/client/smbmount.c
@@ -552,7 +552,7 @@ static void get_password_file(void)
sscanf(p, "%d", &fd);
close_it = False;
} else if ((p = getenv("PASSWD_FILE")) != NULL) {
- fd = sys_open(p, O_RDONLY, 0);
+ fd = open(p, O_RDONLY, 0);
pstrcpy(spec, p);
if (fd < 0) {
fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",
diff --git a/source4/include/includes.h b/source4/include/includes.h
index b61429edd6..374abc4c37 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -475,120 +475,9 @@ typedef int socklen_t;
#endif
/*
- * Types for devices, inodes and offsets.
- */
-
-#ifndef SMB_DEV_T
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
-# define SMB_DEV_T dev64_t
-# else
-# define SMB_DEV_T dev_t
-# endif
-#endif
-
-/*
- * Setup the correctly sized inode type.
- */
-
-#ifndef SMB_INO_T
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
-# define SMB_INO_T ino64_t
-# else
-# define SMB_INO_T ino_t
-# endif
-#endif
-
-#ifndef LARGE_SMB_INO_T
-# if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
-# define LARGE_SMB_INO_T 1
-# endif
-#endif
-
-#ifdef LARGE_SMB_INO_T
-#define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
-#else
-#define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
-#endif
-
-#ifndef SMB_OFF_T
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
-# define SMB_OFF_T off64_t
-# else
-# define SMB_OFF_T off_t
-# endif
-#endif
-
-/*
- * Set the define that tells us if we can do 64 bit
- * NT SMB calls.
- */
-
-#ifndef LARGE_SMB_OFF_T
-# if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
-# define LARGE_SMB_OFF_T 1
-# endif
-#endif
-
-/*
* Type for stat structure.
*/
-#ifndef SMB_STRUCT_STAT
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
-# define SMB_STRUCT_STAT struct stat64
-# else
-# define SMB_STRUCT_STAT struct stat
-# endif
-#endif
-
-/*
- * Type for dirent structure.
- */
-
-#ifndef SMB_STRUCT_DIRENT
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
-# define smb_dirent dirent64
-# else
-# define smb_dirent dirent
-# endif
-#endif
-
-/*
- * Defines for 64 bit fcntl locks.
- */
-
-#ifndef SMB_STRUCT_FLOCK
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
-# define SMB_STRUCT_FLOCK struct flock64
-# else
-# define SMB_STRUCT_FLOCK struct flock
-# endif
-#endif
-
-#ifndef SMB_F_SETLKW
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
-# define SMB_F_SETLKW F_SETLKW64
-# else
-# define SMB_F_SETLKW F_SETLKW
-# endif
-#endif
-
-#ifndef SMB_F_SETLK
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
-# define SMB_F_SETLK F_SETLK64
-# else
-# define SMB_F_SETLK F_SETLK
-# endif
-#endif
-
-#ifndef SMB_F_GETLK
-# if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
-# define SMB_F_GETLK F_GETLK64
-# else
-# define SMB_F_GETLK F_GETLK
-# endif
-#endif
-
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
@@ -970,55 +859,12 @@ int vasprintf(char **ptr, const char *format, va_list ap);
#define LOG_DEBUG 7 /* debug-level messages */
#endif
-/* NetBSD doesn't have these */
-#ifndef SHM_R
-#define SHM_R 0400
-#endif
-
-#ifndef SHM_W
-#define SHM_W 0200
-#endif
-
-#if HAVE_KERNEL_SHARE_MODES
-#ifndef LOCK_MAND
-#define LOCK_MAND 32 /* This is a mandatory flock */
-#define LOCK_READ 64 /* ... Which allows concurrent read operations */
-#define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
-#define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
-#endif
-#endif
-
extern int DEBUGLEVEL;
-#define MAX_SEC_CTX_DEPTH 8 /* Maximum number of security contexts */
-
-
-#ifdef GLIBC_HACK_FCNTL64
-/* this is a gross hack. 64 bit locking is completely screwed up on
- i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack
- "fixes" the problem with the current 2.4.0test kernels
-*/
-#define fcntl fcntl64
-#undef F_SETLKW
-#undef F_SETLK
-#define F_SETLK 13
-#define F_SETLKW 14
-#endif
-
-
-/* Needed for sys_dlopen/sys_dlsym/sys_dlclose */
-#ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL 0
-#endif
-
#ifndef RTLD_LAZY
#define RTLD_LAZY 0
#endif
-#ifndef RTLD_NOW
-#define RTLD_NOW 0
-#endif
-
/* needed for some systems without iconv. Doesn't really matter
what error code we use */
#ifndef EILSEQ
@@ -1026,9 +872,6 @@ extern int DEBUGLEVEL;
#endif
/* add varargs prototypes with printf checking */
-int fdprintf(int , const char *, ...) PRINTF_ATTRIBUTE(2,3);
-int d_printf(const char *, ...) PRINTF_ATTRIBUTE(1,2);
-int d_fprintf(FILE *f, const char *, ...) PRINTF_ATTRIBUTE(2,3);
#ifndef HAVE_SNPRINTF_DECL
int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
#endif
@@ -1036,19 +879,10 @@ int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
#endif
-void sys_adminlog(int priority, const char *format_str, ...) PRINTF_ATTRIBUTE(2,3);
-
-int pstr_sprintf(pstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-int fstr_sprintf(fstring s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-
-int d_vfprintf(FILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-int smb_xvasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
/* we used to use these fns, but now we have good replacements
for snprintf and vsnprintf */
#define slprintf snprintf
-#define vslprintf vsnprintf
/* we need to use __va_copy() on some platforms */
diff --git a/source4/include/rewrite.h b/source4/include/rewrite.h
index 584cc215f9..b26c8f2e5d 100644
--- a/source4/include/rewrite.h
+++ b/source4/include/rewrite.h
@@ -82,28 +82,6 @@ typedef int BOOL;
#define LEVEL_II_OPLOCK_BREAK_CMD 0x3
#define ASYNC_LEVEL_II_OPLOCK_BREAK_CMD 0x4
-/*
- * Capabilities abstracted for different systems.
- */
-
-#define KERNEL_OPLOCK_CAPABILITY 0x1
-
-/*
- * Oplock break command code sent via the kernel interface (if it exists).
- *
- * Form of this is :
- *
- * 0 2 2+devsize 2+devsize+inodesize
- * +----+--------+--------+----------+
- * | cmd| dev | inode | fileid |
- * +----+--------+--------+----------+
- */
-#define KERNEL_OPLOCK_BREAK_DEV_OFFSET 2
-#define KERNEL_OPLOCK_BREAK_INODE_OFFSET (KERNEL_OPLOCK_BREAK_DEV_OFFSET + sizeof(SMB_DEV_T))
-#define KERNEL_OPLOCK_BREAK_FILEID_OFFSET (KERNEL_OPLOCK_BREAK_INODE_OFFSET + sizeof(SMB_INO_T))
-#define KERNEL_OPLOCK_BREAK_MSG_LEN (KERNEL_OPLOCK_BREAK_FILEID_OFFSET + sizeof(unsigned long))
-
-
#define CMD_REPLY 0x8000
#include "smb_macros.h"
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
index 05e92866b2..bd46373d58 100644
--- a/source4/lib/cmdline/popt_common.c
+++ b/source4/lib/cmdline/popt_common.c
@@ -175,7 +175,7 @@ static void get_password_file(struct cmdline_auth_info *a)
sscanf(p, "%d", &fd);
close_it = False;
} else if ((p = getenv("PASSWD_FILE")) != NULL) {
- fd = sys_open(p, O_RDONLY, 0);
+ fd = open(p, O_RDONLY, 0);
pstrcpy(spec, p);
if (fd < 0) {
fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",
diff --git a/source4/lib/dprintf.c b/source4/lib/dprintf.c
index fe939f0e8d..5538c490ce 100644
--- a/source4/lib/dprintf.c
+++ b/source4/lib/dprintf.c
@@ -31,7 +31,7 @@
#include "includes.h"
- int d_vfprintf(FILE *f, const char *format, va_list ap)
+int d_vfprintf(FILE *f, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0)
{
char *p, *p2;
int ret, maxlen, clen;
@@ -77,7 +77,7 @@ again:
}
- int d_fprintf(FILE *f, const char *format, ...)
+int d_fprintf(FILE *f, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
{
int ret;
va_list ap;
@@ -91,7 +91,7 @@ again:
static FILE *outfile;
- int d_printf(const char *format, ...)
+int d_printf(const char *format, ...) _PRINTF_ATTRIBUTE(1,2)
{
int ret;
va_list ap;
diff --git a/source4/lib/genrand.c b/source4/lib/genrand.c
index 72e4997596..11771b32c9 100644
--- a/source4/lib/genrand.c
+++ b/source4/lib/genrand.c
@@ -118,7 +118,7 @@ static void do_filehash(const char *fname, unsigned char *the_hash)
unsigned char tmp_md4[16];
int fd, n;
- fd = sys_open(fname,O_RDONLY,0);
+ fd = open(fname,O_RDONLY,0);
if (fd == -1)
return;
@@ -152,7 +152,7 @@ static int do_reseed(BOOL use_fd, int fd)
if (fd != -1)
return fd;
- fd = sys_open( "/dev/urandom", O_RDONLY,0);
+ fd = open( "/dev/urandom", O_RDONLY,0);
if(fd >= 0)
return fd;
}
diff --git a/source4/lib/pidfile.c b/source4/lib/pidfile.c
index 989f19b323..f8041a2005 100644
--- a/source4/lib/pidfile.c
+++ b/source4/lib/pidfile.c
@@ -37,7 +37,7 @@ pid_t pidfile_pid(const char *name)
slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
- fd = sys_open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
+ fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
if (fd == -1) {
return 0;
}
@@ -54,7 +54,7 @@ pid_t pidfile_pid(const char *name)
goto noproc;
}
- if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_RDLCK)) {
+ if (fcntl_lock(fd,F_SETLK,0,1,F_RDLCK)) {
/* we could get the lock - it can't be a Samba process */
goto noproc;
}
@@ -85,14 +85,14 @@ void pidfile_create(const char *name)
exit(1);
}
- fd = sys_open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY | O_EXCL, 0644);
+ fd = open(pidFile, O_NONBLOCK | O_CREAT | O_WRONLY | O_EXCL, 0644);
if (fd == -1) {
DEBUG(0,("ERROR: can't open %s: Error was %s\n", pidFile,
strerror(errno)));
exit(1);
}
- if (fcntl_lock(fd,SMB_F_SETLK,0,1,F_WRLCK)==False) {
+ if (fcntl_lock(fd,F_SETLK,0,1,F_WRLCK)==False) {
DEBUG(0,("ERROR: %s : fcntl lock of file %s failed. Error was %s\n",
name, pidFile, strerror(errno)));
exit(1);
diff --git a/source4/lib/replace.c b/source4/lib/replace.c
index 4ed99c833c..c23c65c8c8 100644
--- a/source4/lib/replace.c
+++ b/source4/lib/replace.c
@@ -27,7 +27,7 @@
/*******************************************************************
ftruncate for operating systems that don't have it
********************************************************************/
- int ftruncate(int f,SMB_OFF_T l)
+ int ftruncate(int f,off_t l)
{
struct flock fl;
diff --git a/source4/lib/signal.c b/source4/lib/signal.c
index bff4b91c1a..00fc214639 100644
--- a/source4/lib/signal.c
+++ b/source4/lib/signal.c
@@ -27,7 +27,7 @@
static void sig_cld(int signum)
{
- while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0)
+ while (waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0)
;
/*
diff --git a/source4/lib/system.c b/source4/lib/system.c
index e8a944d8f8..1407e7474e 100644
--- a/source4/lib/system.c
+++ b/source4/lib/system.c
@@ -128,193 +128,6 @@ ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct
return ret;
}
-/*******************************************************************
-A recvfrom wrapper that will deal with EINTR.
-********************************************************************/
-
-ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
-{
- ssize_t ret;
-
- do {
- ret = recvfrom(s, buf, len, flags, from, fromlen);
- } while (ret == -1 && errno == EINTR);
- return ret;
-}
-
-/*******************************************************************
-A fcntl wrapper that will deal with EINTR.
-********************************************************************/
-
-int sys_fcntl_ptr(int fd, int cmd, void *arg)
-{
- int ret;
-
- do {
- ret = fcntl(fd, cmd, arg);
- } while (ret == -1 && errno == EINTR);
- return ret;
-}
-
-/*******************************************************************
-A fcntl wrapper that will deal with EINTR.
-********************************************************************/
-
-int sys_fcntl_long(int fd, int cmd, long arg)
-{
- int ret;
-
- do {
- ret = fcntl(fd, cmd, arg);
- } while (ret == -1 && errno == EINTR);
- return ret;
-}
-
-/*******************************************************************
-A stat() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
-{
- int ret;
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_STAT64)
- ret = stat64(fname, sbuf);
-#else
- ret = stat(fname, sbuf);
-#endif
- /* we always want directories to appear zero size */
- if (ret == 0 && S_ISDIR(sbuf->st_mode)) sbuf->st_size = 0;
- return ret;
-}
-
-/*******************************************************************
- An fstat() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_fstat(int fd,SMB_STRUCT_STAT *sbuf)
-{
- int ret;
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FSTAT64)
- ret = fstat64(fd, sbuf);
-#else
- ret = fstat(fd, sbuf);
-#endif
- /* we always want directories to appear zero size */
- if (ret == 0 && S_ISDIR(sbuf->st_mode)) sbuf->st_size = 0;
- return ret;
-}
-
-/*******************************************************************
- An lstat() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_lstat(const char *fname,SMB_STRUCT_STAT *sbuf)
-{
- int ret;
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSTAT64)
- ret = lstat64(fname, sbuf);
-#else
- ret = lstat(fname, sbuf);
-#endif
- /* we always want directories to appear zero size */
- if (ret == 0 && S_ISDIR(sbuf->st_mode)) sbuf->st_size = 0;
- return ret;
-}
-
-/*******************************************************************
- An ftruncate() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_ftruncate(int fd, SMB_OFF_T offset)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_FTRUNCATE64)
- return ftruncate64(fd, offset);
-#else
- return ftruncate(fd, offset);
-#endif
-}
-
-/*******************************************************************
- An lseek() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T) && defined(HAVE_LSEEK64)
- return lseek64(fd, offset, whence);
-#else
- return lseek(fd, offset, whence);
-#endif
-}
-
-/*******************************************************************
- A creat() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_creat(const char *path, mode_t mode)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_CREAT64)
- return creat64(path, mode);
-#else
- /*
- * If creat64 isn't defined then ensure we call a potential open64.
- * JRA.
- */
- return sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
-#endif
-}
-
-/*******************************************************************
- An open() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_open(const char *path, int oflag, mode_t mode)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OPEN64)
- return open64(path, oflag, mode);
-#else
- return open(path, oflag, mode);
-#endif
-}
-
-/*******************************************************************
- An fopen() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-FILE *sys_fopen(const char *path, const char *type)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FOPEN64)
- return fopen64(path, type);
-#else
- return fopen(path, type);
-#endif
-}
-
-/*******************************************************************
- A readdir wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-struct smb_dirent *sys_readdir(DIR *dirp)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_READDIR64)
- return readdir64(dirp);
-#else
- return readdir(dirp);
-#endif
-}
-
-/*******************************************************************
-The wait() calls vary between systems
-********************************************************************/
-
-int sys_waitpid(pid_t pid,int *status,int options)
-{
-#ifdef HAVE_WAITPID
- return waitpid(pid,status,options);
-#else /* HAVE_WAITPID */
- return wait4(pid, status, options, NULL);
-#endif /* HAVE_WAITPID */
-}
/*******************************************************************
System wrapper for getwd
diff --git a/source4/lib/util.c b/source4/lib/util.c
index 97d3d5dd1b..07dc182580 100644
--- a/source4/lib/util.c
+++ b/source4/lib/util.c
@@ -40,13 +40,13 @@ const char *tmpdir(void)
/*******************************************************************
Check if a file exists - call vfs_file_exist for samba files.
********************************************************************/
-BOOL file_exist(const char *fname,SMB_STRUCT_STAT *sbuf)
+BOOL file_exist(const char *fname, struct stat *sbuf)
{
- SMB_STRUCT_STAT st;
+ struct stat st;
if (!sbuf)
sbuf = &st;
- if (sys_stat(fname,sbuf) != 0)
+ if (stat(fname,sbuf) != 0)
return(False);
return((S_ISREG(sbuf->st_mode)) || (S_ISFIFO(sbuf->st_mode)));
@@ -58,9 +58,9 @@ BOOL file_exist(const char *fname,SMB_STRUCT_STAT *sbuf)
time_t file_modtime(const char *fname)
{
- SMB_STRUCT_STAT st;
+ struct stat st;
- if (sys_stat(fname,&st) != 0)
+ if (stat(fname,&st) != 0)
return(0);
return(st.st_mtime);
@@ -70,15 +70,15 @@ time_t file_modtime(const char *fname)
Check if a directory exists.
********************************************************************/
-BOOL directory_exist(const char *dname,SMB_STRUCT_STAT *st)
+BOOL directory_exist(const char *dname,struct stat *st)
{
- SMB_STRUCT_STAT st2;
+ struct stat st2;
BOOL ret;
if (!st)
st = &st2;
- if (sys_stat(dname,st) != 0)
+ if (stat(dname,st) != 0)
return(False);
ret = S_ISDIR(st->st_mode);
@@ -90,12 +90,12 @@ BOOL directory_exist(const char *dname,SMB_STRUCT_STAT *st)
/*******************************************************************
Returns the size in bytes of the named file.
********************************************************************/
-SMB_OFF_T get_file_size(char *file_name)
+off_t get_file_size(char *file_name)
{
- SMB_STRUCT_STAT buf;
+ struct stat buf;
buf.st_size = 0;
- if(sys_stat(file_name,&buf) != 0)
- return (SMB_OFF_T)-1;
+ if(stat(file_name,&buf) != 0)
+ return (off_t)-1;
return(buf.st_size);
}
@@ -120,9 +120,9 @@ void close_low_fds(BOOL stderr_too)
if (i == 2 && !stderr_too)
continue;
- fd = sys_open("/dev/null",O_RDWR,0);
+ fd = open("/dev/null",O_RDWR,0);
if (fd < 0)
- fd = sys_open("/dev/null",O_WRONLY,0);
+ fd = open("/dev/null",O_WRONLY,0);
if (fd < 0) {
DEBUG(0,("Can't open /dev/null\n"));
return;
@@ -155,13 +155,13 @@ int set_blocking(int fd, BOOL set)
#endif
#endif
- if((val = sys_fcntl_long(fd, F_GETFL, 0)) == -1)
+ if((val = fcntl(fd, F_GETFL, 0)) == -1)
return -1;
if(set) /* Turn blocking on - ie. clear nonblock flag */
val &= ~FLAG_TO_SET;
else
val |= FLAG_TO_SET;
- return sys_fcntl_long( fd, F_SETFL, val);
+ return fcntl( fd, F_SETFL, val);
#undef FLAG_TO_SET
}
@@ -198,7 +198,7 @@ void become_daemon(BOOL Fork)
setsid();
#elif defined(TIOCNOTTY)
{
- int i = sys_open("/dev/tty", O_RDWR, 0);
+ int i = open("/dev/tty", O_RDWR, 0);
if (i != -1) {
ioctl(i, (int) TIOCNOTTY, (char *)0);
close(i);
@@ -509,9 +509,9 @@ BOOL process_exists(pid_t pid)
is dealt with in posix.c
****************************************************************************/
-BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
+BOOL fcntl_lock(int fd, int op, off_t offset, off_t count, int type)
{
- SMB_STRUCT_FLOCK lock;
+ struct flock lock;
int ret;
DEBUG(8,("fcntl_lock %d %d %.0f %.0f %d\n",fd,op,(double)offset,(double)count,type));
@@ -522,13 +522,13 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
lock.l_len = count;
lock.l_pid = 0;
- ret = sys_fcntl_ptr(fd,op,&lock);
+ ret = fcntl(fd,op,&lock);
if (ret == -1 && errno != 0)
DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
/* a lock query */
- if (op == SMB_F_GETLK) {
+ if (op == F_GETLK) {
if ((ret != -1) &&
(lock.l_type != F_UNLCK) &&
(lock.l_pid != 0) &&
diff --git a/source4/lib/util_file.c b/source4/lib/util_file.c
index c4f794db0e..0093de9517 100644
--- a/source4/lib/util_file.c
+++ b/source4/lib/util_file.c
@@ -20,96 +20,6 @@
#include "includes.h"
-static int gotalarm;
-
-/***************************************************************
- Signal function to tell us we timed out.
-****************************************************************/
-
-static void gotalarm_sig(void)
-{
- gotalarm = 1;
-}
-
-/***************************************************************
- Lock or unlock a fd for a known lock type. Abandon after waitsecs
- seconds.
-****************************************************************/
-
-BOOL do_file_lock(int fd, int waitsecs, int type)
-{
- SMB_STRUCT_FLOCK lock;
- int ret;
- void (*oldsig_handler)(int);
-
- gotalarm = 0;
- oldsig_handler = CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
-
- lock.l_type = type;
- lock.l_whence = SEEK_SET;
- lock.l_start = 0;
- lock.l_len = 1;
- lock.l_pid = 0;
-
- alarm(waitsecs);
- /* Note we must *NOT* use sys_fcntl here ! JRA */
- ret = fcntl(fd, SMB_F_SETLKW, &lock);
- alarm(0);
- CatchSignal(SIGALRM, SIGNAL_CAST oldsig_handler);
-
- if (gotalarm) {
- DEBUG(0, ("do_file_lock: failed to %s file.\n",
- type == F_UNLCK ? "unlock" : "lock"));
- return False;
- }
-
- return (ret == 0);
-}
-
-
-/***************************************************************
- Lock an fd. Abandon after waitsecs seconds.
-****************************************************************/
-
-BOOL file_lock(int fd, int type, int secs, int *plock_depth)
-{
- if (fd < 0)
- return False;
-
- (*plock_depth)++;
-
- if ((*plock_depth) == 0)
- {
- if (!do_file_lock(fd, secs, type)) {
- DEBUG(10,("file_lock: locking file failed, error = %s.\n",
- strerror(errno)));
- return False;
- }
- }
-
- return True;
-}
-
-/***************************************************************
- Unlock an fd. Abandon after waitsecs seconds.
-****************************************************************/
-
-BOOL file_unlock(int fd, int *plock_depth)
-{
- BOOL ret=True;
-
- if(*plock_depth == 1)
- ret = do_file_lock(fd, 5, F_UNLCK);
-
- (*plock_depth)--;
-
- if(!ret)
- DEBUG(10,("file_unlock: unlocking file failed, error = %s.\n",
- strerror(errno)));
- return ret;
-}
-
-
/*************************************************************************
gets a line out of a file.
line is of format "xxxx:xxxxxx:xxxxx:".
@@ -280,10 +190,10 @@ load a file into memory from a fd.
char *fd_load(int fd, size_t *size)
{
- SMB_STRUCT_STAT sbuf;
+ struct stat sbuf;
char *p;
- if (sys_fstat(fd, &sbuf) != 0) return NULL;
+ if (fstat(fd, &sbuf) != 0) return NULL;
p = (char *)malloc(sbuf.st_size+1);
if (!p) return NULL;
diff --git a/source4/lib/util_sock.c b/source4/lib/util_sock.c
index 638c44f705..0cb23920f1 100644
--- a/source4/lib/util_sock.c
+++ b/source4/lib/util_sock.c
@@ -162,7 +162,7 @@ ssize_t read_udp_socket(int fd, char *buf, size_t len,
struct sockaddr_in sock;
socklen_t socklen = sizeof(sock);
- ret = (ssize_t)sys_recvfrom(fd,buf,len, 0, (struct sockaddr *)&sock, &socklen);
+ ret = recvfrom(fd,buf,len, 0, (struct sockaddr *)&sock, &socklen);
if (ret <= 0) {
DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
return 0;
diff --git a/source4/lib/xfile.c b/source4/lib/xfile.c
index e01723904f..8572bd857a 100644
--- a/source4/lib/xfile.c
+++ b/source4/lib/xfile.c
@@ -109,7 +109,7 @@ XFILE *x_fopen(const char *fname, int flags, mode_t mode)
ret->open_flags = flags;
- ret->fd = sys_open(fname, flags, mode);
+ ret->fd = open(fname, flags, mode);
if (ret->fd == -1) {
SAFE_FREE(ret);
return NULL;
@@ -379,5 +379,5 @@ off_t x_tseek(XFILE *f, off_t offset, int whence)
}
f->flags &= ~X_FLAG_EOF;
- return (off_t)sys_lseek(f->fd, offset, whence);
+ return lseek(f->fd, offset, whence);
}
diff --git a/source4/libcli/clifile.c b/source4/libcli/clifile.c
index b233064085..cdb29beb2d 100644
--- a/source4/libcli/clifile.c
+++ b/source4/libcli/clifile.c
@@ -429,7 +429,7 @@ NTSTATUS smbcli_unlock(struct smbcli_tree *tree, int fnum, uint32_t offset, uint
Lock a file with 64 bit offsets.
****************************************************************************/
NTSTATUS smbcli_lock64(struct smbcli_tree *tree, int fnum,
- SMB_OFF_T offset, SMB_OFF_T len, int timeout,
+ off_t offset, off_t len, int timeout,
enum brl_type lock_type)
{
union smb_lock parms;
@@ -464,8 +464,8 @@ NTSTATUS smbcli_lock64(struct smbcli_tree *tree, int fnum,
/****************************************************************************
Unlock a file with 64 bit offsets.
****************************************************************************/
-NTSTATUS smbcli_unlock64(struct smbcli_tree *tree, int fnum, SMB_OFF_T offset,
- SMB_OFF_T len)
+NTSTATUS smbcli_unlock64(struct smbcli_tree *tree, int fnum, off_t offset,
+ off_t len)
{
union smb_lock parms;
struct smb_lock_entry lock[1];
diff --git a/source4/libcli/clitrans2.c b/source4/libcli/clitrans2.c
index 7a37df6e1f..eb2c671a95 100644
--- a/source4/libcli/clitrans2.c
+++ b/source4/libcli/clitrans2.c
@@ -67,7 +67,7 @@ send a qpathinfo call with the SMB_QUERY_FILE_ALL_INFO info level
NTSTATUS smbcli_qpathinfo2(struct smbcli_tree *tree, const char *fname,
time_t *c_time, time_t *a_time, time_t *m_time,
time_t *w_time, size_t *size, uint16_t *mode,
- SMB_INO_T *ino)
+ ino_t *ino)
{
union smb_fileinfo parms;
TALLOC_CTX *mem_ctx;
@@ -143,7 +143,7 @@ send a qfileinfo call
NTSTATUS smbcli_qfileinfo(struct smbcli_tree *tree, int fnum,
uint16_t *mode, size_t *size,
time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, SMB_INO_T *ino)
+ time_t *w_time, ino_t *ino)
{
union smb_fileinfo parms;
TALLOC_CTX *mem_ctx;
diff --git a/source4/libcli/config.m4 b/source4/libcli/config.m4
index 41f7ad6812..32a62dbb20 100644
--- a/source4/libcli/config.m4
+++ b/source4/libcli/config.m4
@@ -34,7 +34,6 @@ SMB_SUBSYSTEM(LIBCLI_UTILS,[],
libcli/util/doserr.o
libcli/util/errormap.o
libcli/util/clierror.o
- libcli/util/cliutil.o
libcli/util/nterr.o
libcli/util/smbdes.o
libcli/util/smbencrypt.o
diff --git a/source4/libcli/util/cliutil.c b/source4/libcli/util/cliutil.c
deleted file mode 100644
index ead09c4b41..0000000000
--- a/source4/libcli/util/cliutil.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- client utility routines
- Copyright (C) Andrew Tridgell 2001
- Copyright (C) James Myers 2003 <myersjj@samba.org>
-
- 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.
-*/
-
-#include "includes.h"
-#include "libcli/raw/libcliraw.h"
-
-/*******************************************************************
- Functions nicked from lib/util.c needed by client.
-*******************************************************************/
-
-/*******************************************************************
- A wrapper that handles case sensitivity and the special handling
- of the ".." name.
-*******************************************************************/
-
-BOOL mask_match(struct smbcli_state *cli, const char *string, char *pattern, BOOL is_case_sensitive)
-{
- fstring p2, s2;
-
- if (strcmp(string,"..") == 0)
- string = ".";
- if (strcmp(pattern,".") == 0)
- return False;
-
- if (is_case_sensitive)
- return ms_fnmatch(pattern, string,
- cli->transport->negotiate.protocol) == 0;
-
- fstrcpy(p2, pattern);
- fstrcpy(s2, string);
- strlower(p2);
- strlower(s2);
- return ms_fnmatch(p2, s2, cli->transport->negotiate.protocol) == 0;
-}
-
-/****************************************************************************
- Put up a yes/no prompt.
-****************************************************************************/
-
-BOOL yesno(char *p)
-{
- pstring ans;
- printf("%s",p);
-
- if (!fgets(ans,sizeof(ans)-1,stdin))
- return(False);
-
- if (*ans == 'y' || *ans == 'Y')
- return(True);
-
- return(False);
-}
-
-/*******************************************************************
- A readdir wrapper which just returns the file name.
- ********************************************************************/
-
-const char *readdirname(DIR *p)
-{
- struct smb_dirent *ptr;
- char *dname;
-
- if (!p)
- return(NULL);
-
- ptr = (struct smb_dirent *)sys_readdir(p);
- if (!ptr)
- return(NULL);
-
- dname = ptr->d_name;
-
-#ifdef NEXT2
- if (telldir(p) < 0)
- return(NULL);
-#endif
-
-#ifdef HAVE_BROKEN_READDIR
- /* using /usr/ucb/cc is BAD */
- dname = dname - 2;
-#endif
-
- {
- static pstring buf;
- int len = NAMLEN(ptr);
- memcpy(buf, dname, len);
- buf[len] = 0;
- dname = buf;
- }
-
- return(dname);
-}
diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c
index 396d3a418e..8820279584 100644
--- a/source4/ntvfs/nbench/vfs_nbench.c
+++ b/source4/ntvfs/nbench/vfs_nbench.c
@@ -102,7 +102,7 @@ static NTSTATUS nbench_connect(struct ntvfs_module_context *ntvfs,
}
asprintf(&logname, "/tmp/nbenchlog%d.%u", ntvfs->depth, getpid());
- nprivates->log_fd = sys_open(logname, O_WRONLY|O_CREAT|O_APPEND, 0644);
+ nprivates->log_fd = open(logname, O_WRONLY|O_CREAT|O_APPEND, 0644);
free(logname);
if (nprivates->log_fd == -1) {
diff --git a/source4/ntvfs/ntvfs_dfs.c b/source4/ntvfs/ntvfs_dfs.c
index 7acd1f7cbb..afba3ee43e 100644
--- a/source4/ntvfs/ntvfs_dfs.c
+++ b/source4/ntvfs/ntvfs_dfs.c
@@ -92,7 +92,7 @@ struct ntvfs_ops *ntvfs_backend_byname(const char *name, enum ntvfs_type type)
int ntvfs_interface_version(struct ntvfs_critical_sizes *sizes)
{
sizes->sizeof_ntvfs_ops = sizeof(struct ntvfs_ops);
- sizes->sizeof_SMB_OFF_T = sizeof(SMB_OFF_T);
+ sizes->sizeof_off_t = sizeof(off_t);
sizes->sizeof_tcon_context = sizeof(struct tcon_context);
return NTVFS_INTERFACE_VERSION;
diff --git a/source4/smb_server/reply.c b/source4/smb_server/reply.c
index 818d953abb..1b697c4ba7 100644
--- a/source4/smb_server/reply.c
+++ b/source4/smb_server/reply.c
@@ -682,7 +682,7 @@ void reply_readbraw(struct smbsrv_request *req)
/* the 64 bit variant */
if (req->in.wct == 10) {
uint32_t offset_high = IVAL(req->in.vwv, VWV(8));
- io.readbraw.in.offset |= (((SMB_OFF_T)offset_high) << 32);
+ io.readbraw.in.offset |= (((off_t)offset_high) << 32);
}
/* before calling the backend we setup the raw buffer. This
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 15956d3b3b..59775e02d9 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -504,7 +504,7 @@ static uint16_t gen_pid(void)
/*
generate a lock count
*/
-static SMB_OFF_T gen_lock_count(void)
+static off_t gen_lock_count(void)
{
return gen_int_range(0, 3);
}
diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c
index f474b3efa9..e2220a3b1f 100644
--- a/source4/torture/locktest2.c
+++ b/source4/torture/locktest2.c
@@ -133,17 +133,6 @@ static BOOL try_unlock(struct smbcli_state *c, int fstype,
return False;
}
-static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid,
- enum brl_type lock_type,
- br_off start, br_off size)
-{
- printf("%6d %05x:%05x %s %.0f:%.0f(%.0f)\n",
- (int)pid, (int)dev, (int)ino,
- lock_type==READ_LOCK?"R":"W",
- (double)start, (double)start+size-1,(double)size);
-
-}
-
/*****************************************************
return a connection to a server
*******************************************************/
@@ -256,7 +245,6 @@ static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
op==READ_LOCK?"READ_LOCK":"WRITE_LOCK",
ret[0], ret[1]);
}
- if (showall) brl_forall(print_brl);
if (ret[0] != ret[1]) return False;
} else if (r2 < LOCK_PCT+UNLOCK_PCT) {
/* unset a lock */
@@ -271,7 +259,6 @@ static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
start, start+len-1, len,
ret[0], ret[1]);
}
- if (showall) brl_forall(print_brl);
if (!hide_unlock_fails && ret[0] != ret[1]) return False;
} else {
/* reopen the file */
@@ -287,7 +274,6 @@ static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
if (showall) {
printf("reopen conn=%u fstype=%u f=%u\n",
conn, fstype, f);
- brl_forall(print_brl);
}
}
return True;
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index 034bc807bb..8565a4d7d8 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -167,6 +167,15 @@ void *shm_setup(int size)
int shmid;
void *ret;
+/* NetBSD doesn't have these */
+#ifndef SHM_R
+#define SHM_R 0400
+#endif
+
+#ifndef SHM_W
+#define SHM_W 0200
+#endif
+
shmid = shmget(IPC_PRIVATE, size, SHM_R | SHM_W);
if (shmid == -1) {
printf("can't get shared memory\n");