28.10.2021 Views

Python Tutorial ( PDFDrive )

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

info = os.fstat(fd)

print "File Info :", info

# Now get uid of the file

print "UID of the file :%d" % info.st_uid

# Now get gid of the file

print "GID of the file :%d" % info.st_gid

# Close opened file

os.close( fd)

Let us compile and run the above program, this will produce the following result:

File Info : (33261, 3753776L, 103L, 1, 0, 0,

102L, 1238783197, 1238786767, 1238786767)

UID of the file :0

GID of the file :0

os.fstatvfs(fd)

Description

The method fstatvfs() returns information about the file system containing the file associated with file descriptor

fd. This returns the following sturcture:

• f_bsize: file system block size

• f_frsize: fragment size

• f_blocks: size of fs in f_frsize units

• f_bfree: free blocks

• f_bavail: free blocks for non-root

• f_files: inodes

• f_ffree: free inodes

• f_favail: free inodes for non-root

• f_fsid: file system ID

• f_flag: mount flags

• f_namemax: maximum filename length

Syntax

Following is the syntax for fstatvfs() method:

os.fstatvfs(fd)

Parameters

• fd -- This is the file descriptor for which system information is to be returned.

Return Value

This method returns information about the file system containing the file associated.

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!