aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-10-16 11:27:37 +1100
committerDave Chinner <david@fromorbit.com>2015-10-16 11:27:37 +1100
commitff46015d155e51b9b9f3e1a4ade337de86db7271 (patch)
tree82fbfbe5ff326768ecd84bfeab0e3302dd91aa49
parent9d8bde8f671e3a3279eb165697a48445140eb75b (diff)
downloadxfsdump-dev-ff46015d155e51b9b9f3e1a4ade337de86db7271.tar.gz
build: don't rely on xfs/xfs.h to include necessary headers
From xfsprogs 4.2.0, the xfs headers no long include lots of xfsprogs specific build information. xfsdump hasbeen implicitly relying on those header for a clean build, rather than having it's own definitions. Hence we need to add the missing bits to config.h.in and include it in all the files that require the specific help that the xfs headers used to provide. Signed-off-by: Dave Chinner <dchinner@redhat.com>
-rw-r--r--common/arch_xlate.c4
-rw-r--r--common/arch_xlate.h1
-rw-r--r--common/cldmgr.c4
-rw-r--r--common/content_common.c4
-rw-r--r--common/dlog.c4
-rw-r--r--common/drive.c3
-rw-r--r--common/drive_minrmt.c5
-rw-r--r--common/drive_scsitape.c5
-rw-r--r--common/drive_simple.c5
-rw-r--r--common/fs.c4
-rw-r--r--common/global.c4
-rw-r--r--common/hsmapi.c4
-rw-r--r--common/lock.c2
-rw-r--r--common/main.c5
-rw-r--r--common/media.c2
-rw-r--r--common/mlog.c3
-rw-r--r--common/openutil.c5
-rw-r--r--common/path.c7
-rw-r--r--common/qlock.c2
-rw-r--r--common/ring.c2
-rw-r--r--common/stream.c3
-rw-r--r--common/util.c5
-rw-r--r--dump/content.c5
-rw-r--r--dump/inomap.c5
-rw-r--r--dump/var.c5
-rw-r--r--include/config.h.in45
-rw-r--r--inventory/inv_api.c5
-rw-r--r--inventory/inv_core.c5
-rw-r--r--inventory/inv_files.c3
-rw-r--r--inventory/inv_fstab.c5
-rw-r--r--inventory/inv_idx.c5
-rw-r--r--inventory/inv_mgr.c5
-rw-r--r--inventory/inv_oref.c2
-rw-r--r--inventory/inv_stobj.c5
-rw-r--r--inventory/testmain.c4
-rw-r--r--invutil/cmenu.c3
-rw-r--r--invutil/fstab.c3
-rw-r--r--invutil/invidx.c4
-rw-r--r--invutil/invutil.c4
-rw-r--r--invutil/screen.c3
-rw-r--r--invutil/stobj.c4
-rw-r--r--librmt/rmtabort.c1
-rw-r--r--librmt/rmtclose.c1
-rw-r--r--librmt/rmtcommand.c2
-rw-r--r--librmt/rmtfstat.c2
-rw-r--r--librmt/rmtioctl.c10
-rw-r--r--librmt/rmtlib.h3
-rw-r--r--librmt/rmtlseek.c2
-rw-r--r--librmt/rmtmsg.c5
-rw-r--r--librmt/rmtopen.c4
-rw-r--r--librmt/rmtread.c2
-rw-r--r--librmt/rmtstatus.c2
-rw-r--r--librmt/rmtwrite.c2
-rw-r--r--restore/bag.c2
-rw-r--r--restore/content.c5
-rw-r--r--restore/dirattr.c5
-rw-r--r--restore/inomap.c5
-rw-r--r--restore/namreg.c5
-rw-r--r--restore/node.c4
-rw-r--r--restore/tree.c7
-rw-r--r--restore/win.c2
61 files changed, 256 insertions, 18 deletions
diff --git a/common/arch_xlate.c b/common/arch_xlate.c
index e6f897ec..f8aa50f4 100644
--- a/common/arch_xlate.c
+++ b/common/arch_xlate.c
@@ -20,6 +20,10 @@
#include <xfs/jdm.h>
#include <assert.h>
+#include <strings.h>
+
+#include "config.h"
+
#include "arch_xlate.h"
#include "types.h"
#include "global.h"
diff --git a/common/arch_xlate.h b/common/arch_xlate.h
index 35333c68..fa201cdb 100644
--- a/common/arch_xlate.h
+++ b/common/arch_xlate.h
@@ -22,6 +22,7 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <strings.h>
#include "types.h"
#include "global.h"
#include "content.h"
diff --git a/common/cldmgr.c b/common/cldmgr.c
index df33a3fc..88fd7fde 100644
--- a/common/cldmgr.c
+++ b/common/cldmgr.c
@@ -19,6 +19,7 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
#include <sys/wait.h>
#include <sys/ipc.h>
#include <sys/sem.h>
@@ -26,6 +27,9 @@
#include <errno.h>
#include <pthread.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "exit.h"
#include "types.h"
diff --git a/common/content_common.c b/common/content_common.c
index 65be31f4..99b1a4bb 100644
--- a/common/content_common.c
+++ b/common/content_common.c
@@ -19,12 +19,16 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/common/dlog.c b/common/dlog.c
index 6220cfe7..dac4e64e 100644
--- a/common/dlog.c
+++ b/common/dlog.c
@@ -19,6 +19,7 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/select.h>
@@ -27,6 +28,9 @@
#include <errno.h>
#include <signal.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "mlog.h"
diff --git a/common/drive.c b/common/drive.c
index f9ba851f..afef1474 100644
--- a/common/drive.c
+++ b/common/drive.c
@@ -22,6 +22,9 @@
#include <sys/stat.h>
#include <time.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/common/drive_minrmt.c b/common/drive_minrmt.c
index 6d58f1f8..51685dc2 100644
--- a/common/drive_minrmt.c
+++ b/common/drive_minrmt.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/sem.h>
@@ -30,6 +32,9 @@
#include <malloc.h>
#include <sched.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/common/drive_scsitape.c b/common/drive_scsitape.c
index 3f45d014..eade6ac8 100644
--- a/common/drive_scsitape.c
+++ b/common/drive_scsitape.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ipc.h>
#include <sys/sem.h>
@@ -30,6 +32,9 @@
#include <malloc.h>
#include <sched.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/common/drive_simple.c b/common/drive_simple.c
index 2e57d8c6..69fce4bb 100644
--- a/common/drive_simple.c
+++ b/common/drive_simple.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
@@ -26,6 +28,9 @@
#include <malloc.h>
#include <sched.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/common/fs.c b/common/fs.c
index b77f6cc0..2cd2f723 100644
--- a/common/fs.c
+++ b/common/fs.c
@@ -20,6 +20,7 @@
#include <xfs/jdm.h>
#include "config.h"
+#include <unistd.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <time.h>
@@ -28,6 +29,9 @@
#include <mntent.h>
#include <sys/ioctl.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "mlog.h"
diff --git a/common/global.c b/common/global.c
index ed844ccb..319d4df7 100644
--- a/common/global.c
+++ b/common/global.c
@@ -19,10 +19,14 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
#include <errno.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/common/hsmapi.c b/common/hsmapi.c
index 0bca9fff..ed293708 100644
--- a/common/hsmapi.c
+++ b/common/hsmapi.c
@@ -21,6 +21,10 @@
#include <xfs/jdm.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
#include "hsmapi.h"
#include "mlog.h"
diff --git a/common/lock.c b/common/lock.c
index 347f6cdf..a2379316 100644
--- a/common/lock.c
+++ b/common/lock.c
@@ -20,6 +20,8 @@
#include <xfs/jdm.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "qlock.h"
#include "mlog.h"
diff --git a/common/main.c b/common/main.c
index f392856a..3b82a76a 100644
--- a/common/main.c
+++ b/common/main.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/prctl.h>
@@ -34,6 +36,9 @@
#include <sched.h>
#include <pthread.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "exit.h"
#include "types.h"
diff --git a/common/media.c b/common/media.c
index 53b94d1b..7d17405a 100644
--- a/common/media.c
+++ b/common/media.c
@@ -28,6 +28,8 @@
#include <getopt.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "util.h"
#include "mlog.h"
diff --git a/common/mlog.c b/common/mlog.c
index c5460361..1fef1854 100644
--- a/common/mlog.c
+++ b/common/mlog.c
@@ -28,6 +28,9 @@
#include <getopt.h>
#include <pthread.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "qlock.h"
diff --git a/common/openutil.c b/common/openutil.c
index c3b8d9a5..9df42aeb 100644
--- a/common/openutil.c
+++ b/common/openutil.c
@@ -18,11 +18,16 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <limits.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "mlog.h"
diff --git a/common/path.c b/common/path.c
index e40c473e..b73121d9 100644
--- a/common/path.c
+++ b/common/path.c
@@ -19,6 +19,13 @@
#include <xfs/xfs.h>
#include <assert.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+
#include "path.h"
struct pem {
diff --git a/common/qlock.c b/common/qlock.c
index d88917c5..1b466d6d 100644
--- a/common/qlock.c
+++ b/common/qlock.c
@@ -23,6 +23,8 @@
#include <semaphore.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "qlock.h"
#include "mlog.h"
diff --git a/common/ring.c b/common/ring.c
index f3de7c41..37a2d1dd 100644
--- a/common/ring.c
+++ b/common/ring.c
@@ -29,6 +29,8 @@
#include <malloc.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "qlock.h"
#include "cldmgr.h"
diff --git a/common/stream.c b/common/stream.c
index 0db1be39..90d315af 100644
--- a/common/stream.c
+++ b/common/stream.c
@@ -21,6 +21,9 @@
#include <pthread.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "exit.h"
diff --git a/common/util.c b/common/util.c
index 1dc6d6ca..af481626 100644
--- a/common/util.c
+++ b/common/util.c
@@ -20,12 +20,17 @@
#include <xfs/jdm.h>
#include "config.h"
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/dump/content.c b/dump/content.c
index 36823584..5d630bb6 100644
--- a/dump/content.c
+++ b/dump/content.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <sys/prctl.h>
#include <time.h>
@@ -31,6 +33,7 @@
#include <sys/quota.h>
#include <malloc.h>
#include <assert.h>
+#include <string.h>
#ifdef linux
#include <xfs/xqm.h>
@@ -38,6 +41,8 @@
#include <attr/attributes.h>
+#include "config.h"
+
#include "hsmapi.h"
#include "exit.h"
diff --git a/dump/inomap.c b/dump/inomap.c
index 7a3069f6..dacf9548 100644
--- a/dump/inomap.c
+++ b/dump/inomap.c
@@ -20,12 +20,17 @@
#include <xfs/jdm.h>
#include <malloc.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/dump/var.c b/dump/var.c
index 8370fa4b..ceb7e3ae 100644
--- a/dump/var.c
+++ b/dump/var.c
@@ -19,9 +19,14 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "fs.h"
diff --git a/include/config.h.in b/include/config.h.in
index 7cc4f2a0..ef66ed93 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -6,19 +6,44 @@
#ifndef __CONFIG_H__
#define __CONFIG_H__
+/* long and pointer must be either 32 bit or 64 bit */
+#undef SIZEOF_LONG
+#undef SIZEOF_CHAR_P
+#define BITS_PER_LONG (SIZEOF_LONG * CHAR_BIT)
+
+/* Check whether to define umode_t ourselves. */
+#ifndef HAVE_UMODE_T
+typedef unsigned short umode_t;
+#endif
+
/* Define if you want gettext (I18N) support */
#undef ENABLE_GETTEXT
-
-#ifndef _
-# ifdef ENABLE_GETTEXT
-# include <libintl.h>
-# define _(x) gettext(x)
-# else
-# define _(x) (x)
-# define textdomain(d) do { } while (0)
-# define bindtextdomain(d,dir) do { } while (0)
-# endif
+#ifdef ENABLE_GETTEXT
+# include <libintl.h>
+# define _(x) gettext(x)
+# define N_(x) x
+#else
+# define _(x) (x)
+# define N_(x) x
+# define textdomain(d) do { } while (0)
+# define bindtextdomain(d,dir) do { } while (0)
#endif
#include <locale.h>
+#define IRIX_DEV_BITSMAJOR 14
+#define IRIX_DEV_BITSMINOR 18
+#define IRIX_DEV_MAXMAJ 0x1ff
+#define IRIX_DEV_MAXMIN 0x3ffff
+#define IRIX_DEV_MAJOR(dev) ((int)(((unsigned)(dev) >> IRIX_DEV_BITSMINOR) \
+ & IRIX_DEV_MAXMAJ))
+#define IRIX_DEV_MINOR(dev) ((int)((dev) & IRIX_DEV_MAXMIN))
+#define IRIX_MKDEV(major,minor) ((xfs_dev_t)(((major) << IRIX_DEV_BITSMINOR) \
+ | (minor&IRIX_DEV_MAXMIN)))
+#define IRIX_DEV_TO_KDEVT(dev) makedev(IRIX_DEV_MAJOR(dev),IRIX_DEV_MINOR(dev))
+
+#ifndef min
+#define min(a,b) (((a)<(b))?(a):(b))
+#define max(a,b) (((a)>(b))?(a):(b))
+#endif
+
#endif /* __CONFIG_H__ */
diff --git a/inventory/inv_api.c b/inventory/inv_api.c
index bd473e9c..b564d2f8 100644
--- a/inventory/inv_api.c
+++ b/inventory/inv_api.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
@@ -27,6 +29,9 @@
#include <stdio.h>
#include <sys/stat.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "mlog.h"
diff --git a/inventory/inv_core.c b/inventory/inv_core.c
index a83e7ef6..7020f7f0 100644
--- a/inventory/inv_core.c
+++ b/inventory/inv_core.c
@@ -19,6 +19,7 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <time.h>
@@ -26,6 +27,10 @@
#include <errno.h>
#include <sys/dir.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
#include "types.h"
#include "inv_priv.h"
diff --git a/inventory/inv_files.c b/inventory/inv_files.c
index 34b7aacf..409ee0d2 100644
--- a/inventory/inv_files.c
+++ b/inventory/inv_files.c
@@ -24,6 +24,9 @@
#include <sys/stat.h>
#include <sys/dir.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
/*----------------------------------------------------------------------*/
diff --git a/inventory/inv_fstab.c b/inventory/inv_fstab.c
index e87152f8..82638527 100644
--- a/inventory/inv_fstab.c
+++ b/inventory/inv_fstab.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <time.h>
@@ -26,6 +28,9 @@
#include <fcntl.h>
#include <sys/dir.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "mlog.h"
diff --git a/inventory/inv_idx.c b/inventory/inv_idx.c
index edb72b3c..0378c5a5 100644
--- a/inventory/inv_idx.c
+++ b/inventory/inv_idx.c
@@ -19,6 +19,7 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
@@ -26,6 +27,10 @@
#include <sys/stat.h>
#include <sys/dir.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
#include "types.h"
#include "mlog.h"
#include "inv_priv.h"
diff --git a/inventory/inv_mgr.c b/inventory/inv_mgr.c
index 926b4c89..f1341b95 100644
--- a/inventory/inv_mgr.c
+++ b/inventory/inv_mgr.c
@@ -19,12 +19,17 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/dir.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
+
#include "types.h"
#include "mlog.h"
#include "inv_priv.h"
diff --git a/inventory/inv_oref.c b/inventory/inv_oref.c
index b6cd61de..ebcae951 100644
--- a/inventory/inv_oref.c
+++ b/inventory/inv_oref.c
@@ -20,6 +20,8 @@
#include <xfs/jdm.h>
#include <assert.h>
+#include "config.h"
+
#include "inv_priv.h"
#include "inv_oref.h"
diff --git a/inventory/inv_stobj.c b/inventory/inv_stobj.c
index 42969b11..bae2fc5d 100644
--- a/inventory/inv_stobj.c
+++ b/inventory/inv_stobj.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <errno.h>
@@ -27,6 +29,9 @@
#include <sys/dir.h>
#include <sys/mman.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "timeutil.h"
diff --git a/inventory/testmain.c b/inventory/testmain.c
index d8c61e26..51b77740 100644
--- a/inventory/testmain.c
+++ b/inventory/testmain.c
@@ -19,10 +19,14 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <stdio.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
+
+#include "config.h"
+
#include "types.h"
#include "mlog.h"
#include "getopt.h"
diff --git a/invutil/cmenu.c b/invutil/cmenu.c
index ff4abefd..ce23d285 100644
--- a/invutil/cmenu.c
+++ b/invutil/cmenu.c
@@ -19,9 +19,12 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <ncurses.h>
#include <signal.h>
#include <sys/stat.h>
+#include <string.h>
#include "types.h"
#include "mlog.h"
diff --git a/invutil/fstab.c b/invutil/fstab.c
index acbe94b9..ac8f7751 100644
--- a/invutil/fstab.c
+++ b/invutil/fstab.c
@@ -19,9 +19,12 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <signal.h>
#include <ncurses.h>
#include <sys/mman.h>
+#include <string.h>
#include "types.h"
#include "mlog.h"
diff --git a/invutil/invidx.c b/invutil/invidx.c
index 8de137cc..b6ce4fa3 100644
--- a/invutil/invidx.c
+++ b/invutil/invidx.c
@@ -19,9 +19,13 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <ncurses.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <string.h>
#include "types.h"
#include "mlog.h"
diff --git a/invutil/invutil.c b/invutil/invutil.c
index b75db14d..e1c88687 100644
--- a/invutil/invutil.c
+++ b/invutil/invutil.c
@@ -19,11 +19,15 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <sys/mman.h>
+#include <string.h>
+#include <libgen.h>
#include "types.h"
#include "mlog.h"
diff --git a/invutil/screen.c b/invutil/screen.c
index 12074f01..c4b79d89 100644
--- a/invutil/screen.c
+++ b/invutil/screen.c
@@ -18,6 +18,9 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+
+#include <stdio.h>
+#include <string.h>
#include <ncurses.h>
#include "cmenu.h"
diff --git a/invutil/stobj.c b/invutil/stobj.c
index a74ba0f5..eb04385d 100644
--- a/invutil/stobj.c
+++ b/invutil/stobj.c
@@ -18,9 +18,13 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+
+#include <unistd.h>
+#include <stdlib.h>
#include <ncurses.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <string.h>
#include "types.h"
#include "mlog.h"
diff --git a/librmt/rmtabort.c b/librmt/rmtabort.c
index 3efa651f..a7db4b1e 100644
--- a/librmt/rmtabort.c
+++ b/librmt/rmtabort.c
@@ -21,6 +21,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <unistd.h>
#include "rmtlib.h"
/*
diff --git a/librmt/rmtclose.c b/librmt/rmtclose.c
index a1553664..97f53c79 100644
--- a/librmt/rmtclose.c
+++ b/librmt/rmtclose.c
@@ -21,6 +21,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <unistd.h>
#include "rmtlib.h"
static int _rmt_close(int);
diff --git a/librmt/rmtcommand.c b/librmt/rmtcommand.c
index fbd7a6ac..82c90329 100644
--- a/librmt/rmtcommand.c
+++ b/librmt/rmtcommand.c
@@ -22,6 +22,8 @@
*/
#include <errno.h>
+#include <unistd.h>
+#include <string.h>
#include "rmtlib.h"
diff --git a/librmt/rmtfstat.c b/librmt/rmtfstat.c
index 35065673..92a49d77 100644
--- a/librmt/rmtfstat.c
+++ b/librmt/rmtfstat.c
@@ -24,6 +24,8 @@
#include "rmtlib.h"
#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/librmt/rmtioctl.c b/librmt/rmtioctl.c
index 4c108fb9..bd6f8870 100644
--- a/librmt/rmtioctl.c
+++ b/librmt/rmtioctl.c
@@ -21,17 +21,19 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <unistd.h>
#include <errno.h>
-
-#include "rmtlib.h"
-#include "swap.h"
-
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include <sys/param.h>
#include <assert.h>
+#include "config.h"
+#include "rmtlib.h"
+#include "swap.h"
+
+
/*
* uses old_mtget IRIX structure since we don't bother
* sending the "V" version command.
diff --git a/librmt/rmtlib.h b/librmt/rmtlib.h
index bc6961c2..1f877cae 100644
--- a/librmt/rmtlib.h
+++ b/librmt/rmtlib.h
@@ -27,9 +27,6 @@
*
*/
-
-#include <xfs/xfs.h>
-
/*
* Note that local vs remote file descriptors are distinquished
* by adding a bias to the remote descriptors. This is a quick
diff --git a/librmt/rmtlseek.c b/librmt/rmtlseek.c
index 8903886d..bf8c0fa0 100644
--- a/librmt/rmtlseek.c
+++ b/librmt/rmtlseek.c
@@ -21,7 +21,9 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdio.h>
#include <sys/types.h>
+#include <unistd.h>
#include "rmtlib.h"
static off_t _rmt_lseek(int, off_t, int);
diff --git a/librmt/rmtmsg.c b/librmt/rmtmsg.c
index 17addd1c..d28a1f2e 100644
--- a/librmt/rmtmsg.c
+++ b/librmt/rmtmsg.c
@@ -21,6 +21,11 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "config.h"
#include "rmtlib.h"
/*
diff --git a/librmt/rmtopen.c b/librmt/rmtopen.c
index 6a05ab31..4bf9383b 100644
--- a/librmt/rmtopen.c
+++ b/librmt/rmtopen.c
@@ -24,13 +24,15 @@
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#include <string.h>
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-
+#include "config.h"
#include "rmtlib.h"
#define RMT_DEBUG_FILE "/tmp/librmt_debug" /* file for debug output on server */
diff --git a/librmt/rmtread.c b/librmt/rmtread.c
index d5a840e7..34569015 100644
--- a/librmt/rmtread.c
+++ b/librmt/rmtread.c
@@ -21,6 +21,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdio.h>
+#include <unistd.h>
#include <errno.h>
#include "rmtlib.h"
diff --git a/librmt/rmtstatus.c b/librmt/rmtstatus.c
index 8528bc41..21d909de 100644
--- a/librmt/rmtstatus.c
+++ b/librmt/rmtstatus.c
@@ -21,6 +21,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdlib.h>
+#include <unistd.h>
#include <errno.h>
#include "rmtlib.h"
diff --git a/librmt/rmtwrite.c b/librmt/rmtwrite.c
index c42b1abe..9e5a1a3f 100644
--- a/librmt/rmtwrite.c
+++ b/librmt/rmtwrite.c
@@ -21,6 +21,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <unistd.h>
+#include <stdio.h>
#include <errno.h>
#include "rmtlib.h"
diff --git a/restore/bag.c b/restore/bag.c
index 8c7a2162..3927877e 100644
--- a/restore/bag.c
+++ b/restore/bag.c
@@ -24,6 +24,8 @@
#include <memory.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "mlog.h"
#include "bag.h"
diff --git a/restore/content.c b/restore/content.c
index 4796aea4..b02e38a3 100644
--- a/restore/content.c
+++ b/restore/content.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/mman.h>
@@ -35,6 +37,9 @@
#include <malloc.h>
#include <pthread.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "timeutil.h"
diff --git a/restore/dirattr.c b/restore/dirattr.c
index c8298088..a15abe59 100644
--- a/restore/dirattr.c
+++ b/restore/dirattr.c
@@ -29,6 +29,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
@@ -37,6 +39,9 @@
#include <fcntl.h>
#include <dirent.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/restore/inomap.c b/restore/inomap.c
index 2c62afc5..e5bcb55a 100644
--- a/restore/inomap.c
+++ b/restore/inomap.c
@@ -19,6 +19,8 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <errno.h>
@@ -27,6 +29,9 @@
#include <dirent.h>
#include <time.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "util.h"
diff --git a/restore/namreg.c b/restore/namreg.c
index c64833dc..18ba6d91 100644
--- a/restore/namreg.c
+++ b/restore/namreg.c
@@ -19,12 +19,17 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "lock.h"
diff --git a/restore/node.c b/restore/node.c
index f0297a5d..046f2f6e 100644
--- a/restore/node.c
+++ b/restore/node.c
@@ -19,12 +19,16 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/mman.h>
#include <errno.h>
#include <memory.h>
#include <limits.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "mlog.h"
#include "win.h"
diff --git a/restore/tree.c b/restore/tree.c
index d3775902..98f69523 100644
--- a/restore/tree.c
+++ b/restore/tree.c
@@ -19,7 +19,11 @@
#include <xfs/xfs.h>
#include <xfs/jdm.h>
+#include <unistd.h>
+#include <stdlib.h>
#include <sys/mman.h>
+#include <sys/types.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <utime.h>
@@ -29,6 +33,9 @@
#include <dirent.h>
#include <sys/ioctl.h>
#include <assert.h>
+#include <string.h>
+
+#include "config.h"
#include "types.h"
#include "exit.h"
diff --git a/restore/win.c b/restore/win.c
index a9f02399..3ca2af84 100644
--- a/restore/win.c
+++ b/restore/win.c
@@ -27,6 +27,8 @@
#include <errno.h>
#include <assert.h>
+#include "config.h"
+
#include "types.h"
#include "mlog.h"
#include "qlock.h"