More 64-bit compilation/safety fixes.

This commit is contained in:
Alex Smith
2012-06-15 16:04:20 +01:00
parent 40e20c1076
commit 4be4fc6b1f
44 changed files with 326 additions and 301 deletions
+16 -16
View File
@@ -264,7 +264,7 @@ insert_chars_into_line(char* buffer, int32& position, int32& length,
// reposition cursor, if necessary
if (position < length)
kprintf("\x1b[%ldD", length - position);
kprintf("\x1b[%" B_PRId32 "D", length - position);
}
@@ -296,7 +296,7 @@ remove_char_from_line(char* buffer, int32& position, int32& length)
kputchar(' ');
// reposition the cursor
kprintf("\x1b[%ldD", length - position + 1);
kprintf("\x1b[%" B_PRId32 "D", length - position + 1);
}
@@ -439,7 +439,7 @@ public:
if (reprintLine) {
kprintf("%s%.*s", kKDLPrompt, (int)length, buffer);
if (position < length)
kprintf("\x1b[%ldD", length - position);
kprintf("\x1b[%" B_PRId32 "D", length - position);
}
}
};
@@ -488,7 +488,7 @@ read_line(char* buffer, int32 maxLength,
kputchar(' ');
// reposition cursor
kprintf("\x1b[%ldD", length - position);
kprintf("\x1b[%" B_PRId32 "D", length - position);
length = position;
}
@@ -566,7 +566,7 @@ read_line(char* buffer, int32 maxLength,
// swap the current line with something from the history
if (position > 0)
kprintf("\x1b[%ldD", position); // move to beginning of line
kprintf("\x1b[%" B_PRId32 "D", position); // move to beginning of line
strcpy(buffer, sLineBuffer[historyLine]);
length = position = strlen(buffer);
@@ -608,7 +608,7 @@ read_line(char* buffer, int32 maxLength,
length = strlen(buffer);
kprintf("%s\x1b[K", buffer + position);
// print the line and clear the rest
kprintf("\x1b[%ldD", length - position);
kprintf("\x1b[%" B_PRId32 "D", length - position);
// reposition cursor
currentHistoryLine = historyLine;
@@ -617,7 +617,7 @@ read_line(char* buffer, int32 maxLength,
case 'H': // home
{
if (position > 0) {
kprintf("\x1b[%ldD", position);
kprintf("\x1b[%" B_PRId32 "D", position);
position = 0;
}
break;
@@ -625,7 +625,7 @@ read_line(char* buffer, int32 maxLength,
case 'F': // end
{
if (position < length) {
kprintf("\x1b[%ldC", length - position);
kprintf("\x1b[%" B_PRId32 "C", length - position);
position = length;
}
break;
@@ -825,10 +825,10 @@ kernel_debugger_loop(const char* messagePrefix, const char* message,
Thread* thread = thread_get_current_thread();
if (thread == NULL) {
kprintf("Running on CPU %ld\n", sDebuggerOnCPU);
kprintf("Running on CPU %" B_PRId32 "\n", sDebuggerOnCPU);
} else if (!debug_is_kernel_memory_accessible((addr_t)thread,
sizeof(Thread), B_KERNEL_READ_AREA)) {
kprintf("Running on CPU %ld\n", sDebuggerOnCPU);
kprintf("Running on CPU %" B_PRId32 "\n", sDebuggerOnCPU);
kprintf("Current thread pointer is %p, which is an address we "
"can't read from.\n", thread);
arch_debug_unset_current_thread();
@@ -836,8 +836,8 @@ kernel_debugger_loop(const char* messagePrefix, const char* message,
set_debug_variable("_thread", (uint64)(addr_t)thread);
set_debug_variable("_threadID", thread->id);
kprintf("Thread %ld \"%.64s\" running on CPU %ld\n", thread->id,
thread->name, sDebuggerOnCPU);
kprintf("Thread %" B_PRId32 " \"%.64s\" running on CPU %" B_PRId32 "\n",
thread->id, thread->name, sDebuggerOnCPU);
if (thread->cpu != gCPU + cpu) {
kprintf("The thread's CPU pointer is %p, but should be %p.\n",
@@ -1159,7 +1159,7 @@ cmd_switch_cpu(int argc, char** argv)
}
if (argc == 1) {
kprintf("running on CPU %ld\n", smp_get_current_cpu());
kprintf("running on CPU %" B_PRId32 "\n", smp_get_current_cpu());
return 0;
}
@@ -1170,7 +1170,7 @@ cmd_switch_cpu(int argc, char** argv)
}
if (newCPU == smp_get_current_cpu()) {
kprintf("already running on CPU %ld\n", newCPU);
kprintf("already running on CPU %" B_PRId32 "\n", newCPU);
return 0;
}
@@ -1409,7 +1409,7 @@ syslog_init_post_vm(struct kernel_args* args)
"Welcome to syslog debug output!\nHaiku revision: %s\n",
get_haiku_revision());
syslog_write(revisionBuffer,
std::min(length, (ssize_t)sizeof(revisionBuffer) - 1), false);
std::min(length, (int32)sizeof(revisionBuffer) - 1), false);
add_debugger_command_etc("syslog", &cmd_dump_syslog,
"Dumps the syslog buffer.",
@@ -1522,7 +1522,7 @@ flush_pending_repeats(bool notifySyslog)
if (sMessageRepeatCount > 1) {
static char temp[40];
size_t length = snprintf(temp, sizeof(temp),
"Last message repeated %ld times.\n", sMessageRepeatCount);
"Last message repeated %" B_PRId32 " times.\n", sMessageRepeatCount);
length = std::min(length, sizeof(temp) - 1);
if (sSerialDebugEnabled)
@@ -108,7 +108,7 @@ cmd_error(int argc, char **argv)
}
int32 error = parse_expression(argv[1]);
kprintf("error 0x%lx: %s\n", error, strerror(error));
kprintf("error 0x%" B_PRIx32 ": %s\n", error, strerror(error));
return 0;
}
+2 -2
View File
@@ -130,8 +130,8 @@ parse_exception(const char* message, int32 position)
{
if (sNextJumpBufferIndex == 0) {
kprintf_unfiltered("parse_exception(): No jump buffer!\n");
kprintf_unfiltered("exception: \"%s\", position: %lu\n", message,
position);
kprintf_unfiltered("exception: \"%s\", position: %" B_PRId32 "\n",
message, position);
return;
}
+2 -2
View File
@@ -252,8 +252,8 @@ gdb_parse_command(void)
case 'm':
{
char* ptr;
unsigned address;
unsigned len;
addr_t address;
size_t len;
// The 'm' command has the form mAAA,LLL
// where AAA is the address and LLL is the
+2 -2
View File
@@ -806,9 +806,9 @@ AbstractTraceEntry::Dump(TraceOutput& out)
: fTime;
if (out.Flags() & TRACE_OUTPUT_TEAM_ID)
out.Print("[%6ld:%6ld] %10Ld: ", fThread, fTeam, time);
out.Print("[%6" B_PRId32 ":%6" B_PRId32 "] %10Ld: ", fThread, fTeam, time);
else
out.Print("[%6ld] %10Ld: ", fThread, time);
out.Print("[%6" B_PRId32 "] %10Ld: ", fThread, time);
AddDump(out);
+7 -6
View File
@@ -540,7 +540,7 @@ thread_hit_debug_event_internal(debug_debugger_message event,
port_id port = -1;
if (setPort) {
char nameBuffer[128];
snprintf(nameBuffer, sizeof(nameBuffer), "nub to thread %ld",
snprintf(nameBuffer, sizeof(nameBuffer), "nub to thread %" B_PRId32,
thread->id);
port = create_port(1, nameBuffer);
@@ -811,7 +811,7 @@ thread_hit_serious_debug_event(debug_debugger_message event,
if (error != B_OK) {
Thread *thread = thread_get_current_thread();
dprintf("thread_hit_serious_debug_event(): Failed to install debugger: "
"thread: %ld: %s\n", thread->id, strerror(error));
"thread: %" B_PRId32 ": %s\n", thread->id, strerror(error));
return error;
}
@@ -2632,14 +2632,14 @@ install_team_debugger(team_id teamID, port_id debuggerPort,
// create the debugger write lock semaphore
char nameBuffer[B_OS_NAME_LENGTH];
snprintf(nameBuffer, sizeof(nameBuffer), "team %ld debugger port write",
teamID);
snprintf(nameBuffer, sizeof(nameBuffer), "team %" B_PRId32 " debugger port "
"write", teamID);
sem_id debuggerWriteLock = create_sem(1, nameBuffer);
if (debuggerWriteLock < 0)
error = debuggerWriteLock;
// create the nub port
snprintf(nameBuffer, sizeof(nameBuffer), "team %ld debug", teamID);
snprintf(nameBuffer, sizeof(nameBuffer), "team %" B_PRId32 " debug", teamID);
if (error == B_OK) {
nubPort = create_port(1, nameBuffer);
if (nubPort < 0)
@@ -2666,7 +2666,8 @@ install_team_debugger(team_id teamID, port_id debuggerPort,
// spawn the nub thread
thread_id nubThread = -1;
if (error == B_OK) {
snprintf(nameBuffer, sizeof(nameBuffer), "team %ld debug task", teamID);
snprintf(nameBuffer, sizeof(nameBuffer), "team %" B_PRId32 " debug task",
teamID);
nubThread = spawn_kernel_thread_etc(debug_nub_thread, nameBuffer,
B_NORMAL_PRIORITY, NULL, teamID);
if (nubThread < 0)
@@ -232,7 +232,7 @@ FileDevice::Control(void* _cookie, int32 op, void* buffer, size_t length)
switch (op) {
case B_GET_DEVICE_SIZE:
return set_ioctl_result(
fFileSize > ~(size_t)0 ? ~(size_t)0 : (size_t)fFileSize,
(uint64)fFileSize > (uint64)(~(size_t)0) ? ~(size_t)0 : (size_t)fFileSize,
buffer, length);
case B_SET_BLOCKING_IO:
+1 -1
View File
@@ -243,7 +243,7 @@ IOCache::_DoRequest(IORequest* request, generic_size_t& _bytesTransferred)
off_t lineOffset = (offset >> fLineSizeShift) << fLineSizeShift;
// intersection of request and cache line
off_t cacheLineEnd = std::min(lineOffset + fLineSize, fDeviceCapacity);
off_t cacheLineEnd = std::min(lineOffset + (off_t)fLineSize, fDeviceCapacity);
size_t requestLineLength
= std::min(cacheLineEnd - offset, (off_t)length);
@@ -1285,15 +1285,15 @@ IORequest::Dump() const
kprintf(" length: %" B_PRIuGENADDR "\n", fLength);
kprintf(" transfer size: %" B_PRIuGENADDR "\n", fTransferSize);
kprintf(" relative offset: %" B_PRIuGENADDR "\n", fRelativeParentOffset);
kprintf(" pending children: %ld\n", fPendingChildren);
kprintf(" flags: %#lx\n", fFlags);
kprintf(" team: %ld\n", fTeam);
kprintf(" thread: %ld\n", fThread);
kprintf(" pending children: %" B_PRId32 "\n", fPendingChildren);
kprintf(" flags: %#" B_PRIx32 "\n", fFlags);
kprintf(" team: %" B_PRId32 "\n", fTeam);
kprintf(" thread: %" B_PRId32 "\n", fThread);
kprintf(" r/w: %s\n", fIsWrite ? "write" : "read");
kprintf(" partial transfer: %s\n", fPartialTransfer ? "yes" : "no");
kprintf(" finished cvar: %p\n", &fFinishedCondition);
kprintf(" iteration:\n");
kprintf(" vec index: %lu\n", fVecIndex);
kprintf(" vec index: %" B_PRIu32 "\n", fVecIndex);
kprintf(" vec offset: %" B_PRIuGENADDR "\n", fVecOffset);
kprintf(" remaining bytes: %" B_PRIuGENADDR "\n", fRemainingBytes);
kprintf(" callbacks:\n");
@@ -38,9 +38,9 @@ void
IORequestOwner::Dump() const
{
kprintf("IORequestOwner at %p\n", this);
kprintf(" team: %ld\n", team);
kprintf(" thread: %ld\n", thread);
kprintf(" priority: %ld\n", priority);
kprintf(" team: %" B_PRId32 "\n", team);
kprintf(" thread: %" B_PRId32 "\n", thread);
kprintf(" priority: %" B_PRId32 "\n", priority);
kprintf(" requests:");
for (IORequestList::ConstIterator it = requests.GetIterator();
@@ -654,7 +654,7 @@ IOSchedulerSimple::_Scheduler()
if (request == NULL) {
resourcesAvailable = false;
if (operationCount == 0)
panic("no more requests for owner %p (thread %ld)", owner, owner->thread);
panic("no more requests for owner %p (thread %" B_PRId32 ")", owner, owner->thread);
break;
}
+4 -4
View File
@@ -809,7 +809,7 @@ dump_node(int argc, char** argv)
kprintf(" dir next: %p\n", vnode->dir_next);
if (S_ISDIR(vnode->stream.type)) {
kprintf(" dir scanned: %ld\n", vnode->stream.u.dir.scanned);
kprintf(" dir scanned: %" B_PRId32 "\n", vnode->stream.u.dir.scanned);
kprintf(" contents:\n");
devfs_vnode* children = vnode->stream.u.dir.dir_head;
@@ -828,9 +828,9 @@ dump_node(int argc, char** argv)
vnode->stream.u.dev.partition->raw_device);
kprintf(" offset: %Ld\n", info.offset);
kprintf(" size: %Ld\n", info.size);
kprintf(" block size: %ld\n", info.logical_block_size);
kprintf(" session: %ld\n", info.session);
kprintf(" partition: %ld\n", info.partition);
kprintf(" block size: %" B_PRId32 "\n", info.logical_block_size);
kprintf(" session: %" B_PRId32 "\n", info.session);
kprintf(" partition: %" B_PRId32 "\n", info.partition);
kprintf(" device: %s\n", info.device);
set_debug_variable("_raw",
(addr_t)vnode->stream.u.dev.partition->raw_device);
@@ -263,19 +263,23 @@ dump_attribute(device_attr* attr, int32 level)
break;
case B_INT8_TYPE:
case B_UINT8_TYPE:
kprintf("uint8 : %u (%#x)", attr->value.ui8, attr->value.ui8);
kprintf("uint8 : %" B_PRIu8 " (%#" B_PRIx8 ")", attr->value.ui8,
attr->value.ui8);
break;
case B_INT16_TYPE:
case B_UINT16_TYPE:
kprintf("uint16 : %u (%#x)", attr->value.ui16, attr->value.ui16);
kprintf("uint16 : %" B_PRIu16 " (%#" B_PRIx16 ")", attr->value.ui16,
attr->value.ui16);
break;
case B_INT32_TYPE:
case B_UINT32_TYPE:
kprintf("uint32 : %lu (%#lx)", attr->value.ui32, attr->value.ui32);
kprintf("uint32 : %" B_PRIu32 " (%#" B_PRIx32 ")", attr->value.ui32,
attr->value.ui32);
break;
case B_INT64_TYPE:
case B_UINT64_TYPE:
kprintf("uint64 : %Lu (%#Lx)", attr->value.ui64, attr->value.ui64);
kprintf("uint64 : %" B_PRIu64 " (%#" B_PRIx64 ")", attr->value.ui64,
attr->value.ui64);
break;
default:
kprintf("raw data");
@@ -2167,9 +2171,9 @@ void
device_node::Dump(int32 level)
{
put_level(level);
kprintf("(%ld) @%p \"%s\" (ref %ld, init %ld, module %p, data %p)\n", level,
this, ModuleName(), fRefCount, fInitialized, DriverModule(),
DriverData());
kprintf("(%" B_PRId32 ") @%p \"%s\" (ref %" B_PRId32 ", init %" B_PRId32
", module %p, data %p)\n", level, this, ModuleName(), fRefCount,
fInitialized, DriverModule(), DriverData());
AttributeList::Iterator attribute = Attributes().GetIterator();
while (attribute.HasNext()) {
@@ -79,7 +79,7 @@ DMABuffer::Dump() const
kprintf(" bounce buffer: %p (physical %#" B_PRIxPHYSADDR ")\n",
fBounceBuffer->address, fBounceBuffer->physical_address);
kprintf(" bounce buffer size: %" B_PRIxPHYSADDR "\n", fBounceBuffer->size);
kprintf(" vecs: %lu\n", fVecCount);
kprintf(" vecs: %" B_PRIu32 "\n", fVecCount);
for (uint32 i = 0; i < fVecCount; i++) {
kprintf(" [%" B_PRIu32 "] %#" B_PRIxGENADDR ", %" B_PRIuGENADDR "\n",
@@ -225,7 +225,7 @@ dm_free_id(const char* name, uint32 id)
// make sure it's really allocated
// (very important to keep <num_ids> in sync
if ((generator->alloc_map[id / 8] & (1 << (id & 7))) == 0) {
dprintf("id %ld of generator %s wasn't allocated\n", id,
dprintf("id %" B_PRIu32 " of generator %s wasn't allocated\n", id,
generator->name);
release_generator(generator);
@@ -370,8 +370,8 @@ load_driver(legacy_driver *driver)
#error Add checks here for new vs old api version!
#endif
if (*apiVersion > B_CUR_DRIVER_API_VERSION) {
dprintf("devfs: \"%s\" api_version %ld not handled\n", driver->name,
*apiVersion);
dprintf("devfs: \"%s\" api_version %" B_PRId32 " not handled\n",
driver->name, *apiVersion);
status = B_BAD_VALUE;
goto error1;
}
@@ -664,8 +664,8 @@ load_driver_symbols(const char *driverName)
static status_t
reload_driver(legacy_driver *driver)
{
dprintf("devfs: reload driver \"%s\" (%ld, %lld)\n", driver->name,
driver->device, driver->node);
dprintf("devfs: reload driver \"%s\" (%" B_PRIdDEV ", %lld)\n",
driver->name, driver->device, driver->node);
unload_driver(driver);
@@ -825,16 +825,16 @@ dump_driver(legacy_driver* driver)
kprintf("DEVFS DRIVER: %p\n", driver);
kprintf(" name: %s\n", driver->name);
kprintf(" path: %s\n", driver->path);
kprintf(" image: %ld\n", driver->image);
kprintf(" device: %ld\n", driver->device);
kprintf(" image: %" B_PRId32 "\n", driver->image);
kprintf(" device: %" B_PRIdDEV "\n", driver->device);
kprintf(" node: %Ld\n", driver->node);
kprintf(" last modified: %ld.%lu\n", driver->last_modified.tv_sec,
kprintf(" last modified: %" B_PRIdTIME ".%ld\n", driver->last_modified.tv_sec,
driver->last_modified.tv_nsec);
kprintf(" devs used: %ld\n", driver->devices_used);
kprintf(" devs published: %ld\n", driver->devices.Count());
kprintf(" devs used: %" B_PRIu32 "\n", driver->devices_used);
kprintf(" devs published: %" B_PRId32 "\n", driver->devices.Count());
kprintf(" binary updated: %d\n", driver->binary_updated);
kprintf(" priority: %ld\n", driver->priority);
kprintf(" api version: %ld\n", driver->api_version);
kprintf(" priority: %" B_PRId32 "\n", driver->priority);
kprintf(" api version: %" B_PRId32 "\n", driver->api_version);
kprintf(" hooks: find_device %p, publish_devices %p\n"
" uninit_driver %p, uninit_hardware %p\n",
driver->find_device, driver->publish_devices, driver->uninit_driver,
@@ -883,7 +883,8 @@ dump_driver(int argc, char** argv)
if (driver == NULL)
break;
kprintf("%p %5ld %3ld %5ld %c %3ld %s\n", driver,
kprintf("%p %5" B_PRId32 " %3" B_PRIu32 " %5" B_PRId32 " %c "
"%3" B_PRId32 " %s\n", driver,
driver->image < 0 ? -1 : driver->image,
driver->devices_used, driver->devices.Count(),
driver->binary_updated ? 'U' : ' ', driver->priority,
@@ -346,9 +346,9 @@ KDiskDevice::WriteUserData(UserDataWriter& writer)
void
KDiskDevice::Dump(bool deep, int32 level)
{
OUT("device %ld: %s\n", ID(), Path());
OUT("device %" B_PRId32 ": %s\n", ID(), Path());
OUT(" media status: %s\n", strerror(fMediaStatus));
OUT(" device flags: %lx\n", DeviceFlags());
OUT(" device flags: %" B_PRIx32 "\n", DeviceFlags());
if (fMediaStatus == B_OK)
KPartition::Dump(deep, 0);
}
@@ -261,7 +261,7 @@ KDiskDeviceManager::KDiskDeviceManager()
if (fMediaChecker >= 0)
resume_thread(fMediaChecker);
DBG(OUT("number of disk systems: %ld\n", CountDiskSystems()));
DBG(OUT("number of disk systems: %" B_PRId32 "\n", CountDiskSystems()));
// TODO: Watch the disk systems and the relevant directories.
}
@@ -285,26 +285,26 @@ KDiskDeviceManager::~KDiskDeviceManager()
// some sanity checks
if (fPartitions->Count() > 0) {
DBG(OUT("WARNING: There are still %ld unremoved partitions!\n",
DBG(OUT("WARNING: There are still %" B_PRId32 " unremoved partitions!\n",
fPartitions->Count()));
for (PartitionMap::Iterator it = fPartitions->Begin();
it != fPartitions->End(); ++it) {
DBG(OUT(" partition: %ld\n", it->Value()->ID()));
DBG(OUT(" partition: %" B_PRId32 "\n", it->Value()->ID()));
}
}
if (fObsoletePartitions->Count() > 0) {
DBG(OUT("WARNING: There are still %ld obsolete partitions!\n",
DBG(OUT("WARNING: There are still %" B_PRId32 " obsolete partitions!\n",
fObsoletePartitions->Count()));
for (PartitionSet::Iterator it = fObsoletePartitions->Begin();
it != fObsoletePartitions->End(); ++it) {
DBG(OUT(" partition: %ld\n", (*it)->ID()));
DBG(OUT(" partition: %" B_PRId32 "\n", (*it)->ID()));
}
}
// remove all disk systems
for (int32 cookie = 0; KDiskSystem* diskSystem = NextDiskSystem(&cookie);) {
fDiskSystems->Remove(diskSystem->ID());
if (diskSystem->IsLoaded()) {
DBG(OUT("WARNING: Disk system `%s' (%ld) is still loaded!\n",
DBG(OUT("WARNING: Disk system `%s' (%" B_PRId32 ") is still loaded!\n",
diskSystem->Name(), diskSystem->ID()));
} else
delete diskSystem;
@@ -212,7 +212,7 @@ KFileDiskDevice::_GetDirectoryPath(partition_id id, KPath* path)
status_t error = path->SetPath(kFileDevicesDir);
if (error == B_OK) {
char idBuffer[12];
snprintf(idBuffer, sizeof(idBuffer), "%ld", id);
snprintf(idBuffer, sizeof(idBuffer), "%" B_PRId32, id);
error = path->Append(idBuffer);
}
return error;
@@ -216,7 +216,7 @@ KPartition::PublishDevice()
error = devfs_publish_partition(buffer, &info);
if (error != B_OK) {
dprintf("KPartition::PublishDevice(): Failed to publish partition "
"%ld: %s\n", ID(), strerror(error));
"%" B_PRId32 ": %s\n", ID(), strerror(error));
free(fPublishedName);
fPublishedName = NULL;
return error;
@@ -237,14 +237,14 @@ KPartition::UnpublishDevice()
status_t error = GetPath(&path);
if (error != B_OK) {
dprintf("KPartition::UnpublishDevice(): Failed to get path for "
"partition %ld: %s\n", ID(), strerror(error));
"partition %" B_PRId32 ": %s\n", ID(), strerror(error));
return error;
}
error = devfs_unpublish_partition(path.Path());
if (error != B_OK) {
dprintf("KPartition::UnpublishDevice(): Failed to unpublish partition "
"%ld: %s\n", ID(), strerror(error));
"%" B_PRId32 ": %s\n", ID(), strerror(error));
}
free(fPublishedName);
@@ -285,7 +285,7 @@ KPartition::RepublishDevice()
free(newName);
UnpublishDevice();
dprintf("KPartition::RepublishDevice(): Failed to republish partition "
"%ld: %s\n", ID(), strerror(error));
"%" B_PRId32 ": %s\n", ID(), strerror(error));
return error;
}
@@ -657,7 +657,7 @@ KPartition::GetFileName(char* buffer, size_t size) const
{
// If the parent is the device, the name is the index of the partition.
if (Parent() == NULL || Parent()->IsDevice()) {
if (snprintf(buffer, size, "%ld", Index()) >= (int)size)
if (snprintf(buffer, size, "%" B_PRId32, Index()) >= (int)size)
return B_NAME_TOO_LONG;
return B_OK;
}
@@ -669,7 +669,7 @@ KPartition::GetFileName(char* buffer, size_t size) const
return error;
size_t len = strlen(buffer);
if (snprintf(buffer + len, size - len, "_%ld", Index()) >= int(size - len))
if (snprintf(buffer + len, size - len, "_%" B_PRId32, Index()) >= int(size - len))
return B_NAME_TOO_LONG;
return B_OK;
}
@@ -1172,7 +1172,7 @@ KPartition::UninitializeContents(bool logChanges)
B_FORCE_UNMOUNT | B_UNMOUNT_BUSY_PARTITION);
if (error != B_OK) {
dprintf("KPartition::UninitializeContents(): Failed to unmount "
"device %ld: %s\n", VolumeID(), strerror(error));
"device %" B_PRIdDEV ": %s\n", VolumeID(), strerror(error));
}
SetVolumeID(-1);
@@ -1302,17 +1302,17 @@ KPartition::Dump(bool deep, int32 level)
KPath path;
GetPath(&path);
if (level > 0)
OUT("%spartition %ld: %s\n", prefix, ID(), path.Path());
OUT("%spartition %" B_PRId32 ": %s\n", prefix, ID(), path.Path());
OUT("%s offset: %lld\n", prefix, Offset());
OUT("%s size: %lld (%.2f MB)\n", prefix, Size(),
Size() / (1024.0*1024));
OUT("%s content size: %lld\n", prefix, ContentSize());
OUT("%s block size: %lu\n", prefix, BlockSize());
OUT("%s child count: %ld\n", prefix, CountChildren());
OUT("%s index: %ld\n", prefix, Index());
OUT("%s status: %lu\n", prefix, Status());
OUT("%s flags: %lx\n", prefix, Flags());
OUT("%s volume: %ld\n", prefix, VolumeID());
OUT("%s block size: %" B_PRIu32 "\n", prefix, BlockSize());
OUT("%s child count: %" B_PRId32 "\n", prefix, CountChildren());
OUT("%s index: %" B_PRId32 "\n", prefix, Index());
OUT("%s status: %" B_PRIu32 "\n", prefix, Status());
OUT("%s flags: %" B_PRIx32 "\n", prefix, Flags());
OUT("%s volume: %" B_PRIdDEV "\n", prefix, VolumeID());
OUT("%s disk system: %s\n", prefix,
(DiskSystem() ? DiskSystem()->Name() : NULL));
OUT("%s name: %s\n", prefix, Name());
@@ -174,11 +174,11 @@ create_child_partition(partition_id partitionID, int32 index, off_t offset,
== B_OK) {
return child->PartitionData();
} else {
DBG(OUT(" creating child (%ld, %ld) failed\n", partitionID,
index));
DBG(OUT(" creating child (%" B_PRId32 ", %" B_PRId32 ") failed\n",
partitionID, index));
}
} else
DBG(OUT(" partition %ld not found\n", partitionID));
DBG(OUT(" partition %" B_PRId32 " not found\n", partitionID));
return NULL;
}
@@ -244,8 +244,8 @@ get_default_partition_content_name(partition_id partitionID,
// do one digit precision.
uint64 result = uint64(size * 10 + 0.5);
snprintf(buffer, bufferSize, "%s Volume (%ld.%ld %sB)", fileSystemName,
int32(result / 10), int32(result % 10), suffixes[index]);
snprintf(buffer, bufferSize, "%s Volume (%" B_PRId32 ".%" B_PRId32 " %sB)",
fileSystemName, int32(result / 10), int32(result % 10), suffixes[index]);
return B_OK;
}
+1 -1
View File
@@ -243,7 +243,7 @@ socket_write(struct file_descriptor *descriptor, off_t pos, const void *buffer,
static status_t
socket_ioctl(struct file_descriptor *descriptor, uint32 op, void *buffer,
socket_ioctl(struct file_descriptor *descriptor, ulong op, void *buffer,
size_t length)
{
return sStackInterface->ioctl(descriptor->u.socket, op, buffer, length);
+58 -52
View File
@@ -320,7 +320,7 @@ static status_t query_rewind(struct file_descriptor* descriptor);
static void query_free_fd(struct file_descriptor* descriptor);
static status_t query_close(struct file_descriptor* descriptor);
static status_t common_ioctl(struct file_descriptor* descriptor, uint32 op,
static status_t common_ioctl(struct file_descriptor* descriptor, ulong op,
void* buffer, size_t length);
static status_t common_read_stat(struct file_descriptor* descriptor,
struct stat* statData);
@@ -1135,8 +1135,8 @@ restart:
rw_lock_read_unlock(&sVnodeLock);
if (!canWait || --tries < 0) {
// vnode doesn't seem to become unbusy
dprintf("vnode %ld:%Ld is not becoming unbusy!\n", mountID,
vnodeID);
dprintf("vnode %" B_PRIdDEV ":%" B_PRIdINO " is not becoming unbusy!\n",
mountID, vnodeID);
return B_BUSY;
}
snooze(5000); // 5 ms
@@ -1930,8 +1930,8 @@ get_root_vnode(bool kernel)
return root;
// That should never happen.
dprintf("get_root_vnode(): IO context for team %ld doesn't have a "
"root\n", team_get_current_team_id());
dprintf("get_root_vnode(): IO context for team %" B_PRId32 " doesn't "
"have a root\n", team_get_current_team_id());
}
inc_vnode_ref_count(sRoot);
@@ -2088,8 +2088,8 @@ lookup_dir_entry(struct vnode* dir, const char* name, struct vnode** _vnode)
rw_lock_read_unlock(&sVnodeLock);
if (*_vnode == NULL) {
panic("lookup_dir_entry(): could not lookup vnode (mountid 0x%lx vnid "
"0x%Lx)\n", dir->device, id);
panic("lookup_dir_entry(): could not lookup vnode (mountid 0x%" B_PRIx32
" vnid 0x%" B_PRIx64 ")\n", dir->device, id);
return B_ENTRY_NOT_FOUND;
}
@@ -2952,17 +2952,17 @@ _dump_advisory_locking(advisory_locking* locking)
if (locking == NULL)
return;
kprintf(" lock: %ld", locking->lock);
kprintf(" wait_sem: %ld", locking->wait_sem);
kprintf(" lock: %" B_PRId32, locking->lock);
kprintf(" wait_sem: %" B_PRId32, locking->wait_sem);
int32 index = 0;
LockList::Iterator iterator = locking->locks.GetIterator();
while (iterator.HasNext()) {
struct advisory_lock* lock = iterator.Next();
kprintf(" [%2ld] team: %ld\n", index++, lock->team);
kprintf(" start: %Ld\n", lock->start);
kprintf(" end: %Ld\n", lock->end);
kprintf(" [%2" B_PRId32 "] team: %" B_PRId32 "\n", index++, lock->team);
kprintf(" start: %" B_PRIdOFF "\n", lock->start);
kprintf(" end: %" B_PRIdOFF "\n", lock->end);
kprintf(" shared? %s\n", lock->shared ? "yes" : "no");
}
}
@@ -2972,7 +2972,7 @@ static void
_dump_mount(struct fs_mount* mount)
{
kprintf("MOUNT: %p\n", mount);
kprintf(" id: %ld\n", mount->id);
kprintf(" id: %" B_PRIdDEV "\n", mount->id);
kprintf(" device_name: %s\n", mount->device_name);
kprintf(" root_vnode: %p\n", mount->root_vnode);
kprintf(" covers: %p\n", mount->root_vnode->covers);
@@ -2984,7 +2984,7 @@ _dump_mount(struct fs_mount* mount)
fs_volume* volume = mount->volume;
while (volume != NULL) {
kprintf(" volume %p:\n", volume);
kprintf(" layer: %ld\n", volume->layer);
kprintf(" layer: %" B_PRId32 "\n", volume->layer);
kprintf(" private_volume: %p\n", volume->private_volume);
kprintf(" ops: %p\n", volume->ops);
kprintf(" file_system: %p\n", volume->file_system);
@@ -3098,9 +3098,9 @@ static void
_dump_vnode(struct vnode* vnode, bool printPath)
{
kprintf("VNODE: %p\n", vnode);
kprintf(" device: %ld\n", vnode->device);
kprintf(" id: %Ld\n", vnode->id);
kprintf(" ref_count: %ld\n", vnode->ref_count);
kprintf(" device: %" B_PRIdDEV "\n", vnode->device);
kprintf(" id: %" B_PRIdINO "\n", vnode->id);
kprintf(" ref_count: %" B_PRId32 "\n", vnode->ref_count);
kprintf(" private_node: %p\n", vnode->private_node);
kprintf(" mount: %p\n", vnode->mount);
kprintf(" covered_by: %p\n", vnode->covered_by);
@@ -3149,16 +3149,16 @@ dump_mount(int argc, char** argv)
return 0;
}
uint32 id = parse_expression(argv[1]);
struct fs_mount* mount = NULL;
ulong val = parse_expression(argv[1]);
uint32 id = val;
mount = (fs_mount*)hash_lookup(sMountsTable, (void*)&id);
struct fs_mount* mount = (fs_mount*)hash_lookup(sMountsTable, (void*)&id);
if (mount == NULL) {
if (IS_USER_ADDRESS(id)) {
kprintf("fs_mount not found\n");
return 0;
}
mount = (fs_mount*)id;
mount = (fs_mount*)val;
}
_dump_mount(mount);
@@ -3182,7 +3182,7 @@ dump_mounts(int argc, char** argv)
hash_open(sMountsTable, &iterator);
while ((mount = (struct fs_mount*)hash_next(sMountsTable, &iterator))
!= NULL) {
kprintf("%p%4ld %p %p %p %s\n", mount, mount->id, mount->root_vnode,
kprintf("%p%4" B_PRIdDEV " %p %p %p %s\n", mount, mount->id, mount->root_vnode,
mount->root_vnode->covers, mount->volume->private_volume,
mount->volume->file_system_name);
@@ -3265,10 +3265,11 @@ dump_vnodes(int argc, char** argv)
if (vnode->device != device)
continue;
kprintf("%p%4ld%10Ld%5ld %p %p %p %s%s%s\n", vnode, vnode->device,
vnode->id, vnode->ref_count, vnode->cache, vnode->private_node,
vnode->advisory_locking, vnode->IsRemoved() ? "r" : "-",
vnode->IsBusy() ? "b" : "-", vnode->IsUnpublished() ? "u" : "-");
kprintf("%p%4" B_PRIdDEV "%10" B_PRIdINO "%5" B_PRId32 " %p %p %p %s%s%s\n",
vnode, vnode->device, vnode->id, vnode->ref_count, vnode->cache,
vnode->private_node, vnode->advisory_locking,
vnode->IsRemoved() ? "r" : "-", vnode->IsBusy() ? "b" : "-",
vnode->IsUnpublished() ? "u" : "-");
}
hash_close(sVnodeTable, &iterator, false);
@@ -3301,9 +3302,10 @@ dump_vnode_caches(int argc, char** argv)
if (device != -1 && vnode->device != device)
continue;
kprintf("%p%4ld%10Ld %p %8Ld%8ld\n", vnode, vnode->device, vnode->id,
vnode->cache, (vnode->cache->virtual_end + B_PAGE_SIZE - 1)
/ B_PAGE_SIZE, vnode->cache->page_count);
kprintf("%p%4" B_PRIdDEV "%10" B_PRIdINO " %p %8" B_PRIdOFF "%8" B_PRId32 "\n",
vnode, vnode->device, vnode->id, vnode->cache,
(vnode->cache->virtual_end + B_PAGE_SIZE - 1) / B_PAGE_SIZE,
vnode->cache->page_count);
}
hash_close(sVnodeTable, &iterator, false);
@@ -3322,13 +3324,13 @@ dump_io_context(int argc, char** argv)
struct io_context* context = NULL;
if (argc > 1) {
uint32 num = parse_expression(argv[1]);
ulong num = parse_expression(argv[1]);
if (IS_KERNEL_ADDRESS(num))
context = (struct io_context*)num;
else {
Team* team = team_get_team_struct_locked(num);
if (team == NULL) {
kprintf("could not find team with ID %ld\n", num);
kprintf("could not find team with ID %lu\n", num);
return 0;
}
context = (struct io_context*)team->io_context;
@@ -3339,8 +3341,8 @@ dump_io_context(int argc, char** argv)
kprintf("I/O CONTEXT: %p\n", context);
kprintf(" root vnode:\t%p\n", context->root);
kprintf(" cwd vnode:\t%p\n", context->cwd);
kprintf(" used fds:\t%lu\n", context->num_used_fds);
kprintf(" max fds:\t%lu\n", context->table_size);
kprintf(" used fds:\t%" B_PRIu32 "\n", context->num_used_fds);
kprintf(" max fds:\t%" B_PRIu32 "\n", context->table_size);
if (context->num_used_fds)
kprintf(" no. type ops ref open mode pos"
@@ -3360,8 +3362,8 @@ dump_io_context(int argc, char** argv)
fd->u.vnode);
}
kprintf(" used monitors:\t%lu\n", context->num_monitors);
kprintf(" max monitors:\t%lu\n", context->max_monitors);
kprintf(" used monitors:\t%" B_PRIu32 "\n", context->num_monitors);
kprintf(" max monitors:\t%" B_PRIu32 "\n", context->max_monitors);
set_debug_variable("_cwd", (addr_t)context->cwd);
@@ -3377,8 +3379,8 @@ dump_vnode_usage(int argc, char** argv)
return 0;
}
kprintf("Unused vnodes: %ld (max unused %ld)\n", sUnusedVnodes,
kMaxUnusedVnodes);
kprintf("Unused vnodes: %" B_PRIu32 " (max unused %" B_PRIu32 ")\n",
sUnusedVnodes, kMaxUnusedVnodes);
struct hash_iterator iterator;
hash_open(sVnodeTable, &iterator);
@@ -3391,7 +3393,8 @@ dump_vnode_usage(int argc, char** argv)
hash_close(sVnodeTable, &iterator, false);
kprintf("%lu vnodes total (%ld in use).\n", count, count - sUnusedVnodes);
kprintf("%" B_PRIu32 " vnodes total (%" B_PRIu32 " in use).\n", count,
count - sUnusedVnodes);
return 0;
}
@@ -3449,7 +3452,7 @@ common_file_io_vec_pages(struct vnode* vnode, void* cookie,
// now directly read the data from the device
// the first file_io_vec can be read directly
if (fileVecs[0].length < numBytes)
if (fileVecs[0].length < (off_t)numBytes)
size = fileVecs[0].length;
else
size = numBytes;
@@ -3469,20 +3472,20 @@ common_file_io_vec_pages(struct vnode* vnode, void* cookie,
// a) also use this direct I/O for writes (otherwise, it would
// overwrite precious data)
// b) panic if the term below is true (at least for writes)
if (size > fileVecs[0].length) {
if ((off_t)size > fileVecs[0].length) {
//dprintf("warning: device driver %p doesn't respect total length "
// "in read_pages() call!\n", ref->device);
size = fileVecs[0].length;
}
ASSERT(size <= fileVecs[0].length);
ASSERT((off_t)size <= fileVecs[0].length);
// If the file portion was contiguous, we're already done now
if (size == numBytes)
return B_OK;
// if we reached the end of the file, we can return as well
if (size != fileVecs[0].length) {
if ((off_t)size != fileVecs[0].length) {
*_numBytes = size;
return B_OK;
}
@@ -3525,7 +3528,7 @@ common_file_io_vec_pages(struct vnode* vnode, void* cookie,
size = 0;
// assign what is left of the current fileVec to the tempVecs
for (size = 0; size < fileLeft && vecIndex < vecCount
for (size = 0; (off_t)size < fileLeft && vecIndex < vecCount
&& tempCount < MAX_TEMP_IO_VECS;) {
// try to satisfy one iovec per iteration (or as much as
// possible)
@@ -3622,8 +3625,9 @@ new_vnode(fs_volume* volume, ino_t vnodeID, void* privateNode,
// file system integrity check:
// test if the vnode already exists and bail out if this is the case!
if (!nodeCreated) {
panic("vnode %ld:%Ld already exists (node = %p, vnode->node = %p)!",
volume->id, vnodeID, privateNode, vnode->private_node);
panic("vnode %" B_PRIdDEV ":%" B_PRIdINO " already exists (node = %p, "
"vnode->node = %p)!", volume->id, vnodeID, privateNode,
vnode->private_node);
return B_ERROR;
}
@@ -5275,7 +5279,7 @@ create_vnode(struct vnode* directory, const char* name, int openMode,
if (vnode == NULL) {
panic("vfs: fs_create() returned success but there is no vnode, "
"mount ID %ld!\n", directory->device);
"mount ID %" B_PRIdDEV "!\n", directory->device);
return B_BAD_VALUE;
}
@@ -5895,7 +5899,7 @@ dir_remove(int fd, char* path, bool kernel)
static status_t
common_ioctl(struct file_descriptor* descriptor, uint32 op, void* buffer,
common_ioctl(struct file_descriptor* descriptor, ulong op, void* buffer,
size_t length)
{
struct vnode* vnode = descriptor->u.vnode;
@@ -5925,9 +5929,10 @@ common_fcntl(int fd, int op, uint32 argument, bool kernel)
status_t status = B_OK;
if (op == F_SETLK || op == F_SETLKW || op == F_GETLK) {
// TODO: x86_64 needs ulong argument here.
if (descriptor->type != FDTYPE_FILE)
status = B_BAD_VALUE;
else if (user_memcpy(&flock, (struct flock*)argument,
else if (user_memcpy(&flock, (struct flock*)((ulong)argument),
sizeof(struct flock)) != B_OK)
status = B_BAD_ADDRESS;
@@ -6009,7 +6014,8 @@ common_fcntl(int fd, int op, uint32 argument, bool kernel)
status = get_advisory_lock(vnode, &flock);
if (status == B_OK) {
// copy back flock structure
status = user_memcpy((struct flock*)argument, &flock,
// TODO: x86_64
status = user_memcpy((struct flock*)((ulong)argument), &flock,
sizeof(struct flock));
}
} else
@@ -7924,7 +7930,7 @@ _kern_sync(void)
while ((device = next_dev(&cookie)) >= 0) {
status_t status = fs_sync(device);
if (status != B_OK && status != B_BAD_VALUE) {
dprintf("sync: device %ld couldn't sync: %s\n", device,
dprintf("sync: device %" B_PRIdDEV " couldn't sync: %s\n", device,
strerror(status));
}
}
@@ -9216,8 +9222,8 @@ _user_create_pipe(int* userFDs)
status = get_vnode(sRoot->mount->id, nodeID, &vnode, true, false);
if (status != B_OK) {
// that should not happen
dprintf("_user_create_pipe(): Failed to lookup vnode (%ld, %lld)\n",
sRoot->mount->id, sRoot->id);
dprintf("_user_create_pipe(): Failed to lookup vnode (%" B_PRIdDEV ", "
"%" B_PRIdINO ")\n", sRoot->mount->id, sRoot->id);
return status;
}
+2 -1
View File
@@ -329,7 +329,8 @@ get_boot_partitions(kernel_args* args, PartitionStack& partitions)
// create boot method
int32 bootMethodType = bootVolume.GetInt32(BOOT_METHOD, BOOT_METHOD_DEFAULT);
dprintf("get_boot_partitions(): boot method type: %ld\n", bootMethodType);
dprintf("get_boot_partitions(): boot method type: %" B_PRId32 "\n",
bootMethodType);
BootMethod* bootMethod = NULL;
switch (bootMethodType) {
+7 -7
View File
@@ -140,7 +140,7 @@ do_iterative_fd_io_iterate(void* _cookie, io_request* request,
TRACE_RIO("[%ld] do_iterative_fd_io_iterate(request: %p)\n",
find_thread(NULL), request);
static const int32 kMaxSubRequests = 8;
static const size_t kMaxSubRequests = 8;
iterative_io_cookie* cookie = (iterative_io_cookie*)_cookie;
@@ -152,7 +152,7 @@ do_iterative_fd_io_iterate(void* _cookie, io_request* request,
// get the next file vecs
file_io_vec vecs[kMaxSubRequests];
uint32 vecCount = kMaxSubRequests;
size_t vecCount = kMaxSubRequests;
status_t error = cookie->get_vecs(cookie->cookie, request, requestOffset,
requestLength, vecs, &vecCount);
if (error != B_OK && error != B_BUFFER_OVERFLOW)
@@ -161,11 +161,11 @@ do_iterative_fd_io_iterate(void* _cookie, io_request* request,
*_partialTransfer = true;
return B_OK;
}
TRACE_RIO("[%ld] got %lu file vecs\n", find_thread(NULL), vecCount);
TRACE_RIO("[%ld] got %zu file vecs\n", find_thread(NULL), vecCount);
// create subrequests for the file vecs we've got
int32 subRequestCount = 0;
for (uint32 i = 0; i < vecCount && subRequestCount < kMaxSubRequests; i++) {
size_t subRequestCount = 0;
for (size_t i = 0; i < vecCount && subRequestCount < kMaxSubRequests; i++) {
off_t vecOffset = vecs[i].offset;
off_t vecLength = min_c(vecs[i].length, requestLength);
TRACE_RIO("[%ld] vec %lu offset: %lld, length: %lld\n",
@@ -270,13 +270,13 @@ do_synchronous_iterative_vnode_io(struct vnode* vnode, void* openCookie,
while (error == B_OK && vecLength > 0) {
file_io_vec fileVecs[8];
uint32 fileVecCount = 8;
size_t fileVecCount = 8;
error = getVecs(cookie, request, offset, vecLength, fileVecs,
&fileVecCount);
if (error != B_OK || fileVecCount == 0)
break;
for (uint32 i = 0; i < fileVecCount; i++) {
for (size_t i = 0; i < fileVecCount; i++) {
const file_io_vec& fileVec = fileVecs[i];
size_t toTransfer = min_c(fileVec.length, (off_t)length);
size_t transferred = toTransfer;
@@ -12,8 +12,8 @@
void *
memcpy(void *dest, const void *src, size_t count)
{
const unsigned char *s = src;
unsigned char *d = dest;
const unsigned char *s = reinterpret_cast<const unsigned char *>(src);
unsigned char *d = reinterpret_cast<unsigned char *>(dest);
for (; count != 0; count--) {
*d++ = *s++;
@@ -26,7 +26,7 @@ memcpy(void *dest, const void *src, size_t count)
void *
memset(void *dest, int val, size_t count)
{
unsigned char *d = dest;
unsigned char *d = reinterpret_cast<unsigned char *>(dest);
for (; count != 0; count--) {
*d++ = static_cast<unsigned char>(val);
+1 -1
View File
@@ -407,7 +407,7 @@ vsnprintf(char *buffer, size_t bufferSize, const char *format, va_list args)
}
outBuffer.PutString("0x", 2);
number(outBuffer, (uint32)va_arg(args, void *), 16, fieldWidth,
number(outBuffer, (addr_t)va_arg(args, void *), 16, fieldWidth,
precision, flags);
continue;
+12 -12
View File
@@ -535,17 +535,17 @@ dump_rw_lock_info(int argc, char** argv)
kprintf("rw lock %p:\n", lock);
kprintf(" name: %s\n", lock->name);
kprintf(" holder: %ld\n", lock->holder);
kprintf(" count: %#lx\n", lock->count);
kprintf(" holder: %" B_PRId32 "\n", lock->holder);
kprintf(" count: %#" B_PRIx32 "\n", lock->count);
kprintf(" active readers %d\n", lock->active_readers);
kprintf(" pending readers %d\n", lock->pending_readers);
kprintf(" owner count: %#lx\n", lock->owner_count);
kprintf(" flags: %#lx\n", lock->flags);
kprintf(" owner count: %#" B_PRIx32 "\n", lock->owner_count);
kprintf(" flags: %#" B_PRIx32 "\n", lock->flags);
kprintf(" waiting threads:");
rw_lock_waiter* waiter = lock->waiters;
while (waiter != NULL) {
kprintf(" %ld/%c", waiter->thread->id, waiter->writer ? 'w' : 'r');
kprintf(" %" B_PRId32 "/%c", waiter->thread->id, waiter->writer ? 'w' : 'r');
waiter = waiter->next;
}
kputs("\n");
@@ -679,7 +679,7 @@ _mutex_lock(mutex* lock, bool schedulerLocked)
lock->holder = thread_get_current_thread_id();
return B_OK;
} else if (lock->holder == thread_get_current_thread_id()) {
panic("_mutex_lock(): double lock of %p by thread %ld", lock,
panic("_mutex_lock(): double lock of %p by thread %" B_PRId32, lock,
lock->holder);
} else if (lock->holder == 0)
panic("_mutex_lock(): using unitialized lock %p", lock);
@@ -723,9 +723,9 @@ _mutex_unlock(mutex* lock, bool schedulerLocked)
#if KDEBUG
if (thread_get_current_thread_id() != lock->holder) {
panic("_mutex_unlock() failure: thread %ld is trying to release "
"mutex %p (current holder %ld)\n", thread_get_current_thread_id(),
lock, lock->holder);
panic("_mutex_unlock() failure: thread %" B_PRId32 " is trying to "
"release mutex %p (current holder %" B_PRId32 ")\n",
thread_get_current_thread_id(), lock, lock->holder);
return;
}
#else
@@ -798,7 +798,7 @@ _mutex_lock_with_timeout(mutex* lock, uint32 timeoutFlags, bigtime_t timeout)
lock->holder = thread_get_current_thread_id();
return B_OK;
} else if (lock->holder == thread_get_current_thread_id()) {
panic("_mutex_lock(): double lock of %p by thread %ld", lock,
panic("_mutex_lock(): double lock of %p by thread %" B_PRId32, lock,
lock->holder);
} else if (lock->holder == 0)
panic("_mutex_lock(): using unitialized lock %p", lock);
@@ -889,7 +889,7 @@ dump_mutex_info(int argc, char** argv)
kprintf(" name: %s\n", lock->name);
kprintf(" flags: 0x%x\n", lock->flags);
#if KDEBUG
kprintf(" holder: %ld\n", lock->holder);
kprintf(" holder: %" B_PRId32 "\n", lock->holder);
#else
kprintf(" count: %ld\n", lock->count);
#endif
@@ -897,7 +897,7 @@ dump_mutex_info(int argc, char** argv)
kprintf(" waiting threads:");
mutex_waiter* waiter = lock->waiters;
while (waiter != NULL) {
kprintf(" %ld", waiter->thread->id);
kprintf(" %" B_PRId32, waiter->thread->id);
waiter = waiter->next;
}
kputs("\n");
@@ -775,8 +775,9 @@ _user_xsi_msgrcv(int messageQueueID, void *messagePointer,
messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
if (result == EIDRM || messageQueue == NULL || (messageQueue != NULL
&& sequenceNumber != messageQueue->SequenceNumber())) {
TRACE_ERROR(("xsi_msgrcv: message queue id %d (sequence = %ld) "
"got destroyed\n", messageQueueID, sequenceNumber));
TRACE_ERROR(("xsi_msgrcv: message queue id %d (sequence = "
"%" B_PRIu32 ") got destroyed\n", messageQueueID,
sequenceNumber));
return EIDRM;
} else if (result == B_INTERRUPTED) {
TRACE_ERROR(("xsi_msgrcv: thread %d got interrupted while "
@@ -881,8 +882,9 @@ _user_xsi_msgsnd(int messageQueueID, const void *messagePointer,
messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
if (result == EIDRM || messageQueue == NULL || (messageQueue != NULL
&& sequenceNumber != messageQueue->SequenceNumber())) {
TRACE_ERROR(("xsi_msgsnd: message queue id %d (sequence = %ld) "
"got destroyed\n", messageQueueID, sequenceNumber));
TRACE_ERROR(("xsi_msgsnd: message queue id %d (sequence = "
"%" B_PRIu32 ") got destroyed\n", messageQueueID,
sequenceNumber));
delete message;
notSent = false;
result = EIDRM;
+5 -3
View File
@@ -1117,7 +1117,8 @@ _user_xsi_semop(int semaphoreID, struct sembuf *ops, size_t numOps)
for (; i < numOps; i++) {
short semaphoreNumber = operations[i].sem_num;
if (semaphoreNumber >= numberOfSemaphores) {
TRACE_ERROR(("xsi_semop: %ld invalid semaphore number\n", i));
TRACE_ERROR(("xsi_semop: %" B_PRIu32 " invalid semaphore number"
"\n", i));
result = EINVAL;
break;
}
@@ -1188,8 +1189,9 @@ _user_xsi_semop(int semaphoreID, struct sembuf *ops, size_t numOps)
semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreID);
if (result == EIDRM || semaphoreSet == NULL || (semaphoreSet != NULL
&& sequenceNumber != semaphoreSet->SequenceNumber())) {
TRACE_ERROR(("xsi_semop: semaphore set id %d (sequence = %ld) "
"got destroyed\n", semaphoreID, sequenceNumber));
TRACE_ERROR(("xsi_semop: semaphore set id %d (sequence = "
"%" B_PRIu32 ") got destroyed\n", semaphoreID,
sequenceNumber));
notDone = false;
result = EIDRM;
} else if (result == B_INTERRUPTED) {
+1 -1
View File
@@ -64,7 +64,7 @@ void
scheduler_init(void)
{
int32 cpuCount = smp_get_num_cpus();
dprintf("scheduler_init: found %ld logical cpu%s\n", cpuCount,
dprintf("scheduler_init: found %" B_PRId32 " logical cpu%s\n", cpuCount,
cpuCount != 1 ? "s" : "");
if (cpuCount > 1) {
@@ -109,13 +109,13 @@ dump_run_queue(int argc, char **argv)
for (int32 i = 0; i < smp_get_num_cpus(); i++) {
thread = sRunQueue[i];
kprintf("Run queue for cpu %ld (%ld threads)\n", i,
kprintf("Run queue for cpu %" B_PRId32 " (%" B_PRId32 " threads)\n", i,
sRunQueueSize[i]);
if (sRunQueueSize[i] > 0) {
kprintf("thread id priority avg. quantum name\n");
while (thread) {
kprintf("%p %-7ld %-8ld %-12ld %s\n", thread, thread->id,
thread->priority,
kprintf("%p %-7" B_PRId32 " %-8" B_PRId32 " %-12" B_PRId32
" %s\n", thread, thread->id, thread->priority,
thread->scheduler_data->GetAverageQuantumUsage(),
thread->name);
thread = thread->queue_next;
@@ -67,8 +67,8 @@ dump_run_queue(int argc, char **argv)
else {
kprintf("thread id priority name\n");
while (thread) {
kprintf("%p %-7ld %-8ld %s\n", thread, thread->id,
thread->priority, thread->name);
kprintf("%p %-7" B_PRId32 " %-8" B_PRId32 " %s\n", thread,
thread->id, thread->priority, thread->name);
thread = thread->queue_next;
}
}
@@ -70,8 +70,8 @@ dump_run_queue(int argc, char **argv)
else {
kprintf("thread id priority name\n");
while (thread) {
kprintf("%p %-7ld %-8ld %s\n", thread, thread->id,
thread->priority, thread->name);
kprintf("%p %-7" B_PRId32 " %-8" B_PRId32 " %s\n", thread,
thread->id, thread->priority, thread->name);
thread = thread->queue_next;
}
}
+1 -1
View File
@@ -2041,7 +2041,7 @@ MemoryManager::_DumpAreas(int argc, char** argv)
kprintf(" medium: %" B_PRIuSIZE "/%" B_PRIuSIZE "\n", totalUsedMedium,
totalTotalMedium);
kprintf(" large: %" B_PRIuSIZE "\n", totalUsedLarge);
kprintf(" memory: %" B_PRIuSIZE "/%" B_PRIuSIZE " KB\n",
kprintf(" memory: %" B_PRIuSIZE "/%" B_PRIu32 " KB\n",
(totalUsedSmall * SLAB_CHUNK_SIZE_SMALL
+ totalUsedMedium * SLAB_CHUNK_SIZE_MEDIUM
+ totalUsedLarge * SLAB_CHUNK_SIZE_LARGE) / 1024,
+3 -3
View File
@@ -266,8 +266,8 @@ dump_slabs(int argc, char* argv[])
while (it.HasNext()) {
ObjectCache* cache = it.Next();
kprintf("%p %22s %8lu %8" B_PRIuSIZE " %8lu %6lu %8lu %8lu %8lx\n",
cache, cache->name, cache->object_size, cache->alignment,
kprintf("%p %22s %8lu %8" B_PRIuSIZE " %8lu %6lu %8lu %8lu %8" B_PRIx32
"\n", cache, cache->name, cache->object_size, cache->alignment,
cache->usage, cache->empty_count, cache->used_count,
cache->total_objects, cache->flags);
}
@@ -298,7 +298,7 @@ dump_cache_info(int argc, char* argv[])
kprintf("slab_size: %lu\n", cache->slab_size);
kprintf("usage: %lu\n", cache->usage);
kprintf("maximum: %lu\n", cache->maximum);
kprintf("flags: 0x%lx\n", cache->flags);
kprintf("flags: 0x%" B_PRIx32 "\n", cache->flags);
kprintf("cookie: %p\n", cache->cookie);
kprintf("resize entry don't wait: %p\n", cache->resize_entry_dont_wait);
kprintf("resize entry can wait: %p\n", cache->resize_entry_can_wait);
+17 -16
View File
@@ -1114,38 +1114,39 @@ static void
_dump_team_info(Team* team)
{
kprintf("TEAM: %p\n", team);
kprintf("id: %ld (%#lx)\n", team->id, team->id);
kprintf("id: %" B_PRId32 " (%#" B_PRIx32 ")\n", team->id,
team->id);
kprintf("serial_number: %" B_PRId64 "\n", team->serial_number);
kprintf("name: '%s'\n", team->Name());
kprintf("args: '%s'\n", team->Args());
kprintf("hash_next: %p\n", team->hash_next);
kprintf("parent: %p", team->parent);
if (team->parent != NULL) {
kprintf(" (id = %ld)\n", team->parent->id);
kprintf(" (id = %" B_PRId32 ")\n", team->parent->id);
} else
kprintf("\n");
kprintf("children: %p\n", team->children);
kprintf("num_threads: %d\n", team->num_threads);
kprintf("state: %d\n", team->state);
kprintf("flags: 0x%lx\n", team->flags);
kprintf("flags: 0x%" B_PRIx32 "\n", team->flags);
kprintf("io_context: %p\n", team->io_context);
if (team->address_space)
kprintf("address_space: %p\n", team->address_space);
kprintf("user data: %p (area %ld)\n", (void*)team->user_data,
team->user_data_area);
kprintf("user data: %p (area %" B_PRId32 ")\n",
(void*)team->user_data, team->user_data_area);
kprintf("free user thread: %p\n", team->free_user_threads);
kprintf("main_thread: %p\n", team->main_thread);
kprintf("thread_list: %p\n", team->thread_list);
kprintf("group_id: %ld\n", team->group_id);
kprintf("session_id: %ld\n", team->session_id);
kprintf("group_id: %" B_PRId32 "\n", team->group_id);
kprintf("session_id: %" B_PRId32 "\n", team->session_id);
}
static int
dump_team_info(int argc, char** argv)
{
team_id id = -1;
ulong arg;
bool found = false;
if (argc < 2) {
@@ -1157,10 +1158,10 @@ dump_team_info(int argc, char** argv)
return 0;
}
id = strtoul(argv[1], NULL, 0);
if (IS_KERNEL_ADDRESS(id)) {
arg = strtoul(argv[1], NULL, 0);
if (IS_KERNEL_ADDRESS(arg)) {
// semi-hack
_dump_team_info((Team*)id);
_dump_team_info((Team*)arg);
return 0;
}
@@ -1168,7 +1169,7 @@ dump_team_info(int argc, char** argv)
for (TeamTable::Iterator it = sTeamHash.GetIterator();
Team* team = it.Next();) {
if ((team->Name() && strcmp(argv[1], team->Name()) == 0)
|| team->id == id) {
|| team->id == (team_id)arg) {
_dump_team_info(team);
found = true;
break;
@@ -1176,7 +1177,7 @@ dump_team_info(int argc, char** argv)
}
if (!found)
kprintf("team \"%s\" (%ld) doesn't exist!\n", argv[1], id);
kprintf("team \"%s\" (%" B_PRId32 ") doesn't exist!\n", argv[1], (team_id)arg);
return 0;
}
@@ -1188,7 +1189,7 @@ dump_teams(int argc, char** argv)
for (TeamTable::Iterator it = sTeamHash.GetIterator();
Team* team = it.Next();) {
kprintf("%p%7ld %p %s\n", team, team->id, team->parent, team->Name());
kprintf("%p%7" B_PRId32 " %p %s\n", team, team->id, team->parent, team->Name());
}
return 0;
@@ -2054,7 +2055,7 @@ fork_team(void)
if (thread->user_thread == NULL) {
#if KDEBUG
panic("user data area not found, parent area is %ld",
panic("user data area not found, parent area is %" B_PRId32,
parentTeam->user_data_area);
#endif
status = B_ERROR;
@@ -2237,7 +2238,7 @@ job_control_entry::~job_control_entry()
ProcessGroup* group = sGroupHash.Lookup(group_id);
if (group == NULL) {
panic("job_control_entry::~job_control_entry(): unknown group "
"ID: %ld", group_id);
"ID: %" B_PRId32, group_id);
return;
}
+38 -35
View File
@@ -365,7 +365,7 @@ Thread::Init(bool idleThread)
return error;
char temp[64];
snprintf(temp, sizeof(temp), "thread_%ld_retcode_sem", id);
snprintf(temp, sizeof(temp), "thread_%" B_PRId32 "_retcode_sem", id);
exit.sem = create_sem(0, temp);
if (exit.sem < 0)
return exit.sem;
@@ -814,8 +814,8 @@ create_thread_user_stack(Team* team, Thread* thread, void* _stackBase,
size_t areaSize = PAGE_ALIGN(stackSize + TLS_SIZE + additionalSize);
snprintf(nameBuffer, B_OS_NAME_LENGTH, "%s_%ld_stack", thread->name,
thread->id);
snprintf(nameBuffer, B_OS_NAME_LENGTH, "%s_%" B_PRId32 "_stack",
thread->name, thread->id);
virtual_address_restrictions virtualRestrictions = {};
if (thread->id == team->id) {
@@ -913,8 +913,8 @@ thread_create_thread(const ThreadCreationAttributes& attributes, bool kernel)
// create the kernel stack
char stackName[B_OS_NAME_LENGTH];
snprintf(stackName, B_OS_NAME_LENGTH, "%s_%ld_kstack", thread->name,
thread->id);
snprintf(stackName, B_OS_NAME_LENGTH, "%s_%" B_PRId32 "_kstack",
thread->name, thread->id);
thread->kernel_stack_area = create_area(stackName,
(void **)&thread->kernel_stack_base, B_ANY_KERNEL_ADDRESS,
KERNEL_STACK_SIZE + KERNEL_STACK_GUARD_PAGES * B_PAGE_SIZE,
@@ -1405,7 +1405,7 @@ make_thread_unreal(int argc, char **argv)
if (thread->priority > B_DISPLAY_PRIORITY) {
thread->priority = thread->next_priority = B_NORMAL_PRIORITY;
kprintf("thread %ld made unreal\n", thread->id);
kprintf("thread %" B_PRId32 " made unreal\n", thread->id);
}
}
@@ -1441,12 +1441,12 @@ set_thread_prio(int argc, char **argv)
if (thread->id != id)
continue;
thread->priority = thread->next_priority = prio;
kprintf("thread %ld set to priority %ld\n", id, prio);
kprintf("thread %" B_PRId32 " set to priority %" B_PRId32 "\n", id, prio);
found = true;
break;
}
if (!found)
kprintf("thread %ld (%#lx) not found\n", id, id);
kprintf("thread %" B_PRId32 " (%#" B_PRIx32 ") not found\n", id, id);
return 0;
}
@@ -1474,12 +1474,12 @@ make_thread_suspended(int argc, char **argv)
continue;
thread->next_state = B_THREAD_SUSPENDED;
kprintf("thread %ld suspended\n", id);
kprintf("thread %" B_PRId32 " suspended\n", id);
found = true;
break;
}
if (!found)
kprintf("thread %ld (%#lx) not found\n", id, id);
kprintf("thread %" B_PRId32 " (%#" B_PRIx32 ") not found\n", id, id);
return 0;
}
@@ -1507,13 +1507,13 @@ make_thread_resumed(int argc, char **argv)
if (thread->state == B_THREAD_SUSPENDED) {
scheduler_enqueue_in_run_queue(thread);
kprintf("thread %ld resumed\n", thread->id);
kprintf("thread %" B_PRId32 " resumed\n", thread->id);
}
found = true;
break;
}
if (!found)
kprintf("thread %ld (%#lx) not found\n", id, id);
kprintf("thread %" B_PRId32 " (%#" B_PRIx32 ") not found\n", id, id);
return 0;
}
@@ -1541,7 +1541,7 @@ drop_into_debugger(int argc, char **argv)
if (err)
kprintf("drop failed\n");
else
kprintf("thread %ld dropped into user debugger\n", id);
kprintf("thread %" B_PRId32 " dropped into user debugger\n", id);
return 0;
}
@@ -1604,8 +1604,8 @@ static void
_dump_thread_info(Thread *thread, bool shortInfo)
{
if (shortInfo) {
kprintf("%p %6ld %-10s", thread, thread->id, state_to_text(thread,
thread->state));
kprintf("%p %6" B_PRId32 " %-10s", thread, thread->id,
state_to_text(thread, thread->state));
// does it block on a semaphore or a condition variable?
if (thread->state == B_THREAD_WAITING) {
@@ -1616,7 +1616,7 @@ _dump_thread_info(Thread *thread, bool shortInfo)
if (sem == thread->msg.read_sem)
kprintf(" ");
else
kprintf("sem %12ld ", sem);
kprintf("sem %12" B_PRId32 " ", sem);
break;
}
@@ -1657,7 +1657,7 @@ _dump_thread_info(Thread *thread, bool shortInfo)
else
kprintf(" -");
kprintf("%4ld %p%5ld %s\n", thread->priority,
kprintf("%4" B_PRId32 " %p%5" B_PRId32 " %s\n", thread->priority,
(void *)thread->kernel_stack_base, thread->team->id,
thread->name != NULL ? thread->name : "<NULL>");
@@ -1669,13 +1669,15 @@ _dump_thread_info(Thread *thread, bool shortInfo)
struct thread_death_entry *death = NULL;
kprintf("THREAD: %p\n", thread);
kprintf("id: %ld (%#lx)\n", thread->id, thread->id);
kprintf("id: %" B_PRId32 " (%#" B_PRIx32 ")\n", thread->id,
thread->id);
kprintf("serial_number: %" B_PRId64 "\n", thread->serial_number);
kprintf("name: \"%s\"\n", thread->name);
kprintf("hash_next: %p\nteam_next: %p\nq_next: %p\n",
thread->hash_next, thread->team_next, thread->queue_next);
kprintf("priority: %ld (next %ld, I/O: %ld)\n", thread->priority,
thread->next_priority, thread->io_priority);
kprintf("priority: %" B_PRId32 " (next %" B_PRId32 ", "
"I/O: %" B_PRId32 ")\n", thread->priority, thread->next_priority,
thread->io_priority);
kprintf("state: %s\n", state_to_text(thread, thread->state));
kprintf("next_state: %s\n", state_to_text(thread, thread->next_state));
kprintf("cpu: %p ", thread->cpu);
@@ -1700,7 +1702,7 @@ _dump_thread_info(Thread *thread, bool shortInfo)
if (sem == thread->msg.read_sem)
kprintf("data\n");
else
kprintf("semaphore %ld\n", sem);
kprintf("semaphore %" B_PRId32 "\n", sem);
break;
}
@@ -1737,17 +1739,18 @@ _dump_thread_info(Thread *thread, bool shortInfo)
kprintf("fault_handler: %p\n", (void *)thread->fault_handler);
kprintf("team: %p, \"%s\"\n", thread->team,
thread->team->Name());
kprintf(" exit.sem: %ld\n", thread->exit.sem);
kprintf(" exit.status: %#lx (%s)\n", thread->exit.status, strerror(thread->exit.status));
kprintf(" exit.sem: %" B_PRId32 "\n", thread->exit.sem);
kprintf(" exit.status: %#" B_PRIx32 " (%s)\n", thread->exit.status,
strerror(thread->exit.status));
kprintf(" exit.waiters:\n");
while ((death = (struct thread_death_entry*)list_get_next_item(
&thread->exit.waiters, death)) != NULL) {
kprintf("\t%p (thread %ld)\n", death, death->thread);
kprintf("\t%p (thread %" B_PRId32 ")\n", death, death->thread);
}
kprintf("kernel_stack_area: %ld\n", thread->kernel_stack_area);
kprintf("kernel_stack_area: %" B_PRId32 "\n", thread->kernel_stack_area);
kprintf("kernel_stack_base: %p\n", (void *)thread->kernel_stack_base);
kprintf("user_stack_area: %ld\n", thread->user_stack_area);
kprintf("user_stack_area: %" B_PRId32 "\n", thread->user_stack_area);
kprintf("user_stack_base: %p\n", (void *)thread->user_stack_base);
kprintf("user_local_storage: %p\n", (void *)thread->user_local_storage);
kprintf("user_thread: %p\n", (void *)thread->user_thread);
@@ -1755,7 +1758,7 @@ _dump_thread_info(Thread *thread, bool shortInfo)
strerror(thread->kernel_errno));
kprintf("kernel_time: %Ld\n", thread->kernel_time);
kprintf("user_time: %Ld\n", thread->user_time);
kprintf("flags: 0x%lx\n", thread->flags);
kprintf("flags: 0x%" B_PRIx32 "\n", thread->flags);
kprintf("architecture dependant section:\n");
arch_thread_dump_info(&thread->arch_info);
}
@@ -1779,11 +1782,11 @@ dump_thread_info(int argc, char **argv)
for (; argi < argc; argi++) {
const char *name = argv[argi];
int32 id = strtoul(name, NULL, 0);
ulong arg = strtoul(name, NULL, 0);
if (IS_KERNEL_ADDRESS(id)) {
if (IS_KERNEL_ADDRESS(arg)) {
// semi-hack
_dump_thread_info((Thread *)id, shortInfo);
_dump_thread_info((Thread *)arg, shortInfo);
continue;
}
@@ -1791,7 +1794,7 @@ dump_thread_info(int argc, char **argv)
bool found = false;
for (ThreadHashTable::Iterator it = sThreadHash.GetIterator();
Thread* thread = it.Next();) {
if (!strcmp(name, thread->name) || thread->id == id) {
if (!strcmp(name, thread->name) || thread->id == (thread_id)arg) {
_dump_thread_info(thread, shortInfo);
found = true;
break;
@@ -1799,7 +1802,7 @@ dump_thread_info(int argc, char **argv)
}
if (!found)
kprintf("thread \"%s\" (%ld) doesn't exist!\n", name, id);
kprintf("thread \"%s\" (%" B_PRId32 ") doesn't exist!\n", name, (thread_id)arg);
}
return 0;
@@ -2527,7 +2530,7 @@ wait_for_thread_etc(thread_id id, uint32 flags, bigtime_t timeout,
if (status == B_OK) {
// this should never happen as the thread deletes the semaphore on exit
panic("could acquire exit_sem for thread %ld\n", id);
panic("could acquire exit_sem for thread %" B_PRId32 "\n", id);
} else if (status == B_BAD_SEM_ID) {
// this is the way the thread normally exits
status = B_OK;
@@ -2694,7 +2697,7 @@ thread_init(kernel_args *args)
area_info info;
char name[64];
sprintf(name, "idle thread %lu", i + 1);
sprintf(name, "idle thread %" B_PRIu32, i + 1);
thread = new(&sIdleThreads[i]) Thread(name,
i == 0 ? team_get_kernel_team_id() : -1, &gCPU[i]);
if (thread == NULL || thread->Init(true) != B_OK) {
@@ -2708,7 +2711,7 @@ thread_init(kernel_args *args)
thread->priority = thread->next_priority = B_IDLE_PRIORITY;
thread->state = B_THREAD_RUNNING;
thread->next_state = B_THREAD_READY;
sprintf(name, "idle thread %lu kstack", i + 1);
sprintf(name, "idle thread %" B_PRIu32 " kstack", i + 1);
thread->kernel_stack_area = find_area(name);
if (get_area_info(thread->kernel_stack_area, &info) != B_OK)
+2 -2
View File
@@ -417,13 +417,13 @@ hash_dump_table(struct hash_table* table)
{
uint32 i;
dprintf("hash table %p, table size: %lu, elements: %u\n", table,
dprintf("hash table %p, table size: %" B_PRIu32 ", elements: %u\n", table,
table->table_size, table->num_elements);
for (i = 0; i < table->table_size; i++) {
struct hash_element* element = table->table[i];
if (element != NULL) {
dprintf("%6lu:", i);
dprintf("%6" B_PRIu32 ":", i);
while (element != NULL) {
dprintf(" %p", element);
element = (hash_element*)NEXT(table, element);
+9 -8
View File
@@ -222,8 +222,8 @@ dump_swap_info(int argc, char** argv)
for (SwapFileList::Iterator it = sSwapFileList.GetIterator();
swap_file* file = it.Next();) {
swap_addr_t total = file->last_slot - file->first_slot;
kprintf(" vnode: %p, pages: total: %lu, free: %lu\n",
file->vnode, total, file->bmp->free_slots);
kprintf(" vnode: %p, pages: total: %" B_PRIu32 ", free: %" B_PRIu32
"\n", file->vnode, total, file->bmp->free_slots);
totalSwapPages += total;
freeSwapPages += file->bmp->free_slots;
@@ -231,12 +231,12 @@ dump_swap_info(int argc, char** argv)
kprintf("\n");
kprintf("swap space in pages:\n");
kprintf("total: %9lu\n", totalSwapPages);
kprintf("available: %9llu\n", sAvailSwapSpace / B_PAGE_SIZE);
kprintf("reserved: %9llu\n",
kprintf("total: %9" B_PRIu32 "\n", totalSwapPages);
kprintf("available: %9" B_PRIdOFF "\n", sAvailSwapSpace / B_PAGE_SIZE);
kprintf("reserved: %9" B_PRIdOFF "\n",
totalSwapPages - sAvailSwapSpace / B_PAGE_SIZE);
kprintf("used: %9lu\n", totalSwapPages - freeSwapPages);
kprintf("free: %9lu\n", freeSwapPages);
kprintf("used: %9" B_PRIu32 "\n", totalSwapPages - freeSwapPages);
kprintf("free: %9" B_PRIu32 "\n", freeSwapPages);
return 0;
}
@@ -303,7 +303,8 @@ find_swap_file(swap_addr_t slotIndex)
return swapFile;
}
panic("find_swap_file(): can't find swap file for slot %ld\n", slotIndex);
panic("find_swap_file(): can't find swap file for slot %" B_PRIu32 "\n",
slotIndex);
return NULL;
}
+7 -7
View File
@@ -1325,24 +1325,24 @@ void
VMCache::Dump(bool showPages) const
{
kprintf("CACHE %p:\n", this);
kprintf(" ref_count: %ld\n", RefCount());
kprintf(" ref_count: %" B_PRId32 "\n", RefCount());
kprintf(" source: %p\n", source);
kprintf(" type: %s\n", vm_cache_type_to_string(type));
kprintf(" virtual_base: 0x%Lx\n", virtual_base);
kprintf(" virtual_end: 0x%Lx\n", virtual_end);
kprintf(" temporary: %ld\n", temporary);
kprintf(" temporary: %" B_PRIu32 "\n", temporary);
kprintf(" lock: %p\n", &fLock);
#if KDEBUG
kprintf(" lock.holder: %ld\n", fLock.holder);
kprintf(" lock.holder: %" B_PRId32 "\n", fLock.holder);
#endif
kprintf(" areas:\n");
for (VMArea* area = areas; area != NULL; area = area->cache_next) {
kprintf(" area 0x%lx, %s\n", area->id, area->name);
kprintf(" area 0x%" B_PRIx32 ", %s\n", area->id, area->name);
kprintf("\tbase_addr: 0x%lx, size: 0x%lx\n", area->Base(),
area->Size());
kprintf("\tprotection: 0x%lx\n", area->protection);
kprintf("\towner: 0x%lx\n", area->address_space->ID());
kprintf("\tprotection: 0x%" B_PRIx32 "\n", area->protection);
kprintf("\towner: 0x%" B_PRIx32 "\n", area->address_space->ID());
}
kprintf(" consumers:\n");
@@ -1367,7 +1367,7 @@ VMCache::Dump(bool showPages) const
}
}
} else
kprintf("\t%ld in cache\n", page_count);
kprintf("\t%" B_PRIu32 " in cache\n", page_count);
}
+5 -4
View File
@@ -203,7 +203,8 @@ VMUserAddressSpace::CanResizeArea(VMArea* area, size_t newSize)
// also be resized in that area
// TODO: if there is free space after the reserved area, it could
// be used as well...
return next->id == RESERVED_AREA_ID && next->cache_offset <= area->Base()
return next->id == RESERVED_AREA_ID
&& (uint64)next->cache_offset <= (uint64)area->Base()
&& next->Base() + (next->Size() - 1) >= newEnd;
}
@@ -218,7 +219,7 @@ VMUserAddressSpace::ResizeArea(VMArea* _area, size_t newSize,
VMUserArea* next = fAreas.GetNext(area);
if (next != NULL && next->Base() <= newEnd) {
if (next->id != RESERVED_AREA_ID
|| next->cache_offset > area->Base()
|| (uint64)next->cache_offset > (uint64)area->Base()
|| next->Base() + (next->Size() - 1) < newEnd) {
panic("resize situation for area %p has changed although we "
"should have the address space lock", area);
@@ -361,11 +362,11 @@ VMUserAddressSpace::Dump() const
for (VMUserAreaList::ConstIterator it = fAreas.GetIterator();
VMUserArea* area = it.Next();) {
kprintf(" area 0x%lx: ", area->id);
kprintf(" area 0x%" B_PRIx32 ": ", area->id);
kprintf("base_addr = 0x%lx ", area->Base());
kprintf("size = 0x%lx ", area->Size());
kprintf("name = '%s' ", area->name);
kprintf("protection = 0x%lx\n", area->protection);
kprintf("protection = 0x%" B_PRIx32 "\n", area->protection);
}
}
+37 -36
View File
@@ -2972,16 +2972,16 @@ display_mem(int argc, char** argv)
switch (itemSize) {
case 1:
kprintf(" %02x", *(uint8*)&value);
kprintf(" %02" B_PRIx8, *(uint8*)&value);
break;
case 2:
kprintf(" %04x", *(uint16*)&value);
kprintf(" %04" B_PRIx16, *(uint16*)&value);
break;
case 4:
kprintf(" %08lx", *(uint32*)&value);
kprintf(" %08" B_PRIx32, *(uint32*)&value);
break;
case 8:
kprintf(" %016Lx", *(uint64*)&value);
kprintf(" %016" B_PRIx64, *(uint64*)&value);
break;
}
}
@@ -3106,9 +3106,9 @@ dump_caches_recursively(VMCache* cache, cache_info& info, int level)
for (int i = 0; i < level; i++)
kprintf(" ");
kprintf("%p: type: %s, base: %lld, size: %lld, pages: %lu", cache,
vm_cache_type_to_string(cache->type), cache->virtual_base,
cache->virtual_end, cache->page_count);
kprintf("%p: type: %s, base: %" B_PRIdOFF ", size: %" B_PRIdOFF ", "
"pages: %" B_PRIu32, cache, vm_cache_type_to_string(cache->type),
cache->virtual_base, cache->virtual_end, cache->page_count);
if (level == 0)
kprintf("/%lu", info.page_count);
@@ -3123,12 +3123,12 @@ dump_caches_recursively(VMCache* cache, cache_info& info, int level)
// areas
if (cache->areas != NULL) {
VMArea* area = cache->areas;
kprintf(", areas: %ld (%s, team: %ld)", area->id, area->name,
area->address_space->ID());
kprintf(", areas: %" B_PRId32 " (%s, team: %" B_PRId32 ")", area->id,
area->name, area->address_space->ID());
while (area->cache_next != NULL) {
area = area->cache_next;
kprintf(", %ld", area->id);
kprintf(", %" B_PRId32, area->id);
}
}
@@ -3194,9 +3194,9 @@ dump_caches(int argc, char** argv)
kprintf("total committed memory: %" B_PRIdOFF ", total used pages: %"
B_PRIuPHYSADDR "\n", totalCommitted, totalPages);
kprintf("%lu caches (%lu root caches), sorted by %s per cache "
"tree...\n\n", totalCount, rootCount,
sortByPageCount ? "page count" : "committed size");
kprintf("%" B_PRIu32 " caches (%" B_PRIu32 " root caches), sorted by %s "
"per cache tree...\n\n", totalCount, rootCount, sortByPageCount ?
"page count" : "committed size");
if (rootCount <= (uint32)kCacheInfoTableCount) {
for (uint32 i = 0; i < rootCount; i++) {
@@ -3258,11 +3258,11 @@ dump_area_struct(VMArea* area, bool mappings)
{
kprintf("AREA: %p\n", area);
kprintf("name:\t\t'%s'\n", area->name);
kprintf("owner:\t\t0x%lx\n", area->address_space->ID());
kprintf("id:\t\t0x%lx\n", area->id);
kprintf("owner:\t\t0x%" B_PRIx32 "\n", area->address_space->ID());
kprintf("id:\t\t0x%" B_PRIx32 "\n", area->id);
kprintf("base:\t\t0x%lx\n", area->Base());
kprintf("size:\t\t0x%lx\n", area->Size());
kprintf("protection:\t0x%lx\n", area->protection);
kprintf("protection:\t0x%" B_PRIx32 "\n", area->protection);
kprintf("wiring:\t\t0x%x\n", area->wiring);
kprintf("memory_type:\t%#" B_PRIx32 "\n", area->MemoryType());
kprintf("cache:\t\t%p\n", area->cache);
@@ -3284,7 +3284,7 @@ dump_area_struct(VMArea* area, bool mappings)
while (iterator.Next() != NULL) {
count++;
}
kprintf("page mappings:\t%lu\n", count);
kprintf("page mappings:\t%" B_PRIu32 "\n", count);
}
}
@@ -3377,9 +3377,9 @@ dump_area_list(int argc, char** argv)
|| (name != NULL && strstr(area->name, name) == NULL))
continue;
kprintf("%p %5lx %p\t%p %4lx\t%4d %s\n", area, area->id,
(void*)area->Base(), (void*)area->Size(), area->protection,
area->wiring, area->name);
kprintf("%p %5" B_PRIx32 " %p\t%p %4" B_PRIx32 "\t%4d %s\n", area,
area->id, (void*)area->Base(), (void*)area->Size(),
area->protection, area->wiring, area->name);
}
return 0;
}
@@ -3852,7 +3852,7 @@ vm_init(kernel_args* args)
for (i = 0; i < args->num_cpus; i++) {
char name[64];
sprintf(name, "idle thread %lu kstack", i + 1);
sprintf(name, "idle thread %" B_PRIu32 " kstack", i + 1);
address = (void*)args->cpu_kstack[i].start;
create_area(name, &address, B_EXACT_ADDRESS, args->cpu_kstack[i].size,
B_ALREADY_WIRED, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA);
@@ -4035,7 +4035,7 @@ vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser,
if (status < B_OK) {
dprintf("vm_page_fault: vm_soft_fault returned error '%s' on fault at "
"0x%lx, ip 0x%lx, write %d, user %d, thread 0x%lx\n",
"0x%lx, ip 0x%lx, write %d, user %d, thread 0x%" B_PRIx32 "\n",
strerror(status), address, faultAddress, isWrite, isUser,
thread_get_current_thread_id());
if (!isUser) {
@@ -4059,12 +4059,13 @@ vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser,
VMArea* area = addressSpace->LookupArea(faultAddress);
Thread* thread = thread_get_current_thread();
dprintf("vm_page_fault: thread \"%s\" (%ld) in team \"%s\" (%ld) "
"tried to %s address %#lx, ip %#lx (\"%s\" +%#lx)\n",
thread->name, thread->id, thread->team->Name(),
thread->team->id, isWrite ? "write" : "read", address,
faultAddress, area ? area->name : "???",
faultAddress - (area ? area->Base() : 0x0));
dprintf("vm_page_fault: thread \"%s\" (%" B_PRId32 ") in team "
"\"%s\" (%" B_PRId32 ") tried to %s address %#lx, ip %#lx "
"(\"%s\" +%#lx)\n", thread->name, thread->id,
thread->team->Name(), thread->team->id,
isWrite ? "write" : "read", address, faultAddress,
area ? area->name : "???", faultAddress - (area ?
area->Base() : 0x0));
// We can print a stack trace of the userland thread here.
// TODO: The user_memcpy() below can cause a deadlock, if it causes a page
@@ -4394,8 +4395,8 @@ vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress,
// check permissions
uint32 protection = get_area_page_protection(area, address);
if (isUser && (protection & B_USER_PROTECTION) == 0) {
dprintf("user access on kernel area 0x%lx at %p\n", area->id,
(void*)originalAddress);
dprintf("user access on kernel area 0x%" B_PRIx32 " at %p\n",
area->id, (void*)originalAddress);
TPF(PageFaultError(area->id,
VMPageFaultTracing::PAGE_FAULT_ERROR_KERNEL_ONLY));
status = B_PERMISSION_DENIED;
@@ -4403,16 +4404,16 @@ vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress,
}
if (isWrite && (protection
& (B_WRITE_AREA | (isUser ? 0 : B_KERNEL_WRITE_AREA))) == 0) {
dprintf("write access attempted on write-protected area 0x%lx at"
" %p\n", area->id, (void*)originalAddress);
dprintf("write access attempted on write-protected area 0x%"
B_PRIx32 " at %p\n", area->id, (void*)originalAddress);
TPF(PageFaultError(area->id,
VMPageFaultTracing::PAGE_FAULT_ERROR_WRITE_PROTECTED));
status = B_PERMISSION_DENIED;
break;
} else if (!isWrite && (protection
& (B_READ_AREA | (isUser ? 0 : B_KERNEL_READ_AREA))) == 0) {
dprintf("read access attempted on read-protected area 0x%lx at"
" %p\n", area->id, (void*)originalAddress);
dprintf("read access attempted on read-protected area 0x%" B_PRIx32
" at %p\n", area->id, (void*)originalAddress);
TPF(PageFaultError(area->id,
VMPageFaultTracing::PAGE_FAULT_ERROR_READ_PROTECTED));
status = B_PERMISSION_DENIED;
@@ -4673,7 +4674,7 @@ vm_try_reserve_memory(size_t amount, int priority, bigtime_t timeout)
//dprintf("try to reserve %lu bytes, %Lu left\n", amount, sAvailableMemory);
if (sAvailableMemory >= amount + reserve) {
if (sAvailableMemory >= (off_t)(amount + reserve)) {
sAvailableMemory -= amount;
return B_OK;
}
@@ -4696,7 +4697,7 @@ vm_try_reserve_memory(size_t amount, int priority, bigtime_t timeout)
sNeededMemory -= amount;
if (sAvailableMemory >= amount + reserve) {
if (sAvailableMemory >= (off_t)(amount + reserve)) {
sAvailableMemory -= amount;
return B_OK;
}
+3 -3
View File
@@ -943,8 +943,8 @@ dump_page(int argc, char **argv)
&& physicalAddress / B_PAGE_SIZE
== page->physical_page_number) {
VMArea* area = addressSpace->LookupArea(address);
kprintf(" aspace %ld, area %ld: %#" B_PRIxADDR
" (%c%c%s%s)\n", addressSpace->ID(),
kprintf(" aspace %" B_PRId32 ", area %" B_PRId32 ": %#"
B_PRIxADDR " (%c%c%s%s)\n", addressSpace->ID(),
area != NULL ? area->id : -1, address,
(flags & B_KERNEL_READ_AREA) != 0 ? 'r' : '-',
(flags & B_KERNEL_WRITE_AREA) != 0 ? 'w' : '-',
@@ -1117,7 +1117,7 @@ dump_page_stats(int argc, char **argv)
kprintf("unreserved free pages: %" B_PRId32 "\n", sUnreservedFreePages);
kprintf("unsatisfied page reservations: %" B_PRId32 "\n",
sUnsatisfiedPageReservations);
kprintf("mapped pages: %lu\n", gMappedPagesCount);
kprintf("mapped pages: %" B_PRId32 "\n", gMappedPagesCount);
kprintf("longest free pages run: %" B_PRIuPHYSADDR " pages (at %"
B_PRIuPHYSADDR ")\n", longestFreeRun.Length(),
sPages[longestFreeRun.start].physical_page_number);
+2 -1
View File
@@ -126,7 +126,8 @@
#if defined(__i386__) || defined(__ia64__) || defined(__alpha__) || \
defined(__sparc64__) || defined(__powerpc__) || defined(__POWERPC__) || \
defined(__m68k__) || defined(__M68K__) || defined(__arm__) || \
defined(__ARM__) || defined(__mipsel__) || defined(__MIPSEL__)
defined(__ARM__) || defined(__mipsel__) || defined(__MIPSEL__) || \
defined(__x86_64__)
# include <sys/types.h>
# if BYTE_ORDER == BIG_ENDIAN
# define IEEE_BIG_ENDIAN