summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-09 03:32:29 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-09 03:32:29 +1000
commit598eaa6c0c36c3169963c7e6505d53b4073590f5 (patch)
tree52872f9bfe82fd5a3e1b1a059bd063351bfbadd7 /openbsd-compat
parent294b84183265a9be32971fce856e578160e1a825 (diff)
- (dtucker) [configure.ac defines.h sftp-client.c sftp-server.c sftp.c
openbsd-compat/Makefile.in openbsd-compat/openbsd-compat.h openbsd-compat/bsd-statvfs.{c,h}] Add a null implementation of statvfs and fstatvfs and remove #defines around statvfs code. ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/Makefile.in4
-rw-r--r--openbsd-compat/bsd-statvfs.c37
-rw-r--r--openbsd-compat/bsd-statvfs.h68
-rw-r--r--openbsd-compat/openbsd-compat.h3
4 files changed, 109 insertions, 3 deletions
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index d1ec47b6e..a60e5a68d 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.42 2008/05/19 22:57:08 djm Exp $ 1# $Id: Makefile.in,v 1.43 2008/06/08 17:32:29 dtucker Exp $
2 2
3sysconfdir=@sysconfdir@ 3sysconfdir=@sysconfdir@
4piddir=@piddir@ 4piddir=@piddir@
@@ -18,7 +18,7 @@ LDFLAGS=-L. @LDFLAGS@
18 18
19OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o strtonum.o strtoll.o strtoul.o vis.o 19OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strsep.o strtonum.o strtoll.o strtoul.o vis.o
20 20
21COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-snprintf.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o 21COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o
22 22
23PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o 23PORTS=port-aix.o port-irix.o port-linux.o port-solaris.o port-tun.o port-uw.o
24 24
diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c
new file mode 100644
index 000000000..844d5b464
--- /dev/null
+++ b/openbsd-compat/bsd-statvfs.c
@@ -0,0 +1,37 @@
1/* $Id: bsd-statvfs.c,v 1.1 2008/06/08 17:32:29 dtucker Exp $ */
2
3/*
4 * Copyright (c) 2008 Darren Tucker <dtucker@zip.com.au>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include "includes.h"
20
21#include <errno.h>
22
23#ifndef HAVE_STATVFS
24int statvfs(const char *path, struct statvfs *buf)
25{
26 errno = ENOSYS;
27 return -1;
28}
29#endif
30
31#ifndef HAVE_FSTATVFS
32int fstatvfs(int fd, struct statvfs *buf)
33{
34 errno = ENOSYS;
35 return -1;
36}
37#endif
diff --git a/openbsd-compat/bsd-statvfs.h b/openbsd-compat/bsd-statvfs.h
new file mode 100644
index 000000000..da215ffc6
--- /dev/null
+++ b/openbsd-compat/bsd-statvfs.h
@@ -0,0 +1,68 @@
1/* $Id: bsd-statvfs.h,v 1.1 2008/06/08 17:32:29 dtucker Exp $ */
2
3/*
4 * Copyright (c) 2008 Darren Tucker <dtucker@zip.com.au>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19#include "includes.h"
20
21#include <sys/types.h>
22
23#ifdef HAVE_SYS_STATFS_H
24#include <sys/statfs.h>
25#endif
26
27#ifndef HAVE_STATVFS
28
29#ifndef HAVE_FSBLKCNT_T
30typedef unsigned long fsblkcnt_t;
31#endif
32#ifndef HAVE_FSFILCNT_T
33typedef unsigned long fsfilcnt_t;
34#endif
35
36#ifndef ST_RDONLY
37#define ST_RDONLY 1
38#endif
39#ifndef ST_NOSUID
40#define ST_NOSUID 2
41#endif
42
43 /* as defined in IEEE Std 1003.1, 2004 Edition */
44struct statvfs {
45 unsigned long f_bsize; /* File system block size. */
46 unsigned long f_frsize; /* Fundamental file system block size. */
47 fsblkcnt_t f_blocks; /* Total number of blocks on file system in */
48 /* units of f_frsize. */
49 fsblkcnt_t f_bfree; /* Total number of free blocks. */
50 fsblkcnt_t f_bavail; /* Number of free blocks available to */
51 /* non-privileged process. */
52 fsfilcnt_t f_files; /* Total number of file serial numbers. */
53 fsfilcnt_t f_ffree; /* Total number of free file serial numbers. */
54 fsfilcnt_t f_favail; /* Number of file serial numbers available to */
55 /* non-privileged process. */
56 unsigned long f_fsid; /* File system ID. */
57 unsigned long f_flag; /* BBit mask of f_flag values. */
58 unsigned long f_namemax;/* Maximum filename length. */
59};
60#endif
61
62#ifndef HAVE_STATVFS
63int statvfs(const char *, struct statvfs *);
64#endif
65
66#ifndef HAVE_FSTATVFS
67int fstatvfs(int, struct statvfs *);
68#endif
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 0b7d979e0..50c6d990b 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -1,4 +1,4 @@
1/* $Id: openbsd-compat.h,v 1.45 2008/05/19 22:57:08 djm Exp $ */ 1/* $Id: openbsd-compat.h,v 1.46 2008/06/08 17:32:29 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@@ -144,6 +144,7 @@ int writev(int, struct iovec *, int);
144 144
145/* Home grown routines */ 145/* Home grown routines */
146#include "bsd-misc.h" 146#include "bsd-misc.h"
147#include "bsd-statvfs.h"
147#include "bsd-waitpid.h" 148#include "bsd-waitpid.h"
148#include "bsd-poll.h" 149#include "bsd-poll.h"
149 150