473,756 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

understanding stat module names

I'm trying to use os.chmod and am refered to the stat module.

Is there are explanation of:
* S_ISUID
* S_ISGID
* S_ENFMT
* S_ISVTX
* S_IREAD
* S_IWRITE
* S_IEXEC
* S_IRWXU
* S_IRUSR
* S_IWUSR
* S_IXUSR
* S_IRWXG
* S_IRGRP
* S_IWGRP
* S_IXGRP
* S_IRWXO
* S_IROTH
* S_IWOTH
* S_IXOTH

this isn't much help:

dir(stat)
['ST_ATIME', 'ST_CTIME', 'ST_DEV', 'ST_GID', 'ST_INO', 'ST_MODE',
'ST_MTIME', 'ST_NLINK', 'ST_SIZE', 'ST_UID', 'S_ENFMT', 'S_IEXEC',
'S_IFBLK', 'S_IFCHR', 'S_IFDIR', 'S_IFIFO', 'S_IFLNK', 'S_IFMT', 'S_IFREG',
'S_IFSOCK', 'S_IMODE', 'S_IREAD', 'S_IRGRP', 'S_IROTH', 'S_IRUSR',
'S_IRWXG', 'S_IRWXO', 'S_IRWXU', 'S_ISBLK', 'S_ISCHR', 'S_ISDIR',
'S_ISFIFO', 'S_ISGID', 'S_ISLNK', 'S_ISREG', 'S_ISSOCK', 'S_ISUID',
'S_ISVTX', 'S_IWGRP', 'S_IWOTH', 'S_IWRITE', 'S_IWUSR', 'S_IXGRP',
'S_IXOTH', 'S_IXUSR', '__builtins__', '__doc__', '__file__', '__name__']
print stat.__doc__

Constants/functions for interpreting results of os.stat() and os.lstat().

Suggested usage: from stat import *


--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
Jan 18 '06 #1
3 3947
David Bear wrote:
I'm trying to use os.chmod and am refered to the stat module.

Is there are explanation of:
* S_ISUID
* S_ISGID
* S_ENFMT
* S_ISVTX
* S_IREAD
* S_IWRITE
* S_IEXEC
* S_IRWXU
* S_IRUSR
* S_IWUSR
* S_IXUSR
* S_IRWXG
* S_IRGRP
* S_IWGRP
* S_IXGRP
* S_IRWXO
* S_IROTH
* S_IWOTH
* S_IXOTH

this isn't much help:

dir(stat)
['ST_ATIME', 'ST_CTIME', 'ST_DEV', 'ST_GID', 'ST_INO', 'ST_MODE',
'ST_MTIME', 'ST_NLINK', 'ST_SIZE', 'ST_UID', 'S_ENFMT', 'S_IEXEC',
'S_IFBLK', 'S_IFCHR', 'S_IFDIR', 'S_IFIFO', 'S_IFLNK', 'S_IFMT', 'S_IFREG',
'S_IFSOCK', 'S_IMODE', 'S_IREAD', 'S_IRGRP', 'S_IROTH', 'S_IRUSR',
'S_IRWXG', 'S_IRWXO', 'S_IRWXU', 'S_ISBLK', 'S_ISCHR', 'S_ISDIR',
'S_ISFIFO', 'S_ISGID', 'S_ISLNK', 'S_ISREG', 'S_ISSOCK', 'S_ISUID',
'S_ISVTX', 'S_IWGRP', 'S_IWOTH', 'S_IWRITE', 'S_IWUSR', 'S_IXGRP',
'S_IXOTH', 'S_IXUSR', '__builtins__', '__doc__', '__file__', '__name__']
print stat.__doc__


Constants/functions for interpreting results of os.stat() and os.lstat().

Suggested usage: from stat import *

from stat.h of Microsoft Visual C++ .NET 2003:

#define _S_IFMT 0170000 /* file type mask */
#define _S_IFDIR 0040000 /* directory */
#define _S_IFCHR 0020000 /* character special */
#define _S_IFIFO 0010000 /* pipe */
#define _S_IFREG 0100000 /* regular */
#define _S_IREAD 0000400 /* read permission, owner */
#define _S_IWRITE 0000200 /* write permission, owner */
#define _S_IEXEC 0000100 /* execute/search permission,
owner */
#define S_IFMT _S_IFMT
#define S_IFDIR _S_IFDIR
#define S_IFCHR _S_IFCHR
#define S_IFREG _S_IFREG
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC

struct stat {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
_off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};

From MSDN Help:

The _fstat function obtains information about the open file associated
with fd and stores it in the structure pointed to by buffer. The _stat
structure, defined in SYS\STAT.H, contains the following fields:

st_atime
Time of last file access.
st_ctime
Time of creation of file.
st_dev
If a device, fd; otherwise 0.
st_mode
Bit mask for file-mode information. The _S_IFCHR bit is set if fd refers
to a device. The _S_IFREG bit is set if fd refers to an ordinary file.
The read/write bits are set according to the file's permission mode.
_S_IFCHR and other constants are defined in SYS\STAT.H.
st_mtime
Time of last modification of file.
st_nlink
Always 1 on non-NTFS file systems.
st_rdev
If a device, fd; otherwise 0.
st_size
Size of the file in bytes.

Probably googling for the constants will show up some more useful
information , too.

Hope this helps.

Claudio
Jan 19 '06 #2
David Bear wrote:
I'm trying to use os.chmod and am refered to the stat module.

Is there are explanation of:
* S_ISUID .... * S_IXOTH


These come from the POSIX standard. See
http://www.opengroup.org/onlinepubs/...sysstat.h.html

HTH,
Marius Gedminas

Jan 19 '06 #3
Claudio Grondi wrote:
David Bear wrote:
I'm trying to use os.chmod and am refered to the stat module.

Is there are explanation of:
* S_ISUID
* S_ISGID
* S_ENFMT
* S_ISVTX
* S_IREAD
* S_IWRITE
* S_IEXEC
* S_IRWXU
* S_IRUSR
* S_IWUSR
* S_IXUSR
* S_IRWXG
* S_IRGRP
* S_IWGRP
* S_IXGRP
* S_IRWXO
* S_IROTH
* S_IWOTH
* S_IXOTH

this isn't much help:

dir(stat)
['ST_ATIME', 'ST_CTIME', 'ST_DEV', 'ST_GID', 'ST_INO', 'ST_MODE',
'ST_MTIME', 'ST_NLINK', 'ST_SIZE', 'ST_UID', 'S_ENFMT', 'S_IEXEC',
'S_IFBLK', 'S_IFCHR', 'S_IFDIR', 'S_IFIFO', 'S_IFLNK', 'S_IFMT',
'S_IFREG', 'S_IFSOCK', 'S_IMODE', 'S_IREAD', 'S_IRGRP', 'S_IROTH',
'S_IRUSR', 'S_IRWXG', 'S_IRWXO', 'S_IRWXU', 'S_ISBLK', 'S_ISCHR',
'S_ISDIR', 'S_ISFIFO', 'S_ISGID', 'S_ISLNK', 'S_ISREG', 'S_ISSOCK',
'S_ISUID', 'S_ISVTX', 'S_IWGRP', 'S_IWOTH', 'S_IWRITE', 'S_IWUSR',
'S_IXGRP', 'S_IXOTH', 'S_IXUSR', '__builtins__', '__doc__', '__file__',
'__name__']
>print stat.__doc__


Constants/functions for interpreting results of os.stat() and os.lstat().

Suggested usage: from stat import *

from stat.h of Microsoft Visual C++ .NET 2003:

#define _S_IFMT 0170000 /* file type mask */
#define _S_IFDIR 0040000 /* directory */
#define _S_IFCHR 0020000 /* character special */
#define _S_IFIFO 0010000 /* pipe */
#define _S_IFREG 0100000 /* regular */
#define _S_IREAD 0000400 /* read permission, owner */
#define _S_IWRITE 0000200 /* write permission, owner */
#define _S_IEXEC 0000100 /* execute/search permission,
owner */
#define S_IFMT _S_IFMT
#define S_IFDIR _S_IFDIR
#define S_IFCHR _S_IFCHR
#define S_IFREG _S_IFREG
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC

struct stat {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
_off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};

From MSDN Help:

The _fstat function obtains information about the open file associated
with fd and stores it in the structure pointed to by buffer. The _stat
structure, defined in SYS\STAT.H, contains the following fields:

st_atime
Time of last file access.
st_ctime
Time of creation of file.
st_dev
If a device, fd; otherwise 0.
st_mode
Bit mask for file-mode information. The _S_IFCHR bit is set if fd refers
to a device. The _S_IFREG bit is set if fd refers to an ordinary file.
The read/write bits are set according to the file's permission mode.
_S_IFCHR and other constants are defined in SYS\STAT.H.
st_mtime
Time of last modification of file.
st_nlink
Always 1 on non-NTFS file systems.
st_rdev
If a device, fd; otherwise 0.
st_size
Size of the file in bytes.

Probably googling for the constants will show up some more useful
information , too.

Hope this helps.

Claudio


Thnks for the info. I didn't even think I would have to look in a unix/c ref
manual. This was usefull.

http://www.opengroup.org/onlinepubs/...sysstat.h.html

--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
Jan 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1680
by: Gian Mario Tagliaretti | last post by:
Hi guys, maybe is an easy question but there is something I haven't understood I will post the example for better explain Python 2.3.4c1 (#2, May 13 2004, 21:46:36) >>> import os >>> mode_list = os.lstat('/etc/passwd') >>> import stat >>> mode = stat.S_IMODE(mode_list)
0
1219
by: Bob Palank | last post by:
In creating content for a VC++.NET programming class, I'd like the students to create a single form application starting with an Empty Project(.NET) and then construct the application step by step naming each file as it is being created. Code could be copied in from another similar application. I would like thenaming of the files to be frmMain.cpp and frmMain.h The other files can be copied in (ie stdafx.cpp and stdafx.h) The purpose is...
0
1209
by: davidlmontgomery | last post by:
I'm trying to use both nosetests and doctest with the tests pulled out into a separate file. My problem is that it seems that I need to use different import statements depending on from where I run the tests. Here's my directory structure: /dir __init__.py /sub __init__.py
9
2359
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice = CDec(txbInv.Text) Wage = CDec(txbTotWage.Text)
24
6122
by: Joe Salmeri | last post by:
I just upgraded from Python 2.4.2 to Python 2.5.1 and have found some unexpected behavior that appears to be a bug in the os.stat module. My OS is Windows XP SP2 + all updates. I have several programs that have worked flawlessly on all previous Python versions for years and they are now producing incorrect results in the code that uses os.stat. Searching through the 2.5.1 release notes I found the following:
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.