summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-07-31 11:36:32 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-07-31 11:36:32 +0000
commit25bc4d84f6e57bd873e9b5135cd49fc329aa0876 (patch)
tree167e57422f8864e8439ed2e79a83deed40092d36
parent6f421ca6ecc53bb3a0db68f7360f6f7e826350e6 (diff)
parentfed692705a66b80d86971df5b579fcac7386f7df (diff)
downloadillumos-joyent-25bc4d84f6e57bd873e9b5135cd49fc329aa0876.tar.gz
[illumos-gate merge]
commit fed692705a66b80d86971df5b579fcac7386f7df 11459 mdb: disk_label should allow to set sector size (add ::sectorsize) commit 06fcb0bcd6642c350546e3c87bbe20e27c20bff3 11456 mdb: libmlsvc NULL pointer errors commit 7b64dea37f86f82e3b7fc0f52918a46d5567ac8e 11455 mdb: libfksmbfs NULL pointer errors commit 1e88dc672aa1283fdca243a70822306e816340d7 11452 zonestat: NULL pointer errors commit eaf5a31c5f4fa067aaddcf5b08a0cd96c60bb9a4 11451 zonecfg: NULL pointer errors commit 4535e8bf8bd491fa8e4cdbe5019f9f59988c2b3e 11450 zoneadm: NULL pointer errors commit 35c005f243fafd7cad624b8a3a64298cab8ac172 11449 zoneadmd: NULL pointer errors commit a6959a060879676e965529db823ea71db60ac49b 11448 xstr: NULL pointer errors commit 1dfc79c00accaeca37225189e270abb0fab8619e 11447 xargs: NULL pointer errors commit 61aaa916808c601f9ee36d96c05ee9dac211d09e 11446 whodo: NULL pointer errors commit 352d7aeda1f43047aa9ff2e75cc69021c19a6a07 11445 w: NULL pointer errors commit c57b775050136774ef88b195e5833b3f9b86561b 11435 svr4pkg: NULL pointer errors commit 741b4d05bd52eb10a07f4f147bd8a211e5fe4351 11502 installboot: find_multiboot() does crash with small files commit 9b73ad49e885405d1de7968ac2e3d8c72087aa7d 11444 vi: NULL pointer errors commit df8910b3b3628a21874ee73195c149a955fce3a3 11443 ttymon: NULL pointer errors commit 0afbf5395cf4f4b8d9381a23f852c72b01ec43a4 11441 th_tools: NULL pointer errors commit 1580259811fb1670012fc9fad4be9624c2b60dae 11440 tar: NULL pointer errors commit b40273e57d35fb2f7610ad13fa58c32658c42ff3 11439 tnf: NULL pointer errors commit e8bca4ea3a0f5e2a084777440ee86870f8c9d88f 11438 vgrind: NULL pointer errors commit 974925512dfb8d6b72662ec04481adc913c6f914 11437 uadmin: NULL pointer errors commit 82aa8bddc8a3d3dd077c1cfa454aa5c0d5c23f04 11436 tip: NULL pointer errors commit 07b415c8e1ba7739721d764d37d8d12f9660af1b 11433 stmfadm: NULL pointer errors commit f9409f99581bedf7777548eccf1310c6995764a0 11432 stat: NULL pointer errors commit ce5e7d21f9e2e48a2f9b5a23ffec805e334d513e 11397 mpathadm: NULL pointer errors commit f9350d110371843c93efedac637b9d029faafee3 11430 smbsrv: NULL pointer errors commit 0ddec5a427aa889528aeed17fc3a8e7e26579f1d 11454 smbclnt: NULL pointer errors commit 06435337d318262e4e31a9efe4e40f5026d3e26b commit e21c734b6349feebc8c570483066f720d79022b0 11430 smbsrv: NULL pointer errors commit f1ecae5bb6568ce2aae66095708ad60af2979a39 11429 sulogin: NULL pointer errors commit fad16a7e4518fa4e5453c3808b1145177946e030 11428 sendmail: NULL pointer errors commit e9f63cd6c655b536e94b801b642dc5ff37254568 11427 stmfsvc: NULL pointer errors commit 48fde5fb20cd190052b1df46a6d135fe26684fe9 11426 stmfproxy: NULL pointer errors commit 14916c4b3821f9ac20da481ae3d8f73f1f6a16d8 11425 smserverd: NULL pointer errors commit 09ece02e953c23ed645b4d9768b786c444f4b430 11424 sbdadm: NULL pointer errors commit b33ffbed882c3e46e1242f5768ff3dfa3a887e4c 11423 sa: NULL pointer errors commit 053601185d4f955b8a517694e8469c12a90c9c7b 11420 rpcbind: NULL pointer errors commit 9292c78d437d97bc5dd20bc4d6788a79e0661e02 11419 rmformat: NULL pointer errors commit 7bc3049f70ccb68ec7cd7ba1bb17a4643fb60f36 11418 refer: NULL pointer errors commit 46fbc806d6e97aff59942e61f3f01b8abc70b716 11417 rcm_daemon: NULL pointer errors
-rw-r--r--usr/src/cmd/boot/installboot/i386/installboot.c3
-rw-r--r--usr/src/cmd/mdb/common/modules/disk_label/disk_label.c183
-rw-r--r--usr/src/cmd/mdb/common/modules/libmlsvc/smb_ht.c6
-rw-r--r--usr/src/cmd/mdb/common/modules/smbfs/smbfs.c2
-rw-r--r--usr/src/cmd/mpathadm/mpathadm.c134
-rw-r--r--usr/src/cmd/rcm_daemon/common/aggr_rcm.c22
-rw-r--r--usr/src/cmd/rcm_daemon/common/ip_rcm.c36
-rw-r--r--usr/src/cmd/rcm_daemon/common/network_rcm.c2
-rw-r--r--usr/src/cmd/rcm_daemon/common/rcm_subr.c14
-rw-r--r--usr/src/cmd/refer/addbib.c25
-rw-r--r--usr/src/cmd/refer/refer2.c4
-rw-r--r--usr/src/cmd/refer/refer4.c12
-rw-r--r--usr/src/cmd/refer/sortbib.c14
-rw-r--r--usr/src/cmd/rmformat/rmf_slice.c4
-rw-r--r--usr/src/cmd/rpcbind/rpcb_stat.c6
-rw-r--r--usr/src/cmd/rpcbind/rpcbind.c8
-rw-r--r--usr/src/cmd/sa/sar.c414
-rw-r--r--usr/src/cmd/sbdadm/sbdadm.c2
-rw-r--r--usr/src/cmd/sendmail/util/mailcompat.c2
-rw-r--r--usr/src/cmd/sendmail/util/vacation.c2
-rw-r--r--usr/src/cmd/smbsrv/smbd/smbd_doorsvc.c2
-rw-r--r--usr/src/cmd/smserverd/myaudit.c4
-rw-r--r--usr/src/cmd/stat/common/acquire_iodevs.c9
-rw-r--r--usr/src/cmd/stat/common/dsr.c6
-rw-r--r--usr/src/cmd/stat/mpstat/mpstat.c10
-rw-r--r--usr/src/cmd/stmfadm/stmfadm.c2
-rw-r--r--usr/src/cmd/stmfproxy/aluaadm/aluaadm.c2
-rw-r--r--usr/src/cmd/stmfsvc/stmfsvc.c2
-rw-r--r--usr/src/cmd/sulogin/sulogin.c2
-rw-r--r--usr/src/cmd/svr4pkg/libinst/fixpath.c2
-rw-r--r--usr/src/cmd/svr4pkg/libinst/isreloc.c6
-rw-r--r--usr/src/cmd/svr4pkg/libinst/mntinfo.c4
-rw-r--r--usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c4
-rw-r--r--usr/src/cmd/svr4pkg/libinst/pkgobjmap.c2
-rw-r--r--usr/src/cmd/svr4pkg/libinst/scriptvfy.l2
-rw-r--r--usr/src/cmd/svr4pkg/pkgchk/checkmap.c2
-rw-r--r--usr/src/cmd/svr4pkg/pkgchk/ckentry.c4
-rw-r--r--usr/src/cmd/svr4pkg/pkginfo/pkginfo.c14
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/getinst.c6
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/quit.c4
-rw-r--r--usr/src/cmd/svr4pkg/pkgmk/main.c2
-rw-r--r--usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c2
-rw-r--r--usr/src/cmd/svr4pkg/pkgremove/check.c8
-rw-r--r--usr/src/cmd/svr4pkg/pkgserv/pkgserv.c4
-rw-r--r--usr/src/cmd/tar/tar.c60
-rw-r--r--usr/src/cmd/th_tools/th_define.c46
-rw-r--r--usr/src/cmd/th_tools/th_manage.c6
-rw-r--r--usr/src/cmd/tip/tip.c2
-rw-r--r--usr/src/cmd/tip/vars.c4
-rw-r--r--usr/src/cmd/tnf/prex/spec.c6
-rw-r--r--usr/src/cmd/tnf/tnfxtract/tnfxtract.c4
-rw-r--r--usr/src/cmd/ttymon/sttyparse.c2
-rw-r--r--usr/src/cmd/uadmin/uadmin.c10
-rw-r--r--usr/src/cmd/vgrind/vfontedpr.c11
-rw-r--r--usr/src/cmd/vi/misc/ctags.c18
-rw-r--r--usr/src/cmd/w/w.c22
-rw-r--r--usr/src/cmd/whodo/whodo.c12
-rw-r--r--usr/src/cmd/xargs/xargs.c18
-rw-r--r--usr/src/cmd/xstr/xstr.c8
-rw-r--r--usr/src/cmd/zoneadm/zoneadm.c2
-rw-r--r--usr/src/cmd/zoneadmd/zoneadmd.c28
-rw-r--r--usr/src/cmd/zonecfg/zonecfg.c2
-rw-r--r--usr/src/cmd/zonestat/zonestatd/zonestatd.c2
-rw-r--r--usr/src/uts/common/fs/smbclnt/smbfs/smbfs_smb1.c2
64 files changed, 642 insertions, 623 deletions
diff --git a/usr/src/cmd/boot/installboot/i386/installboot.c b/usr/src/cmd/boot/installboot/i386/installboot.c
index 9e131ac626..80066b1430 100644
--- a/usr/src/cmd/boot/installboot/i386/installboot.c
+++ b/usr/src/cmd/boot/installboot/i386/installboot.c
@@ -201,7 +201,8 @@ read_bootblock_from_file(char *file, ib_bootblock_t *bblock)
goto outfd;
}
- if (find_multiboot(bblock->file, MBOOT_SCAN_SIZE, &mboot_off)
+ buf_size = MIN(buf_size, MBOOT_SCAN_SIZE);
+ if (find_multiboot(bblock->file, buf_size, &mboot_off)
!= BC_SUCCESS) {
(void) fprintf(stderr,
gettext("Unable to find multiboot header\n"));
diff --git a/usr/src/cmd/mdb/common/modules/disk_label/disk_label.c b/usr/src/cmd/mdb/common/modules/disk_label/disk_label.c
index 5753fb805f..d95c7cc902 100644
--- a/usr/src/cmd/mdb/common/modules/disk_label/disk_label.c
+++ b/usr/src/cmd/mdb/common/modules/disk_label/disk_label.c
@@ -16,8 +16,6 @@
/*
* The on-disk elements here are all little-endian, and this code doesn't make
* any attempt to adjust for running on a big-endian system.
- *
- * We also currently assume a 512-byte sized logical block.
*/
#include <sys/types.h>
@@ -93,6 +91,8 @@ stringval_t pflag_array[] = {
{ NULL }
};
+size_t sector_size = SECTOR_SIZE;
+
static const char *
array_find_string(stringval_t *array, int match_value)
{
@@ -248,10 +248,10 @@ mbr_info(struct mboot *mbr)
static int
cmd_mbr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
{
- struct mboot mbr;
+ struct mboot *mbr;
mbr_type_t type;
- CTASSERT(sizeof (mbr) == SECTOR_SIZE);
+ CTASSERT(sizeof (*mbr) == SECTOR_SIZE);
if (argc != 0)
return (DCMD_USAGE);
@@ -259,27 +259,29 @@ cmd_mbr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
if (!(flags & DCMD_ADDRSPEC))
addr = 0;
- if (mdb_vread(&mbr, sizeof (mbr), addr) == -1) {
+ mbr = mdb_zalloc(sector_size, UM_SLEEP | UM_GC);
+
+ if (mdb_vread(mbr, sector_size, addr) == -1) {
mdb_warn("failed to read MBR");
return (DCMD_ERR);
}
- type = mbr_info(&mbr);
+ type = mbr_info(mbr);
/* If the magic is wrong, stop here. */
- if (mbr.signature != MBB_MAGIC)
+ if (mbr->signature != MBB_MAGIC)
return (DCMD_ERR);
/* Also print volume boot record */
switch (type) {
case MBR_TYPE_LOADER:
case MBR_TYPE_LOADER_JOYENT:
- if (*(uint16_t *)&mbr.bootinst[STAGE1_STAGE2_SIZE] == 1) {
+ if (*(uint16_t *)&mbr->bootinst[STAGE1_STAGE2_SIZE] == 1) {
struct mboot vbr;
uintptr_t vbrp;
- vbrp = *(uint64_t *)&mbr.bootinst[STAGE1_STAGE2_LBA];
- vbrp *= SECTOR_SIZE;
+ vbrp = *(uint64_t *)&mbr->bootinst[STAGE1_STAGE2_LBA];
+ vbrp *= sector_size;
vbrp += addr;
if (mdb_vread(&vbr, sizeof (vbr), vbrp) == -1) {
mdb_warn("failed to read VBR");
@@ -299,7 +301,7 @@ cmd_mbr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
for (size_t i = 0; i < FD_NUMPART; i++) {
struct ipart *ip = (struct ipart *)
- (mbr.parts + (sizeof (struct ipart) * i));
+ (mbr->parts + (sizeof (struct ipart) * i));
print_fdisk_part(ip, i);
}
@@ -410,9 +412,9 @@ cmd_gpt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
char uuid[UUID_PRINTABLE_STRING_LENGTH];
int show_alternate = B_FALSE;
int show_guid = B_FALSE;
- efi_gpt_t altheader;
+ efi_gpt_t *altheader;
size_t table_size;
- efi_gpt_t header;
+ efi_gpt_t *header;
efi_gpe_t *gpet;
uint_t orig_crc;
uint_t crc;
@@ -425,87 +427,89 @@ cmd_gpt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
/* Primary header is at LBA 1. */
if (!(flags & DCMD_ADDRSPEC))
- addr = SECTOR_SIZE;
+ addr = sector_size;
- if (mdb_vread(&header, sizeof (header), addr) == -1) {
+ header = mdb_zalloc(sector_size, UM_SLEEP | UM_GC);
+ if (mdb_vread(header, sector_size, addr) == -1) {
mdb_warn("failed to read GPT header");
return (DCMD_ERR);
}
if (show_alternate) {
- addr = header.efi_gpt_AlternateLBA * SECTOR_SIZE;
+ addr = header->efi_gpt_AlternateLBA * sector_size;
- if (mdb_vread(&header, sizeof (header), addr) == -1) {
+ if (mdb_vread(header, sector_size, addr) == -1) {
mdb_warn("failed to read GPT header");
return (DCMD_ERR);
}
}
- mdb_printf("Signature: %s (%s)\n", (char *)&header.efi_gpt_Signature,
- strncmp((char *)&header.efi_gpt_Signature, "EFI PART", 8) == 0 ?
+ mdb_printf("Signature: %s (%s)\n", (char *)&header->efi_gpt_Signature,
+ strncmp((char *)&header->efi_gpt_Signature, "EFI PART", 8) == 0 ?
"valid" : "invalid");
- mdb_printf("Revision: %hu.%hu\n", header.efi_gpt_Revision >> 16,
- header.efi_gpt_Revision);
+ mdb_printf("Revision: %hu.%hu\n", header->efi_gpt_Revision >> 16,
+ header->efi_gpt_Revision);
- mdb_printf("HeaderSize: %u bytes\n", header.efi_gpt_HeaderSize);
+ mdb_printf("HeaderSize: %u bytes\n", header->efi_gpt_HeaderSize);
- if (header.efi_gpt_HeaderSize > SECTOR_SIZE) {
+ if (header->efi_gpt_HeaderSize > SECTOR_SIZE) {
mdb_warn("invalid header size: skipping CRC\n");
} else {
- orig_crc = header.efi_gpt_HeaderCRC32;
+ orig_crc = header->efi_gpt_HeaderCRC32;
- header.efi_gpt_HeaderCRC32 = 0;
+ header->efi_gpt_HeaderCRC32 = 0;
- crc = efi_crc32((unsigned char *)&header,
- header.efi_gpt_HeaderSize);
+ crc = efi_crc32((unsigned char *)header,
+ header->efi_gpt_HeaderSize);
mdb_printf("HeaderCRC32: %#x (should be %#x)\n", orig_crc, crc);
}
mdb_printf("Reserved1: %#x (should be 0x0)\n",
- header.efi_gpt_Reserved1);
+ header->efi_gpt_Reserved1);
mdb_printf("MyLBA: %llu (should be %llu)\n",
- header.efi_gpt_MyLBA, addr / SECTOR_SIZE);
+ header->efi_gpt_MyLBA, addr / sector_size);
- mdb_printf("AlternateLBA: %llu\n", header.efi_gpt_AlternateLBA);
- mdb_printf("FirstUsableLBA: %llu\n", header.efi_gpt_FirstUsableLBA);
- mdb_printf("LastUsableLBA: %llu\n", header.efi_gpt_LastUsableLBA);
+ mdb_printf("AlternateLBA: %llu\n", header->efi_gpt_AlternateLBA);
+ mdb_printf("FirstUsableLBA: %llu\n", header->efi_gpt_FirstUsableLBA);
+ mdb_printf("LastUsableLBA: %llu\n", header->efi_gpt_LastUsableLBA);
- if (header.efi_gpt_MyLBA >= header.efi_gpt_FirstUsableLBA &&
- header.efi_gpt_MyLBA <= header.efi_gpt_LastUsableLBA) {
+ if (header->efi_gpt_MyLBA >= header->efi_gpt_FirstUsableLBA &&
+ header->efi_gpt_MyLBA <= header->efi_gpt_LastUsableLBA) {
mdb_warn("MyLBA is within usable LBA range\n");
}
- if (header.efi_gpt_AlternateLBA >= header.efi_gpt_FirstUsableLBA &&
- header.efi_gpt_AlternateLBA <= header.efi_gpt_LastUsableLBA) {
+ if (header->efi_gpt_AlternateLBA >= header->efi_gpt_FirstUsableLBA &&
+ header->efi_gpt_AlternateLBA <= header->efi_gpt_LastUsableLBA) {
mdb_warn("AlternateLBA is within usable LBA range\n");
}
- if (mdb_vread(&altheader, sizeof (altheader),
- header.efi_gpt_AlternateLBA * SECTOR_SIZE) == -1) {
+ altheader = mdb_zalloc(sector_size, UM_SLEEP | UM_GC);
+ if (mdb_vread(altheader, sector_size,
+ header->efi_gpt_AlternateLBA * sector_size) == -1) {
mdb_warn("failed to read alternate GPT header");
} else {
- if (strncmp((char *)&altheader.efi_gpt_Signature,
+ if (strncmp((char *)&altheader->efi_gpt_Signature,
"EFI PART", 8) != 0) {
mdb_warn("found invalid alternate GPT header with "
"Signature: %s\n",
- (char *)&altheader.efi_gpt_Signature);
+ (char *)&altheader->efi_gpt_Signature);
}
- if (altheader.efi_gpt_MyLBA != header.efi_gpt_AlternateLBA) {
+ if (altheader->efi_gpt_MyLBA != header->efi_gpt_AlternateLBA) {
mdb_warn("alternate GPT header at offset %#llx has "
"invalid MyLBA %llu\n",
- header.efi_gpt_AlternateLBA * SECTOR_SIZE,
- altheader.efi_gpt_MyLBA);
+ header->efi_gpt_AlternateLBA * sector_size,
+ altheader->efi_gpt_MyLBA);
}
- if (altheader.efi_gpt_AlternateLBA != header.efi_gpt_MyLBA) {
+ if (altheader->efi_gpt_AlternateLBA != header->efi_gpt_MyLBA) {
mdb_warn("alternate GPT header at offset %#llx has "
"invalid AlternateLBA %llu\n",
- header.efi_gpt_AlternateLBA * SECTOR_SIZE,
- altheader.efi_gpt_AlternateLBA);
+ header->efi_gpt_AlternateLBA * sector_size,
+ altheader->efi_gpt_AlternateLBA);
}
/*
@@ -514,31 +518,31 @@ cmd_gpt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
*/
}
- uuid_unparse((uchar_t *)&header.efi_gpt_DiskGUID, uuid);
+ uuid_unparse((uchar_t *)&header->efi_gpt_DiskGUID, uuid);
mdb_printf("DiskGUID: %s\n", uuid);
mdb_printf("PartitionEntryLBA: %llu\n",
- header.efi_gpt_PartitionEntryLBA);
+ header->efi_gpt_PartitionEntryLBA);
mdb_printf("NumberOfPartitionEntries: %u\n",
- header.efi_gpt_NumberOfPartitionEntries);
+ header->efi_gpt_NumberOfPartitionEntries);
/*
* While the spec allows a different size, in practice the table
* is always packed.
*/
- if (header.efi_gpt_SizeOfPartitionEntry != sizeof (efi_gpe_t)) {
+ if (header->efi_gpt_SizeOfPartitionEntry != sizeof (efi_gpe_t)) {
mdb_warn("SizeOfPartitionEntry: %#x bytes "
"(expected %#x bytes)\n",
- header.efi_gpt_SizeOfPartitionEntry, sizeof (efi_gpe_t));
+ header->efi_gpt_SizeOfPartitionEntry, sizeof (efi_gpe_t));
return (DCMD_ERR);
}
mdb_printf("SizeOfPartitionEntry: %#x bytes\n",
- header.efi_gpt_SizeOfPartitionEntry);
+ header->efi_gpt_SizeOfPartitionEntry);
- table_size = header.efi_gpt_SizeOfPartitionEntry *
- header.efi_gpt_NumberOfPartitionEntries;
+ table_size = header->efi_gpt_SizeOfPartitionEntry *
+ header->efi_gpt_NumberOfPartitionEntries;
/*
* While this is a minimum reservation, it serves us ably as a
@@ -549,11 +553,11 @@ cmd_gpt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
return (DCMD_ERR);
}
- gpet = mdb_alloc(header.efi_gpt_SizeOfPartitionEntry *
- header.efi_gpt_NumberOfPartitionEntries, UM_SLEEP | UM_GC);
+ table_size = P2ROUNDUP(table_size, sector_size);
+ gpet = mdb_alloc(table_size, UM_SLEEP | UM_GC);
if (mdb_vread(gpet, table_size,
- header.efi_gpt_PartitionEntryLBA * SECTOR_SIZE) == -1) {
+ header->efi_gpt_PartitionEntryLBA * sector_size) == -1) {
mdb_warn("couldn't read GPT array");
return (DCMD_ERR);
}
@@ -561,7 +565,7 @@ cmd_gpt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
crc = efi_crc32((unsigned char *)gpet, table_size);
mdb_printf("PartitionEntryArrayCRC32: %#x (should be %#x)\n",
- header.efi_gpt_PartitionEntryArrayCRC32, crc);
+ header->efi_gpt_PartitionEntryArrayCRC32, crc);
if (show_guid) {
mdb_printf("\n%<u>%-4s %-19s %-37s%</u>\n",
@@ -571,7 +575,7 @@ cmd_gpt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv __unused)
"PART", "TYPE", "STARTLBA", "ENDLBA", "ATTR", "NAME");
}
- for (size_t i = 0; i < header.efi_gpt_NumberOfPartitionEntries; i++)
+ for (size_t i = 0; i < header->efi_gpt_NumberOfPartitionEntries; i++)
print_gpe(&gpet[i], i, show_guid);
return (DCMD_OK);
@@ -588,7 +592,7 @@ gpt_help(void)
static int
cmd_vtoc(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
{
- uint8_t buf[SECTOR_SIZE];
+ uint8_t *buf;
struct dk_label *dl;
struct dk_vtoc *dv;
uintptr_t vaddr;
@@ -606,10 +610,12 @@ cmd_vtoc(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (!(flags & DCMD_ADDRSPEC))
addr = 0;
else
- addr *= SECTOR_SIZE;
+ addr *= sector_size;
+
+ buf = mdb_zalloc(sector_size, UM_SLEEP | UM_GC);
#if defined(_SUNOS_VTOC_16)
- if (mdb_vread(&buf, sizeof (buf), addr) == -1) {
+ if (mdb_vread(buf, sector_size, addr) == -1) {
mdb_warn("failed to read VBR");
return (DCMD_ERR);
}
@@ -618,14 +624,14 @@ cmd_vtoc(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
(void) mbr_info((struct mboot *)buf);
#endif
- vaddr = addr + DK_LABEL_LOC * SECTOR_SIZE;
+ vaddr = addr + DK_LABEL_LOC * sector_size;
- if (mdb_vread(&buf, sizeof (buf), vaddr) == -1) {
+ if (mdb_vread(buf, sector_size, vaddr) == -1) {
mdb_warn("failed to read VTOC");
return (DCMD_ERR);
}
- dl = (struct dk_label *)&buf;
+ dl = (struct dk_label *)buf;
dv = (struct dk_vtoc *)&dl->dkl_vtoc;
mdb_printf("Label magic: 0x%hx (%s)\n", dl->dkl_magic,
@@ -656,7 +662,7 @@ cmd_vtoc(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (show_sectors)
cyl = 1;
else
- addr /= (cyl * SECTOR_SIZE);
+ addr /= (cyl * sector_size);
tag_width = array_widest_str(ptag_array);
@@ -732,7 +738,7 @@ cmd_vtoc(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
sflag = "?";
mdb_printf("%-4d %-*s %-7s ", i, tag_width, stag, sflag);
- mdb_nicenum(size * SECTOR_SIZE, nnum);
+ mdb_nicenum(size * sector_size, nnum);
if (show_sectors) {
mdb_printf("%-11u %-11u %-*s %-10u\n", start, end,
MDB_NICENUM_BUFLEN, nnum, size);
@@ -760,13 +766,54 @@ vtoc_help(void)
mdb_printf("Display a Virtual Table of Content (VTOC).\n\n"
"-r Display relative addresses\n"
"-c Use cylinder based addressing\n");
- mdb_printf("\nThe addr is in 512-byte disk blocks.\n");
+ mdb_printf("\nThe addr is in %u-byte disk blocks.\n", sector_size);
+}
+
+static int
+cmd_sect(uintptr_t addr __unused, uint_t flags __unused, int argc,
+ const mdb_arg_t *argv)
+{
+ uint64_t size = SECTOR_SIZE;
+
+ if (argc < 1) {
+ mdb_printf("Current sector size is %u (%#x)\n", sector_size,
+ sector_size);
+ return (DCMD_OK);
+ }
+
+ if (argc != 1)
+ return (DCMD_USAGE);
+
+ switch (argv[0].a_type) {
+ case MDB_TYPE_STRING:
+ size = mdb_strtoull(argv[0].a_un.a_str);
+ break;
+ case MDB_TYPE_IMMEDIATE:
+ size = argv[0].a_un.a_val;
+ break;
+ default:
+ return (DCMD_USAGE);
+ }
+
+ if (!ISP2(size)) {
+ mdb_printf("sector size must be power of 2\n");
+ return (DCMD_USAGE);
+ }
+ sector_size = size;
+ return (DCMD_OK);
+}
+
+void
+sect_help(void)
+{
+ mdb_printf("Show or set sector size.\n");
}
static const mdb_dcmd_t dcmds[] = {
{ "mbr", NULL, "dump Master Boot Record information", cmd_mbr },
{ "gpt", "?[-ag]", "dump an EFI GPT", cmd_gpt, gpt_help },
{ "vtoc", "?[-cr]", "dump VTOC information", cmd_vtoc, vtoc_help },
+ { "sectorsize", NULL, "set or show sector size", cmd_sect, sect_help },
{ NULL }
};
diff --git a/usr/src/cmd/mdb/common/modules/libmlsvc/smb_ht.c b/usr/src/cmd/mdb/common/modules/libmlsvc/smb_ht.c
index a060d9f0e4..52421264e7 100644
--- a/usr/src/cmd/mdb/common/modules/libmlsvc/smb_ht.c
+++ b/usr/src/cmd/mdb/common/modules/libmlsvc/smb_ht.c
@@ -42,7 +42,7 @@ smb_ht_walk_init(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
HT_HANDLE *ht;
- if (addr == NULL) {
+ if (addr == (uintptr_t)NULL) {
mdb_printf("require address of an HT_HANDLE\n");
return (WALK_ERR);
}
@@ -63,7 +63,7 @@ smb_ht_walk_init(mdb_walk_state_t *wsp)
}
hw->hw_idx = -1;
- wsp->walk_addr = NULL;
+ wsp->walk_addr = (uintptr_t)NULL;
wsp->walk_data = hw;
return (WALK_NEXT);
@@ -78,7 +78,7 @@ smb_ht_walk_step(mdb_walk_state_t *wsp)
uintptr_t he_addr;
int rv;
- while (wsp->walk_addr == NULL) {
+ while (wsp->walk_addr == (uintptr_t)NULL) {
if (++hw->hw_idx >= hw->hw_handle.ht_table_size)
return (WALK_DONE);
he_addr = (uintptr_t)hw->hw_handle.ht_table +
diff --git a/usr/src/cmd/mdb/common/modules/smbfs/smbfs.c b/usr/src/cmd/mdb/common/modules/smbfs/smbfs.c
index e787fd86e5..d7ea831663 100644
--- a/usr/src/cmd/mdb/common/modules/smbfs/smbfs.c
+++ b/usr/src/cmd/mdb/common/modules/smbfs/smbfs.c
@@ -281,7 +281,7 @@ static const mdb_dcmd_t dcmds[] = {
int
vfs_walk_init(mdb_walk_state_t *wsp)
{
- if (wsp->walk_addr == NULL &&
+ if (wsp->walk_addr == (uintptr_t)NULL &&
mdb_readvar(&wsp->walk_addr, "rootvfs") == -1) {
mdb_warn("failed to read 'rootvfs'");
return (WALK_ERR);
diff --git a/usr/src/cmd/mpathadm/mpathadm.c b/usr/src/cmd/mpathadm/mpathadm.c
index 407bbdbeab..85256368b1 100644
--- a/usr/src/cmd/mpathadm/mpathadm.c
+++ b/usr/src/cmd/mpathadm/mpathadm.c
@@ -98,7 +98,7 @@ static char *cmdName;
static char *
getExecBasename(char *execFullname)
{
- char *lastSlash, *execBasename;
+ char *lastSlash, *execBasename;
/* guard against '/' at end of command invocation */
for (;;) {
@@ -189,7 +189,7 @@ objectRules_t objectRules[] = {
{PATH, 0, 0, ENABLE|DISABLE|OVERRIDE,
SHOW|LIST|MODIFY|FAILOVER|ADD|REMOVE, 0,
"initiator-port name"},
- {0, 0, 0, 0, 0, NULL}
+ {0, 0, 0, 0, 0, 0, NULL}
};
/*
@@ -207,7 +207,7 @@ optionRules_t optionRules[] = {
{PATH, ENABLE, "itl", B_TRUE, NULL},
{PATH, DISABLE, "itl", B_TRUE, NULL},
{PATH, OVERRIDE, "itlc", B_TRUE, NULL},
- {0, 0, 0, 0, 0}
+ {0, 0, NULL, 0, NULL}
};
@@ -313,7 +313,7 @@ showMpathSupport(int operandLen, char *operand[])
MP_DEVICE_PRODUCT_PROPERTIES devProps;
boolean_t bListIt = B_FALSE;
int op, i, j;
- MP_LOAD_BALANCE_TYPE lb;
+ MP_LOAD_BALANCE_TYPE lb;
if ((mpstatus = MP_GetPluginOidList(&pPluginOidList)) !=
@@ -572,7 +572,7 @@ showMpathSupport(int operandLen, char *operand[])
* ****************************************************************************
*
* modifyMpathSupport -
- * mpathadm modify mpath-support [options] <mpath-support name>, ...
+ * mpathadm modify mpath-support [options] <mpath-support name>, ...
*
* operandLen - number of operands user passed into the cli
* operand - pointer to operand list from user
@@ -588,7 +588,7 @@ modifyMpathSupport(int operandLen, char *operand[], cmdOptions_t *options)
MP_OID_LIST *pPluginOidList;
boolean_t bFoundIt = B_FALSE;
MP_OID pluginOid;
- cmdOptions_t *optionList = options;
+ cmdOptions_t *optionList = options;
char *cmdStr = getTextString(TEXT_UNKNOWN);
int op, i, lbValue;
@@ -724,7 +724,7 @@ modifyMpathSupport(int operandLen, char *operand[], cmdOptions_t *options)
* ****************************************************************************
*
* listLogicalUnit -
- * mpathadm list {logical-unit | LU} [options] [<logical-unit name>, ...]
+ * mpathadm list {logical-unit | LU} [options] [<logical-unit name>, ...]
*
* operandLen - number of operands user passed into the cli
* operand - pointer to operand list from user
@@ -1059,13 +1059,13 @@ switch (optionList->optval) {
* ****************************************************************************
*
* compareLUName -
- * compare names directly and via devid if no match directly
+ * compare names directly and via devid if no match directly
*
* cmpString - first string to compare
* deviceProperty - string from properties
* sizeToCompare - size of deviceProperty
*
- * returns B_TRUE if the strings match either directly or via devid
+ * returns B_TRUE if the strings match either directly or via devid
* B_FALSE otherwise
*
* ****************************************************************************
@@ -1075,7 +1075,7 @@ compareLUName(MP_CHAR *cmpString, MP_CHAR *deviceProperty)
{
boolean_t isSame = B_FALSE;
- int fd1, fd2;
+ int fd1, fd2;
ddi_devid_t devid1 = NULL, devid2 = NULL;
if (0 == strcmp(cmpString, deviceProperty)) {
@@ -1123,7 +1123,7 @@ compareLUName(MP_CHAR *cmpString, MP_CHAR *deviceProperty)
* ****************************************************************************
*
* listIndivudualLogicalUnit -
- * Used by list logical unit cli.
+ * Used by list logical unit cli.
* Displays info about an LU
*
* luOid - LU to list
@@ -1133,7 +1133,7 @@ compareLUName(MP_CHAR *cmpString, MP_CHAR *deviceProperty)
*/
int
listIndividualLogicalUnit(MP_OID luOid,
- MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps)
+ MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps)
{
MP_PATH_LOGICAL_UNIT_PROPERTIES pathProps;
MP_OID_LIST *pPathOidListArray;
@@ -1189,7 +1189,7 @@ listIndividualLogicalUnit(MP_OID luOid,
* ****************************************************************************
*
* showLogicalUnit -
- * mpathadm show {logical-unit | LU} <logical-unit name>, ...
+ * mpathadm show {logical-unit | LU} <logical-unit name>, ...
*
* operandLen - number of operands user passed into the cli
* operand - pointer to operand list from user
@@ -1262,7 +1262,7 @@ showLogicalUnit(int operandLen, char *operand[])
* ****************************************************************************
*
* showIndivudualLogicalUnit -
- * Used by show logical unit cli.
+ * Used by show logical unit cli.
* Displays info about an LU
*
* luOid - LU to show
@@ -1273,13 +1273,13 @@ showLogicalUnit(int operandLen, char *operand[])
*/
int
showIndividualLogicalUnit(MP_OID luOid,
- MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps,
- MP_PLUGIN_PROPERTIES pluginProps)
+ MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps,
+ MP_PLUGIN_PROPERTIES pluginProps)
{
MP_PATH_LOGICAL_UNIT_PROPERTIES pathProps;
MP_TARGET_PORT_GROUP_PROPERTIES tpgProps;
- MP_TARGET_PORT_PROPERTIES tportProps;
- MP_INITIATOR_PORT_PROPERTIES initProps;
+ MP_TARGET_PORT_PROPERTIES tportProps;
+ MP_INITIATOR_PORT_PROPERTIES initProps;
MP_OID_LIST *pPathOidListArray, *pTPGOidListArray,
*pTportOidListArray;
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
@@ -1524,7 +1524,7 @@ showIndividualLogicalUnit(MP_OID luOid,
* ****************************************************************************
*
* modifyLogicalUnit -
- * mpathadm modify {logical-unit | LU} [options] <logical-unit name>, ...
+ * mpathadm modify {logical-unit | LU} [options] <logical-unit name>, ...
*
* operandLen - number of operands user passed into the cli
* operand - pointer to operand list from user
@@ -1537,7 +1537,7 @@ modifyLogicalUnit(int operandLen, char *operand[], cmdOptions_t *options)
{
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
MP_OID luOid;
- cmdOptions_t *optionList = options;
+ cmdOptions_t *optionList = options;
char *cmdStr = getTextString(TEXT_UNKNOWN);
int op;
@@ -1626,7 +1626,7 @@ modifyLogicalUnit(int operandLen, char *operand[], cmdOptions_t *options)
* ****************************************************************************
*
* failoverLogicalUnit -
- * mpathadm failover {logical-unit | LU} <logical-unit name>, ...
+ * mpathadm failover {logical-unit | LU} <logical-unit name>, ...
*
* operand - pointer to operand list from user
*
@@ -1759,7 +1759,7 @@ getLogicalUnitOid(MP_CHAR *luFileName, MP_OID *pluOid)
int i, lu;
- int fd1, fd2;
+ int fd1, fd2;
ddi_devid_t devid1, devid2;
if (NULL == pluOid) {
@@ -1882,7 +1882,7 @@ getLogicalUnitOid(MP_CHAR *luFileName, MP_OID *pluOid)
* ****************************************************************************
*
* listInitiatorPort -
- * mpathadm list initiator-port [<initiator-port name>, ...]
+ * mpathadm list initiator-port [<initiator-port name>, ...]
*
* operandLen - number of operands user passed into the cli
* operand - pointer to operand list from user
@@ -1893,7 +1893,7 @@ int
listInitiatorPort(int operandLen, char *operand[])
{
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
- MP_INITIATOR_PORT_PROPERTIES initProps;
+ MP_INITIATOR_PORT_PROPERTIES initProps;
MP_OID_LIST *pPluginOidList, *pInitOidList;
boolean_t bListIt = B_FALSE;
boolean_t *foundOp;
@@ -2005,7 +2005,7 @@ listInitiatorPort(int operandLen, char *operand[])
* ****************************************************************************
*
* listIndividualInitiatorPort -
- * used by listInitiatorPort to list info for one init port
+ * used by listInitiatorPort to list info for one init port
*
* initProps - properties of initiator port to list
*
@@ -2030,7 +2030,7 @@ listIndividualInitiatorPort(MP_INITIATOR_PORT_PROPERTIES initProps)
* ****************************************************************************
*
* showInitiatorPort -
- * mpathadm show initiator-port <initiator-port name>, ...
+ * mpathadm show initiator-port <initiator-port name>, ...
*
* operandLen - number of operands user passed into the cli
* operand - pointer to operand list from user
@@ -2041,7 +2041,7 @@ int
showInitiatorPort(int operandLen, char *operand[])
{
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
- MP_INITIATOR_PORT_PROPERTIES initProps;
+ MP_INITIATOR_PORT_PROPERTIES initProps;
MP_OID_LIST *pPluginOidList, *pInitOidList;
boolean_t bListIt = B_FALSE, bFoundIt = B_FALSE;
int op, i, iport;
@@ -2137,7 +2137,7 @@ showInitiatorPort(int operandLen, char *operand[])
* ****************************************************************************
*
* showIndividualInitiatorPort -
- * used by showInitiatorPort to show info for one init port
+ * used by showInitiatorPort to show info for one init port
*
* initProps - properties of initiator port to show
*
@@ -2169,7 +2169,7 @@ showIndividualInitiatorPort(MP_INITIATOR_PORT_PROPERTIES initProps)
* ****************************************************************************
*
* enablePath -
- * mpathadm enable path -i <initiator-port>
+ * mpathadm enable path -i <initiator-port>
* -t <target-port name> -l <logical-unit name>
*
* options - pointer to option list from user
@@ -2182,7 +2182,7 @@ enablePath(cmdOptions_t *options)
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
MP_OID pathOid;
- cmdOptions_t *optionList = options;
+ cmdOptions_t *optionList = options;
boolean_t bHaveInit = B_FALSE, bHaveTarg = B_FALSE, bHaveLu = B_FALSE;
for (; optionList->optval; optionList++) {
@@ -2252,7 +2252,7 @@ enablePath(cmdOptions_t *options)
* ****************************************************************************
*
* disablePath -
- * mpathadm disable path -i <initiator-port>
+ * mpathadm disable path -i <initiator-port>
* -t <target-port name> -l <logical-unit name>
*
* options - pointer to option list from user
@@ -2265,7 +2265,7 @@ disablePath(cmdOptions_t *options)
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
MP_OID pathOid;
- cmdOptions_t *optionList = options;
+ cmdOptions_t *optionList = options;
boolean_t bHaveInit = B_FALSE, bHaveTarg = B_FALSE,
bHaveLu = B_FALSE;
@@ -2337,7 +2337,7 @@ disablePath(cmdOptions_t *options)
* ****************************************************************************
*
* overridePath -
- * mpathadm override path {-i <initiator-port>
+ * mpathadm override path {-i <initiator-port>
* -t <target-port name> | -c} <logical-unit name>
*
* options - pointer to option list from user
@@ -2351,7 +2351,7 @@ overridePath(cmdOptions_t *options)
MP_OID pathOid, luOid;
boolean_t bCancelOverride = B_FALSE;
MP_CHAR pLuDeviceFileName[256];
- cmdOptions_t *optionList = options;
+ cmdOptions_t *optionList = options;
/* First check to see if we have the cancel option, */
/* May as well save off the lun while we're at it */
@@ -2447,7 +2447,7 @@ boolean_t
getPathOid(cmdOptions_t *options, MP_OID *pPathOid)
{
MP_STATUS mpstatus = MP_STATUS_SUCCESS;
- MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
+ MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
MP_PATH_LOGICAL_UNIT_PROPERTIES pathProps;
MP_INITIATOR_PORT_PROPERTIES initProps;
MP_TARGET_PORT_PROPERTIES targProps;
@@ -2461,7 +2461,7 @@ getPathOid(cmdOptions_t *options, MP_OID *pPathOid)
MP_CHAR luDeviceFileName[256];
boolean_t bHaveTarg = B_FALSE, bHaveLu = B_FALSE,
bHaveInit = B_FALSE;
- cmdOptions_t *optionList = options;
+ cmdOptions_t *optionList = options;
int i, lu, pa;
if (NULL == pPathOid) {
@@ -2623,7 +2623,7 @@ getPathOid(cmdOptions_t *options, MP_OID *pPathOid)
* ****************************************************************************
*
* getLbValueFromString
- * Gets the MP_LOAD_BALANCE_TYPE specified load balance type string
+ * Gets the MP_LOAD_BALANCE_TYPE specified load balance type string
*
* lbStr - load balance string defined in the .h file
* This is what users will be required to feed into the
@@ -2713,7 +2713,7 @@ getLbValueFromString(char *lbStr)
* ****************************************************************************
*
* displayLogicalUnitNameTypeString
- * Displays the text equivalent string for the MP_LOGICAL_UNIT_NAME_TYPE
+ * Displays the text equivalent string for the MP_LOGICAL_UNIT_NAME_TYPE
* specified load balance type
*
* typeVal - load balance type defined in the MPAPI spec
@@ -2758,7 +2758,7 @@ displayLogicalUnitNameTypeString(MP_LOGICAL_UNIT_NAME_TYPE typeVal)
* ****************************************************************************
*
* displayLoadBalanceString
- * Displays the text equivalent string for the MP_LOAD_BALANCE_TYPE
+ * Displays the text equivalent string for the MP_LOAD_BALANCE_TYPE
* specified load balance type
*
* lbVal - load balance type defined in the MPAPI spec
@@ -2856,7 +2856,7 @@ displayLoadBalanceString(MP_LOAD_BALANCE_TYPE lbVal)
* ****************************************************************************
*
* displayTransportTypeString
- * Displays the text equivalent string for the MP_PORT_TRANSPORT_TYPE
+ * Displays the text equivalent string for the MP_PORT_TRANSPORT_TYPE
* specified load balance type
*
* transportTypeVal - transport type defined in the MPAPI spec
@@ -2900,7 +2900,7 @@ displayTransportTypeString(MP_PORT_TRANSPORT_TYPE transportTypeVal)
* ****************************************************************************
*
* getMpStatusStr
- * Gets the string description for the specified load balance type value
+ * Gets the string description for the specified load balance type value
*
* mpstatus - MP_STATUS value
*
@@ -2964,7 +2964,7 @@ getMpStatusStr(MP_STATUS mpstatus)
* ****************************************************************************
*
* GetPathStateStr
- * Gets the string description for the specified path state type value
+ * Gets the string description for the specified path state type value
*
* pathState - MP_PATH_STATE values
*
@@ -3021,7 +3021,7 @@ getPathStateStr(MP_PATH_STATE pathState)
* ****************************************************************************
*
* getAccessStateStr
- * Gets the string description for the specified access state type value
+ * Gets the string description for the specified access state type value
*
* accessState - MP_ACCESS_STATE_TYPE values
*
@@ -3069,7 +3069,7 @@ getAccessStateStr(MP_ACCESS_STATE_TYPE accessState)
* ****************************************************************************
*
* displayArray
- * Print out the specified array.
+ * Print out the specified array.
*
* arrayToDisplay - array to display
* arraySize - size of array to display
@@ -3094,7 +3094,7 @@ displayArray(MP_CHAR *arrayToDisplay, int arraySize)
* ****************************************************************************
*
* getStringArray
- * Return a null terminated array for the specified array as a string,
+ * Return a null terminated array for the specified array as a string,
* This is used for inputting into the %s in formatted strings.
*
* arrayToDisplay - array to display
@@ -3129,8 +3129,8 @@ getStringArray(MP_CHAR *arrayToDisplay, int arraySize)
* ****************************************************************************
*
* displayWideArray
- * Print out the specified wide character array as a string,
- * adding the null termination
+ * Print out the specified wide character array as a string,
+ * adding the null termination
*
* arrayToDisplay - array to display
* arraySize - size of array to display
@@ -3155,7 +3155,7 @@ displayWideArray(MP_WCHAR *arrayToDisplay, int arraySize)
* ****************************************************************************
*
* listfunc
- * Used by cmdparse for list clis
+ * Used by cmdparse for list clis
*
* ****************************************************************************
*/
@@ -3164,7 +3164,7 @@ static int
listFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case MPATH_SUPPORT:
@@ -3191,7 +3191,7 @@ listFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
* ****************************************************************************
*
* showFunc
- * used bycmdparse for show clis
+ * used bycmdparse for show clis
*
* ****************************************************************************
*/
@@ -3200,7 +3200,7 @@ static int
showFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case MPATH_SUPPORT:
@@ -3225,7 +3225,7 @@ showFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
* ****************************************************************************
*
* modifyFunc
- * Used by cmdparse for midify clis
+ * Used by cmdparse for midify clis
*
*
* ****************************************************************************
@@ -3235,7 +3235,7 @@ static int
modifyFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case MPATH_SUPPORT:
@@ -3258,7 +3258,7 @@ modifyFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
* ****************************************************************************
*
* enableFunc
- * Used by cmdpars for enable clis
+ * Used by cmdpars for enable clis
*
* ****************************************************************************
*/
@@ -3267,7 +3267,7 @@ static int
enableFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case PATH:
@@ -3286,7 +3286,7 @@ enableFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
* ****************************************************************************
*
* disableFunc
- * Used by cmdpars for disable clis
+ * Used by cmdpars for disable clis
*
* ****************************************************************************
*/
@@ -3295,7 +3295,7 @@ static int
disableFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case PATH:
@@ -3314,7 +3314,7 @@ disableFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
* ****************************************************************************
*
* failoverFunc
- * Used by cmdpars for failover clis
+ * Used by cmdpars for failover clis
*
* ****************************************************************************
*/
@@ -3323,7 +3323,7 @@ static int
failoverFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case LOGICAL_UNIT:
@@ -3342,17 +3342,17 @@ failoverFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
* ****************************************************************************
*
* overrideFunc
- * Used by cmdpars for override clis
+ * Used by cmdpars for override clis
*
* ****************************************************************************
*/
/*ARGSUSED*/
static int
overrideFunc(int operandLen, char *operand[],
- int object, cmdOptions_t *options,
+ int object, cmdOptions_t *options,
void *addArgs)
{
- int ret = 0;
+ int ret = 0;
switch (object) {
case PATH:
@@ -3378,11 +3378,11 @@ overrideFunc(int operandLen, char *operand[],
int
main(int argc, char *argv[])
{
- synTables_t synTables;
- char versionString[VERSION_STRING_MAX_LEN];
- int ret;
- int funcRet;
- void *subcommandArgs = NULL;
+ synTables_t synTables;
+ char versionString[VERSION_STRING_MAX_LEN];
+ int ret;
+ int funcRet;
+ void *subcommandArgs = NULL;
/* set global command name */
cmdName = getExecBasename(argv[0]);
diff --git a/usr/src/cmd/rcm_daemon/common/aggr_rcm.c b/usr/src/cmd/rcm_daemon/common/aggr_rcm.c
index d2aa27d735..5810709ad1 100644
--- a/usr/src/cmd/rcm_daemon/common/aggr_rcm.c
+++ b/usr/src/cmd/rcm_daemon/common/aggr_rcm.c
@@ -126,13 +126,13 @@ static int aggr_configure_all(rcm_handle_t *, datalink_id_t,
boolean_t *);
/* Module private routines */
-static int cache_update(rcm_handle_t *);
-static void cache_remove(link_cache_t *);
-static void cache_insert(link_cache_t *);
-static void node_free(link_cache_t *);
-static void aggr_list_remove(dl_aggr_t *);
-static void aggr_list_insert(dl_aggr_t *);
-static void aggr_list_free();
+static int cache_update(rcm_handle_t *);
+static void cache_remove(link_cache_t *);
+static void cache_insert(link_cache_t *);
+static void node_free(link_cache_t *);
+static void aggr_list_remove(dl_aggr_t *);
+static void aggr_list_insert(dl_aggr_t *);
+static void aggr_list_free();
static link_cache_t *cache_lookup(rcm_handle_t *, char *, char);
static int aggr_consumer_offline(rcm_handle_t *, link_cache_t *,
char **, uint_t, rcm_info_t **);
@@ -140,8 +140,8 @@ static int aggr_consumer_online(rcm_handle_t *, link_cache_t *,
char **, uint_t, rcm_info_t **);
static int aggr_offline_port(link_cache_t *, cache_node_state_t);
static int aggr_online_port(link_cache_t *, boolean_t *);
-static char *aggr_usage(link_cache_t *);
-static void aggr_log_err(datalink_id_t, char **, char *);
+static char *aggr_usage(link_cache_t *);
+static void aggr_log_err(datalink_id_t, char **, char *);
static int aggr_consumer_notify(rcm_handle_t *, datalink_id_t,
char **, uint_t, rcm_info_t **);
@@ -177,12 +177,12 @@ rcm_mod_init(void)
cache_head.vc_prev = NULL;
cache_tail.vc_prev = &cache_head;
cache_tail.vc_next = NULL;
- (void) mutex_init(&cache_lock, 0, NULL);
+ (void) mutex_init(&cache_lock, USYNC_THREAD, NULL);
aggr_head.da_next = &aggr_tail;
aggr_head.da_prev = NULL;
aggr_tail.da_prev = &aggr_head;
aggr_tail.da_next = NULL;
- (void) mutex_init(&aggr_list_lock, NULL, NULL);
+ (void) mutex_init(&aggr_list_lock, USYNC_THREAD, NULL);
if ((status = dladm_open(&dld_handle)) != DLADM_STATUS_OK) {
rcm_log_message(RCM_WARNING,
diff --git a/usr/src/cmd/rcm_daemon/common/ip_rcm.c b/usr/src/cmd/rcm_daemon/common/ip_rcm.c
index 28bca35c24..a389fc770d 100644
--- a/usr/src/cmd/rcm_daemon/common/ip_rcm.c
+++ b/usr/src/cmd/rcm_daemon/common/ip_rcm.c
@@ -121,7 +121,7 @@ typedef struct ip_pif {
typedef struct ip_lif
{
struct ip_lif *li_next; /* ptr to next lif */
- struct ip_lif *li_prev; /* previous next ptr */
+ struct ip_lif *li_prev; /* previous next ptr */
ip_pif_t *li_pif; /* back ptr to phy int */
ushort_t li_ifnum; /* interface number */
union {
@@ -180,20 +180,20 @@ static int ip_notify_event(rcm_handle_t *, char *, id_t, uint_t,
char **, nvlist_t *, rcm_info_t **);
/* Module private routines */
-static void free_cache();
-static int update_cache(rcm_handle_t *);
-static void cache_remove(ip_cache_t *);
+static void free_cache();
+static int update_cache(rcm_handle_t *);
+static void cache_remove(ip_cache_t *);
static ip_cache_t *cache_lookup(rcm_handle_t *, char *, char);
-static void free_node(ip_cache_t *);
-static void cache_insert(ip_cache_t *);
-static char *ip_usage(ip_cache_t *);
-static int update_pif(rcm_handle_t *, int, int, struct ifaddrs *);
-static int ip_ipmp_offline(ip_cache_t *);
+static void free_node(ip_cache_t *);
+static void cache_insert(ip_cache_t *);
+static char *ip_usage(ip_cache_t *);
+static int update_pif(rcm_handle_t *, int, int, struct ifaddrs *);
+static int ip_ipmp_offline(ip_cache_t *);
static int ip_ipmp_undo_offline(ip_cache_t *);
static int if_cfginfo(ip_cache_t *, uint_t);
static int if_unplumb(ip_cache_t *);
static int if_replumb(ip_cache_t *);
-static void ip_log_err(ip_cache_t *, char **, char *);
+static void ip_log_err(ip_cache_t *, char **, char *);
static char *get_link_resource(const char *);
static void clr_cfg_state(ip_pif_t *);
static int modop(char *, char *, int, char);
@@ -204,7 +204,7 @@ static int ip_onlinelist(rcm_handle_t *, ip_cache_t *, char **, uint_t,
rcm_info_t **);
static int ip_offlinelist(rcm_handle_t *, ip_cache_t *, char **, uint_t,
rcm_info_t **);
-static char **ip_get_addrlist(ip_cache_t *);
+static char **ip_get_addrlist(ip_cache_t *);
static void ip_free_addrlist(char **);
static void ip_consumer_notify(rcm_handle_t *, datalink_id_t, char **,
uint_t, rcm_info_t **);
@@ -251,7 +251,7 @@ rcm_mod_init(void)
cache_head.ip_prev = NULL;
cache_tail.ip_prev = &cache_head;
cache_tail.ip_next = NULL;
- (void) mutex_init(&cache_lock, NULL, NULL);
+ (void) mutex_init(&cache_lock, USYNC_THREAD, NULL);
if ((status = dladm_open(&dld_handle)) != DLADM_STATUS_OK) {
rcm_log_message(RCM_WARNING,
@@ -654,7 +654,7 @@ ip_get_info(rcm_handle_t *hd, char *rsrc, id_t id, uint_t flags,
/*ARGSUSED*/
static int
ip_suspend(rcm_handle_t *hd, char *rsrc, id_t id, timespec_t *interval,
- uint_t flags, char **errorp, rcm_info_t **depend_info)
+ uint_t flags, char **errorp, rcm_info_t **depend_info)
{
/* Guard against bad arguments */
assert(hd != NULL);
@@ -674,7 +674,7 @@ ip_suspend(rcm_handle_t *hd, char *rsrc, id_t id, timespec_t *interval,
/*ARGSUSED*/
static int
ip_resume(rcm_handle_t *hd, char *rsrc, id_t id, uint_t flags,
- char **errorp, rcm_info_t ** depend_info)
+ char **errorp, rcm_info_t ** depend_info)
{
/* Guard against bad arguments */
assert(hd != NULL);
@@ -694,7 +694,7 @@ ip_resume(rcm_handle_t *hd, char *rsrc, id_t id, uint_t flags,
/*ARGSUSED*/
static int
ip_remove(rcm_handle_t *hd, char *rsrc, id_t id, uint_t flags,
- char **errorp, rcm_info_t **depend_info)
+ char **errorp, rcm_info_t **depend_info)
{
ip_cache_t *node;
@@ -735,7 +735,7 @@ ip_remove(rcm_handle_t *hd, char *rsrc, id_t id, uint_t flags,
/*ARGSUSED*/
static int
ip_notify_event(rcm_handle_t *hd, char *rsrc, id_t id, uint_t flags,
- char **errorp, nvlist_t *nvl, rcm_info_t **depend_info)
+ char **errorp, nvlist_t *nvl, rcm_info_t **depend_info)
{
datalink_id_t linkid;
nvpair_t *nvp = NULL;
@@ -2091,7 +2091,7 @@ ip_plink(int mux_fd, int muxid_fd, int fd, struct lifreq *lifr)
/*ARGSUSED*/
static int
ip_onlinelist(rcm_handle_t *hd, ip_cache_t *node, char **errorp, uint_t flags,
- rcm_info_t **depend_info)
+ rcm_info_t **depend_info)
{
char **addrlist;
int ret = RCM_SUCCESS;
@@ -2120,7 +2120,7 @@ ip_onlinelist(rcm_handle_t *hd, ip_cache_t *node, char **errorp, uint_t flags,
/*ARGSUSED*/
static int
ip_offlinelist(rcm_handle_t *hd, ip_cache_t *node, char **errorp, uint_t flags,
- rcm_info_t **depend_info)
+ rcm_info_t **depend_info)
{
char **addrlist;
int ret = RCM_SUCCESS;
diff --git a/usr/src/cmd/rcm_daemon/common/network_rcm.c b/usr/src/cmd/rcm_daemon/common/network_rcm.c
index dbb60775fa..792d4549f1 100644
--- a/usr/src/cmd/rcm_daemon/common/network_rcm.c
+++ b/usr/src/cmd/rcm_daemon/common/network_rcm.c
@@ -141,7 +141,7 @@ rcm_mod_init(void)
cache_head.prev = NULL;
cache_tail.prev = &cache_head;
cache_tail.next = NULL;
- (void) mutex_init(&cache_lock, NULL, NULL);
+ (void) mutex_init(&cache_lock, USYNC_THREAD, NULL);
if ((status = dladm_open(&dld_handle)) != DLADM_STATUS_OK) {
rcm_log_message(RCM_WARNING,
diff --git a/usr/src/cmd/rcm_daemon/common/rcm_subr.c b/usr/src/cmd/rcm_daemon/common/rcm_subr.c
index 82234e1894..4c150f3205 100644
--- a/usr/src/cmd/rcm_daemon/common/rcm_subr.c
+++ b/usr/src/cmd/rcm_daemon/common/rcm_subr.c
@@ -22,8 +22,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "rcm_impl.h"
#include "rcm_module.h"
@@ -235,7 +233,7 @@ module_load(char *modname)
if (module->dlhandle == NULL) {
rcm_log_message(RCM_NOTICE,
- gettext("cannot open module %s\n"), modname);
+ gettext("cannot open module %s\n"), modname);
goto fail;
}
@@ -243,9 +241,9 @@ module_load(char *modname)
* dlsym rcm_mod_init/fini/info() entry points
*/
module->init = (struct rcm_mod_ops *(*)())dlsym(
- module->dlhandle, "rcm_mod_init");
+ module->dlhandle, "rcm_mod_init");
module->fini = (int (*)())dlsym(
- module->dlhandle, "rcm_mod_fini");
+ module->dlhandle, "rcm_mod_fini");
module->info = (const char *(*)())dlsym(module->dlhandle,
"rcm_mod_info");
if (module->init == NULL || module->fini == NULL ||
@@ -266,7 +264,7 @@ module_load(char *modname)
if ((module->modops = module_init(module)) == NULL) {
if (module->dlhandle)
rcm_log_message(RCM_ERROR,
- gettext("cannot init module %s\n"), modname);
+ gettext("cannot init module %s\n"), modname);
goto fail;
}
@@ -1566,7 +1564,7 @@ rcmd_db_init()
module_t *module;
if (strcmp(entp->d_name, ".") == 0 ||
- strcmp(entp->d_name, "..") == 0)
+ strcmp(entp->d_name, "..") == 0)
continue;
if (rcm_script == 0) {
@@ -1750,7 +1748,7 @@ rcmd_db_clean()
rcm_log_message(RCM_DEBUG,
"rcm_db_clean(): launch thread to clean database\n");
- if (thr_create(NULL, NULL, (void *(*)(void *))db_clean,
+ if (thr_create(NULL, 0, (void *(*)(void *))db_clean,
NULL, THR_DETACHED, NULL) != 0) {
rcm_log_message(RCM_WARNING,
gettext("failed to create cleanup thread %s\n"),
diff --git a/usr/src/cmd/refer/addbib.c b/usr/src/cmd/refer/addbib.c
index 99570efce7..8037bfa117 100644
--- a/usr/src/cmd/refer/addbib.c
+++ b/usr/src/cmd/refer/addbib.c
@@ -4,7 +4,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
@@ -12,9 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
#include <locale.h>
#include <stdio.h>
#include <ctype.h>
@@ -23,16 +20,16 @@
struct skeleton {
char prompt[20]; /* prompt user for entry */
- char keylet[5]; /* key letter for database */
+ char keylet[5]; /* key letter for database */
} bibskel[MAXENT] = {
" Author:", "%A",
" Title:", "%T",
" Journal:", "%J",
- " Volume:", "%V",
+ " Volume:", "%V",
" Pages:", "%P",
"Publisher:", "%I",
- " City:", "%C",
- " Date:", "%D",
+ " City:", "%C",
+ " Date:", "%D",
" Other:", "%O",
" Keywords:", "%K", };
@@ -134,7 +131,7 @@ addbib(FILE *fp, char *argv) /* add entries to a bibliographic database */
} else if (line[strlen(line)-2] == '\\') {
if (line[0] != '\\') {
line[strlen(line)-2] = '\n';
- line[strlen(line)-1] = NULL;
+ line[strlen(line)-1] = '\0';
trim(line);
fprintf(fp, "%s %s",
bibskel[i].keylet, line);
@@ -144,7 +141,7 @@ addbib(FILE *fp, char *argv) /* add entries to a bibliographic database */
fgets(line, BUFSIZ, stdin);
if (line[strlen(line)-2] == '\\') {
line[strlen(line)-2] = '\n';
- line[strlen(line)-1] = NULL;
+ line[strlen(line)-1] = '\0';
trim(line);
fputs(line, fp);
printf("> ");
@@ -197,7 +194,7 @@ trim(char line[]) /* trim line of trailing white space */
break;
}
line[++n] = '\n';
- line[++n] = NULL;
+ line[++n] = '\0';
}
void
@@ -208,7 +205,7 @@ bibedit(FILE *fp, char *cmd, char *arg) /* edit database with edit, ex, or vi */
fclose(fp);
while (!isspace(cmd[i]))
i++;
- cmd[i] = NULL;
+ cmd[i] = '\0';
if (fork() == 0) {
if (cmd[0] == 'v' && cmd[1] == 'i')
execlp(cmd, cmd, "+$", arg, NULL);
@@ -261,7 +258,7 @@ rd_skel(char *arg) /* redo bibskel from user-supplied file */
for (entry = 0; fgets(str, BUFSIZ, pfp); entry++) {
for (i = 0; str[i] != '\t' && str[i] != '\n'; i++)
bibskel[entry].prompt[i] = str[i];
- bibskel[entry].prompt[i] = NULL;
+ bibskel[entry].prompt[i] = '\0';
if (str[i] == '\n') {
fprintf(stderr, gettext(
"No tabs between promptfile fields.\n"));
@@ -271,7 +268,7 @@ rd_skel(char *arg) /* redo bibskel from user-supplied file */
}
for (i++, j = 0; str[i] != '\n'; i++, j++)
bibskel[entry].keylet[j] = str[i];
- bibskel[entry].keylet[j] = NULL;
+ bibskel[entry].keylet[j] = '\0';
if (entry >= MAXENT) {
fprintf(stderr, gettext(
diff --git a/usr/src/cmd/refer/refer2.c b/usr/src/cmd/refer/refer2.c
index f8605e227b..5d879cf320 100644
--- a/usr/src/cmd/refer/refer2.c
+++ b/usr/src/cmd/refer/refer2.c
@@ -4,7 +4,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
@@ -47,7 +47,7 @@ doref(char *line1)
int stat, nf, nr, query = 0, alph, digs;
again:
- buff[0] = dbuff[0] = NULL;
+ buff[0] = dbuff[0] = '\0';
if (biblio && Iline == 1 && line1[0] == '%')
strcat(dbuff, line1);
while (input(line)) { /* get query */
diff --git a/usr/src/cmd/refer/refer4.c b/usr/src/cmd/refer/refer4.c
index e8cd5f22ab..560c4ec627 100644
--- a/usr/src/cmd/refer/refer4.c
+++ b/usr/src/cmd/refer/refer4.c
@@ -4,7 +4,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "refer..c"
#include <locale.h>
@@ -50,7 +48,7 @@ append(char *s)
;
lch = *--p;
if (postpunct && punctuat(lch))
- *p = NULL;
+ *p = '\0';
else /* pre-punctuation */
switch (lch) {
case '.':
@@ -60,7 +58,7 @@ append(char *s)
case ';':
case ':':
*p++ = lch;
- *p = NULL;
+ *p = '\0';
}
strcat(buff, s);
if (postpunct)
@@ -74,10 +72,10 @@ append(char *s)
for (p = buff; *p; p++)
;
if (*--p == '\n')
- *p = NULL;
+ *p = '\0';
*p++ = lch;
*p++ = '\n';
- *p = NULL;
+ *p = '\0';
}
if (strlen(buff) > BUFSIZ)
err(gettext("output buff too long (%d)"), BUFSIZ);
diff --git a/usr/src/cmd/refer/sortbib.c b/usr/src/cmd/refer/sortbib.c
index b05bf3b96e..fd1a7eeeba 100644
--- a/usr/src/cmd/refer/sortbib.c
+++ b/usr/src/cmd/refer/sortbib.c
@@ -4,7 +4,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <locale.h>
#include <stdio.h>
#include <signal.h>
@@ -136,7 +134,7 @@ sortbib(FILE *fp, FILE *tfp, int i)
error(tempfile);
}
}
- *fld[0] = *fld[1] = *fld[2] = *fld[3] = NULL;
+ *fld[0] = *fld[1] = *fld[2] = *fld[3] = '\0';
oneauth = 0; /* reset number of authors */
lastoffset = offset; /* save for next time */
}
@@ -211,7 +209,7 @@ parse(char line[], char fld[][BUF])
int n, i, j;
for (i = 0; i < 8; i++) /* zap out old strings */
- *wd[i] = NULL;
+ *wd[i] = '\0';
n = sscanf(line, "%s %s %s %s %s %s %s %s",
wd[0], wd[1], wd[2], wd[3], wd[4], wd[5], wd[6], wd[7]);
for (i = 0; i < 4; i++) {
@@ -290,11 +288,11 @@ eval(char keystr[])
multauth = 1;
i++;
}
- if (keystr[i] == NULL)
+ if (keystr[i] == '\0')
break;
keystr[j] = keystr[i];
}
- keystr[j] = NULL;
+ keystr[j] = '\0';
}
/* exit in case of various system errors */
@@ -321,7 +319,7 @@ endcomma(char *str)
n = strlen(str) - 1;
if (str[n] == ',') {
- str[n] = NULL;
+ str[n] = '\0';
return (1);
}
return (0);
diff --git a/usr/src/cmd/rmformat/rmf_slice.c b/usr/src/cmd/rmformat/rmf_slice.c
index ec8d5209e0..bac5da9ca4 100644
--- a/usr/src/cmd/rmformat/rmf_slice.c
+++ b/usr/src/cmd/rmformat/rmf_slice.c
@@ -758,7 +758,7 @@ str2sector(char *str)
mul_factor = 1024;
s1++;
}
- if ((*s1 != 'B') || (*(++s1) != NULL)) {
+ if ((*s1 != 'B') || (*(++s1) != '\0')) {
(void) fprintf(stderr,
gettext("Extra chars at the end\n"));
free(base);
@@ -770,7 +770,7 @@ str2sector(char *str)
*s2 = '\0';
}
}
- *s2 = NULL;
+ *s2 = '\0';
size = my_atoll(base);
if ((!mul_factor) || (size == -1)) {
diff --git a/usr/src/cmd/rpcbind/rpcb_stat.c b/usr/src/cmd/rpcbind/rpcb_stat.c
index ed831505f3..4b998af551 100644
--- a/usr/src/cmd/rpcbind/rpcb_stat.c
+++ b/usr/src/cmd/rpcbind/rpcb_stat.c
@@ -111,7 +111,7 @@ rpcbs_getaddr(int rtype, rpcprog_t prog, rpcvers_t vers, char *netid,
(strcmp(al->netid, netid) == 0)) {
(void) rw_unlock(&inf_lock);
- if ((uaddr == NULL) || (uaddr[0] == NULL))
+ if ((uaddr == NULL) || (uaddr[0] == '\0'))
atomic_add_int((uint_t *)&al->failure, 1);
else
atomic_add_int((uint_t *)&al->success, 1);
@@ -138,7 +138,7 @@ rpcbs_getaddr(int rtype, rpcprog_t prog, rpcvers_t vers, char *netid,
al->prog = prog;
al->vers = vers;
al->netid = nconf->nc_netid;
- if ((uaddr == NULL) || (uaddr[0] == NULL)) {
+ if ((uaddr == NULL) || (uaddr[0] == '\0')) {
al->failure = 1;
al->success = 0;
} else {
@@ -154,7 +154,7 @@ rpcbs_getaddr(int rtype, rpcprog_t prog, rpcvers_t vers, char *netid,
free(al);
- if ((uaddr == NULL) || (uaddr[0] == NULL))
+ if ((uaddr == NULL) || (uaddr[0] == '\0'))
atomic_add_int((uint_t *)&wal->failure, 1);
else
atomic_add_int((uint_t *)&wal->success, 1);
diff --git a/usr/src/cmd/rpcbind/rpcbind.c b/usr/src/cmd/rpcbind/rpcbind.c
index 694e4f942f..cf763d978e 100644
--- a/usr/src/cmd/rpcbind/rpcbind.c
+++ b/usr/src/cmd/rpcbind/rpcbind.c
@@ -312,7 +312,7 @@ main(int argc, char *argv[])
ipv6flag = Is_ipv6present();
rpcb_check_init();
- nc_handle = setnetconfig(); /* open netconfig file */
+ nc_handle = setnetconfig(); /* open netconfig file */
if (nc_handle == NULL) {
syslog(LOG_ERR, "could not read /etc/netconfig");
exit(1);
@@ -323,8 +323,8 @@ main(int argc, char *argv[])
}
endnetconfig(nc_handle);
- if ((loopback_dg[0] == NULL) && (loopback_vc[0] == NULL) &&
- (loopback_vc_ord[0] == NULL)) {
+ if ((loopback_dg[0] == '\0') && (loopback_vc[0] == '\0') &&
+ (loopback_vc_ord[0] == '\0')) {
syslog(LOG_ERR, "could not find loopback transports");
exit(1);
}
@@ -617,7 +617,7 @@ init_transport(struct netconfig *nconf)
PMAPLIST *pml;
if (!svc_register(my_xprt, PMAPPROG, PMAPVERS,
- pmap_service, NULL)) {
+ pmap_service, 0)) {
syslog(LOG_ERR, "could not register on %s",
nconf->nc_netid);
goto error;
diff --git a/usr/src/cmd/sa/sar.c b/usr/src/cmd/sa/sar.c
index 17de1c0684..08f9ca082b 100644
--- a/usr/src/cmd/sa/sar.c
+++ b/usr/src/cmd/sa/sar.c
@@ -24,7 +24,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
@@ -93,7 +93,7 @@ static int tabflg;
static char options[30], fopt[30];
static float tdiff, sec_diff, totsec_diff = 0.0, percent;
static float start_time, end_time, isec;
-static int fin, fout;
+static int fin, fout;
static pid_t childid;
static int pipedes[2];
static char arg1[10], arg2[10];
@@ -127,26 +127,26 @@ main(int argc, char **argv)
*/
while ((i = getopt(argc, argv, "ubdycwaqvmpgrkAo:s:e:i:f:")) != EOF)
switch (ccc = (char)i) {
- case 'o':
+ case 'o':
oflg++;
if (strlcpy(ofile, optarg, sizeof (ofile)) >=
sizeof (ofile)) {
fail(2, "-o filename is too long: %s", optarg);
}
break;
- case 's':
+ case 's':
if (sscanf(optarg, "%d:%d:%d",
&args.tm_hour, &args.tm_min, &args.tm_sec) < 1)
fail(0, "-%c %s -- illegal option argument",
ccc, optarg);
else {
- sflg++,
+ sflg++;
start_time = args.tm_hour*3600.0 +
args.tm_min*60.0 +
args.tm_sec;
}
break;
- case 'e':
+ case 'e':
if (sscanf(optarg, "%d:%d:%d",
&arge.tm_hour, &arge.tm_min, &arge.tm_sec) < 1)
fail(0, "-%c %s -- illegal option argument",
@@ -158,7 +158,7 @@ main(int argc, char **argv)
arge.tm_sec;
}
break;
- case 'i':
+ case 'i':
if (sscanf(optarg, "%f", &isec) < 1)
fail(0, "-%c %s -- illegal option argument",
ccc, optarg);
@@ -167,14 +167,14 @@ main(int argc, char **argv)
iflg++;
}
break;
- case 'f':
+ case 'f':
fflg++;
if (strlcpy(flnm, optarg, sizeof (flnm)) >=
sizeof (ofile)) {
fail(2, "-f filename is too long: %s", optarg);
}
break;
- case '?':
+ case '?':
usage();
exit(1);
break;
@@ -200,7 +200,7 @@ main(int argc, char **argv)
* time or from a file.
*/
switch (argc - optind) {
- case 0: /* Get input data from file */
+ case 0: /* Get input data from file */
if (fflg == 0) {
temp = time(NULL);
curt = localtime(&temp);
@@ -210,12 +210,12 @@ main(int argc, char **argv)
if ((fin = open(flnm, 0)) == -1)
fail(1, "can't open %s", flnm);
break;
- case 1: /* Real time data; one cycle */
+ case 1: /* Real time data; one cycle */
realtime++;
t = safe_strtoi(argv[optind], "invalid sampling interval");
n = 2;
break;
- case 2: /* Real time data; specified cycles */
+ case 2: /* Real time data; specified cycles */
default:
realtime++;
t = safe_strtoi(argv[optind], "invalid sampling interval");
@@ -415,13 +415,13 @@ prpass(int input_pipe)
* The data file must exceed this size to be valid.
*/
if (!input_pipe) {
- if ((curr_pos = lseek(fin, 0, SEEK_CUR)) ==
- (off_t)-1)
- fail(1, "lseek failed");
- if (in_stat.st_size < curr_pos ||
- size > in_stat.st_size - curr_pos)
- fail(2, "data file corrupt; specified size"
- "exceeds actual");
+ if ((curr_pos = lseek(fin, 0, SEEK_CUR)) ==
+ (off_t)-1)
+ fail(1, "lseek failed");
+ if (in_stat.st_size < curr_pos ||
+ size > in_stat.st_size - curr_pos)
+ fail(2, "data file corrupt; "
+ "specified size exceeds actual");
}
safe_zalloc((void **)&nxio, size, 1);
@@ -535,9 +535,9 @@ prpass(int input_pipe)
if (recno++ > 1) {
ts = ox.csi.cpu[0] + ox.csi.cpu[1] +
- ox.csi.cpu[2] + ox.csi.cpu[3];
+ ox.csi.cpu[2] + ox.csi.cpu[3];
te = nx.csi.cpu[0] + nx.csi.cpu[1] +
- nx.csi.cpu[2] + nx.csi.cpu[3];
+ nx.csi.cpu[2] + nx.csi.cpu[3];
tdiff = (float)(te - ts);
sec_diff = tdiff / hz;
percent = 100.0 / tdiff;
@@ -637,121 +637,121 @@ prthdg(void)
(void) printf("\n");
prttim();
- while ((ccc = fopt[jj++]) != NULL) {
+ while ((ccc = fopt[jj++]) != '\0') {
tsttab();
switch (ccc) {
- case 'u':
+ case 'u':
(void) printf(" %7s %7s %7s %7s\n",
- "%usr",
- "%sys",
- "%wio",
- "%idle");
+ "%usr",
+ "%sys",
+ "%wio",
+ "%idle");
break;
- case 'b':
+ case 'b':
(void) printf(" %7s %7s %7s %7s %7s %7s %7s %7s\n",
- "bread/s",
- "lread/s",
- "%rcache",
- "bwrit/s",
- "lwrit/s",
- "%wcache",
- "pread/s",
- "pwrit/s");
+ "bread/s",
+ "lread/s",
+ "%rcache",
+ "bwrit/s",
+ "lwrit/s",
+ "%wcache",
+ "pread/s",
+ "pwrit/s");
break;
- case 'd':
+ case 'd':
(void) printf(" %-8.8s %7s %7s %7s %7s %7s %7s\n",
- "device",
- "%busy",
- "avque",
- "r+w/s",
- "blks/s",
- "avwait",
- "avserv");
+ "device",
+ "%busy",
+ "avque",
+ "r+w/s",
+ "blks/s",
+ "avwait",
+ "avserv");
break;
- case 'y':
+ case 'y':
(void) printf(" %7s %7s %7s %7s %7s %7s\n",
- "rawch/s",
- "canch/s",
- "outch/s",
- "rcvin/s",
- "xmtin/s",
- "mdmin/s");
+ "rawch/s",
+ "canch/s",
+ "outch/s",
+ "rcvin/s",
+ "xmtin/s",
+ "mdmin/s");
break;
- case 'c':
+ case 'c':
(void) printf(" %7s %7s %7s %7s %7s %7s %7s\n",
- "scall/s",
- "sread/s",
- "swrit/s",
- "fork/s",
- "exec/s",
- "rchar/s",
- "wchar/s");
+ "scall/s",
+ "sread/s",
+ "swrit/s",
+ "fork/s",
+ "exec/s",
+ "rchar/s",
+ "wchar/s");
break;
- case 'w':
+ case 'w':
(void) printf(" %7s %7s %7s %7s %7s\n",
- "swpin/s",
- "bswin/s",
- "swpot/s",
- "bswot/s",
- "pswch/s");
+ "swpin/s",
+ "bswin/s",
+ "swpot/s",
+ "bswot/s",
+ "pswch/s");
break;
- case 'a':
+ case 'a':
(void) printf(" %7s %7s %7s\n",
- "iget/s",
- "namei/s",
- "dirbk/s");
+ "iget/s",
+ "namei/s",
+ "dirbk/s");
break;
- case 'q':
+ case 'q':
(void) printf(" %7s %7s %7s %7s\n",
- "runq-sz",
- "%runocc",
- "swpq-sz",
- "%swpocc");
+ "runq-sz",
+ "%runocc",
+ "swpq-sz",
+ "%swpocc");
break;
- case 'v':
+ case 'v':
(void) printf(" %s %s %s %s\n",
- "proc-sz ov",
- "inod-sz ov",
- "file-sz ov",
- "lock-sz");
+ "proc-sz ov",
+ "inod-sz ov",
+ "file-sz ov",
+ "lock-sz");
break;
- case 'm':
+ case 'm':
(void) printf(" %7s %7s\n",
- "msg/s",
- "sema/s");
+ "msg/s",
+ "sema/s");
break;
- case 'p':
+ case 'p':
(void) printf(" %7s %7s %7s %7s %7s %7s\n",
- "atch/s",
- "pgin/s",
- "ppgin/s",
- "pflt/s",
- "vflt/s",
- "slock/s");
+ "atch/s",
+ "pgin/s",
+ "ppgin/s",
+ "pflt/s",
+ "vflt/s",
+ "slock/s");
break;
- case 'g':
+ case 'g':
(void) printf(" %8s %8s %8s %8s %8s\n",
- "pgout/s",
- "ppgout/s",
- "pgfree/s",
- "pgscan/s",
- "%ufs_ipf");
+ "pgout/s",
+ "ppgout/s",
+ "pgfree/s",
+ "pgscan/s",
+ "%ufs_ipf");
break;
- case 'r':
+ case 'r':
(void) printf(" %7s %8s\n",
- "freemem",
- "freeswap");
+ "freemem",
+ "freeswap");
break;
- case 'k':
+ case 'k':
(void) printf(" %7s %7s %5s %7s %7s %5s %11s %5s\n",
- "sml_mem",
- "alloc",
- "fail",
- "lg_mem",
- "alloc",
- "fail",
- "ovsz_alloc",
- "fail");
+ "sml_mem",
+ "alloc",
+ "fail",
+ "lg_mem",
+ "alloc",
+ "fail",
+ "ovsz_alloc",
+ "fail");
break;
}
}
@@ -769,16 +769,16 @@ update_counters(void)
iodevinfo_t *nio, *oio, *aio, *dio;
ulong_delta((uint64_t *)&nx.csi, (uint64_t *)&ox.csi,
- (uint64_t *)&dx.csi, (uint64_t *)&ax.csi, 0, sizeof (ax.csi));
+ (uint64_t *)&dx.csi, (uint64_t *)&ax.csi, 0, sizeof (ax.csi));
ulong_delta((uint64_t *)&nx.si, (uint64_t *)&ox.si,
- (uint64_t *)&dx.si, (uint64_t *)&ax.si, 0, sizeof (ax.si));
+ (uint64_t *)&dx.si, (uint64_t *)&ax.si, 0, sizeof (ax.si));
ulong_delta((uint64_t *)&nx.cvmi, (uint64_t *)&ox.cvmi,
- (uint64_t *)&dx.cvmi, (uint64_t *)&ax.cvmi, 0,
- sizeof (ax.cvmi));
+ (uint64_t *)&dx.cvmi, (uint64_t *)&ax.cvmi, 0,
+ sizeof (ax.cvmi));
ax.vmi.freemem += dx.vmi.freemem = nx.vmi.freemem - ox.vmi.freemem;
ax.vmi.swap_avail += dx.vmi.swap_avail =
- nx.vmi.swap_avail - ox.vmi.swap_avail;
+ nx.vmi.swap_avail - ox.vmi.swap_avail;
nio = nxio;
oio = oxio;
@@ -786,23 +786,23 @@ update_counters(void)
dio = dxio;
for (i = 0; i < niodevs; i++) {
aio->kios.wlastupdate += dio->kios.wlastupdate
- = nio->kios.wlastupdate - oio->kios.wlastupdate;
+ = nio->kios.wlastupdate - oio->kios.wlastupdate;
aio->kios.reads += dio->kios.reads
- = nio->kios.reads - oio->kios.reads;
+ = nio->kios.reads - oio->kios.reads;
aio->kios.writes += dio->kios.writes
- = nio->kios.writes - oio->kios.writes;
+ = nio->kios.writes - oio->kios.writes;
aio->kios.nread += dio->kios.nread
- = nio->kios.nread - oio->kios.nread;
+ = nio->kios.nread - oio->kios.nread;
aio->kios.nwritten += dio->kios.nwritten
- = nio->kios.nwritten - oio->kios.nwritten;
+ = nio->kios.nwritten - oio->kios.nwritten;
aio->kios.wlentime += dio->kios.wlentime
- = nio->kios.wlentime - oio->kios.wlentime;
+ = nio->kios.wlentime - oio->kios.wlentime;
aio->kios.rlentime += dio->kios.rlentime
- = nio->kios.rlentime - oio->kios.rlentime;
+ = nio->kios.rlentime - oio->kios.rlentime;
aio->kios.wtime += dio->kios.wtime
- = nio->kios.wtime - oio->kios.wtime;
+ = nio->kios.wtime - oio->kios.wtime;
aio->kios.rtime += dio->kios.rtime
- = nio->kios.rtime - oio->kios.rtime;
+ = nio->kios.rtime - oio->kios.rtime;
aio->ks.ks_snaptime += dio->ks.ks_snaptime
= nio->ks.ks_snaptime - oio->ks.ks_snaptime;
nio++;
@@ -816,24 +816,24 @@ static void
prt_u_opt(struct sa64 *xx)
{
(void) printf(" %7.0f %7.0f %7.0f %7.0f\n",
- (float)xx->csi.cpu[1] * percent,
- (float)xx->csi.cpu[2] * percent,
- (float)xx->csi.cpu[3] * percent,
- (float)xx->csi.cpu[0] * percent);
+ (float)xx->csi.cpu[1] * percent,
+ (float)xx->csi.cpu[2] * percent,
+ (float)xx->csi.cpu[3] * percent,
+ (float)xx->csi.cpu[0] * percent);
}
static void
prt_b_opt(struct sa64 *xx)
{
(void) printf(" %7.0f %7.0f %7.0f %7.0f %7.0f %7.0f %7.0f %7.0f\n",
- (float)xx->csi.bread / sec_diff,
- (float)xx->csi.lread / sec_diff,
- freq((float)xx->csi.lread, (float)xx->csi.bread),
- (float)xx->csi.bwrite / sec_diff,
- (float)xx->csi.lwrite / sec_diff,
- freq((float)xx->csi.lwrite, (float)xx->csi.bwrite),
- (float)xx->csi.phread / sec_diff,
- (float)xx->csi.phwrite / sec_diff);
+ (float)xx->csi.bread / sec_diff,
+ (float)xx->csi.lread / sec_diff,
+ freq((float)xx->csi.lread, (float)xx->csi.bread),
+ (float)xx->csi.bwrite / sec_diff,
+ (float)xx->csi.lwrite / sec_diff,
+ freq((float)xx->csi.lwrite, (float)xx->csi.bwrite),
+ (float)xx->csi.phread / sec_diff,
+ (float)xx->csi.phwrite / sec_diff);
}
static void
@@ -856,57 +856,57 @@ prt_d_opt(int ii, iodevinfo_t *xio)
(void) printf(" %-8.8s ", nxio[ii].ks.ks_name);
(void) printf("%7.0f %7.1f %7.0f %7.0f %7.1f %7.1f\n",
- pbusy,
- avq + avs,
- tps,
- BLKS(xio[ii].kios.nread + xio[ii].kios.nwritten) / etime,
- (tps > 0 ? avq / tps * 1000.0 : 0.0),
- (tps > 0 ? avs / tps * 1000.0 : 0.0));
+ pbusy,
+ avq + avs,
+ tps,
+ BLKS(xio[ii].kios.nread + xio[ii].kios.nwritten) / etime,
+ (tps > 0 ? avq / tps * 1000.0 : 0.0),
+ (tps > 0 ? avs / tps * 1000.0 : 0.0));
}
static void
prt_y_opt(struct sa64 *xx)
{
(void) printf(" %7.0f %7.0f %7.0f %7.0f %7.0f %7.0f\n",
- (float)xx->csi.rawch / sec_diff,
- (float)xx->csi.canch / sec_diff,
- (float)xx->csi.outch / sec_diff,
- (float)xx->csi.rcvint / sec_diff,
- (float)xx->csi.xmtint / sec_diff,
- (float)xx->csi.mdmint / sec_diff);
+ (float)xx->csi.rawch / sec_diff,
+ (float)xx->csi.canch / sec_diff,
+ (float)xx->csi.outch / sec_diff,
+ (float)xx->csi.rcvint / sec_diff,
+ (float)xx->csi.xmtint / sec_diff,
+ (float)xx->csi.mdmint / sec_diff);
}
static void
prt_c_opt(struct sa64 *xx)
{
(void) printf(" %7.0f %7.0f %7.0f %7.2f %7.2f %7.0f %7.0f\n",
- (float)xx->csi.syscall / sec_diff,
- (float)xx->csi.sysread / sec_diff,
- (float)xx->csi.syswrite / sec_diff,
- (float)(xx->csi.sysfork + xx->csi.sysvfork) / sec_diff,
- (float)xx->csi.sysexec / sec_diff,
- (float)xx->csi.readch / sec_diff,
- (float)xx->csi.writech / sec_diff);
+ (float)xx->csi.syscall / sec_diff,
+ (float)xx->csi.sysread / sec_diff,
+ (float)xx->csi.syswrite / sec_diff,
+ (float)(xx->csi.sysfork + xx->csi.sysvfork) / sec_diff,
+ (float)xx->csi.sysexec / sec_diff,
+ (float)xx->csi.readch / sec_diff,
+ (float)xx->csi.writech / sec_diff);
}
static void
prt_w_opt(struct sa64 *xx)
{
(void) printf(" %7.2f %7.1f %7.2f %7.1f %7.0f\n",
- (float)xx->cvmi.swapin / sec_diff,
- (float)PGTOBLK(xx->cvmi.pgswapin) / sec_diff,
- (float)xx->cvmi.swapout / sec_diff,
- (float)PGTOBLK(xx->cvmi.pgswapout) / sec_diff,
- (float)xx->csi.pswitch / sec_diff);
+ (float)xx->cvmi.swapin / sec_diff,
+ (float)PGTOBLK(xx->cvmi.pgswapin) / sec_diff,
+ (float)xx->cvmi.swapout / sec_diff,
+ (float)PGTOBLK(xx->cvmi.pgswapout) / sec_diff,
+ (float)xx->csi.pswitch / sec_diff);
}
static void
prt_a_opt(struct sa64 *xx)
{
(void) printf(" %7.0f %7.0f %7.0f\n",
- (float)xx->csi.ufsiget / sec_diff,
- (float)xx->csi.namei / sec_diff,
- (float)xx->csi.ufsdirblk / sec_diff);
+ (float)xx->csi.ufsiget / sec_diff,
+ (float)xx->csi.namei / sec_diff,
+ (float)xx->csi.ufsdirblk / sec_diff);
}
static void
@@ -943,33 +943,33 @@ static void
prt_m_opt(struct sa64 *xx)
{
(void) printf(" %7.2f %7.2f\n",
- (float)xx->csi.msg / sec_diff,
- (float)xx->csi.sema / sec_diff);
+ (float)xx->csi.msg / sec_diff,
+ (float)xx->csi.sema / sec_diff);
}
static void
prt_p_opt(struct sa64 *xx)
{
(void) printf(" %7.2f %7.2f %7.2f %7.2f %7.2f %7.2f\n",
- (float)xx->cvmi.pgfrec / sec_diff,
- (float)xx->cvmi.pgin / sec_diff,
- (float)xx->cvmi.pgpgin / sec_diff,
- (float)(xx->cvmi.prot_fault + xx->cvmi.cow_fault) / sec_diff,
- (float)(xx->cvmi.hat_fault + xx->cvmi.as_fault) / sec_diff,
- (float)xx->cvmi.softlock / sec_diff);
+ (float)xx->cvmi.pgfrec / sec_diff,
+ (float)xx->cvmi.pgin / sec_diff,
+ (float)xx->cvmi.pgpgin / sec_diff,
+ (float)(xx->cvmi.prot_fault + xx->cvmi.cow_fault) / sec_diff,
+ (float)(xx->cvmi.hat_fault + xx->cvmi.as_fault) / sec_diff,
+ (float)xx->cvmi.softlock / sec_diff);
}
static void
prt_g_opt(struct sa64 *xx)
{
(void) printf(" %8.2f %8.2f %8.2f %8.2f %8.2f\n",
- (float)xx->cvmi.pgout / sec_diff,
- (float)xx->cvmi.pgpgout / sec_diff,
- (float)xx->cvmi.dfree / sec_diff,
- (float)xx->cvmi.scan / sec_diff,
- (float)xx->csi.ufsipage * 100.0 /
- denom((float)xx->csi.ufsipage +
- (float)xx->csi.ufsinopage));
+ (float)xx->cvmi.pgout / sec_diff,
+ (float)xx->cvmi.pgpgout / sec_diff,
+ (float)xx->cvmi.dfree / sec_diff,
+ (float)xx->cvmi.scan / sec_diff,
+ (float)xx->csi.ufsipage * 100.0 /
+ denom((float)xx->csi.ufsipage +
+ (float)xx->csi.ufsinopage));
}
static void
@@ -982,7 +982,7 @@ prt_r_opt(struct sa64 *xx)
(void) printf(" %7.0f %8.0f\n",
(double)xx->vmi.freemem / (float)xx->si.updates,
(double)PGTOBLK(xx->vmi.swap_avail) /
- (float)xx->si.updates);
+ (float)xx->si.updates);
}
}
@@ -1029,51 +1029,51 @@ prtopt(void)
prttim();
- while ((ccc = fopt[jj++]) != NULL) {
+ while ((ccc = fopt[jj++]) != '\0') {
if (ccc != 'd')
tsttab();
switch (ccc) {
- case 'u':
+ case 'u':
prt_u_opt(&dx);
break;
- case 'b':
+ case 'b':
prt_b_opt(&dx);
break;
- case 'd':
+ case 'd':
for (ii = 0; ii < niodevs; ii++)
prt_d_opt(ii, dxio);
break;
- case 'y':
+ case 'y':
prt_y_opt(&dx);
break;
- case 'c':
+ case 'c':
prt_c_opt(&dx);
break;
- case 'w':
+ case 'w':
prt_w_opt(&dx);
break;
- case 'a':
+ case 'a':
prt_a_opt(&dx);
break;
- case 'q':
+ case 'q':
prt_q_opt(&dx);
break;
- case 'v':
+ case 'v':
prt_v_opt(&dx);
break;
- case 'm':
+ case 'm':
prt_m_opt(&dx);
break;
- case 'p':
+ case 'p':
prt_p_opt(&dx);
break;
- case 'g':
+ case 'g':
prt_g_opt(&dx);
break;
- case 'r':
+ case 'r':
prt_r_opt(&dx);
break;
- case 'k':
+ case 'k':
prt_k_opt(&nx, 1);
/*
* To avoid overflow, copy the data from the sa record
@@ -1114,51 +1114,51 @@ prtavg(void)
percent = 100.0 / tdiff;
(void) printf("\n");
- while ((ccc = fopt[jj++]) != NULL) {
+ while ((ccc = fopt[jj++]) != '\0') {
if (ccc != 'v')
(void) printf("Average ");
switch (ccc) {
- case 'u':
+ case 'u':
prt_u_opt(&ax);
break;
- case 'b':
+ case 'b':
prt_b_opt(&ax);
break;
- case 'd':
+ case 'd':
tabflg = 1;
for (ii = 0; ii < niodevs; ii++)
prt_d_opt(ii, axio);
break;
- case 'y':
+ case 'y':
prt_y_opt(&ax);
break;
- case 'c':
+ case 'c':
prt_c_opt(&ax);
break;
- case 'w':
+ case 'w':
prt_w_opt(&ax);
break;
- case 'a':
+ case 'a':
prt_a_opt(&ax);
break;
- case 'q':
+ case 'q':
prt_q_opt(&ax);
break;
- case 'v':
+ case 'v':
break;
- case 'm':
+ case 'm':
prt_m_opt(&ax);
break;
- case 'p':
+ case 'p':
prt_p_opt(&ax);
break;
- case 'g':
+ case 'g':
prt_g_opt(&ax);
break;
- case 'r':
+ case 'r':
prt_r_opt(&ax);
break;
- case 'k':
+ case 'k':
prt_k_opt(&ax, lines);
break;
}
@@ -1167,7 +1167,7 @@ prtavg(void)
static void
ulong_delta(uint64_t *new, uint64_t *old, uint64_t *delta, uint64_t *accum,
- int begin, int end)
+ int begin, int end)
{
int i;
uint64_t n, o, d;
diff --git a/usr/src/cmd/sbdadm/sbdadm.c b/usr/src/cmd/sbdadm/sbdadm.c
index dfabdd7a3a..cff0759cae 100644
--- a/usr/src/cmd/sbdadm/sbdadm.c
+++ b/usr/src/cmd/sbdadm/sbdadm.c
@@ -89,7 +89,7 @@ subCommandProps_t subCommands[] = {
{ "modify-lu", modify_lu, "s", "s", NULL,
OPERAND_MANDATORY_SINGLE,
"Full path of the LU or GUID of a registered LU" },
- { NULL, 0, 0, NULL, 0, NULL}
+ { NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL}
};
/*ARGSUSED*/
diff --git a/usr/src/cmd/sendmail/util/mailcompat.c b/usr/src/cmd/sendmail/util/mailcompat.c
index aefc3dcfe5..ce685337f0 100644
--- a/usr/src/cmd/sendmail/util/mailcompat.c
+++ b/usr/src/cmd/sendmail/util/mailcompat.c
@@ -156,7 +156,7 @@ char **shortp;
/* read the from line */
if (fgets(line, sizeof line, stdin) == NULL ||
- strncmp(line, "From ", 5) != NULL)
+ strncmp(line, "From ", 5) != 0)
{
usrerr("No initial From line");
exit(EX_USAGE);
diff --git a/usr/src/cmd/sendmail/util/vacation.c b/usr/src/cmd/sendmail/util/vacation.c
index 5a0f93756d..95ed7c0797 100644
--- a/usr/src/cmd/sendmail/util/vacation.c
+++ b/usr/src/cmd/sendmail/util/vacation.c
@@ -382,7 +382,7 @@ char **shortp;
/* read the from line */
if (fgets(line, sizeof (line), stdin) == NULL ||
- strncmp(line, "From ", 5) != NULL)
+ strncmp(line, "From ", 5) != 0)
{
usrerr("No initial From line");
exit(EX_PROTOCOL);
diff --git a/usr/src/cmd/smbsrv/smbd/smbd_doorsvc.c b/usr/src/cmd/smbsrv/smbd/smbd_doorsvc.c
index ce606b7b97..e13f271e51 100644
--- a/usr/src/cmd/smbsrv/smbd/smbd_doorsvc.c
+++ b/usr/src/cmd/smbsrv/smbd/smbd_doorsvc.c
@@ -802,7 +802,7 @@ smbd_dop_vss_map_gmttoken(smbd_arg_t *arg)
if ((snapname = malloc(MAXPATHLEN)) == NULL) {
xdr_free(smb_gmttoken_snapname_xdr, (char *)&request);
- return (NULL);
+ return (SMB_DOP_ENCODE_ERROR);
}
if ((smbd_vss_map_gmttoken(request.gts_path, request.gts_gmttoken,
diff --git a/usr/src/cmd/smserverd/myaudit.c b/usr/src/cmd/smserverd/myaudit.c
index 041cfc9360..05310476f5 100644
--- a/usr/src/cmd/smserverd/myaudit.c
+++ b/usr/src/cmd/smserverd/myaudit.c
@@ -111,8 +111,8 @@ audit_init(door_data_t *door_dp)
door_dp->audit_event = 0;
door_dp->audit_sorf = -2;
door_dp->audit_user = NULL;
- door_dp->audit_text[0] = NULL;
- door_dp->audit_text1[0] = NULL;
+ door_dp->audit_text[0] = '\0';
+ door_dp->audit_text1[0] = '\0';
door_dp->audit_na = 0;
door_dp->audit_asid = (au_asid_t)(-1);
door_dp->audit_path = NULL;
diff --git a/usr/src/cmd/stat/common/acquire_iodevs.c b/usr/src/cmd/stat/common/acquire_iodevs.c
index 4fd1115142..2a88b89e28 100644
--- a/usr/src/cmd/stat/common/acquire_iodevs.c
+++ b/usr/src/cmd/stat/common/acquire_iodevs.c
@@ -355,7 +355,7 @@ iodev_match(struct iodev_snapshot *dev, struct iodev_filter *df)
return (1); /* pass */
/* no filtered names, pass if not floppy and skipped */
- if (df->if_nr_names == NULL)
+ if (df->if_nr_names == 0)
return (!(df->if_skip_floppy && is_floppy));
isn = dev->is_name;
@@ -451,7 +451,7 @@ choose_iodevs(struct snapshot *ss, struct iodev_snapshot *iodevs,
* don't want to fill the remaining slots - it is just confusing
* if we don that, it makes it look like the filter code is broken.
*/
- if ((df->if_nr_names == NULL) || (nr_iodevs != nr_iodevs_orig)) {
+ if ((df->if_nr_names == 0) || (nr_iodevs != nr_iodevs_orig)) {
/* now insert any iodevs into the remaining slots */
pos = iodevs;
while (pos && nr_iodevs) {
@@ -627,7 +627,7 @@ get_ids(struct iodev_snapshot *iodev, const char *pretty)
static void
get_pretty_name(enum snapshot_types types, struct iodev_snapshot *iodev,
- kstat_ctl_t *kc)
+ kstat_ctl_t *kc)
{
disk_list_t *dl;
char *pretty = NULL;
@@ -683,8 +683,7 @@ get_iodev_type(kstat_t *ksp)
/* get the lun/target/initiator from the name, return 1 on success */
static int
-get_lti(char *s,
- char *lname, int *l, char *tname, int *t, char *iname, int *i)
+get_lti(char *s, char *lname, int *l, char *tname, int *t, char *iname, int *i)
{
int num = 0;
diff --git a/usr/src/cmd/stat/common/dsr.c b/usr/src/cmd/stat/common/dsr.c
index e9db7e3042..b1af45c653 100644
--- a/usr/src/cmd/stat/common/dsr.c
+++ b/usr/src/cmd/stat/common/dsr.c
@@ -291,7 +291,7 @@ lookup_ks_name(char *ks_name, int want_devid)
goto fail;
part = strchr(ks_name, ','); /* start of ",<partition>" */
- p = strchr(ks_name, ':'); /* start of ":<partition>" */
+ p = strchr(ks_name, ':'); /* start of ":<partition>" */
if (part != NULL && p != NULL)
goto fail; /* can't have both */
if (p != NULL)
@@ -508,7 +508,7 @@ again:
if (*cp == ',') {
cp++;
while (*cp != ':') {
- if (*cp == NULL)
+ if (*cp == '\0')
return (NULL);
cp++;
}
@@ -520,7 +520,7 @@ again:
*/
while (*cp) {
if (isspace(*cp) || *cp == ',') {
- *cp = NULL;
+ *cp = '\0';
return (path);
}
cp++;
diff --git a/usr/src/cmd/stat/mpstat/mpstat.c b/usr/src/cmd/stat/mpstat/mpstat.c
index 64324224fd..e945988636 100644
--- a/usr/src/cmd/stat/mpstat/mpstat.c
+++ b/usr/src/cmd/stat/mpstat/mpstat.c
@@ -110,7 +110,7 @@ main(int argc, char **argv)
usage();
display_pset = (int)strtol
(optarg, &endptr, 10);
- if (*endptr != NULL)
+ if (*endptr != '\0')
usage();
/*
* Not valid to specify a negative processor
@@ -143,13 +143,13 @@ main(int argc, char **argv)
if (argc > optind) {
interval = (int)strtol(argv[optind], &endptr, 10);
- if (*endptr != NULL)
+ if (*endptr != '\0')
usage();
period_n = (hrtime_t)interval * NANOSEC;
if (argc > optind + 1) {
iter = (unsigned int)strtoul
(argv[optind + 1], &endptr, 10);
- if (*endptr != NULL || iter < 0)
+ if (*endptr != '\0' || iter < 0)
usage();
if (iter == 0)
return (0);
@@ -314,7 +314,7 @@ agg_vm(struct pset_snapshot *p, kstat_t *ks)
{
size_t i;
- if (p->ps_nr_cpus == NULL)
+ if (p->ps_nr_cpus == 0)
return (NULL);
if (kstat_copy(&p->ps_cpus[0]->cs_vm, ks))
@@ -334,7 +334,7 @@ agg_sys(struct pset_snapshot *p, kstat_t *ks)
{
size_t i;
- if (p->ps_nr_cpus == NULL)
+ if (p->ps_nr_cpus == 0)
return (NULL);
if (kstat_copy(&p->ps_cpus[0]->cs_sys, ks))
diff --git a/usr/src/cmd/stmfadm/stmfadm.c b/usr/src/cmd/stmfadm/stmfadm.c
index 0c98614974..f2d3305fce 100644
--- a/usr/src/cmd/stmfadm/stmfadm.c
+++ b/usr/src/cmd/stmfadm/stmfadm.c
@@ -243,7 +243,7 @@ subCommandProps_t subcommands[] = {
OPERAND_MANDATORY_MULTIPLE, OPERANDSTRING_GROUP_MEMBER, NULL},
{"remove-view", removeViewFunc, "la", "l", NULL,
OPERAND_OPTIONAL_MULTIPLE, OPERANDSTRING_VIEW_ENTRY, NULL},
- {NULL, 0, NULL, NULL, 0, NULL, 0, NULL, NULL}
+ {NULL, 0, NULL, NULL, 0, 0, 0, NULL, 0}
};
/* globals */
diff --git a/usr/src/cmd/stmfproxy/aluaadm/aluaadm.c b/usr/src/cmd/stmfproxy/aluaadm/aluaadm.c
index 3a8a21705f..69c8ace7a5 100644
--- a/usr/src/cmd/stmfproxy/aluaadm/aluaadm.c
+++ b/usr/src/cmd/stmfproxy/aluaadm/aluaadm.c
@@ -72,7 +72,7 @@ subCommandProps_t subcommands[] = {
OPERAND_NONE, NULL, NULL},
{"enable", enableAluaFunc, NULL, NULL, NULL,
OPERAND_MANDATORY_SINGLE, OPERANDSTRING_NODE_ID, NULL},
- {NULL, 0, NULL, NULL, 0, NULL, 0, NULL, NULL}
+ {NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL}
};
/* globals */
diff --git a/usr/src/cmd/stmfsvc/stmfsvc.c b/usr/src/cmd/stmfsvc/stmfsvc.c
index 814ebc249c..9f83338edb 100644
--- a/usr/src/cmd/stmfsvc/stmfsvc.c
+++ b/usr/src/cmd/stmfsvc/stmfsvc.c
@@ -70,7 +70,7 @@ optionTbl_t longOptions[] = {
subCommandProps_t subcommands[] = {
{"start", svcStart, NULL, NULL, NULL, OPERAND_NONE, NULL},
{"stop", svcStop, NULL, NULL, NULL, OPERAND_NONE, NULL},
- {NULL, 0, NULL, NULL, 0, NULL, 0, NULL}
+ {NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL}
};
/* globals */
diff --git a/usr/src/cmd/sulogin/sulogin.c b/usr/src/cmd/sulogin/sulogin.c
index f242af0e68..634de9b18e 100644
--- a/usr/src/cmd/sulogin/sulogin.c
+++ b/usr/src/cmd/sulogin/sulogin.c
@@ -290,7 +290,7 @@ main(int argc, char **argv)
* init() was invoked from a console that was not
* the default console, nor was it an auxiliary.
*/
- if (cttyname[0] == NULL)
+ if (cttyname[0] == '\0')
termhandler(0);
/* Never returns */
diff --git a/usr/src/cmd/svr4pkg/libinst/fixpath.c b/usr/src/cmd/svr4pkg/libinst/fixpath.c
index 7ed5961b81..9eccb948f9 100644
--- a/usr/src/cmd/svr4pkg/libinst/fixpath.c
+++ b/usr/src/cmd/svr4pkg/libinst/fixpath.c
@@ -316,7 +316,7 @@ orig_path_ptr(char *path)
*/
else if (strncmp(path, install_root, install_root_len) == 0) {
retv = path + install_root_len;
- if (*retv == NULL)
+ if (*retv == '\0')
retv = "/";
/*
diff --git a/usr/src/cmd/svr4pkg/libinst/isreloc.c b/usr/src/cmd/svr4pkg/libinst/isreloc.c
index 73bed3160b..58f8ca897d 100644
--- a/usr/src/cmd/svr4pkg/libinst/isreloc.c
+++ b/usr/src/cmd/svr4pkg/libinst/isreloc.c
@@ -137,7 +137,7 @@ has_rel_path(char *entry)
register int entry_pos = 1;
/* If the line is a comment or special directive, return 0 */
- if (*entry == NULL || strchr(IGNORE_START, *entry))
+ if (*entry == '\0' || strchr(IGNORE_START, *entry) != NULL)
return (0);
/* Skip past this data entry if it is volume number. */
@@ -158,7 +158,7 @@ has_rel_path(char *entry)
* or the type indicates this line should be ignored, we return
* as though not relative.
*/
- if (*entry == NULL || strchr(IGNORE_TYPE, *entry))
+ if (*entry == '\0' || strchr(IGNORE_TYPE, *entry))
return (0);
/* The pathname is in the third position */
@@ -172,7 +172,7 @@ has_rel_path(char *entry)
while (*entry && isspace(*entry)) {
entry++;
}
- } while (++entry_pos < 3 && *entry != NULL);
+ } while (++entry_pos < 3 && *entry != '\0');
/*
* Now we're pointing at the first character of the pathname.
diff --git a/usr/src/cmd/svr4pkg/libinst/mntinfo.c b/usr/src/cmd/svr4pkg/libinst/mntinfo.c
index 086762899c..7090568a65 100644
--- a/usr/src/cmd/svr4pkg/libinst/mntinfo.c
+++ b/usr/src/cmd/svr4pkg/libinst/mntinfo.c
@@ -223,7 +223,7 @@ get_server_host(uint32_t n)
if (n < fs_tab_used) {
(void) strcpy(hostname, fs_tab[n]->remote_name);
if ((host_end = strchr(hostname, ':')) == NULL) {
- if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTOFS)) == NULL)
+ if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTOFS)) == 0)
return ("automounter");
else
return (fs_tab[n]->fstype);
@@ -1121,7 +1121,7 @@ fsys(char *path)
* do the string compare. -- JST
*/
if ((fs_namelen == 1 && *(fs_tab[i]->name) == '/') ||
- ((term_char == '/' || term_char == NULL) &&
+ ((term_char == '/' || term_char == '\0') &&
strncmp(fs_tab[i]->name, path2use, fs_namelen) == 0)) {
return (i);
}
diff --git a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c
index ef1bdb07e1..5418cd9209 100644
--- a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c
+++ b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c
@@ -930,7 +930,7 @@ merg(struct cfextra *el_ent, struct cfent *cf_ent)
* already done.
*/
if (strcmp(cf_ent->ainfo.local,
- el_ent->cf_ent.ainfo.local) != NULL) {
+ el_ent->cf_ent.ainfo.local) != 0) {
changed++;
/*
@@ -939,7 +939,7 @@ merg(struct cfextra *el_ent, struct cfent *cf_ent)
* entry.
*/
if (strcmp(el_ent->cf_ent.ainfo.local,
- "?") == NULL) {
+ "?") == 0) {
(void) strlcpy(
el_ent->cf_ent.ainfo.local,
cf_ent->ainfo.local,
diff --git a/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c b/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c
index 13a041418c..9d4a05d116 100644
--- a/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c
+++ b/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c
@@ -227,7 +227,7 @@ seed_pkgobjmap(struct cfextra *ext_entry, char *path, char *local)
if (ext_ptr == NULL || *ext_ptr == NULL) {
progerr(gettext(ERR_MEMORY));
- return (NULL);
+ return (0);
}
ext = *ext_ptr;
diff --git a/usr/src/cmd/svr4pkg/libinst/scriptvfy.l b/usr/src/cmd/svr4pkg/libinst/scriptvfy.l
index f467b840cc..68c2e8d009 100644
--- a/usr/src/cmd/svr4pkg/libinst/scriptvfy.l
+++ b/usr/src/cmd/svr4pkg/libinst/scriptvfy.l
@@ -626,7 +626,7 @@ scripteval(char *script_name, char *script_path, int mask, int silent)
int error = 0;
line_no = 1;
- if ((script_path == NULL) || (*script_path == NULL) ||
+ if ((script_path == NULL) || (*script_path == '\0') ||
(script_name == NULL)) {
logerr(gettext(ERR_ARGS));
return (0);
diff --git a/usr/src/cmd/svr4pkg/pkgchk/checkmap.c b/usr/src/cmd/svr4pkg/pkgchk/checkmap.c
index 9bfcd3c620..fff5c2a93d 100644
--- a/usr/src/cmd/svr4pkg/pkgchk/checkmap.c
+++ b/usr/src/cmd/svr4pkg/pkgchk/checkmap.c
@@ -326,7 +326,7 @@ selpkg(char *p)
}
} else {
for (i = 0; i < pkgcnt; ++i) {
- if (selected[i] == NULL) {
+ if (selected[i] == '\0') {
root = get_inst_root();
if (root)
(void) snprintf(buf,
diff --git a/usr/src/cmd/svr4pkg/pkgchk/ckentry.c b/usr/src/cmd/svr4pkg/pkgchk/ckentry.c
index ab470ac8fc..6c1595010b 100644
--- a/usr/src/cmd/svr4pkg/pkgchk/ckentry.c
+++ b/usr/src/cmd/svr4pkg/pkgchk/ckentry.c
@@ -224,8 +224,8 @@ xdir(int maptyp, VFP_T *vfp, PKGserver server, char *dirname)
errflg = 0;
(void) memset((char *)&mine, '\0', sizeof (struct cfent));
while ((drp = readdir(dirfp)) != NULL) {
- if (strcmp(drp->d_name, ".") == NULL ||
- strcmp(drp->d_name, "..") == NULL)
+ if (strcmp(drp->d_name, ".") == 0 ||
+ strcmp(drp->d_name, "..") == 0)
continue;
(void) snprintf(badpath, sizeof (badpath), "%s/%s",
dirname, drp->d_name);
diff --git a/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c b/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c
index cdb0397015..4e97dd8ef3 100644
--- a/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c
+++ b/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c
@@ -279,7 +279,7 @@ main(int argc, char **argv)
pkg = &argv[optind];
pkgcnt = (argc - optind);
- if (pkg[0] && strcmp(pkg[0], "all") == NULL) {
+ if (pkg[0] && strcmp(pkg[0], "all") == 0) {
pkgcnt = 0;
pkg[0] = NULL;
}
@@ -358,10 +358,10 @@ report(void)
* Confirm that the pkginfo file contains the
* required information.
*/
- if (info.name == NULL || *(info.name) == NULL ||
- info.arch == NULL || *(info.arch) == NULL ||
- info.version == NULL || *(info.version) == NULL ||
- info.catg == NULL || *(info.catg) == NULL) {
+ if (info.name == NULL || *(info.name) == '\0' ||
+ info.arch == NULL || *(info.arch) == '\0' ||
+ info.version == NULL || *(info.version) == '\0' ||
+ info.catg == NULL || *(info.catg) == '\0') {
progerr(gettext(ERR_BADINFO));
errflg++;
return;
@@ -542,9 +542,9 @@ fpkg(char *pkginst)
struct cfstat *dp, *last;
dp = data;
- last = (struct cfstat *)0;
+ last = NULL;
while (dp) {
- if (strcmp(dp->pkginst, pkginst) == NULL)
+ if (strcmp(dp->pkginst, pkginst) == 0)
return (dp);
last = dp;
dp = dp->next;
diff --git a/usr/src/cmd/svr4pkg/pkginstall/getinst.c b/usr/src/cmd/svr4pkg/pkginstall/getinst.c
index 1e4bbfec71..d0ba4a610c 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/getinst.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/getinst.c
@@ -110,10 +110,10 @@ getinst(int *updatingExisting, struct pkginfo *info, int npkgs,
samearch = nsamearch = 0;
sameinst = NULL;
for (i = 0; i < npkgs; i++) {
- if (strcmp(info[i].arch, pkgarch) == NULL) {
+ if (strcmp(info[i].arch, pkgarch) == 0) {
samearch = i;
nsamearch++;
- if (strcmp(info[i].version, pkgvers) == NULL) {
+ if (strcmp(info[i].version, pkgvers) == 0) {
sameinst = info[i].pkginst;
}
}
@@ -189,7 +189,7 @@ getinst(int *updatingExisting, struct pkginfo *info, int npkgs,
}
inst = prompt(info, npkgs);
- if (strcmp(inst, "new") == NULL) {
+ if (strcmp(inst, "new") == 0) {
inst = nextinst();
return (inst);
}
diff --git a/usr/src/cmd/svr4pkg/pkginstall/quit.c b/usr/src/cmd/svr4pkg/pkginstall/quit.c
index 664de95126..6abb2b3087 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/quit.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/quit.c
@@ -289,12 +289,12 @@ quit(int retcode)
ptext(stderr, MSG_DRYRUN_DONE);
ptext(stderr, MSG_NOCHANGE);
- if (tmpdir[0] != NULL)
+ if (tmpdir[0] != '\0')
(void) rrmdir(tmpdir);
} else {
/* fix bug #1082589 that deletes root file */
- if (tmpdir[0] != NULL) {
+ if (tmpdir[0] != '\0') {
(void) rrmdir(tmpdir);
}
diff --git a/usr/src/cmd/svr4pkg/pkgmk/main.c b/usr/src/cmd/svr4pkg/pkgmk/main.c
index 64fac814d5..bfe1c43a42 100644
--- a/usr/src/cmd/svr4pkg/pkgmk/main.c
+++ b/usr/src/cmd/svr4pkg/pkgmk/main.c
@@ -427,7 +427,7 @@ main(int argc, char *argv[])
/* add command line variables */
while (*cmdparam && (value = strchr(*cmdparam, '=')) != NULL) {
- *value = NULL; /* terminate the parameter */
+ *value = '\0'; /* terminate the parameter */
value++; /* value is now the value (not '=') */
putparam(*cmdparam++, value); /* store it in environ */
}
diff --git a/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c b/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c
index a0c327fb0c..fa5a311165 100644
--- a/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c
+++ b/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c
@@ -600,7 +600,7 @@ doinclude(void)
translate(file, temp);
canonize(temp);
- if (*temp == NULL)
+ if (*temp == '\0')
return;
else if (*temp != '/')
(void) snprintf(file, sizeof (file), "%s/%s", dname[nfp], temp);
diff --git a/usr/src/cmd/svr4pkg/pkgremove/check.c b/usr/src/cmd/svr4pkg/pkgremove/check.c
index 6cf5b4350b..b5fc8e5470 100644
--- a/usr/src/cmd/svr4pkg/pkgremove/check.c
+++ b/usr/src/cmd/svr4pkg/pkgremove/check.c
@@ -100,7 +100,7 @@ rckrunlevel(void)
if ((pt = strtok(pt, " \t\n, ")) == NULL)
return (0); /* no list is no list */
do {
- if (strcmp(pt, uxstate) == NULL) {
+ if (strcmp(pt, uxstate) == 0) {
free(rstates);
return (0);
}
@@ -220,9 +220,9 @@ rckpriv(void)
found = 0;
while ((dp = readdir(dirfp)) != NULL) {
- if ((strcmp(dp->d_name, "preremove") == NULL) ||
- (strcmp(dp->d_name, "postremove") == NULL) ||
- (strncmp(dp->d_name, "r.", 2) == NULL)) {
+ if ((strcmp(dp->d_name, "preremove") == 0) ||
+ (strcmp(dp->d_name, "postremove") == 0) ||
+ (strncmp(dp->d_name, "r.", 2) == 0)) {
found++;
break;
}
diff --git a/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c b/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c
index 44cfb52972..2841f24b6d 100644
--- a/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c
+++ b/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c
@@ -580,7 +580,7 @@ pkg_door_srv(void *cookie, char *argp, size_t asz, door_desc_t *dp,
err:
(void) mutex_unlock(&mtx);
- (void) door_return((void *)&one, 4, NULL, NULL);
+ (void) door_return((void *)&one, 4, NULL, 0);
}
/*
@@ -1263,7 +1263,7 @@ pkgfilter(pkgfilter_t *pf, door_desc_t *dp)
/* Copy the file descriptor in the command field */
cpf->cmd = p[1];
- if (thr_create(NULL, NULL, thr_pkgfilter, cpf, THR_DETACHED,
+ if (thr_create(NULL, 0, thr_pkgfilter, cpf, THR_DETACHED,
&tid) != 0) {
(void) close(p[0]);
(void) close(p[1]);
diff --git a/usr/src/cmd/tar/tar.c b/usr/src/cmd/tar/tar.c
index 7aca75a35f..659d6eb5cc 100644
--- a/usr/src/cmd/tar/tar.c
+++ b/usr/src/cmd/tar/tar.c
@@ -26,7 +26,7 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/* Copyright (c) 1987, 1988 Microsoft Corporation */
/* All Rights Reserved */
@@ -405,7 +405,7 @@ struct linkbuf {
dev_t devnum;
int count;
char pathname[MAXNAM+1]; /* added 1 for last NULL */
- char attrname[MAXNAM+1];
+ char attrname[MAXNAM+1];
struct linkbuf *nextp;
} *ihead;
@@ -566,7 +566,7 @@ static int uflag;
static int errflag;
static int oflag;
static int bflag, Aflag;
-static int Pflag; /* POSIX conformant archive */
+static int Pflag; /* POSIX conformant archive */
static int Eflag; /* Allow files greater than 8GB */
static int atflag; /* traverse extended attributes */
static int saflag; /* traverse extended sys attributes */
@@ -629,7 +629,7 @@ static int extno; /* number of extent: starts at 1 */
static int extotal; /* total extents in this file */
static off_t extsize; /* size of current extent during extraction */
static ushort_t Oumask = 0; /* old umask value */
-static boolean_t is_posix; /* true if archive is POSIX-conformant */
+static boolean_t is_posix; /* true if archive is POSIX-conformant */
static const char *magic_type = "ustar";
static size_t xrec_size = 8 * PATH_MAX; /* extended rec initial size */
static char *xrec_ptr;
@@ -710,7 +710,7 @@ int waitaround = 0; /* wait for rendezvous with the debugger */
#define BSUF 4 /* number of valid 'bzip2' sufixes */
#define XSUF 1 /* number of valid 'xz' suffixes */
-static char *compress_opt; /* compression type */
+static char *compress_opt; /* compression type */
static char *gsuffix[] = {".gz", "-gz", ".z", "-z", "_z", ".Z",
".tgz", ".taz"};
@@ -1989,7 +1989,7 @@ putfile(char *longname, char *shortname, char *parent, attr_data_t *attrinfo,
* -- the length of the fullname equals NAMSIZ, and the shortname
* is less than NAMSIZ, (splitting in this case preserves
* compatibility with 5.6 and 5.5.1 tar), or
- * -- the length of the fullname equals NAMSIZ, the file is a
+ * -- the length of the fullname equals NAMSIZ, the file is a
* directory and we are not in POSIX-conformant mode (where
* trailing slashes are removed from directories).
*/
@@ -2694,13 +2694,13 @@ splitfile(char *longname, int ifd, char *name, char *prefix, int filetype)
* regular file when extracted
*
* Returns 1 when file size > 0 and typeflag is not recognized
- * Otherwise returns 0
+ * Otherwise returns 0
*/
static int
convtoreg(off_t size)
{
if ((size > 0) && (dblock.dbuf.typeflag != '0') &&
- (dblock.dbuf.typeflag != NULL) && (dblock.dbuf.typeflag != '1') &&
+ (dblock.dbuf.typeflag != '\0') && (dblock.dbuf.typeflag != '1') &&
(dblock.dbuf.typeflag != '2') && (dblock.dbuf.typeflag != '3') &&
(dblock.dbuf.typeflag != '4') && (dblock.dbuf.typeflag != '5') &&
(dblock.dbuf.typeflag != '6') && (dblock.dbuf.typeflag != 'A') &&
@@ -2825,13 +2825,13 @@ verify_attr_support(char *filename, int attrflg, arc_action_t actflag,
* it will be set to 0.
*
* Possible return values:
- * ATTR_OK Successfully opened and, if needed, changed into the
+ * ATTR_OK Successfully opened and, if needed, changed into the
* attribute directory containing attrname.
* ATTR_SKIP The command line specifications don't enable the
* processing of the attribute type.
- * ATTR_CHDIR_ERR An error occurred while trying to change into an
+ * ATTR_CHDIR_ERR An error occurred while trying to change into an
* attribute directory.
- * ATTR_OPEN_ERR An error occurred while trying to open an
+ * ATTR_OPEN_ERR An error occurred while trying to open an
* attribute directory.
* ATTR_XATTR_ERR The underlying file system doesn't support extended
* attributes.
@@ -3213,7 +3213,7 @@ doxtract(char *argv[])
(void) unlink(namep);
}
linkp = templink;
- if (*linkp != NULL) {
+ if (*linkp != '\0') {
if (Aflag && *linkp == '/')
linkp++;
if (link(linkp, namep) < 0) {
@@ -3254,7 +3254,7 @@ doxtract(char *argv[])
(void) unlink(namep);
}
linkp = templink;
- if (*linkp != NULL) {
+ if (*linkp != '\0') {
if (Aflag && *linkp == '/')
linkp++;
if (link(linkp, namep) < 0) {
@@ -3303,7 +3303,7 @@ doxtract(char *argv[])
(void) unlink(namep);
}
linkp = templink;
- if (*linkp != NULL) {
+ if (*linkp != '\0') {
if (Aflag && *linkp == '/')
linkp++;
if (link(linkp, namep) < 0) {
@@ -3443,10 +3443,10 @@ doxtract(char *argv[])
}
}
if (dblock.dbuf.typeflag == '0' ||
- dblock.dbuf.typeflag == NULL || convflag) {
+ dblock.dbuf.typeflag == '\0' || convflag) {
delete_target(dirfd, comp, namep);
linkp = templink;
- if (*linkp != NULL) {
+ if (*linkp != '\0') {
if (Aflag && *linkp == '/')
linkp++;
if (link(linkp, comp) < 0) {
@@ -3652,7 +3652,7 @@ filedone:
if (pflag && newfile == TRUE && !dir &&
(dblock.dbuf.typeflag == '0' ||
- dblock.dbuf.typeflag == NULL ||
+ dblock.dbuf.typeflag == '\0' ||
convflag || dblock.dbuf.typeflag == '1')) {
if (fstat(ofile, &xtractbuf) == -1)
(void) fprintf(stderr, gettext(
@@ -3983,7 +3983,7 @@ xblocks(int issysattr, off_t bytes, int ofile)
}
/*
- * xsfile extract split file
+ * xsfile extract split file
*
* xsfile(ofd); ofd = output file descriptor
*
@@ -5526,7 +5526,7 @@ add_file_to_table(file_list_t *table[], char *str)
(void) strcpy(name, str);
while (name[strlen(name) - 1] == '/') {
- name[strlen(name) - 1] = NULL;
+ name[strlen(name) - 1] = '\0';
}
h = hash(name);
@@ -5564,7 +5564,7 @@ is_in_table(file_list_t *table[], char *str)
(void) strcpy(name, str);
while (name[strlen(name) - 1] == '/') {
- name[strlen(name) - 1] = NULL;
+ name[strlen(name) - 1] = '\0';
}
/*
@@ -5583,7 +5583,7 @@ is_in_table(file_list_t *table[], char *str)
* check for any parent directories in the file list
*/
while ((ptr = strrchr(name, '/'))) {
- *ptr = NULL;
+ *ptr = '\0';
h = hash(name);
exp = table[h];
while (exp != NULL) {
@@ -6661,7 +6661,7 @@ delete_target(int fd, char *comp, char *namep)
(void) unlinkat(fd, comp, 0);
} else if ((n = readlink(namep, buf,
PATH_MAX)) != -1) {
- buf[n] = (char)NULL;
+ buf[n] = '\0';
(void) unlinkat(fd, buf,
AT_REMOVEDIR);
if (errno == ENOTDIR)
@@ -6835,7 +6835,7 @@ write_ancillary(union hblock *dblockp, char *secinfo, int len, char hdrtype)
* Read the data record for extended headers and then the regular header.
* The data are read into the buffer and then null-terminated. Entries
* for typeflag 'X' extended headers are of the format:
- * "%d %s=%s\n"
+ * "%d %s=%s\n"
*
* When an extended header record is found, the extended header must
* be processed and its values used to override the values in the
@@ -7592,7 +7592,7 @@ prepare_xattr(
{
char *bufhead; /* ptr to full buffer */
char *aptr;
- struct xattr_hdr *hptr; /* ptr to header in bufhead */
+ struct xattr_hdr *hptr; /* ptr to header in bufhead */
struct xattr_buf *tptr; /* ptr to pathing pieces */
int totalen; /* total buffer length */
int len; /* length returned to user */
@@ -8617,8 +8617,8 @@ chop_endslashes(char *path)
*
* attribute type attribute process procedure
* ---------------- ---------------- --------------------------
- * DIR_TYPE = 'D' directory flag append if a directory
- * LBL_TYPE = 'L' SL[IL] or SL append ascii label
+ * DIR_TYPE = 'D' directory flag append if a directory
+ * LBL_TYPE = 'L' SL[IL] or SL append ascii label
*
*
*/
@@ -8771,7 +8771,7 @@ append_ext_attr(char *shortname, char **secinfo, int *len)
* attribute type attribute process procedure
* ---------------- ---------------- -------------------------
* # LBL_TYPE = 'L' SL construct binary label
- * # APRIV_TYPE = 'P' allowed priv construct privileges
+ * # APRIV_TYPE = 'P' allowed priv construct privileges
* # FPRIV_TYPE = 'p' forced priv construct privileges
* # COMP_TYPE = 'C' path component construct real path
* # DIR_TYPE = 'D' directory flag note it is a directory
@@ -9264,7 +9264,7 @@ compress_back()
void
check_compression(void)
{
- char magic[16];
+ char magic[16];
FILE *fp;
if ((fp = fopen(usefile, "r")) != NULL) {
@@ -9339,7 +9339,7 @@ add_suffix()
void
decompress_file(void)
{
- pid_t pid;
+ pid_t pid;
char *added_suffix;
@@ -9430,7 +9430,7 @@ uncompress_file(void)
char *
check_suffix(char **suf, int size)
{
- int i;
+ int i;
int slen;
int nlen = strlen(usefile);
diff --git a/usr/src/cmd/th_tools/th_define.c b/usr/src/cmd/th_tools/th_define.c
index 85650d8436..955dc724fa 100644
--- a/usr/src/cmd/th_tools/th_define.c
+++ b/usr/src/cmd/th_tools/th_define.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/time_impl.h>
#include <sys/wait.h>
#include <stdio.h>
@@ -378,7 +376,7 @@ log_cmp2(const void *p1, const void *p2)
static void
dump_log(uint_t lvl, FILE *fp, struct acc_log_elem *items,
- size_t nitems, uint_t logflags)
+ size_t nitems, uint_t logflags)
{
if (lvl <= dbglvl) {
int i;
@@ -510,8 +508,8 @@ define_one_error(
static void
define_op_err(FILE *fp, int *ecnt, struct bofi_errdef *edp,
- struct acc_log_elem *item, ulong_t nttime, ulong_t interval, char *type,
- int fon, size_t fcnt)
+ struct acc_log_elem *item, ulong_t nttime, ulong_t interval, char *type,
+ int fon, size_t fcnt)
{
coding_t *ct;
char *opname;
@@ -664,13 +662,8 @@ define_op_err(FILE *fp, int *ecnt, struct bofi_errdef *edp,
/* ARGSUSED */
static int
define_nerrs(int fd, FILE *fp, int *ecnt, struct bofi_errdef *edp,
- struct acc_log_elem *items,
- size_t nitems,
- uint_t naccess,
- uint_t minac,
- uint_t maxac,
- ulong_t logtime,
- ulong_t logsize)
+ struct acc_log_elem *items, size_t nitems, uint_t naccess, uint_t minac,
+ uint_t maxac, ulong_t logtime, ulong_t logsize)
{
char *type;
uint_t at;
@@ -878,7 +871,7 @@ define_nerrs(int fd, FILE *fp, int *ecnt, struct bofi_errdef *edp,
static int
reduce_log(uint16_t pol, struct acc_log *log, /* input args */
- struct acc_log_elem **llp, size_t *cntp) /* output args */
+ struct acc_log_elem **llp, size_t *cntp) /* output args */
{
ulong_t logtime;
struct acc_log_elem *items, *item, *elem;
@@ -1050,7 +1043,7 @@ reduce_log(uint16_t pol, struct acc_log *log, /* input args */
static void
log2errdefs(int fd, struct bofi_errdef *edp, struct acc_log *log,
- char *devpath)
+ char *devpath)
{
struct acc_log_elem *items;
size_t nitems;
@@ -1228,7 +1221,8 @@ log2errdefs(int fd, struct bofi_errdef *edp, struct acc_log *log,
#define LLSZMASK (sizeof (longlong_t) -1)
static int
-add_edef(int fd,
+add_edef(
+ int fd,
struct bofi_errdef *errdef, /* returned access criteria */
struct bofi_errstate *errstate,
struct handle_info *hdl, /* handle to match against request */
@@ -1283,10 +1277,8 @@ add_edef(int fd,
}
static void
-collect_state(int fd, int cmd,
- struct bofi_errstate *errstate,
- struct bofi_errdef *errdef,
- char *devpath)
+collect_state(int fd, int cmd, struct bofi_errstate *errstate,
+ struct bofi_errdef *errdef, char *devpath)
{
int rval;
size_t ls = errstate->log.logsize;
@@ -1360,7 +1352,7 @@ collect_state(int fd, int cmd,
static void
print_err_reports(FILE *fp, struct bofi_errstate *esp,
- char *fname, char *cmt, int id)
+ char *fname, char *cmt, int id)
{
if (fname != 0 && *fname != 0)
(void) fprintf(fp, "%sErrdef file %s definition %d:",
@@ -1422,7 +1414,7 @@ thr_collect(void *arg, char *devpath)
*/
static int
match_hinfo(struct handle_info *hp, int instance, uint_t access_type,
- int rnumber, offset_t offset, offset_t len)
+ int rnumber, offset_t offset, offset_t len)
{
msg(9, "matching (%d %d) 0x%x %d offset (%llx, %llx) len (%llx %llx)\n",
@@ -1691,7 +1683,7 @@ walk_callback(di_node_t node, void *arg)
driver_name = di_driver_name(node);
if (driver_name != NULL) {
- if (strcmp(driver_name, warg->name) == NULL &&
+ if (strcmp(driver_name, warg->name) == 0 &&
di_instance(node) == warg->instance) {
path = di_devfs_path(node);
if (path == NULL)
@@ -1746,7 +1738,7 @@ getpath(char *path, int instance, char *name, int pathlen)
*/
static void
test_driver(struct bofi_errdef *edp,
- unsigned long long collecttime)
+ unsigned long long collecttime)
{
pid_t pid;
int statloc;
@@ -2114,13 +2106,13 @@ main(int argc, char *argv[])
if (str != optarg)
errdef.acc_chk = tmpl;
- else if (strcmp(optarg, "PIO") == NULL)
+ else if (strcmp(optarg, "PIO") == 0)
errdef.acc_chk = 1;
- else if (strcmp(optarg, "DMA") == NULL)
+ else if (strcmp(optarg, "DMA") == 0)
errdef.acc_chk = 2;
- else if (strcmp(optarg, "U4FT_ACC_NO_PIO") == NULL)
+ else if (strcmp(optarg, "U4FT_ACC_NO_PIO") == 0)
errdef.acc_chk = 1;
- else if (strcmp(optarg, "U4FT_ACC_NO_DMA") == NULL)
+ else if (strcmp(optarg, "U4FT_ACC_NO_DMA") == 0)
errdef.acc_chk = 2;
else
err = EINVAL;
diff --git a/usr/src/cmd/th_tools/th_manage.c b/usr/src/cmd/th_tools/th_manage.c
index 5b36a01e96..ff28e909c5 100644
--- a/usr/src/cmd/th_tools/th_manage.c
+++ b/usr/src/cmd/th_tools/th_manage.c
@@ -25,8 +25,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -89,7 +87,7 @@ main(int argc, char **argv)
(void) strncpy(path, argv[1], MAXPATHLEN);
for (i = 0; i < CMD_TABLE_SIZE; i++) {
- if (strcmp(argv[2], cmd_table[i].string) == NULL) {
+ if (strcmp(argv[2], cmd_table[i].string) == 0) {
command = cmd_table[i].val;
devctl_command = cmd_table[i].devctl_val;
}
@@ -115,7 +113,7 @@ main(int argc, char **argv)
(void) strncpy(errctl.name, argv[1], MAXNAMELEN);
errctl.instance = atoi(argv[2]);
for (i = 0; i < CMD_TABLE_SIZE; i++) {
- if (strcmp(argv[3], cmd_table[i].string) == NULL) {
+ if (strcmp(argv[3], cmd_table[i].string) == 0) {
command = cmd_table[i].val;
devctl_command = cmd_table[i].devctl_val;
}
diff --git a/usr/src/cmd/tip/tip.c b/usr/src/cmd/tip/tip.c
index bc8bcd1f85..9f06d66955 100644
--- a/usr/src/cmd/tip/tip.c
+++ b/usr/src/cmd/tip/tip.c
@@ -161,7 +161,7 @@ notnumber:
vinit(); /* init variables */
setparity("none"); /* set the parity table */
- if ((i = speed(number(value(BAUDRATE)))) == NULL) {
+ if ((i = speed(number(value(BAUDRATE)))) == 0) {
(void) printf("tip: bad baud rate %d\n",
number(value(BAUDRATE)));
myperm();
diff --git a/usr/src/cmd/tip/vars.c b/usr/src/cmd/tip/vars.c
index 3c33923fbe..9b6f477b8c 100644
--- a/usr/src/cmd/tip/vars.c
+++ b/usr/src/cmd/tip/vars.c
@@ -9,8 +9,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "tip.h"
/*
@@ -85,5 +83,5 @@ value_t vtable[] = {
"par", (char *)&PA },
{ "hardwareflow", BOOL, (READ|WRITE)<<PUBLIC,
"hf", (char *)FALSE },
- { NOSTR, NULL, NULL, NOSTR, NOSTR }
+ { NOSTR, 0, 0, NOSTR, NOSTR }
};
diff --git a/usr/src/cmd/tnf/prex/spec.c b/usr/src/cmd/tnf/prex/spec.c
index 159212d8e6..d8d125fa45 100644
--- a/usr/src/cmd/tnf/prex/spec.c
+++ b/usr/src/cmd/tnf/prex/spec.c
@@ -23,8 +23,6 @@
* Copyright (c) 1994, by Sun Microsytems, Inc.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Includes
*/
@@ -185,7 +183,7 @@ spec_match(spec_t * spec_p,
return ((strcmp(spec_p->str, str) == 0));
case SPEC_REGEXP:
- return ((step(str, spec_p->regexp_p) != NULL));
+ return ((step(str, spec_p->regexp_p) != 0));
}
return (B_FALSE);
@@ -317,7 +315,7 @@ spec_valtrav(spec_t * spec_p,
}
for (s = s0 = valstr; ; s++) {
switch (*s) {
- case NULL:
+ case '\0':
if (intoken) {
if (spec_match(spec_p, s0))
(*fun) (spec_p, s0, calldatap);
diff --git a/usr/src/cmd/tnf/tnfxtract/tnfxtract.c b/usr/src/cmd/tnf/tnfxtract/tnfxtract.c
index 5e48d6094d..9e1ac13d61 100644
--- a/usr/src/cmd/tnf/tnfxtract/tnfxtract.c
+++ b/usr/src/cmd/tnf/tnfxtract/tnfxtract.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -128,7 +126,7 @@ dumpfile_init()
"kvm_read error in %s\n"), dumpfile);
exit(1);
}
- if (dump_bufaddr == NULL || tnf_bufsize == 0) {
+ if (dump_bufaddr == (uintptr_t)NULL || tnf_bufsize == 0) {
(void) fprintf(stderr, gettext(
"No trace data available in the kernel.\n"));
exit(1);
diff --git a/usr/src/cmd/ttymon/sttyparse.c b/usr/src/cmd/ttymon/sttyparse.c
index 84599af825..cfa30043e3 100644
--- a/usr/src/cmd/ttymon/sttyparse.c
+++ b/usr/src/cmd/ttymon/sttyparse.c
@@ -603,7 +603,7 @@ parse_encoded(struct termios *cb
}
s[2] = '\0';
for (i = 0; *t != 0 && i < MAXNAMELEN; i++) {
- if (*(t + 1) == (char)NULL) {
+ if (*(t + 1) == '\0') {
free((void *)r);
return (0);
}
diff --git a/usr/src/cmd/uadmin/uadmin.c b/usr/src/cmd/uadmin/uadmin.c
index 1a38e3bd4e..25fd7f8f7d 100644
--- a/usr/src/cmd/uadmin/uadmin.c
+++ b/usr/src/cmd/uadmin/uadmin.c
@@ -23,7 +23,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
@@ -60,7 +60,7 @@ int
main(int argc, char *argv[])
{
int cmd, fcn;
- uintptr_t mdep = NULL;
+ uintptr_t mdep = (uintptr_t)NULL;
sigset_t set;
adt_session_data_t *ah; /* audit session handle */
adt_event_data_t *event = NULL; /* event to be generated */
@@ -152,7 +152,7 @@ main(int argc, char *argv[])
case AD_FASTREBOOT:
#ifdef __i386
fcn_id = ADT_UADMIN_FCN_AD_FASTREBOOT;
- mdep = NULL; /* Ignore all arguments */
+ mdep = (uintptr_t)NULL; /* Ignore all arguments */
#else /* __i386 */
fcn = AD_BOOT;
fcn_id = ADT_UADMIN_FCN_AD_BOOT;
@@ -160,7 +160,7 @@ main(int argc, char *argv[])
break;
case AD_FASTREBOOT_DRYRUN:
fcn_id = ADT_UADMIN_FCN_AD_FASTREBOOT_DRYRUN;
- mdep = NULL; /* Ignore all arguments */
+ mdep = (uintptr_t)NULL; /* Ignore all arguments */
break;
default:
fcn_id = 0;
@@ -435,7 +435,7 @@ wait_for_auqueue()
au_stat_t au_stat;
int retries = 10;
- while (retries-- && auditon(A_GETSTAT, (caddr_t)&au_stat, NULL) == 0) {
+ while (retries-- && auditon(A_GETSTAT, (caddr_t)&au_stat, 0) == 0) {
if (au_stat.as_enqueue == au_stat.as_written) {
break;
}
diff --git a/usr/src/cmd/vgrind/vfontedpr.c b/usr/src/cmd/vgrind/vfontedpr.c
index ec9fa29194..b06c29ad1d 100644
--- a/usr/src/cmd/vgrind/vfontedpr.c
+++ b/usr/src/cmd/vgrind/vfontedpr.c
@@ -267,7 +267,7 @@ flagsdone:
cp = strings;
while (*cp) {
while (*cp == ' ' || *cp =='\t')
- *cp++ = NULL;
+ *cp++ = '\0';
if (*cp)
*cpp++ = cp;
while (*cp != ' ' && *cp != '\t' && *cp)
@@ -355,7 +355,7 @@ flagsdone:
blklevel = 0;
prclevel = -1;
for (psptr=0; psptr<PSMAX; psptr++) {
- pstack[psptr][0] = NULL;
+ pstack[psptr][0] = '\0';
plstack[psptr] = 0;
}
psptr = -1;
@@ -445,7 +445,7 @@ putScp(char *os)
if (psptr < PSMAX-1) {
++psptr;
strncpy (pstack[psptr], pname, PNAMELEN);
- pstack[psptr][PNAMELEN] = NULL;
+ pstack[psptr][PNAMELEN] = '\0';
plstack[psptr] = blklevel;
}
}
@@ -801,10 +801,9 @@ putcp(int c)
* look for a process beginning on this line
*/
boolean
-isproc(s)
- char *s;
+isproc(char *s)
{
- pname[0] = NULL;
+ pname[0] = '\0';
if (l_prclevel ? (prclevel == blklevel) : (!l_toplex || blklevel == 0))
if (expmatch (s, l_prcbeg, pname) != NIL) {
return (TRUE);
diff --git a/usr/src/cmd/vi/misc/ctags.c b/usr/src/cmd/vi/misc/ctags.c
index d6e2de739b..84d4a427ab 100644
--- a/usr/src/cmd/vi/misc/ctags.c
+++ b/usr/src/cmd/vi/misc/ctags.c
@@ -28,7 +28,7 @@
* e.g. classz ::afunc
*
* Enhance operator functions support:
- * - Control flow involving operator tokens scanning are
+ * - Control flow involving operator tokens scanning are
* consistent with that of other function tokens - original
* hacking method for 2.0 is removed. This will accurately
* identify tags for declarations of the form 'operator+()'
@@ -69,7 +69,7 @@ char copyright[] = "@(#) Copyright (c) 1980 Regents of the University of "
#define endtoken(arg) (_etk[arg]) /* T if char ends tokens */
#define isgood(arg) (_gd[arg]) /* T if char can be after ')' */
-#define optoken(arg) (_opr[arg]) /* T if char can be */
+#define optoken(arg) (_opr[arg]) /* T if char can be */
/* an overloaded operator token */
#define max(I1, I2) (I1 > I2 ? I1 : I2)
@@ -104,7 +104,7 @@ typedef enum {none, begin, begin_rec, begin_tag, middle, end } TYST;
static TYST tydef = none;
-static char searchar = '/'; /* use /.../ searches */
+static char searchar = '/'; /* use /.../ searches */
static int lineno; /* line number of current line */
static char
@@ -141,7 +141,7 @@ static FILE
*inf, /* ioptr for current input file */
*outf; /* ioptr for tags file */
-static long lineftell; /* ftell after getc( inf ) == '\n' */
+static long lineftell; /* ftell after getc( inf ) == '\n' */
static NODE *head; /* the head of the sorted binary tree */
@@ -354,9 +354,9 @@ char *file;
/* .l implies lisp or lex source code */
if (cp && cp[1] == 'l' && cp[2] == '\0') {
#ifdef __STDC__
- if (strchr(";([", first_char()) != NULL) /* lisp */
+ if (strchr(";([", first_char()) != NULL) /* lisp */
#else
- if (index(";([", first_char()) != NULL) /* lisp */
+ if (index(";([", first_char()) != NULL) /* lisp */
#endif
{
L_funcs(inf);
@@ -545,7 +545,7 @@ C_entries()
continue;
case '/':
*++sp = c = getc(inf);
- /* Handles the C++ comment token "//" */
+ /* Handles the C++ comment token "//" */
if (c == '*')
incomm = TRUE;
else if (c == '/') {
@@ -1451,7 +1451,7 @@ char **av; /* ptr to original argument space */
}
/* for each argument, see if we need to change things: */
- for (; (av[i] != (char *)NULL) && (av[i][0] != (char)NULL); i++) {
+ for (; (av[i] != NULL) && (av[i][0] != '\0'); i++) {
if (strcmp(av[i], "--") == 0) {
fflag = 1; /* just handle filenames now */
@@ -1466,7 +1466,7 @@ char **av; /* ptr to original argument space */
*
* so, if we've found a "-" string which needs separating:
*/
- if (fflag == 0 && /* not handling filename args */
+ if (fflag == 0 && /* not handling filename args */
av[i][0] == '-' && /* and this is a flag */
sz > 2) { /* and there's more than 1 flag */
/* then for each flag after the "-" sign: */
diff --git a/usr/src/cmd/w/w.c b/usr/src/cmd/w/w.c
index 6576b67d34..c062190a21 100644
--- a/usr/src/cmd/w/w.c
+++ b/usr/src/cmd/w/w.c
@@ -26,7 +26,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -88,7 +88,7 @@ static struct utmpx dummy;
#endif
#define ERR (-1)
-#define HSIZE 256 /* size of process hash table */
+#define HSIZE 256 /* size of process hash table */
#define PROCDIR "/proc"
#define INITPROCESS (pid_t)1 /* init process pid */
#define NONE 'n' /* no state */
@@ -115,15 +115,15 @@ struct uproc {
};
/*
- * define hash table for struct uproc
+ * define hash table for struct uproc
* Hash function uses process id
* and the size of the hash table(HSIZE)
* to determine process index into the table.
*/
static struct uproc pr_htbl[HSIZE];
-static struct uproc *findhash(pid_t);
-static time_t findidle(char *);
+static struct uproc *findhash(pid_t);
+static time_t findidle(char *);
static void clnarglist(char *);
static void showtotals(struct uproc *);
static void calctotals(struct uproc *);
@@ -134,7 +134,7 @@ static char *prog; /* pointer to invocation name */
static int header = 1; /* true if -h flag: don't print heading */
static int lflag = 1; /* set if -l flag; 0 for -s flag: short form */
static char *sel_user; /* login of particular user selected */
-static char firstchar; /* first char of name of prog invoked as */
+static char firstchar; /* first char of name of prog invoked as */
static int login; /* true if invoked as login shell */
static time_t now; /* current time of day */
static time_t uptime; /* time of last reboot & elapsed time since */
@@ -165,10 +165,10 @@ main(int argc, char *argv[])
struct pstatus statinfo;
size_t size;
struct stat sbuf;
- DIR *dirp;
+ DIR *dirp;
struct dirent *dp;
char pname[64];
- char *fname;
+ char *fname;
int procfd;
char *cp;
int i;
@@ -731,13 +731,13 @@ static void
clnarglist(char *arglist)
{
char *c;
- int err = 0;
+ int err = 0;
/* get rid of unsavory characters */
- for (c = arglist; *c != NULL; c++) {
+ for (c = arglist; *c != '\0'; c++) {
if ((*c < ' ') || (*c > 0176)) {
if (err++ > 5) {
- *arglist = NULL;
+ *arglist = '\0';
break;
}
*c = '?';
diff --git a/usr/src/cmd/whodo/whodo.c b/usr/src/cmd/whodo/whodo.c
index 80a781b7b7..fe097ace23 100644
--- a/usr/src/cmd/whodo/whodo.c
+++ b/usr/src/cmd/whodo/whodo.c
@@ -139,7 +139,7 @@ static void prtat(time_t *);
static char *prog;
static int header = 1; /* true if -h flag: don't print heading */
static int lflag = 0; /* true if -l flag: w command format */
-static char *sel_user; /* login of particular user selected */
+static char *sel_user; /* login of particular user selected */
static time_t now; /* current time of day */
static time_t uptime; /* time of last reboot & elapsed time since */
static int nusers; /* number of users logged in now */
@@ -162,7 +162,7 @@ main(int argc, char *argv[])
struct utmpx *ut;
struct utmpx *utmpbegin;
struct utmpx *utmpend;
- struct utmpx *utp;
+ struct utmpx *utp;
struct tm *tm;
struct uproc *up, *parent, *pgrp;
struct psinfo info;
@@ -173,8 +173,8 @@ main(int argc, char *argv[])
struct utsname uts;
DIR *dirp;
struct dirent *dp;
- char pname[64];
- char *fname;
+ char pname[64];
+ char *fname;
int procfd;
int i;
int days, hrs, mins;
@@ -825,10 +825,10 @@ clnarglist(char *arglist)
int err = 0;
/* get rid of unsavory characters */
- for (c = arglist; *c == NULL; c++) {
+ for (c = arglist; *c == '\0'; c++) {
if ((*c < ' ') || (*c > 0176)) {
if (err++ > 5) {
- *arglist = NULL;
+ *arglist = '\0';
break;
}
*c = '?';
diff --git a/usr/src/cmd/xargs/xargs.c b/usr/src/cmd/xargs/xargs.c
index 26feb9bdf6..ba582df141 100644
--- a/usr/src/cmd/xargs/xargs.c
+++ b/usr/src/cmd/xargs/xargs.c
@@ -36,7 +36,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
#include <stdio.h>
@@ -177,8 +177,8 @@ main(int argc, char **argv)
n_inserts = 0;
psave = saveargv;
(void) setlocale(LC_ALL, "");
-#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
-#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
+#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
+#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
#endif
(void) textdomain(TEXT_DOMAIN);
if (init_yes() < 0) {
@@ -376,7 +376,7 @@ main(int argc, char **argv)
*/
- mac -= optind; /* dec arg count by what we've processed */
+ mac -= optind; /* dec arg count by what we've processed */
mav += optind; /* inc to current mav */
procs = calloc(MAXPROCS, sizeof (pid_t));
@@ -1100,7 +1100,7 @@ parseargs(int ac, char **av)
/*
* if we're doing special processing, and we've got a flag
*/
- else if ((av[i][0] == '-') && (av[i][1] != NULL)) {
+ else if ((av[i][0] == '-') && (av[i][1] != '\0')) {
char *def;
switch (av[i][1]) {
@@ -1119,11 +1119,11 @@ process_special:
* be able to distinguish between a valid
* suboption, and a command name.
*/
- if (av[i][2] == NULL) {
+ if (av[i][2] == '\0') {
mav[++mac] = strdup(def);
} else {
/* clear out our version: */
- mav[mac][2] = NULL;
+ mav[mac][2] = '\0';
mav[++mac] = strdup(&av[i][2]);
}
if (mav[mac] == NULL) {
@@ -1157,9 +1157,9 @@ process_special:
* we move the subargument into our
* mod'd argument list.
*/
- if (av[i][2] != NULL) {
+ if (av[i][2] != '\0') {
/* first clean things up: */
- mav[mac][2] = NULL;
+ mav[mac][2] = '\0';
/* now add the separation: */
++mac; /* inc to next mod'd arg */
diff --git a/usr/src/cmd/xstr/xstr.c b/usr/src/cmd/xstr/xstr.c
index 7378337aa2..d2f7c659b0 100644
--- a/usr/src/cmd/xstr/xstr.c
+++ b/usr/src/cmd/xstr/xstr.c
@@ -4,7 +4,7 @@
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
@@ -12,8 +12,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
@@ -272,7 +270,7 @@ inithash(void)
return;
for (;;) {
mesgpt = tellpt;
- if (fgetNUL(buf, sizeof (buf), mesgread) == NULL)
+ if (fgetNUL(buf, sizeof (buf), mesgread) == 0)
break;
(void) hashit(buf, 0);
}
@@ -288,7 +286,7 @@ fgetNUL(char *obuf, int rmdr, FILE *file)
while (--rmdr > 0 && (c = xgetc(file)) != 0 && c != EOF)
*buf++ = c;
*buf++ = 0;
- return ((feof(file) || ferror(file)) ? NULL : 1);
+ return ((feof(file) || ferror(file)) ? 0 : 1);
}
int
diff --git a/usr/src/cmd/zoneadm/zoneadm.c b/usr/src/cmd/zoneadm/zoneadm.c
index 67372504a4..3487dcc7e6 100644
--- a/usr/src/cmd/zoneadm/zoneadm.c
+++ b/usr/src/cmd/zoneadm/zoneadm.c
@@ -3893,7 +3893,7 @@ cleanup_zonepath(char *zonepath, boolean_t all)
* We shouldn't need these checks but lets be paranoid since we
* could blow away the whole system here if we got the wrong zonepath.
*/
- if (*zonepath == NULL || strcmp(zonepath, "/") == 0) {
+ if (*zonepath == '\0' || strcmp(zonepath, "/") == 0) {
(void) fprintf(stderr, "invalid zonepath '%s'\n", zonepath);
return (Z_INVAL);
}
diff --git a/usr/src/cmd/zoneadmd/zoneadmd.c b/usr/src/cmd/zoneadmd/zoneadmd.c
index 9f998ba475..7c8d2a2bbc 100644
--- a/usr/src/cmd/zoneadmd/zoneadmd.c
+++ b/usr/src/cmd/zoneadmd/zoneadmd.c
@@ -378,7 +378,7 @@ filter_bootargs(zlog_t *zlogp, const char *inargs, char *outargs,
* We preserve compatibility with the illumos system boot behavior,
* which allows:
*
- * # reboot kernel/unix -s -m verbose
+ * # reboot kernel/unix -s -m verbose
*
* In this example, kernel/unix tells the booter what file to boot. The
* original intent of this was that we didn't want reboot in a zone to
@@ -552,7 +552,7 @@ notify_zonestatd(zoneid_t zoneid)
params.desc_ptr = NULL;
params.desc_num = 0;
params.rbuf = NULL;
- params.rsize = NULL;
+ params.rsize = 0;
(void) door_call(fd, &params);
(void) close(fd);
}
@@ -2205,20 +2205,20 @@ setup_door(zlog_t *zlogp)
* vnodes we could be dealing with. Our strategy is as follows:
*
* - If the file we opened is a regular file (common case):
- * There is no fattach(3c)ed door, so we have a chance of becoming
- * the managing zoneadmd. We attempt to lock the file: if it is
- * already locked, that means someone else raced us here, so we
- * lose and give up. zoneadm(1m) will try to contact the zoneadmd
- * that beat us to it.
+ * There is no fattach(3c)ed door, so we have a chance of becoming
+ * the managing zoneadmd. We attempt to lock the file: if it is
+ * already locked, that means someone else raced us here, so we
+ * lose and give up. zoneadm(1m) will try to contact the zoneadmd
+ * that beat us to it.
*
* - If the file we opened is a namefs file:
- * This means there is already an established door fattach(3c)'ed
- * to the rendezvous path. We've lost the race, so we give up.
- * Note that in this case we also try to grab the file lock, and
- * will succeed in acquiring it since the vnode locked by the
- * "winning" zoneadmd was a regular one, and the one we locked was
- * the fattach(3c)'ed door node. At any rate, no harm is done, and
- * we just return to zoneadm(1m) which knows to retry.
+ * This means there is already an established door fattach(3c)'ed
+ * to the rendezvous path. We've lost the race, so we give up.
+ * Note that in this case we also try to grab the file lock, and
+ * will succeed in acquiring it since the vnode locked by the
+ * "winning" zoneadmd was a regular one, and the one we locked was
+ * the fattach(3c)'ed door node. At any rate, no harm is done, and
+ * we just return to zoneadm(1m) which knows to retry.
*/
static int
make_daemon_exclusive(zlog_t *zlogp)
diff --git a/usr/src/cmd/zonecfg/zonecfg.c b/usr/src/cmd/zonecfg/zonecfg.c
index 512f27d1e6..414e59abcd 100644
--- a/usr/src/cmd/zonecfg/zonecfg.c
+++ b/usr/src/cmd/zonecfg/zonecfg.c
@@ -6432,7 +6432,7 @@ brand_verify(zone_dochandle_t handle)
* Dump the current config information for this zone to a file.
*/
strcpy(xml_file, "/tmp/zonecfg_verify.XXXXXX");
- if (mkstemp(xml_file) == NULL)
+ if (mkstemp(xml_file) == -1)
return (Z_TEMP_FILE);
if ((err = zonecfg_verify_save(handle, xml_file)) != Z_OK) {
(void) unlink(xml_file);
diff --git a/usr/src/cmd/zonestat/zonestatd/zonestatd.c b/usr/src/cmd/zonestat/zonestatd/zonestatd.c
index 6c293bcc0e..eb807ff06b 100644
--- a/usr/src/cmd/zonestat/zonestatd/zonestatd.c
+++ b/usr/src/cmd/zonestat/zonestatd/zonestatd.c
@@ -4509,7 +4509,7 @@ zsd_stat_server(void *cookie, char *argp, size_t arg_size,
rvals = usage->zsu_size;
zsd_usage_cache_rele(cache);
- (void) door_return(rvalp, rvals, 0, NULL);
+ (void) door_return(rvalp, rvals, NULL, 0);
thr_exit(NULL);
}
diff --git a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_smb1.c b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_smb1.c
index 6c00816133..89e75505d6 100644
--- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_smb1.c
+++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_smb1.c
@@ -780,7 +780,7 @@ smbfs_smb1_get_streaminfo(smbnode_t *np, struct mdchain *mdp,
(void) mb_init(mbp);
(void) mb_put_uint16le(mbp, SMB_QFILEINFO_STREAM_INFO);
(void) mb_put_uint32le(mbp, 0);
- error = smbfs_fullpath(mbp, vcp, np, NULL, NULL, 0);
+ error = smbfs_fullpath(mbp, vcp, np, NULL, 0, 0);
if (error)
goto out;