#2261 closed enhancement (fixed)
Member named `st_blocks' is missing from struct stat in sys/stat.h
Reported by: | kaoutsis | Owned by: | axeld |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | System/libroot.so | Version: | R1/pre-alpha1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Change History (9)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
This has been a common issue for ports, see some examples and workarounds at HaikuPorts (formerly BePorts). BeOS did not have it either.
comment:4 by , 17 years ago
Component: | - General → System |
---|---|
Type: | bug → enhancement |
stat::st_blocks is actually part of the XSI extension.
comment:5 by , 16 years ago
comment:6 by , 16 years ago
Component: | System → System/libroot.so |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in hrev27791. What unit is used for st_blocks in the software that it uses besides WINE which assumes a block size of 512? Currently, BFS uses its native block size for the computation of the value, but if it's always expressed in 512 blocks, then we should probably change this.
Also note that this is just another value that cannot be retrieved via BStatable::GetStat() due to binary compatibility.
comment:7 by , 16 years ago
The POSIX spec seems to indicate that it's allowed to vary:
The unit for the st_blocks member of the stat structure is not defined within IEEE Std 1003.1-2001. In some implementations it is 512 bytes. It may differ on a file system basis. There is no correlation between values of the st_blocks and st_blksize, and the f_bsize (from <sys/statvfs.h>) structure members.
Source: http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/stat.h.html
comment:8 by , 16 years ago
The POSIX spec is pretty stupid in this regard, as it makes the st_blocks field essentially useless. So if other platforms are using a consistent value, we should use that, too.
comment:9 by , 16 years ago
Right, I was wondering about that as well, since I don't see from the spec how you would actually determine the block size on a particular platform.
Required by wine:
directory.c at line 947 +-1: