Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c9608c

Browse files
committed
Portability fix for [f]statvfs() return tuple: no longer return the
f_fsid field, since it's not a scalar on all systems supporting this call (in particular, it's a tuple of two longs on AIX). Since it's not particularly useful, just nuke it. Adapted the doc strings too.
1 parent c256ece commit 0c9608c

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

Doc/lib/libos.tex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ \subsection{Files and Directories \label{os-file-dir}}
527527

528528
\begin{funcdesc}{statvfs}{path}
529529
Perform a \cfunction{statvfs()} system call on the given path. The
530-
return value is a tuple of 11 integers giving the most common
530+
return value is a tuple of 10 integers giving the most common
531531
members of the \ctype{statvfs} structure, in the order
532532
\code{f_bsize},
533533
\code{f_frsize},
@@ -537,7 +537,6 @@ \subsection{Files and Directories \label{os-file-dir}}
537537
\code{f_files},
538538
\code{f_ffree},
539539
\code{f_favail},
540-
\code{f_fsid},
541540
\code{f_flag},
542541
\code{f_namemax}.
543542
Availability: \UNIX{}.

Modules/posixmodule.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,8 +3025,8 @@ posix_WSTOPSIG(self, args)
30253025
#include <sys/statvfs.h>
30263026

30273027
static char posix_fstatvfs__doc__[] =
3028-
"fstatvfs(fd) -> \
3029-
(bsize,frsize,blocks,bfree,bavail,files,ffree,favail,fsid,flag, namemax)\n\
3028+
"fstatvfs(fd) -> \n\
3029+
(bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\
30303030
Perform an fstatvfs system call on the given fd.";
30313031

30323032
static PyObject *
@@ -3044,7 +3044,7 @@ posix_fstatvfs(self, args)
30443044
if (res != 0)
30453045
return posix_error();
30463046
#if !defined(HAVE_LARGEFILE_SUPPORT)
3047-
return Py_BuildValue("(lllllllllll)",
3047+
return Py_BuildValue("(llllllllll)",
30483048
(long) st.f_bsize,
30493049
(long) st.f_frsize,
30503050
(long) st.f_blocks,
@@ -3053,11 +3053,10 @@ posix_fstatvfs(self, args)
30533053
(long) st.f_files,
30543054
(long) st.f_ffree,
30553055
(long) st.f_favail,
3056-
(long) st.f_fsid,
30573056
(long) st.f_flag,
30583057
(long) st.f_namemax);
30593058
#else
3060-
return Py_BuildValue("(llLLLLLLlll)",
3059+
return Py_BuildValue("(llLLLLLLll)",
30613060
(long) st.f_bsize,
30623061
(long) st.f_frsize,
30633062
(LONG_LONG) st.f_blocks,
@@ -3066,7 +3065,6 @@ posix_fstatvfs(self, args)
30663065
(LONG_LONG) st.f_files,
30673066
(LONG_LONG) st.f_ffree,
30683067
(LONG_LONG) st.f_favail,
3069-
(long) st.f_fsid,
30703068
(long) st.f_flag,
30713069
(long) st.f_namemax);
30723070
#endif
@@ -3078,8 +3076,8 @@ posix_fstatvfs(self, args)
30783076
#include <sys/statvfs.h>
30793077

30803078
static char posix_statvfs__doc__[] =
3081-
"statvfs(path) -> \
3082-
(bsize,frsize,blocks,bfree,bavail,files,ffree,favail,fsid,flag, namemax)\n\
3079+
"statvfs(path) -> \n\
3080+
(bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax)\n\
30833081
Perform a statvfs system call on the given path.";
30843082

30853083
static PyObject *
@@ -3098,7 +3096,7 @@ posix_statvfs(self, args)
30983096
if (res != 0)
30993097
return posix_error_with_filename(path);
31003098
#if !defined(HAVE_LARGEFILE_SUPPORT)
3101-
return Py_BuildValue("(lllllllllll)",
3099+
return Py_BuildValue("(llllllllll)",
31023100
(long) st.f_bsize,
31033101
(long) st.f_frsize,
31043102
(long) st.f_blocks,
@@ -3107,11 +3105,10 @@ posix_statvfs(self, args)
31073105
(long) st.f_files,
31083106
(long) st.f_ffree,
31093107
(long) st.f_favail,
3110-
(long) st.f_fsid,
31113108
(long) st.f_flag,
31123109
(long) st.f_namemax);
31133110
#else /* HAVE_LARGEFILE_SUPPORT */
3114-
return Py_BuildValue("(llLLLLLLlll)",
3111+
return Py_BuildValue("(llLLLLLLll)",
31153112
(long) st.f_bsize,
31163113
(long) st.f_frsize,
31173114
(LONG_LONG) st.f_blocks,
@@ -3120,7 +3117,6 @@ posix_statvfs(self, args)
31203117
(LONG_LONG) st.f_files,
31213118
(LONG_LONG) st.f_ffree,
31223119
(LONG_LONG) st.f_favail,
3123-
(long) st.f_fsid,
31243120
(long) st.f_flag,
31253121
(long) st.f_namemax);
31263122
#endif

0 commit comments

Comments
 (0)