Sha256: f7519ae1e255cec6fed6648b63cad3739c43272b375217a1147c4edc7d4fac6a

Contents?: true

Size: 334 Bytes

Versions: 7

Compression:

Stored size: 334 Bytes

Contents

static VALUE getSectorSize(volatile VALUE obj, volatile VALUE path) {
	char *dev = StringValuePtr(path) ;

	unsigned int fd = open(dev, O_RDONLY | O_NONBLOCK) ;
	if(fd < 0) return Qnil ;

	unsigned int sSize = 0 ;
	short status = ioctl(fd, BLKSSZGET, &sSize) ;
	close(fd) ;
	if(status < 0)  return Qnil ;

	return UINT2NUM(sSize) ;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
linux_stat-2.6.0 ext/fs_stat/sector_size.h
linux_stat-2.5.3 ext/fs_stat/sector_size.h
linux_stat-2.5.2 ext/fs_stat/sector_size.h
linux_stat-2.5.1 ext/fs_stat/sector_size.h
linux_stat-2.5.0 ext/fs_stat/sector_size.h
linux_stat-2.4.0 ext/fs_stat/sector_size.h
linux_stat-2.3.0 ext/fs_stat/sector_size.h