[Python-Dev] before I open an issue re: posix.stat and/or os.stat

Michael Felt aixtools at felt.demon.nl
Fri Mar 1 08:51:40 EST 2019


Shortening the original mail to something shorter.

The reason I am starting here, in -dev, rather than as an issue directly, is because I would like some direction/recommendation from concerned individuals before I take a "outsider" approach. Too often I have learned that I guessed wrong how the Python community "sees the world".
> On 2/21/2019 11:26 AM, Michael wrote:
> It seems so - however, Is there something such as PyUnsignedLong and is
> that large enough for a "long long"? and if it exists, would that make
> the value positive (for the first test).
> 
> posix.major and os.major will need to mask away the MSB and
> posix.makedev and os.makedev will need to add it back.
> 
> OR - do I need to make the PyStat values "the same" in both 32-bit and
> 64-bit?
I think I already have the answer to this - follow the platform (as far as size goes).

On 32-bit max(1) == 256 (2^^8) and on 64-bit 65536 (2^^16).

However, I am still puzzeled re: the idiosyncratic MSB addition - that the value for 
st.st_dev

on AIX 64-bit has always (as far back as I could look at least) had the MSB set so that, as a signed number st.st_dev is always negative. And MSB is not part of the major device number. It's just there.

So, it has been a few days since I studied this (waiting for reactions) - but is the return suppossed to always be a value returned by the posixmodule.c (if so, can strip the MSB bit and make everything positive - even for st.st_dev (but that would break under a direct comparision with a C program that does not strip the MSB).

Currently, the macros on AIX for 64-bit are broken, so I cannot guess how they will decide to implement major() and mkdevice() as far as striping (and adding) the MSB when "constructing" the st_dev number from two "regular" major and minor numbers.

Parked for now,

Best wishes,

Michael
> 
> Puzzled on what you think is the correct approach.
> 
> Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190301/36629631/attachment.html>


More information about the Python-Dev mailing list