25 Linux下的off_t類型

off_t類型用於指示文件的偏移量,常就是long類型,其默認爲一個32位的整數,在gcc編譯中會被編譯爲long int類型,在64位的Linux系統中則會被編譯爲long long int,這是一個64位的整數,其定義在unistd.h頭文件中可以查看。


 242 # ifndef __off_t_defined
243 #  ifndef __USE_FILE_OFFSET64
244 typedef __off_t off_t;
245 #  else
246 typedef __off64_t off_t;
247 #  endif
248 #  define __off_t_defined
249 # endif
250 # if defined __USE_LARGEFILE64 && !defined __off64_t_defined
251 typedef __off64_t off64_t;
252 #  define __off64_t_defined
253 # endif



329 /* Move FD's file position to OFFSET bytes from the
330    beginning of the file (if WHENCE is SEEK_SET),
331    the current position (if WHENCE is SEEK_CUR),
332    or the end of the file (if WHENCE is SEEK_END).
333    Return the new file position.  */
334 #ifndef __USE_FILE_OFFSET64
335 extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
336 #else
337 # ifdef __REDIRECT_NTH
338 extern __off64_t __REDIRECT_NTH (lseek,
339                                  (int __fd, __off64_t __offset, int __whence),
340                                  lseek64);
341 # else
342 #  define lseek lseek64
343 # endif
344 #endif
345 #ifdef __USE_LARGEFILE64
346 extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
347      __THROW;
348 #endif

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章