summaryrefslogtreecommitdiff
path: root/usr/src/lib/libcmdutils/libcmdutils.h
diff options
context:
space:
mode:
authorJason King <jason.brian.king@gmail.com>2017-06-11 01:01:30 -0500
committerGordon Ross <gwr@nexenta.com>2017-06-12 18:53:07 -0400
commitd1151f9bab097777251f26772ebcc50468637a12 (patch)
tree1b75933c1a647bbe9c8a8959a56f220bf2098c0a /usr/src/lib/libcmdutils/libcmdutils.h
parent336970851eecf9c4348b3de7bbea0687059dd216 (diff)
downloadillumos-gate-d1151f9bab097777251f26772ebcc50468637a12.tar.gz
8369 libcmdutils should be better about large file support
8370 libcmdutils needlessly defines its own OFFSETOF() macro Reviewed by: Yuri Pankov <yuripv@gmx.com> Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src/lib/libcmdutils/libcmdutils.h')
-rw-r--r--usr/src/lib/libcmdutils/libcmdutils.h31
1 files changed, 25 insertions, 6 deletions
diff --git a/usr/src/lib/libcmdutils/libcmdutils.h b/usr/src/lib/libcmdutils/libcmdutils.h
index 7c3d0ebbc1..933ceb0fde 100644
--- a/usr/src/lib/libcmdutils/libcmdutils.h
+++ b/usr/src/lib/libcmdutils/libcmdutils.h
@@ -26,7 +26,7 @@
* Copyright (c) 2013 RackTop Systems.
*/
/*
- * Copyright 2016 Joyent, Inc.
+ * Copyright 2017 Joyent, Inc.
*/
/*
@@ -36,6 +36,11 @@
#ifndef _LIBCMDUTILS_H
#define _LIBCMDUTILS_H
+#if !defined(_LP64) && \
+ !((_FILE_OFFSET_BITS == 64) || defined(_LARGEFILE64_SOURCE))
+#error "libcmdutils.h can only be used in a largefile compilation environment"
+#endif
+
/*
* This is a private header file. Applications should not directly include
* this file.
@@ -70,16 +75,21 @@ extern "C" {
#define MAXMAPSIZE (1024*1024*8) /* map at most 8MB */
#define SMALLFILESIZE (32*1024) /* don't use mmap on little file */
-/* avltree */
-#define OFFSETOF(s, m) ((size_t)(&(((s *)0)->m)))
-
/* Type used for a node containing a device id and inode number */
+
+#if defined(_LP64) || (_FILE_OFFSET_BITS == 64)
typedef struct tree_node {
dev_t node_dev;
ino_t node_ino;
avl_node_t avl_link;
} tree_node_t;
-
+#else
+typedef struct tree_node {
+ dev_t node_dev;
+ ino64_t node_ino;
+ avl_node_t avl_link;
+} tree_node_t;
+#endif
/* extended system attribute support */
@@ -90,8 +100,13 @@ extern int sysattr_type(char *);
extern int sysattr_support(char *, int);
/* Copies the content of the source file to the target file */
+#if defined(_LP64) || (_FILE_OFFSET_BITS == 64)
extern int writefile(int, int, char *, char *, char *, char *,
-struct stat *, struct stat *);
+ struct stat *, struct stat *);
+#else
+extern int writefile(int, int, char *, char *, char *, char *,
+ struct stat64 *, struct stat64 *);
+#endif
/* Gets file descriptors of the source and target attribute files */
extern int get_attrdirs(int, int, char *, int *, int *);
@@ -120,7 +135,11 @@ extern int tnode_compare(const void *, const void *);
* application must set the tree pointer to NULL before calling
* add_tnode() for the first time.
*/
+#if defined(_LP64) || (_FILE_OFFSET_BITS == 64)
extern int add_tnode(avl_tree_t **, dev_t, ino_t);
+#else
+extern int add_tnode(avl_tree_t **, dev_t, ino64_t);
+#endif
/*
* Used to destroy a whole tree (all nodes) without rebalancing.