Use required formatters for given data types (signedness).
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
if (res == 0) {
if (verbose)
printf(_("get size in 512-byte sectors: "));
- printf("%lld\n", llu);
+ printf("%llu\n", llu);
}
else
errx(EXIT_FAILURE,
ioctl(fd, BLKSSZGET, &ssz) == 0 &&
ioctl(fd, BLKBSZGET, &bsz) == 0 &&
blkdev_get_size(fd, &bytes) == 0) {
- printf("%s %5ld %5d %5d %s %15lld %s\n",
+ printf("%s %5ld %5d %5d %s %15llu %s\n",
ro ? "ro" : "rw", ra, ssz, bsz, start_str, bytes, device);
} else {
if (!quiet)
fdisk_info(cxt, _("Disk model: %s"), fdisk_get_devmodel(cxt));
if (lb && (fdisk_label_require_geometry(lb) || fdisk_use_cylinders(cxt)))
- fdisk_info(cxt, _("Geometry: %d heads, %ju sectors/track, %ju cylinders"),
+ fdisk_info(cxt, _("Geometry: %u heads, %ju sectors/track, %ju cylinders"),
fdisk_get_geom_heads(cxt),
(uintmax_t) fdisk_get_geom_sectors(cxt),
(uintmax_t) fdisk_get_geom_cylinders(cxt));
- fdisk_info(cxt, _("Units: %s of %d * %ld = %ld bytes"),
+ fdisk_info(cxt, _("Units: %s of %u * %lu = %lu bytes"),
fdisk_get_unit(cxt, FDISK_PLURAL),
fdisk_get_units_per_sector(cxt),
fdisk_get_sector_size(cxt),
color_disable();
free(strsz);
- fdisk_info(cxt, _("Units: %s of %d * %ld = %ld bytes"),
+ fdisk_info(cxt, _("Units: %s of %u * %lu = %lu bytes"),
fdisk_get_unit(cxt, FDISK_PLURAL),
fdisk_get_units_per_sector(cxt),
fdisk_get_sector_size(cxt),
rc = snprintf(path, sizeof(path),
- "/sys/dev/block/%d:%d/queue/rotational",
+ "/sys/dev/block/%u:%u/queue/rotational",
major(disk), minor(disk));
if (rc < 0 || (unsigned int) rc >= sizeof(path))
/* What are valid superblock sizes? */
if (super.size < *start + sizeof(struct cramfs_super))
- errx(FSCK_EX_UNCORRECTED, _("superblock size (%d) too small"),
+ errx(FSCK_EX_UNCORRECTED, _("superblock size (%"PRIu32") too small"),
super.size);
if (super.flags & CRAMFS_FLAG_FSID_VERSION_2) {
if (S_ISCHR(i->mode) || (S_ISBLK(i->mode)))
/* major/minor numbers can be as high as 2^12 or 4096 */
- snprintf(info, 10, "%4d,%4d", major(i->size), minor(i->size));
+ snprintf(info, 10, "%4u,%4u", major(i->size), minor(i->size));
else
/* size be as high as 2^24 or 16777216 */
snprintf(info, 10, "%9d", i->size);
if (size >= blksize) {
if (out != blksize)
errx(FSCK_EX_UNCORRECTED,
- _("non-block (%ld) bytes"), out);
+ _("non-block (%lu) bytes"), out);
} else {
if (out != size)
errx(FSCK_EX_UNCORRECTED,
- _("non-size (%ld vs %ld) bytes"), out,
+ _("non-size (%lu vs %lu) bytes"), out,
size);
}
size -= out;
}
get_dirsize();
if (show) {
- printf(_("%ld inodes\n"), inodes);
- printf(_("%ld blocks\n"), zones);
+ printf(_("%lu inodes\n"), inodes);
+ printf(_("%lu blocks\n"), zones);
printf(_("Firstdatazone=%jd (%jd)\n"),
(intmax_t)first_zone, (intmax_t)norm_first_zone);
printf(_("Zonesize=%d\n"), MINIX_BLOCK_SIZE << get_zone_size());
printf(_("Maxsize=%zu\n"), get_max_size());
if (fs_version < 3)
printf(_("Filesystem state=%d\n"), Super.s_state);
- printf(_("namelen=%zd\n\n"), namelen);
+ printf(_("namelen=%zu\n\n"), namelen);
}
}
if (!inode_count[nr]) {
if (!inode_in_use(nr)) {
get_current_name();
- printf(_("Inode %d marked unused, "
+ printf(_("Inode %u marked unused, "
"but used for file '%s'\n"), nr, current_name);
if (repair) {
if (ask(_("Mark in use"), 1))
if (!inode_count[nr]) {
if (!inode_in_use(nr)) {
get_current_name();
- printf(_("Inode %d marked unused, "
+ printf(_("Inode %u marked unused, "
"but used for file '%s'\n"), nr, current_name);
if (repair) {
if (ask(_("Mark in use"), 1))
name_depth++;
if (list) {
if (verbose)
- printf("%6d %07o %3d ", ino,
+ printf("%6u %07o %3d ", ino,
inode->i_mode, inode->i_nlinks);
get_current_name();
printf("%s", current_name);
for (inode = 1, free = 0; inode <= get_ninodes(); inode++)
if (!inode_in_use(inode))
free++;
- printf(_("\n%6ld inodes used (%ld%%)\n"),
+ printf(_("\n%6lu inodes used (%lu%%)\n"),
(get_ninodes() - free),
100 * (get_ninodes() - free) / get_ninodes());
for (inode = get_first_zone(), free = 0; inode < get_nzones(); inode++)
if (!zone_in_use(inode))
free++;
- printf(_("%6ld zones used (%ld%%)\n"), (get_nzones() - free),
+ printf(_("%6lu zones used (%lu%%)\n"), (get_nzones() - free),
100 * (get_nzones() - free) / get_nzones());
printf(_("\n%6d regular files\n"
"%6d directories\n"
fprintf(stderr, _("Inodes: %ld (in %llu blocks)\n"),
inodes, ino_blocks);
fprintf(stderr, _("Blocks: %llu\n"), total_blocks);
- fprintf(stderr, _("Inode end: %d, Data end: %d\n"),
+ fprintf(stderr, _("Inode end: %"PRIu32", Data end: %"PRIu32"\n"),
le32_to_cpu(sb.s_start) - 1, le32_to_cpu(sb.s_end));
}
if (len > blksize*2) {
/* (I don't think this can happen with zlib.) */
printf(_("AIEEE: block \"compressed\" to > "
- "2*blocklength (%ld)\n"),
+ "2*blocklength (%lu)\n"),
len);
exit(MKFS_EX_ERROR);
}
/* Write the superblock now that we can fill in all of the fields. */
write_superblock(root_entry, rom_image+opt_pad, offset);
if (verbose)
- printf(_("Super block: %zd bytes\n"),
+ printf(_("Super block: %zu bytes\n"),
sizeof(struct cramfs_super));
/* Put the checksum in. */
if (fslen_ub < offset)
errx(MKFS_EX_ERROR,
_("not enough space allocated for ROM image "
- "(%lld allocated, %zu used)"),
+ "(%lld allocated, %zd used)"),
(long long) fslen_ub, offset);
written = write(fd, rom_image, offset);
if (warn_namelen)
/* Can't happen when reading from ext2fs. */
/* Bytes, not chars: think UTF8. */
- warnx(_("warning: filenames truncated to %u bytes."), MAX_INPUT_NAMELEN);
+ warnx(_("warning: filenames truncated to %d bytes."), MAX_INPUT_NAMELEN);
if (warn_skip)
warnx(_("warning: files were skipped due to errors."));
if (warn_size)
- warnx(_("warning: file sizes truncated to %luMB "
+ warnx(_("warning: file sizes truncated to %ldMB "
"(minus 1 byte)."), 1L << (CRAMFS_SIZE_WIDTH - 20));
if (warn_uid)
/* (not possible with current Linux versions) */
- warnx(_("warning: uids truncated to %u bits. "
+ warnx(_("warning: uids truncated to %d bits. "
"(This may be a security concern.)"), CRAMFS_UID_WIDTH);
if (warn_gid)
- warnx(_("warning: gids truncated to %u bits. "
+ warnx(_("warning: gids truncated to %d bits. "
"(This may be a security concern.)"), CRAMFS_GID_WIDTH);
if (warn_dev)
- warnx(_("WARNING: device numbers truncated to %u bits. "
+ warnx(_("WARNING: device numbers truncated to %d bits. "
"This almost certainly means\n"
"that some device files will be wrong."),
CRAMFS_OFFSET_WIDTH);
const char *str = getenv("MKFS_MINIX_TEST_SECOND_SINCE_EPOCH");
uint64_t sec;
- if (str && sscanf(str, "%"SCNd64, &sec) == 1)
+ if (str && sscanf(str, "%"SCNu64, &sec) == 1)
return sec;
return time(t);
}
if (ctl->user_pagesize < 0 || !is_power_of_2(ctl->user_pagesize) ||
(size_t) ctl->user_pagesize < sizeof(struct swap_header_v1_2) + 10)
errx(EXIT_FAILURE,
- _("Bad user-specified page size %u"),
+ _("Bad user-specified page size %d"),
ctl->user_pagesize);
if (!ctl->quiet && ctl->user_pagesize != kernel_pagesize)
warnx(_("Using user-specified page size %d, "
~permMask & 0666, ctl.devname);
if (!ctl.quiet
&& getuid() == 0 && S_ISREG(ctl.devstat.st_mode) && ctl.devstat.st_uid != 0)
- warnx(_("%s: insecure file owner %d, fix with: chown 0:0 %s"),
+ warnx(_("%s: insecure file owner %u, fix with: chown 0:0 %s"),
ctl.devname, ctl.devstat.st_uid, ctl.devname);
goto dflt;
parent++;
- snprintf(path, sizeof(path), _PATH_SYS_DEVBLOCK "/%d:%d/",
+ snprintf(path, sizeof(path), _PATH_SYS_DEVBLOCK "/%u:%u/",
major(devno), minor(devno));
dir = opendir(path);
xasprintf(&str, "%d", blkid_partition_get_partno(par));
break;
case COL_START:
- xasprintf(&str, "%ju", blkid_partition_get_start(par));
+ xasprintf(&str, "%"PRId64, blkid_partition_get_start(par));
break;
case COL_END:
- xasprintf(&str, "%ju",
+ xasprintf(&str, "%"PRId64,
blkid_partition_get_start(par) +
blkid_partition_get_size(par) - 1);
break;
case COL_SECTORS:
- xasprintf(&str, "%ju", blkid_partition_get_size(par));
+ xasprintf(&str, "%"PRId64, blkid_partition_get_size(par));
break;
case COL_SIZE:
if (partx_flags & FL_BYTES)
#ifndef UTIL_LINUX_ISO_H
#define UTIL_LINUX_ISO_H
+#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
if (check_match && le != be)
/* translation is useless */
- warnx("733error: le=%d be=%d", le, be);
+ warnx("733error: le=%"PRIu32" be=%"PRIu32, le, be);
return(le);
}
if (strcmp(type, "str") == 0)
printf("$%s: '%s'\n", name, getlogindefs_str(name, "DEFAULT"));
else if (strcmp(type, "num") == 0)
- printf("$%s: '%ld'\n", name, getlogindefs_num(name, 0));
+ printf("$%s: '%lu'\n", name, getlogindefs_num(name, 0));
else if (strcmp(type, "bool") == 0)
printf("$%s: '%s'\n", name,
getlogindefs_bool(name, 0) ? "Y" : "N");
*/
char name[PATH_MAX], *cn, *p = NULL;
- snprintf(name, sizeof(name), _PATH_SYS_DEVBLOCK "/%d:%d",
+ snprintf(name, sizeof(name), _PATH_SYS_DEVBLOCK "/%u:%u",
major(st.st_rdev), minor(st.st_rdev));
cn = ul_canonicalize_path(name);
if (cn)
return -EINVAL;
lc->config.info.lo_offset = offset;
- DBG_OBJ(CXT, lc, ul_debug("set offset=%jd", offset));
+ DBG_OBJ(CXT, lc, ul_debug("set offset=%"PRIu64, offset));
return 0;
}
return -EINVAL;
lc->config.info.lo_sizelimit = sizelimit;
- DBG_OBJ(CXT, lc, ul_debug("set sizelimit=%jd", sizelimit));
+ DBG_OBJ(CXT, lc, ul_debug("set sizelimit=%"PRIu64, sizelimit));
return 0;
}
return -EINVAL;
lc->blocksize = blocksize;
- DBG_OBJ(CXT, lc, ul_debug("set blocksize=%jd", blocksize));
+ DBG_OBJ(CXT, lc, ul_debug("set blocksize=%"PRIu64, blocksize));
return 0;
}
if (t < threshold)
{
DBG_OBJ(BEST, *best,
- ul_debug("best iface %s, threshold %hhd",
+ ul_debug("best iface %s, threshold %u",
ifaceq->ifname, t));
*best_ifaceq = ifaceq;
threshold = t;
if (ul_path_read_s64(pc, &res, file) != 0)
err(EXIT_FAILURE, "read u64 failed");
- printf("read: %s: %" PRIu64 "\n", file, res);
+ printf("read: %s: %" PRId64 "\n", file, res);
if (ul_path_readf_s64(pc, &res, "%s", file) != 0)
err(EXIT_FAILURE, "readf u64 failed");
- printf("readf: %s: %" PRIu64 "\n", file, res);
+ printf("readf: %s: %" PRId64 "\n", file, res);
} else if (strcmp(command, "read-majmin") == 0) {
dev_t res;
err(EXIT_FAILURE, "failed to get %s pwd entry", argv[1]);
printf("Username: %s\n", pwd->pw_name);
- printf("UID: %d\n", pwd->pw_uid);
+ printf("UID: %u\n", pwd->pw_uid);
printf("HOME: %s\n", pwd->pw_dir);
printf("GECO: %s\n", pwd->pw_gecos);
printf("Multiple random calls:\n");
for (i = 0; i < n; i++) {
ul_random_get_bytes(&v, sizeof(v));
- printf("#%02zu: %25"PRIu64"\n", i, v);
+ printf("#%02zu: %25"PRId64"\n", i, v);
}
ul_random_get_bytes(buf, bufsz);
for (i = 0; i < n; i++) {
vp = (int64_t *) (buf + (i * sizeof(*vp)));
- printf("#%02zu: %25"PRIu64"\n", i, *vp);
+ printf("#%02zu: %25"PRId64"\n", i, *vp);
}
return EXIT_SUCCESS;
* Written by Karel Zak <kzak@redhat.com> [2011]
*/
#include <ctype.h>
+#include <inttypes.h>
#include <libgen.h>
#include <fcntl.h>
#include <sys/stat.h>
+ 3];
/* define path to devno stuff */
- snprintf(buf, sizeof(buf), _PATH_SYS_DEVBLOCK "/%d:%d", major(devno), minor(devno));
+ snprintf(buf, sizeof(buf), _PATH_SYS_DEVBLOCK "/%u:%u", major(devno), minor(devno));
rc = ul_path_set_dir(pc, buf);
if (rc)
return rc;
err(EXIT_FAILURE, "failed to read devno");
printf("non-context:\n");
- printf(" DEVNO: %u (%d:%d)\n", (unsigned int) devno, major(devno), minor(devno));
+ printf(" DEVNO: %u (%u:%u)\n", (unsigned int) devno, major(devno), minor(devno));
printf(" DEVNAME: %s\n", sysfs_devno_to_devname(devno, path, sizeof(path)));
printf(" DEVPATH: %s\n", sysfs_devno_to_devpath(devno, path, sizeof(path)));
sysfs_devno_to_wholedisk(devno, diskname, sizeof(diskname), &disk_devno);
- printf(" WHOLEDISK-DEVNO: %u (%d:%d)\n", (unsigned int) disk_devno, major(disk_devno), minor(disk_devno));
+ printf(" WHOLEDISK-DEVNO: %u (%u:%u)\n", (unsigned int) disk_devno, major(disk_devno), minor(disk_devno));
printf(" WHOLEDISK-DEVNAME: %s\n", diskname);
pc = ul_new_sysfs_path(devno, NULL, NULL);
printf("context based:\n");
devno = sysfs_blkdev_get_devno(pc);
- printf(" DEVNO: %u (%d:%d)\n", (unsigned int) devno, major(devno), minor(devno));
+ printf(" DEVNO: %u (%u:%u)\n", (unsigned int) devno, major(devno), minor(devno));
printf(" DEVNAME: %s\n", sysfs_blkdev_get_name(pc, path, sizeof(path)));
printf(" DEVPATH: %s\n", sysfs_blkdev_get_path(pc, path, sizeof(path)));
sysfs_devno_to_wholedisk(devno, diskname, sizeof(diskname), &disk_devno);
- printf(" WHOLEDISK-DEVNO: %u (%d:%d)\n", (unsigned int) disk_devno, major(disk_devno), minor(disk_devno));
+ printf(" WHOLEDISK-DEVNO: %u (%u:%u)\n", (unsigned int) disk_devno, major(disk_devno), minor(disk_devno));
printf(" WHOLEDISK-DEVNAME: %s\n", diskname);
is_part = ul_path_access(pc, F_OK, "partition") == 0;
for (i = 1; i <= 5; i++) {
dev_t dev = sysfs_blkdev_partno_to_devno(pc, i);
if (dev)
- printf("\t#%d %d:%d\n", i, major(dev), minor(dev));
+ printf("\t#%d %u:%u\n", i, major(dev), minor(dev));
}
}
if (ul_path_read_u64(pc, &u64, "size") != 0)
printf(" (!) read SIZE failed\n");
else
- printf(" SIZE: %jd\n", u64);
+ printf(" SIZE: %"PRIu64"\n", u64);
if (ul_path_read_s32(pc, &i, "queue/hw_sector_size"))
printf(" (!) read SECTOR failed\n");
if (ts->tv_nsec) {
if (ts->tv_nsec % NSEC_PER_MSEC) {
- rc = snprintf(buf, bufsz, "%*luns",
+ rc = snprintf(buf, bufsz, "%*ldns",
parts ? 10 : 0, ts->tv_nsec);
if (rc < 0 || (size_t) rc > bufsz)
goto err;
}
if (result != t.expected) {
- fprintf(stderr, "#%02zu %-25s: %"PRId64" != %"PRId64"\n",
+ fprintf(stderr, "#%02zu %-25s: %"PRIu64" != %"PRIu64"\n",
i, t.input, result, t.expected);
rc = EXIT_FAILURE;
}
blkid_topology_get_physical_sector_size(tp));
printf("\tdax support : %lu\n",
blkid_topology_get_dax(tp));
- printf("\tdiskseq : %"PRId64"\n",
+ printf("\tdiskseq : %"PRIu64"\n",
blkid_topology_get_diskseq(tp));
}
if (stat(devname, &st) || !S_ISBLK(st.st_mode))
return -1;
- snprintf(uevent, sizeof(uevent), "/sys/dev/block/%d:%d/uevent",
+ snprintf(uevent, sizeof(uevent), "/sys/dev/block/%u:%u/uevent",
major(st.st_rdev), minor(st.st_rdev));
f = fopen(uevent, "w" UL_CLOEXECSTR);
*
* Inspired by fdisk, partx, Linux kernel and libparted.
*/
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int ct_nodata = 0; /* count ext.partitions without data partitions */
int i;
- DBG(LOWPROBE, ul_debug("parse EBR [start=%d, size=%d]", ex_start/ssf, ex_size/ssf));
+ DBG(LOWPROBE, ul_debug("parse EBR [start=%"PRIu32", size=%"PRIu32"]", ex_start/ssf, ex_size/ssf));
if (ex_start == 0) {
DBG(LOWPROBE, ul_debug("Bad offset in primary extended partition -- ignore"));
return 0;
/* the partition has to inside usable range */
if (start < fu || start + size - 1 > lu) {
DBG(LOWPROBE, ul_debug(
- "GPT entry[%d] overflows usable area - ignore",
+ "GPT entry[%"PRIu32"] overflows usable area - ignore",
i));
blkid_partlist_increment_partno(ls);
continue;
list_add_tail(&tab->t_tabs, &ls->l_tabs);
DBG(LOWPROBE, ul_debug("parts: create a new partition table "
- "(type=%s, offset=%"PRId64")", type, offset));
+ "(type=%s, offset=%"PRIu64")", type, offset));
return tab;
}
if (par->start + par->size > (pr->size >> 9)) {
DBG(LOWPROBE, ul_debug("partition #%d overflows "
- "device (off=%" PRId64 " size=%" PRId64 ")",
+ "device (off=%" PRIu64 " size=%" PRIu64 ")",
par->partno, par->start, par->size));
goto done;
}
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
*/
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
if (le32_to_cpu(l->v_version) != 1) {
DBG(LOWPROBE, ul_debug(
- "WARNING: unsupported solaris x86 version %d, ignore",
+ "WARNING: unsupported solaris x86 version %"PRIu32", ignore",
le32_to_cpu(l->v_version)));
goto nothing;
}
return errno ? -errno : 1;
if (memcmp(prs->magic, persistence_magic, sizeof(prs->magic)) == 0 &&
- blkid_probe_sprintf_version(pr, "%d", be32_to_cpu(prs->version_le)) != 0)
+ blkid_probe_sprintf_version(pr, "%"PRIu32, be32_to_cpu(prs->version_le)) != 0)
return errno ? -errno : 1;
return 0;
if (jm->mode > 5)
return 1;
- if (blkid_probe_sprintf_version(pr, "%u.%u",
+ if (blkid_probe_sprintf_version(pr, "%hu.%hu",
JM_MAJOR_VERSION(jm), JM_MINOR_VERSION(jm)) != 0)
return 1;
if (blkid_probe_set_magic(pr, off, sizeof(jm->signature),
return BLKID_PROBE_NONE;
version = be16_to_cpu(header->version);
- blkid_probe_sprintf_version(pr, "%u", version);
+ blkid_probe_sprintf_version(pr, "%d", version);
if (version == 1) {
header_v1 = (struct luks_phdr *)header;
continue;
}
- DBG(LOWPROBE, ul_debug("[%zd] %s:", i, id->name));
+ DBG(LOWPROBE, ul_debug("[%zu] %s:", i, id->name));
rc = blkid_probe_get_idmag(pr, id, &off, &mag);
if (rc < 0)
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
*/
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
return 1;
blkid_probe_set_uuid(pr, sb->uuid);
- blkid_probe_sprintf_version(pr, "w%dr%d",
+ blkid_probe_sprintf_version(pr, "w%"PRIu32"r%"PRIu32,
le32_to_cpu(sb->fmt_version),
le32_to_cpu(sb->ro_compat_version));
blkid_probe_set_fssize(pr,
if ((ent->attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) ==
FAT_ATTR_VOLUME_ID) {
- DBG(LOWPROBE, ul_debug("\tfound fs LABEL at entry %d", i));
+ DBG(LOWPROBE, ul_debug("\tfound fs LABEL at entry %"PRIu32, i));
memcpy(out, ent->name, 11);
if (out[0] == 0x05)
out[0] = 0xE5;
goto cont;
}
- DBG(LOWPROBE, ul_debug("left %zd nvp_size %u",
+ DBG(LOWPROBE, ul_debug("left %zu nvp_size %"PRIu32,
size, nvp_size));
/* nvpair fits in buffer and name fits in nvpair? */
if (drop_permissions() != 0)
_exit(1);
- snprintf(maj, sizeof(maj), "%d", major(devno));
- snprintf(min, sizeof(min), "%d", minor(devno));
+ snprintf(maj, sizeof(maj), "%u", major(devno));
+ snprintf(min, sizeof(min), "%u", minor(devno));
dmargv[0] = cmd;
dmargv[1] = "table";
if (!cxt->io_size)
cxt->io_size = cxt->sector_size;
- DBG_OBJ(CXT, cxt, ul_debug("result: log/phy sector size: %ld/%ld",
+ DBG_OBJ(CXT, cxt, ul_debug("result: log/phy sector size: %lu/%lu",
cxt->sector_size, cxt->phy_sector_size));
- DBG_OBJ(CXT, cxt, ul_debug("result: fdisk/optimal/minimal io: %ld/%ld/%ld",
+ DBG_OBJ(CXT, cxt, ul_debug("result: fdisk/optimal/minimal io: %lu/%lu/%lu",
cxt->io_size, cxt->optimal_io_size, cxt->min_io_size));
return 0;
}
ss = dos_partition_get_start(l->dos_part);
if (!ss) {
- fdisk_warnx(cxt, _("Partition %zd: has invalid starting "
+ fdisk_warnx(cxt, _("Partition %zu: has invalid starting "
"sector 0."), i + 1);
return -1;
}
nerrors++;
}
if (h >= cxt->geom.heads) {
- fdisk_warnx(cxt, _("Partition %zu: head %d greater than "
- "maximum %d"), n, h + 1, cxt->geom.heads);
+ fdisk_warnx(cxt, _("Partition %zu: head %u greater than "
+ "maximum %u"), n, h + 1, cxt->geom.heads);
nerrors++;
}
if (real_s >= cxt->geom.sectors) {
- fdisk_warnx(cxt, _("Partition %zu: sector %d greater than "
+ fdisk_warnx(cxt, _("Partition %zu: sector %u greater than "
"maximum %ju"), n, real_s + 1,
(uintmax_t) cxt->geom.sectors);
nerrors++;
}
if (real_c >= cxt->geom.cylinders) {
- fdisk_warnx(cxt, _("Partition %zu: cylinder %d greater than "
+ fdisk_warnx(cxt, _("Partition %zu: cylinder %u greater than "
"maximum %ju"),
n, real_c + 1,
(uintmax_t) cxt->geom.cylinders);
&& (pbc != lbc || pbh != lbh || pbs != lbs)) {
fdisk_warnx(cxt, _("Partition %zu: different physical/logical "
"beginnings (non-Linux?): "
- "phys=(%d, %d, %d), logical=(%d, %d, %d)"),
+ "phys=(%u, %u, %u), logical=(%u, %u, %u)"),
partition + 1,
pbc, pbh, pbs,
lbc, lbh, lbs);
if (lec < 1024
&& (pec != lec || peh != leh || pes != les)) {
fdisk_warnx(cxt, _("Partition %zu: different physical/logical "
- "endings: phys=(%d, %d, %d), logical=(%d, %d, %d)"),
+ "endings: phys=(%u, %u, %u), logical=(%u, %u, %u)"),
partition + 1,
pec, peh, pes,
lec, leh, les);
fdisk_info(cxt, _("Total allocated sectors %ju greater "
"than the maximum %ju."), (uintmax_t) total, (uintmax_t) n_sectors);
else if (total < n_sectors)
- fdisk_info(cxt, _("Remaining %ju unallocated %ld-byte "
+ fdisk_info(cxt, _("Remaining %ju unallocated %lu-byte "
"sectors."), (uintmax_t) n_sectors - total, cxt->sector_size);
} else
fdisk_warnx(cxt,
fdisk_ask_menu_set_default(ask, free_primary == 1
&& !l->ext_offset ? 'e' : 'p');
snprintf(hint, sizeof(hint),
- _("%u primary, %d extended, %u free"),
+ _("%d primary, %d extended, %d free"),
4 - (l->ext_offset ? 1 : 0) - free_primary,
l->ext_offset ? 1 : 0,
free_primary);
rc = seek_sector(cxt, secno);
if (rc != 0) {
- fdisk_warn(cxt, _("Cannot write sector %jd: seek failed"),
+ fdisk_warn(cxt, _("Cannot write sector %ju: seek failed"),
(uintmax_t) secno);
return rc;
}
if (obc != nbc || obh != nbh || obs != nbs ||
oec != nec || oeh != neh || oes != nes) {
DBG(LABEL, ul_debug("DOS: changing %zu partition CHS "
- "from (%d, %d, %d)-(%d, %d, %d) "
- "to (%d, %d, %d)-(%d, %d, %d)",
+ "from (%u, %u, %u)-(%u, %u, %u) "
+ "to (%u, %u, %u)-(%u, %u, %u)",
i, obc, obh, obs, oec, oeh, oes,
nbc, nbh, nbs, nec, neh, nes));
p->bc = nbc & 0xff;
return -ENOMEM;
fdisk_partition_set_type(pa, t);
- DBG_OBJ(CXT, cxt, ul_debug("partition: %zd: set type", partnum));
+ DBG_OBJ(CXT, cxt, ul_debug("partition: %zu: set type", partnum));
rc = cxt->label->op->set_part(cxt, partnum, pa);
fdisk_unref_partition(pa);
return rc;
rc = cxt->label->op->part_toggle_flag(cxt, partnum, flag);
- DBG_OBJ(CXT, cxt, ul_debug("partition: %zd: toggle: 0x%04lx [rc=%d]", partnum, flag, rc));
+ DBG_OBJ(CXT, cxt, ul_debug("partition: %zu: toggle: 0x%04lx [rc=%d]", partnum, flag, rc));
return rc;
}
fdisk_wipe_partition(cxt, partno, 0);
- DBG_OBJ(CXT, cxt, ul_debug("deleting %s partition number %zd",
+ DBG_OBJ(CXT, cxt, ul_debug("deleting %s partition number %zu",
cxt->label->name, partno));
return cxt->label->op->del_part(cxt, partno);
}
if (verbose && sgi_get_start_sector(cxt, Index[0]) != 0)
fdisk_info(cxt, _("The entire disk partition should "
- "start at block 0, not at block %d."),
+ "start at block 0, not at block %u."),
sgi_get_start_sector(cxt, Index[0]));
if (verbose && sgi_get_num_sectors(cxt, Index[0]) != lastblock)
DBG(LABEL, ul_debug(
- "entire disk partition=%ds, but disk=%ds",
+ "entire disk partition=%us, but disk=%us",
sgi_get_num_sectors(cxt, Index[0]),
lastblock));
lastblock = sgi_get_num_sectors(cxt, Index[0]);
if (start > sgi_get_start_sector(cxt, Index[i])) {
if (verbose)
fdisk_info(cxt,
- P_("Partitions %d and %d overlap by %d sector.",
- "Partitions %d and %d overlap by %d sectors.",
+ P_("Partitions %d and %d overlap by %u sector.",
+ "Partitions %d and %d overlap by %u sectors.",
start - sgi_get_start_sector(cxt, Index[i])),
Index[i-1]+1, Index[i]+1,
start - sgi_get_start_sector(cxt, Index[i]));
if (cylsize && start % cylsize)
start += cylsize - (start % cylsize);
- DBG(LABEL, ul_debug("%2d:%12d\t%12d\t%12d", Index[i],
+ DBG(LABEL, ul_debug("%2d:%12u\t%12u\t%12d", Index[i],
sgi_get_start_sector(cxt, Index[i]),
sgi_get_num_sectors(cxt, Index[i]),
sgi_get_sysid(cxt, Index[i])));
* Merged with fdisk for other architectures, aeb, June 1998.
* Arnaldo Carvalho de Melo <acme@conectiva.com.br> Mar 1999, Internationalization
*/
+#include <inttypes.h>
#include <stdio.h> /* stderr */
#include <stdlib.h> /* qsort */
#include <string.h> /* strstr */
fdisk_apply_user_device_properties(cxt);
if (be32_to_cpu(sunlabel->vtoc.version) != SUN_VTOC_VERSION) {
- fdisk_warnx(cxt, _("Detected sun disklabel with wrong version [%d]."),
+ fdisk_warnx(cxt, _("Detected sun disklabel with wrong version [%"PRIu32"]."),
be32_to_cpu(sunlabel->vtoc.version));
need_fixing = 1;
}
whole_disk = 1;
break;
}
- fdisk_warnx(cxt, _("Sector %d is already allocated"), first);
+ fdisk_warnx(cxt, _("Sector %u is already allocated"), first);
} else
break;
}
int w = 0;
if (!dev || !*dev) {
- if (asprintf(&res, "%zd", partno) > 0)
+ if (asprintf(&res, "%zu", partno) > 0)
return res;
return NULL;
}
if (mnt_fs_get_parent_id(self->fs))
PySys_WriteStdout("parent: %d\n", mnt_fs_get_parent_id(self->fs));
if (mnt_fs_get_devno(self->fs))
- PySys_WriteStdout("devno: %d:%d\n", major(mnt_fs_get_devno(self->fs)),
+ PySys_WriteStdout("devno: %u:%u\n", major(mnt_fs_get_devno(self->fs)),
minor(mnt_fs_get_devno(self->fs)));
if (mnt_fs_get_tid(self->fs))
PySys_WriteStdout("tid: %d\n", mnt_fs_get_tid(self->fs));
DBG(BTRFS, ul_debug("root tree dir object id not found"));
goto out;
}
- DBG(BTRFS, ul_debug("found %d root tree dir object id items", sk->nr_items));
+ DBG(BTRFS, ul_debug("found %"PRIu32" root tree dir object id items", sk->nr_items));
sh = (struct btrfs_ioctl_search_header *)args.buf;
e->flag = flag;
cache->nents++;
- DBG_OBJ(CACHE, cache, ul_debug("add entry [%2zd] (%s): %s: %s",
+ DBG_OBJ(CACHE, cache, ul_debug("add entry [%2zu] (%s): %s: %s",
cache->nents,
(flag & MNT_CACHE_ISPATH) ? "path" : "tag",
value, key));
}
done:
- DBG_OBJ(CACHE, cache, ul_debug("\tread %zd tags [rc=%d]", ntags, rc));
+ DBG_OBJ(CACHE, cache, ul_debug("\tread %zu tags [rc=%d]", ntags, rc));
blkid_free_probe(pr);
free(cacheval);
free(tagval), tagval = NULL;
}
- DBG_OBJ(CACHE, cache, ul_debug("\tread %zd tags [rc=%d]", ntags, rc));
+ DBG_OBJ(CACHE, cache, ul_debug("\tread %zu tags [rc=%d]", ntags, rc));
sd_device_unref(sd);
free(cacheval);
free(tagval);
}
if (!curr_user) {
DBG_OBJ(CXT, cxt, ul_debug("umount %s: cannot "
- "convert %d to username", tgt, getuid()));
+ "convert %u to username", tgt, getuid()));
goto eperm;
}
fprintf(file, "uniq-parent: %" PRIu64 "\n", mnt_fs_get_parent_uniq_id(fs));
if (mnt_fs_get_devno(fs))
- fprintf(file, "devno: %d:%d\n", major(mnt_fs_get_devno(fs)),
+ fprintf(file, "devno: %u:%u\n", major(mnt_fs_get_devno(fs)),
minor(mnt_fs_get_devno(fs)));
if (mnt_fs_get_tid(fs))
fprintf(file, "tid: %d\n", mnt_fs_get_tid(fs));
if (rc == 0) {
printf("found; name: %s", name);
if (sz) {
- printf(", argument: size=%zd data=", sz);
+ printf(", argument: size=%zu data=", sz);
if (fwrite(val, 1, sz, stdout) != sz)
return -1;
}
printf(" S_ISREG: %s\n", S_ISREG(st.st_mode) ? "y" : "n");
printf(" S_IFLNK: %s\n", S_ISLNK(st.st_mode) ? "y" : "n");
- printf(" devno: %lu (%d:%d)\n", (unsigned long) st.st_dev,
+ printf(" devno: %lu (%u:%u)\n", (unsigned long) st.st_dev,
major(st.st_dev), minor(st.st_dev));
printf(" ino: %lu\n", (unsigned long) st.st_ino);
st = &cl->wstat;
- DBG_OBJ(COL, cl, ul_debug("#%zu %12s: width=%zd "
+ DBG_OBJ(COL, cl, ul_debug("#%zu %12s: width=%zu "
"hint=%d max=%zu min=%zu "
"0x04%x [%s%s%s]",
cl->flags |= SCOLS_FL_HIDDEN;
if (cl->width != org_width)
- DBG_OBJ(COL, cl, ul_debug(" [%02zd] %s reduced %zu-->%zu",
+ DBG_OBJ(COL, cl, ul_debug(" [%02zu] %s reduced %zu-->%zu",
cl->seqnum,
cl->header.data, org_width, cl->width));
if (!add)
continue;
- DBG_OBJ(COL, cl, ul_debug(" add +%zd (%s)",
+ DBG_OBJ(COL, cl, ul_debug(" add +%zu (%s)",
add, cl->header.data));
cl->width += add;
width += add;
if (!ctl.username) {
ctl.pw = getpwuid(uid);
if (!ctl.pw)
- errx(EXIT_FAILURE, _("your user %d does not exist"),
+ errx(EXIT_FAILURE, _("your user %u does not exist"),
uid);
} else {
ctl.pw = ul_getuserpw_str(ctl.username, NULL);
if (!info.username) {
pw = xgetpwuid(uid, &pwbuf);
if (!pw)
- errx(EXIT_FAILURE, _("you (user %d) don't exist."),
+ errx(EXIT_FAILURE, _("you (user %u) don't exist."),
uid);
} else {
pw = xgetuserpw(info.username, &pwbuf);
pw = getpwnam(user);
if (!pw)
return 1;
- snprintf(path, sizeof(path), "/proc/%u/loginuid", ut->ut_pid);
+ snprintf(path, sizeof(path), "/proc/%d/loginuid", ut->ut_pid);
if (access(path, R_OK) == 0) {
unsigned int loginuid;
FILE *f = NULL;
else
sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
- xasprintf(&match, "_UID=%d", uid);
+ xasprintf(&match, "_UID=%u", uid);
sd_journal_add_match(j, match, 0);
sd_journal_seek_tail(j);
static void change_identity(const struct passwd *pw)
{
- DBG(MISC, ul_debug("changing identity [GID=%d, UID=%d]", pw->pw_gid, pw->pw_uid));
+ DBG(MISC, ul_debug("changing identity [GID=%u, UID=%u]", pw->pw_gid, pw->pw_uid));
if (setgid(pw->pw_gid))
err(EXIT_FAILURE, _("cannot set group id"));
xasprintf(&str, "%d", file->stat.st_nlink == 0);
break;
case COL_MNT_ID:
- xasprintf(&str, "%d", has_mnt_id(file)? file->mnt_id: 0);
+ xasprintf(&str, "%u", has_mnt_id(file)? file->mnt_id: 0);
break;
case COL_MODE:
if (does_file_has_fdinfo_alike(file))
return;
}
- DBG_OBJ(DEV, dev, ul_debug("%s: has %d queues", dev->name, queues));
+ DBG_OBJ(DEV, dev, ul_debug("%s: has %u queues", dev->name, queues));
xasprintf(str, "%3u", queues);
}
break;
case COL_MAJMIN:
if (is_parsable(lsblk))
- xasprintf(&str, "%u:%u", dev->maj, dev->min);
+ xasprintf(&str, "%d:%d", dev->maj, dev->min);
else
- xasprintf(&str, "%3u:%-3u", dev->maj, dev->min);
+ xasprintf(&str, "%3d:%-3d", dev->maj, dev->min);
if (rawdata)
*rawdata = makedev(dev->maj, dev->min);
break;
case COL_MAJ:
- xasprintf(&str, "%u", dev->maj);
+ xasprintf(&str, "%d", dev->maj);
if (rawdata)
*rawdata = dev->maj;
break;
case COL_MIN:
- xasprintf(&str, "%u", dev->min);
+ xasprintf(&str, "%d", dev->min);
if (rawdata)
*rawdata = dev->min;
break;
}
devno = st.st_rdev;
} else if (devno) {
- DBG(DEV, ul_debug("%d:%d: reading alone device", major(devno), minor(devno)));
+ DBG(DEV, ul_debug("%u:%u: reading alone device", major(devno), minor(devno)));
} else {
assert(devno || devname);
return -EINVAL;
case CT_RTC:
return "rtc";
}
- errx(EXIT_FAILURE, _("Unknown clock type %d"), type);
+ errx(EXIT_FAILURE, _("Unknown clock type %u"), type);
}
struct clockinfo {
static void scols_line_format_timespec(struct libscols_line *ln, size_t n, const struct timespec *ts)
{
- scols_line_sprintf(ln, n, "%ju.%09" PRId32, (uintmax_t) ts->tv_sec, (uint32_t) ts->tv_nsec);
+ scols_line_sprintf(ln, n, "%ju.%09" PRIu32, (uintmax_t) ts->tv_sec, (uint32_t) ts->tv_nsec);
}
static clockid_t parse_clock(const char *name)
rc = clock_gettime(clock, &now);
if (rc)
err(EXIT_FAILURE, _("failed to get time"));
- printf("%ju.%09"PRId32"\n", (uintmax_t) now.tv_sec, (uint32_t) now.tv_nsec);
+ printf("%ju.%09"PRIu32"\n", (uintmax_t) now.tv_sec, (uint32_t) now.tv_nsec);
return EXIT_SUCCESS;
}
fputs(USAGE_OPTIONS, stdout);
fputsln(_(" -g, --get examine pipe buffers"), stdout);
fprintf(stdout,
- _(" -s, --set <size> the buffer size to be used (default: %u)\n"), opt_size);
+ _(" -s, --set <size> the buffer size to be used (default: %d)\n"), opt_size);
fputs(USAGE_SEPARATOR, stdout);
fputsln(_(" -f, --file <path> act on a file"), stdout);
}
if (ret == 0) { /* true when poll() times out */
if (uuidd_cxt->debug)
- fprintf(stderr, _("timeout [%d sec]\n"), uuidd_cxt->timeout);
+ fprintf(stderr, _("timeout [%"PRIu32" sec]\n"), uuidd_cxt->timeout);
all_done(uuidd_cxt, EXIT_SUCCESS);
}
if (pfd[POLLFD_SIGNAL].revents != 0)
else
comm = pid_get_cmdname(pid);
- printf(_("%s (%d) util_clamp: min: %d max: %d\n"),
+ printf(_("%s (%d) util_clamp: min: %"PRIu32" max: %"PRIu32"\n"),
comm ? : "unknown", pid, sa.sched_util_min, sa.sched_util_max);
if (!cmd)
err(EXIT_FAILURE, _("%s: BLKREPORTZONE ioctl failed"), ctl->devname);
if (ctl->verbose)
- printf(_("Found %d zones from 0x%"PRIx64"\n"),
+ printf(_("Found %"PRIu32" zones from 0x%"PRIx64"\n"),
zi->nr_zones, ctl->offset);
if (!zi->nr_zones)
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
continue;
if (ul_path_accessf(sys, F_OK, "cpu%d", cpu) != 0) {
- warnx(_("CPU %u does not exist"), cpu);
+ warnx(_("CPU %d does not exist"), cpu);
fails++;
continue;
}
if (ul_path_accessf(sys, F_OK, "cpu%d/online", cpu) != 0) {
- warnx(_("CPU %u is not hot pluggable"), cpu);
+ warnx(_("CPU %d is not hot pluggable"), cpu);
fails++;
continue;
}
if (ul_path_readf_s32(sys, &online, "cpu%d/online", cpu) == 0
&& online == 1
&& enable == 1) {
- printf(_("CPU %u is already enabled\n"), cpu);
+ printf(_("CPU %d is already enabled\n"), cpu);
continue;
}
if (online == 0 && enable == 0) {
- printf(_("CPU %u is already disabled\n"), cpu);
+ printf(_("CPU %d is already disabled\n"), cpu);
continue;
}
if (ul_path_accessf(sys, F_OK, "cpu%d/configure", cpu) == 0)
if (enable) {
rc = ul_path_writef_string(sys, "1", "cpu%d/online", cpu);
if (rc != 0 && configured == 0) {
- warn(_("CPU %u enable failed (CPU is deconfigured)"), cpu);
+ warn(_("CPU %d enable failed (CPU is deconfigured)"), cpu);
fails++;
} else if (rc != 0) {
- warn(_("CPU %u enable failed"), cpu);
+ warn(_("CPU %d enable failed"), cpu);
fails++;
} else
- printf(_("CPU %u enabled\n"), cpu);
+ printf(_("CPU %d enabled\n"), cpu);
} else {
if (onlinecpus && num_online_cpus() == 1) {
- warnx(_("CPU %u disable failed (last enabled CPU)"), cpu);
+ warnx(_("CPU %d disable failed (last enabled CPU)"), cpu);
fails++;
continue;
}
rc = ul_path_writef_string(sys, "0", "cpu%d/online", cpu);
if (rc != 0) {
- warn(_("CPU %u disable failed"), cpu);
+ warn(_("CPU %d disable failed"), cpu);
fails++;
} else {
- printf(_("CPU %u disabled\n"), cpu);
+ printf(_("CPU %d disabled\n"), cpu);
if (onlinecpus)
CPU_CLR_S(cpu, setsize, onlinecpus);
}
if (!CPU_ISSET_S(cpu, setsize, cpu_set))
continue;
if (ul_path_accessf(sys, F_OK, "cpu%d", cpu) != 0) {
- warnx(_("CPU %u does not exist"), cpu);
+ warnx(_("CPU %d does not exist"), cpu);
fails++;
continue;
}
if (ul_path_accessf(sys, F_OK, "cpu%d/configure", cpu) != 0) {
- warnx(_("CPU %u is not configurable"), cpu);
+ warnx(_("CPU %d is not configurable"), cpu);
fails++;
continue;
}
ul_path_readf_s32(sys, ¤t, "cpu%d/configure", cpu);
if (current == 1 && configure == 1) {
- printf(_("CPU %u is already configured\n"), cpu);
+ printf(_("CPU %d is already configured\n"), cpu);
continue;
}
if (current == 0 && configure == 0) {
- printf(_("CPU %u is already deconfigured\n"), cpu);
+ printf(_("CPU %d is already deconfigured\n"), cpu);
continue;
}
if (current == 1 && configure == 0 && onlinecpus &&
is_cpu_online(cpu)) {
- warnx(_("CPU %u deconfigure failed (CPU is enabled)"), cpu);
+ warnx(_("CPU %d deconfigure failed (CPU is enabled)"), cpu);
fails++;
continue;
}
if (configure) {
rc = ul_path_writef_string(sys, "1", "cpu%d/configure", cpu);
if (rc != 0) {
- warn(_("CPU %u configure failed"), cpu);
+ warn(_("CPU %d configure failed"), cpu);
fails++;
} else
- printf(_("CPU %u configured\n"), cpu);
+ printf(_("CPU %d configured\n"), cpu);
} else {
rc = ul_path_writef_string(sys, "0", "cpu%d/configure", cpu);
if (rc != 0) {
- warn(_("CPU %u deconfigure failed"), cpu);
+ warn(_("CPU %d deconfigure failed"), cpu);
fails++;
} else
- printf(_("CPU %u deconfigured\n"), cpu);
+ printf(_("CPU %d deconfigured\n"), cpu);
}
}
* "swap performance = %ld attempts, %ld successes\n"
*/
printf (_("segments allocated %d\n"
- "pages allocated %ld\n"
- "pages resident %ld\n"
- "pages swapped %ld\n"
- "Swap performance: %ld attempts\t %ld successes\n"),
+ "pages allocated %lu\n"
+ "pages resident %lu\n"
+ "pages swapped %lu\n"
+ "Swap performance: %lu attempts\t %lu successes\n"),
shm_info->used_ids,
shm_info->shm_tot,
shm_info->shm_rss,
printf ("%-10d %-10.10s", shmdsp->shm_perm.id, pw->pw_name);
else
printf ("%-10d %-10u", shmdsp->shm_perm.id, shmdsp->shm_perm.uid);
- printf (" %-10u %-10u\n",
+ printf (" %-10d %-10d\n",
shmdsp->shm_cprid, shmdsp->shm_lprid);
break;
shmdata->shm_perm.mode & 0777);
ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("size=") : _("bytes="),
shmdata->shm_segsz, "\t", 0);
- printf(_("lpid=%u\tcpid=%u\tnattch=%jd\n"),
+ printf(_("lpid=%d\tcpid=%d\tnattch=%"PRIu64"\n"),
shmdata->shm_lprid, shmdata->shm_cprid,
shmdata->shm_nattch);
printf(_("att_time=%-26.24s\n"),
msgdata->q_cbytes, "\t", 0);
ipc_print_size(unit, unit == IPC_UNIT_HUMAN ? _("qsize=") : _("qbytes="),
msgdata->q_qbytes, "\t", 0);
- printf("qnum=%jd\tlspid=%d\tlrpid=%d\n",
+ printf("qnum=%"PRIu64"\tlspid=%d\tlrpid=%d\n",
msgdata->q_qnum,
msgdata->q_lspid, msgdata->q_lrpid);
printf(_("send_time=%-26.24s\n"),
xasprintf(&str, "%s", info->irq);
break;
case COL_TOTAL:
- xasprintf(&str, "%ld", info->total);
+ xasprintf(&str, "%lu", info->total);
break;
case COL_DELTA:
- xasprintf(&str, "%ld", info->delta);
+ xasprintf(&str, "%lu", info->delta);
break;
case COL_NAME:
xasprintf(&str, "%s", info->name);
break;
case COL_OFFSET:
if (loopcxt_get_offset(lc, &x) == 0)
- xasprintf(&np, "%jd", x);
+ xasprintf(&np, "%"PRIu64, x);
break;
case COL_SIZELIMIT:
if (loopcxt_get_sizelimit(lc, &x) == 0)
- xasprintf(&np, "%jd", x);
+ xasprintf(&np, "%"PRIu64, x);
break;
case COL_BACK_MAJMIN:
{
break;
case COL_LOGSEC:
if (loopcxt_get_blocksize(lc, &x) == 0)
- xasprintf(&np, "%jd", x);
+ xasprintf(&np, "%"PRIu64, x);
break;
case COL_REF:
np = loopcxt_get_refname(lc);
"cpu%d/l1_icache_size", num) == 0)
return read_sparc_caches(cxt, cpu);
- DBG_OBJ(CPU, cpu, ul_debug("#%d reading %zd caches", num, ncaches));
+ DBG_OBJ(CPU, cpu, ul_debug("#%d reading %zu caches", num, ncaches));
for (i = 0; i < ncaches; i++) {
struct lscpu_cache *ca;
(time_t) p->q_rtime));
break;
case COL_LSPID:
- rc = scols_line_sprintf(ln, n, "%u", p->q_lspid);
+ rc = scols_line_sprintf(ln, n, "%d", p->q_lspid);
break;
case COL_LRPID:
- rc = scols_line_sprintf(ln, n, "%u", p->q_lrpid);
+ rc = scols_line_sprintf(ln, n, "%d", p->q_lrpid);
break;
}
if (rc != 0)
(time_t) p->shm_dtim));
break;
case COL_CPID:
- rc = scols_line_sprintf(ln, n, "%u", p->shm_cprid);
+ rc = scols_line_sprintf(ln, n, "%d", p->shm_cprid);
break;
case COL_LPID:
- rc = scols_line_sprintf(ln, n, "%u", p->shm_lprid);
+ rc = scols_line_sprintf(ln, n, "%d", p->shm_lprid);
break;
case COL_COMMAND:
arg = pid_get_cmdline(p->shm_cprid);
}
case COL_SIZE:
if (lsmem->bytes)
- xasprintf(&str, "%"PRId64, (uint64_t) blk->count * lsmem->block_size);
+ xasprintf(&str, "%"PRIu64, (uint64_t) blk->count * lsmem->block_size);
else
str = size_to_human_string(SIZE_SUFFIX_1LETTER,
(uint64_t) blk->count * lsmem->block_size);
break;
case COL_BLOCK:
if (blk->count == 1)
- xasprintf(&str, "%"PRId64, blk->index);
+ xasprintf(&str, "%"PRIu64, blk->index);
else
- xasprintf(&str, "%"PRId64"-%"PRId64,
+ xasprintf(&str, "%"PRIu64"-%"PRIu64,
blk->index, blk->index + blk->count - 1);
break;
case COL_NODE:
const char *prefix;
if (lsmem->bytes) {
- printf("%-32s %15"PRId64"\n",_("Memory block size:"), lsmem->block_size);
- printf("%-32s %15"PRId64"\n",_("Total online memory:"), lsmem->mem_online);
- printf("%-32s %15"PRId64"\n",_("Total offline memory:"), lsmem->mem_offline);
+ printf("%-32s %15"PRIu64"\n",_("Memory block size:"), lsmem->block_size);
+ printf("%-32s %15"PRIu64"\n",_("Total online memory:"), lsmem->mem_online);
+ printf("%-32s %15"PRIu64"\n",_("Total offline memory:"), lsmem->mem_offline);
} else {
char *p;
char pathbuf[PATH_MAX];
if (!path && namespace_target_pid) {
- snprintf(pathbuf, sizeof(pathbuf), "/proc/%u/%s",
+ snprintf(pathbuf, sizeof(pathbuf), "/proc/%d/%s",
namespace_target_pid, type);
path = pathbuf;
}
sk = pidfd_getfd(pidfd, sock_fd, 0);
if (sk < 0)
- err(EXIT_FAILURE, _("pidfd_getfd(%d, %u)"), pidfd, sock_fd);
+ err(EXIT_FAILURE, _("pidfd_getfd(%d, %d)"), pidfd, sock_fd);
if (fstat(sk, &sb) < 0)
err(EXIT_FAILURE, _("fstat(%d)"), sk);
int rc;
/* Check NS accessibility */
- snprintf(path, sizeof(path), "/proc/%u/%s", getpid(), nsfile->name);
+ snprintf(path, sizeof(path), "/proc/%d/%s", getpid(), nsfile->name);
rc = get_ns_ino(path, &my_ino);
if (rc == -ENOENT)
return false; /* Unsupported NS */
if (nsfile->nstype & CLONE_NEWUSER) {
ino_t target_ino = 0;
- snprintf(path, sizeof(path), "/proc/%u/%s", target, nsfile->name);
+ snprintf(path, sizeof(path), "/proc/%d/%s", target, nsfile->name);
if (get_ns_ino(path, &target_ino) != 0)
err(EXIT_FAILURE, _("stat of %s failed"), path);
case RFKILL_IS_INDEX:
event.op = RFKILL_OP_CHANGE;
event.idx = id->index;
- xasprintf(&message, "id %d", id->index);
+ xasprintf(&message, "id %"PRIu32, id->index);
break;
case RFKILL_IS_ALL:
message = xstrdup("all");
if (ctl.verbose)
printf(_("alarm %"PRId64", sys_time %"PRId64", "
- "rtc_time %"PRId64", seconds %"PRIu64"\n"),
+ "rtc_time %"PRId64", seconds %"PRId64"\n"),
(int64_t) alarm, (int64_t) ctl.sys_time,
(int64_t) ctl.rtc_time,
(int64_t) seconds);
~permMask & 0666);
if (S_ISREG(st.st_mode) && st.st_uid != 0)
- warnx(_("%s: insecure file owner %d, 0 (root) suggested."),
+ warnx(_("%s: insecure file owner %u, 0 (root) suggested."),
dev->path, st.st_uid);
/* test for holes by LBT */
}
if (ctl->verbose)
- warnx(_("%s: found signature [pagesize=%d, signature=%s]"),
+ warnx(_("%s: found signature [pagesize=%u, signature=%s]"),
dev->path,
dev->pagesize,
sig == SIG_SWAPSPACE ? "swap" :
int syspg = getpagesize();
if (ctl->verbose)
- warnx(_("%s: pagesize=%d, swapsize=%llu, devsize=%llu"),
+ warnx(_("%s: pagesize=%u, swapsize=%llu, devsize=%llu"),
dev->path, dev->pagesize, swapsize, devsize);
if (swapsize > devsize) {
pw = xgetpwuid(uid, &pwbuf);
if (!pw)
- errx(EXIT_FAILURE, _("you (user %d) don't exist."), uid);
+ errx(EXIT_FAILURE, _("you (user %u) don't exist."), uid);
idmap = fopen(filename, "r");
if (!idmap)
length += 3;
argv = xcalloc(length, sizeof(*argv));
argv[i++] = xstrdup(idmapper);
- xasprintf(&argv[i++], "%u", ppid);
+ xasprintf(&argv[i++], "%d", ppid);
for (struct map_range *map = chain; map; map = map->next) {
xasprintf(&argv[i++], "%u", map->inner);
unsigned int length = 0;
char buffer[4096], *path;
- xasprintf(&path, "/proc/%u/%s", ppid, type);
+ xasprintf(&path, "/proc/%d/%s", ppid, type);
for (struct map_range *map = chain; map; map = map->next) {
count = snprintf(buffer + length, sizeof(buffer) - length,
"%u %u %u\n",
gettime_monotonic(&now);
timersub(&now, &log->oldtime, &delta);
- ssz = fprintf(log->fp, "%"PRId64".%06"PRId64" %zd\n",
+ ssz = fprintf(log->fp, "%"PRId64".%06"PRId64" %zu\n",
(int64_t)delta.tv_sec, (int64_t)delta.tv_usec, bytes);
if (ssz < 0)
return -errno;
gettime_monotonic(&now);
timersub(&now, &log->oldtime, &delta);
- ssz = fprintf(log->fp, "%c %"PRId64".%06"PRId64" %zd\n",
+ ssz = fprintf(log->fp, "%c %"PRId64".%06"PRId64" %zu\n",
stream->ident,
(int64_t)delta.tv_sec, (int64_t)delta.tv_usec, bytes);
if (ssz < 0)
size_t width;
char *res;
res = encode_fn(argv[i], &width);
- printf("%zi %s\n", width, res);
+ printf("%zu %s\n", width, res);
free(res);
}
int mapfd;
int r;
- n = snprintf(buf, sizeof(buf), "0 %d 1", uid);
+ n = snprintf(buf, sizeof(buf), "0 %u 1", uid);
mapfd = open("/proc/self/uid_map", O_WRONLY);
if (mapfd < 0)
err(EXIT_FAILURE,
"failed to write to /proc/self/setgroups");
close(mapfd);
- n = snprintf(buf, sizeof(buf), "0 %d 1", gid);
+ n = snprintf(buf, sizeof(buf), "0 %u 1", gid);
mapfd = open("/proc/self/gid_map", O_WRONLY);
if (mapfd < 0)
err(EXIT_FAILURE,