我在AIX上使用statvfs函數調用。並使用GCC編譯器。 我希望statvfs調用由預處理器解析爲statvfs64。例如:在Solaris中,使用「-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS = 64」標誌和gcc我解析爲statvfs64。GCC選項獲取statvfs64
請幫助獲取AIX上的類似標誌,它可以解決statvfs中的statvfs64問題。
感謝&問候, Sivaram牛逼
我在AIX上使用statvfs函數調用。並使用GCC編譯器。 我希望statvfs調用由預處理器解析爲statvfs64。例如:在Solaris中,使用「-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS = 64」標誌和gcc我解析爲statvfs64。GCC選項獲取statvfs64
請幫助獲取AIX上的類似標誌,它可以解決statvfs中的statvfs64問題。
感謝&問候, Sivaram牛逼
我沒有AIX系統,所以我不能告訴你要設置的標記。但是,在Solaris上,您可以查看sys/statvfs.h
並查看它是如何工作的,例如搜索statvfs64
並查找其周圍的#ifdef塊。您將看到行
#if defined(_LARGEFILE64_SOURCE)
typedef struct statvfs64 {
.....
} statvfs64_t;
#endif
#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
...
#define statvfs_t statvfs64_t
#define statvfs statvfs64
#define fstatvfs fstatvfs64
#endif
您將可以在AIX上完成相同的事情。但是,AIX可能會有不同的行爲,並且不使用預處理器在32位和64位版本之間切換。
如果對你不明顯,那麼你可以在這裏發佈sys/statvfs.h
的內容,我們可以爲你尋找。
AIX上的iirc您需要_LARGE_FILES標記集,這將啓用隱式大文件支持。
-D_LARGE_FILES
如果你想打電話explicittly statvfs64,你所要做的
-D_LARGE_FILE_API
非常感謝立即響應。 不幸的是,在AIX包含文件中沒有定義「_LARGEFILE64_SOURCE」。
我來了解以下選項 「-maix64 -mpowerpc64」可以解析爲statvfs64。不確定這些是否適合使用。
請查找以下SYS/statvfs.h文件
================================ =================
#ifndef _H_STATVFS
#define _H_STATVFS
#ifndef _H_STANDARDS
#include <standards.h>
#endif
#if _XOPEN_SOURCE_EXTENDED==1
#include <strict_stdtypes.h>
#ifndef _H_TYPES
#include <sys/types.h>
#endif
#include <end_strict_stdtypes.h>
#define _FSTYPSIZ 16
#ifdef _ALL_SOURCE
#include <sys/vmount.h>
#define FSTYPSIZ _FSTYPSIZ
#endif
/*
* statvfs system call return structure
*/
struct statvfs {
ulong_t f_bsize; /* preferred file system block size */
ulong_t f_frsize; /* fundamental file system block size */
fsblkcnt_t f_blocks; /* total # of blocks of f_frsize in fs */
fsblkcnt_t f_bfree; /* total # of free blocks */
fsblkcnt_t f_bavail; /* # of blocks available to non super user */
fsfilcnt_t f_files; /* total # of file nodes (inode in JFS) */
fsfilcnt_t f_ffree; /* total # of free file nodes */
fsfilcnt_t f_favail; /* # of nodes available to non super user */
#ifdef _ALL_SOURCE
fsid_t f_fsid; /* file system id */
#else
ulong_t f_fsid; /* file system id */
#ifndef __64BIT__
ulong_t f_fstype; /* file system type */
#endif
#endif /* _ALL_SOURCE */
char f_basetype[_FSTYPSIZ]; /* Filesystem type name (eg. jfs) */
ulong_t f_flag; /* bit mask of flags */
ulong_t f_namemax; /* maximum filename length */
char f_fstr[32]; /* filesystem-specific string */
ulong_t f_filler[16];/* reserved for future use */
};
#define ST_NOSUID 0x0040 /* don't maintain SUID capability */
#define ST_RDONLY 0x0001 /* file system mounted read only */
#define ST_NODEV 0x0080 /* don't allow device access across */
/* this mount */
/*
* Prototypes
*/
#ifdef _NO_PROTO
extern int statvfs();
extern int fstatvfs();
#else
extern int statvfs(const char *__restrict__, struct statvfs *__restrict__);
extern int fstatvfs(int, struct statvfs *);
#endif
/*
* statvfs64 system call return structure
*/
#ifdef _ALL_SOURCE
struct statvfs64 {
blksize64_t f_bsize; /* preferred file system block size */
blksize64_t f_frsize; /* fundamental file system block size */
blkcnt64_t f_blocks; /* total # of blocks of f_frsize in fs */
blkcnt64_t f_bfree; /* total # of free blocks */
blkcnt64_t f_bavail; /* # of blocks available to non super user */
blkcnt64_t f_files; /* total # of file nodes (inode in JFS) */
blkcnt64_t f_ffree; /* total # of free file nodes */
blkcnt64_t f_favail; /* # of nodes available to non super user */
fsid64_t f_fsid; /* file system id */
char f_basetype[FSTYPSIZ]; /* Filesystem type name (eg. jfs) */
ulong_t f_flag; /* bit mask of flags */
ulong_t f_namemax; /* maximum filename length */
char f_fstr[32]; /* filesystem-specific string */
ulong_t f_filler[16];/* reserved for future use */
};
/*
* Prototypes
*/
#ifdef _NO_PROTO
extern int statvfs64();
extern int fstatvfs64();
#else
extern int statvfs64(const char *__restrict__, struct statvfs64 *__restrict__);
extern int fstatvfs64(int, struct statvfs64 *);
#endif
#endif /* _ALL_SOURCE */
#endif /* _XOPEN_SOURCE_EXTENDED */
#endif /* _H_STATVFS */
========================== =======================
如果解決了您的問題,請接受此答案。具有諷刺意味的是,我通過尋找類似的東西,而不是通過國旗找到了這個:) – 2011-04-26 03:53:44
嗨,我已經嘗試「-D_LARGE_FILES」和「-D_LARGE_FILE_API」選項,沒有運氣。 – Thumbeti 2010-01-19 17:38:58