mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
shmfd: consistently return size in 512 byte blocks for fstat(2) st_blocks
This is ABI-breaking change that could be considered as the bug fix. Requested by: David Timber <[email protected]> Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation Relnotes: yes MFC after: 1 week Differential revision: https://reviews.freebsd.org/D58942
This commit is contained in:
1 parent
805c5004fa
commit
3a1bf59d19
2 files changed
+8
-8
No files matched your search
+6
-2
@@ -271,10 +271,14 @@ be zero.
|
||||
.Pp
|
||||
For file descriptors referencing specific non-file objects,
|
||||
the field is type-specific.
|
||||
.Pp
|
||||
For POSIX shared memory segments
|
||||
.Pq see Xr shm_open 2 ,
|
||||
the block size is equal to
|
||||
the platform page size
|
||||
the block size is 512 bytes.
|
||||
For older versions of
|
||||
.Fx
|
||||
.Pq before 15.2 and 16.0
|
||||
the block size was equal to the platform page size
|
||||
.Pq Xr getpagesize 2 .
|
||||
.El
|
||||
.Pp
|
||||
|
||||
+2
-6
@@ -658,12 +658,8 @@ shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred)
|
||||
sb->st_dev = shm_dev_ino;
|
||||
sb->st_ino = shmfd->shm_ino;
|
||||
sb->st_nlink = shmfd->shm_object->ref_count;
|
||||
if (shm_largepage(shmfd)) {
|
||||
sb->st_blocks = shmfd->shm_object->size /
|
||||
(pagesizes[shmfd->shm_lp_psind] >> PAGE_SHIFT);
|
||||
} else {
|
||||
sb->st_blocks = shmfd->shm_pages;
|
||||
}
|
||||
sb->st_blocks = ptoa(shm_largepage(shmfd) ? shmfd->shm_object->size :
|
||||
shmfd->shm_pages) / DEV_BSIZE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user