Artifacts Associated With Ticket 942170ffffffffff
Ticket change [989b0c531c] (rid 110637) by nobody on 2004-04-26 08:33:43:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
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
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "None"
- title initialized to: "HAVE_ST_BLOCKS missing in configure"
- type initialized to: "Bug"
Ticket change [67fe027909] (rid 102989) by dkf on 2004-04-26 16:19:26:
- assignee changed to: "stwo"
- subsystem changed to: "53. Configuration and Build Tools"
Ticket change [77429b16a2] (rid 89749) by dkf on 2004-12-13 23:08:05:
- foundin changed to: "obsolete: 8.4.6"
- resolution changed to: "Remind"
Ticket change [a6187121b3] (rid 98539) by matzek on 2009-11-05 15:33:23:
- icomment:
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
- login: "matzek"
- mimetype: "text/plain"
- username: "matzek"
- icomment:
Ticket change [6bd10d8847] (rid 128389) by matzek on 2009-11-05 15:35:06:
- icomment:
Oh ... and the code came in with the implementation of TIP 72.
- login: "matzek"
- mimetype: "text/plain"
- username: "matzek"
- icomment:
Ticket change [662e06a965] (rid 102659) by dgp on 2009-11-05 22:57:38:
- icomment:
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.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [deead33d2e] (rid 114926) by stwo on 2009-11-06 03:02:22:
- icomment:
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.
- login: "stwo"
- mimetype: "text/plain"
- username: "stwo"
- icomment:
Ticket change [135f5645a6] (rid 124207) by matzek on 2009-11-06 15:57:28:
- icomment:
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 - login: "matzek"
- mimetype: "text/plain"
- username: "matzek"
- icomment:
Ticket change [2e253b3847] (rid 119172) by stwo on 2009-11-10 01:23:10:
- icomment:
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 ;)
- login: "stwo"
- mimetype: "text/plain"
- username: "stwo"
- icomment:
Ticket change [f135991929] (rid 109331) by stwo on 2009-11-10 01:24:42:
- icomment:
File Added - 350177: tcl-st_blocks.patch
- login: "stwo"
- mimetype: "text/plain"
- username: "stwo"
- icomment:
Add attachment "tcl-st_blocks.patch" [3a32b9ae3c] (rid 112522) by stwo on 2009-11-10 01:24:42.
Ticket change [692da906b9] (rid 103201) by dkf on 2009-12-28 19:57:15:
- icomment:
Fixed on HEAD. This was caused by the change from autoconf 2.13 to 2.57+
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [85a4708fcd] (rid 131349) by dkf on 2009-12-28 20:56:20:
- icomment:
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).
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [73ef0fff3e] (rid 105119) by dkf on 2009-12-28 20:56:21:
- assignee changed to: "dkf"
- closedate changed to: "2009-12-28T13:56:21"
- closer changed to: "dkf"
- icomment:
allow_comments - 1
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"