|
2009-12-28
| ||
| 20:56 | • Closed ticket [942170ffff]: HAVE_ST_BLOCKS missing in configure plus 8 other... artifact: 73ef0fff3e user: dkf | |
| 20:56 | • Ticket [942170ffff]: 4 changes artifact: 85a4708fcd user: dkf | |
| 19:57 | • Ticket [942170ffff]: 4 changes artifact: 692da906b9 user: dkf | |
|
2009-11-10
| ||
| 01:24 | • Ticket [942170ffff]: 4 changes artifact: f135991929 user: stwo | |
| 01:24 | • Add attachment tcl-st_blocks.patch to ticket [942170ffffffffff|942170ff... artifact: 3a32b9ae3c user: stwo | |
| 01:23 | • Ticket [942170ffff] HAVE_ST_BLOCKS missing in configure status still Open wi... artifact: 2e253b3847 user: stwo | |
|
2009-11-06
| ||
| 15:57 | • Ticket [942170ffff]: 4 changes artifact: 135f5645a6 user: matzek | |
| 03:02 | • Ticket [942170ffff]: 4 changes artifact: deead33d2e user: stwo | |
|
2009-11-05
| ||
| 22:57 | • Ticket [942170ffff]: 4 changes artifact: 662e06a965 user: dgp | |
| 15:35 | • Ticket [942170ffff]: 4 changes artifact: 6bd10d8847 user: matzek | |
| 15:33 | • Ticket [942170ffff]: 4 changes artifact: a6187121b3 user: matzek | |
|
2004-12-13
| ||
| 23:08 | • Ticket [942170ffff]: 2 changes artifact: 77429b16a2 user: dkf | |
|
2004-04-26
| ||
| 16:19 | • Ticket [942170ffff]: 2 changes artifact: 67fe027909 user: dkf | |
| 08:33 | • New ticket [942170ffff]. artifact: 989b0c531c user: nobody | |
HAVE_ST_BLOCKS missing in configure
Closed / Fixed942170ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 17 years ago
Descriptionplain2004-04-26 08:33:43
Hi, in the tcl8.4.6 source-code are lines like noadmin@win01:.> find . -type f | xargs grep BLOCKS ./generic/tclTest.c:# ifdef HAVE_ST_BLOCKS ./generic/tclTest.c:# ifdef HAVE_ST_BLOCKS ./generic/tclIOUtil.c:#ifdef HAVE_ST_BLOCKS ./generic/tclIOUtil.c:#ifdef HAVE_ST_BLOCKS ./generic/tclIOUtil.c:#ifdef HAVE_ST_BLOCKS ./generic/tclCmdAH.c:#ifdef HAVE_ST_BLOCKS ths "configure" entries are missing mfg aotto
dkf Ticket [942170ffff]: 2 changes
[History diff]2004-04-26 16:19:26
dkf Ticket [942170ffff]: 2 changes
[History diff]2004-12-13 23:08:05
matzekplain2009-11-05 15:33:23
Summing up some conversation on the chat about this topic, today: * To enable this code one apparently has to provide the defines HAVE_ST_BLOCKS and USE_OBSOLETE_FS_HOOKS. Neither one is provided via the autoconf stuff. * If I read the commentary in tclIOUtil.c correctly, this was never released and is only in there for backward compatibility for TclPro. * st_blocks itself is relatively useless (IMHO), one have to KNOW the block size of the file system. It is not a part of POSIX, but is an X/Open System Interface. Besides this POSIX documents for sys/stat.h: "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. Traditionally, some implementations defined the multiplier for st_blocks in <sys/param.h> as the symbol DEV_BSIZE." -- Matthias Kraft
matzekplain2009-11-05 15:35:06
Oh ... and the code came in with the implementation of TIP 72.
dgpplain2009-11-05 22:57:38
Support for the obsolete FS hooks is already purged from the HEAD, so if HAVE_ST_BLOCKS is only for their sake, they ought to be purged too.
stwoplain2009-11-06 03:02:22
USE_OBSOLETE_FS_HOOKS enables old code which also uses HAVE_ST_BLOCKS. If HAVE_ST_BLOCKS is enabled then the C function Tcl_Stat and the Tcl command [file stat] will return a 'blocks' field. This has been around since 8.4.0 and seeing as no one seems to be missing it, I'd agree that it should be purged. But! The implementation of TIP 316 has now added: Tcl_GetBlocksFromStat - Returns the st_blocks field as an unsigned wide integer. If HAVE_ST_BLOCKS isn't defined then a guess is made. So perhaps HAVE_ST_BLOCKS should be properly configured and used. The function StoreStatData in generic/tclICmdAH.c could be modified to use the TIP 316 functions. Have all the 'stat' functions/commands return the same fields. As it is now, if HAVE_ST_BLOCKS were to be enabled then the result of [file stat] would contain an 'extra' field. This causes a test failure since the test suite doesn't account for the 'blocks' field either.
matzekplain2009-11-06 15:57:28
So what will Tcl_GetBlocksFromStat() return , if st_blocks is not available? And how does Tcl support me to find out, of which size 1 block in st_blocks is? Don't answer "look at Tcl_GetBlockSizefromStat()"! That's returning st_blksize, and this may or may not the actual block size...
Linux "man 2 stat":
----
The st_blocks field indicates the number of blocks allocated to the file, 512-byte units. (This may be smaller than st_size/512 when the file has holes.)
The st_blksize field gives the "preferred" blocksize for efficient file system I/O. (Writing to a file in smaller chunks may cause an inefficient read-modify-rewrite.)
----
AIX "man stat.h":
----
st_blksize Size, in bytes of each block of the file.
st_blocks Number of blocks actually used by the file (measured in the units specified by the DEV_BSIZE constant).
----
HP-UX "man 5 stat":
----
longst_blksizea filesystem-specific preferred I/O block size for this object. In some filesystem types, this may vary from file to file
blkcnt_tst_blocksnumber of blocks of a filesystem-specific size allocated for this object
----
Solaris "man 2 stat":
----
st_blksize A hint as to the “best” unit size for I/O operations. This field is not defined for block special or character special files.
st_blocks The total number of physical blocks of size 512 bytes actually allocated on disk. This field is not defined for block special or character special files.
----
-- Matthias Kraft
stwoplain2009-11-10 01:23:10
With this patch: HAVE_ST_BLOCKS becomes HAVE_STRUCT_STAT_ST_BLOCKS via the proper autoconf macro and all relevant code is adapted for this change, except for the tests. Note that this will break cmdAH-28.3 if your system has an st_blocks field in struct stat. Note that the casts retrieving the values from struct stat in function StoreStatData() are different from those used in the TIP 316 implementation. I put this patch here as a next step. I think that StoreStatData() (and others?) should use the TIP 316 functions, but the differences in casting should be worked out. Which ones are the correct ones? It's not important to me whether or not to include the blocks field - you can fight amongst yourselves for that ;)
stwoplain2009-11-10 01:24:42
File Added - 350177: tcl-st_blocks.patch
dkfplain2009-12-28 19:57:15
Fixed on HEAD. This was caused by the change from autoconf 2.13 to 2.57+
dkfplain2009-12-28 20:56:20
Fixed on 8.5. Can't be bothered to backport to 8.4 branch (it's not exactly a disaster if we simply don't use the st_blocks field).
dkfplain2009-12-28 20:56:21
allow_comments - 1
Log in (anonymous is fine) to add a comment.
Attachments:
- tcl-st_blocks.patch [download] added by stwo on 2009-11-10 01:24:42. [details]