diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index b49bf6e902..6a02dad69d 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -290,8 +290,8 @@ public: virtual void AddDump(TraceOutput& out) { - out.Print("block cache %p, %s %Ld, %c%c%c transaction %ld " - "(previous id %ld)\n", fCache, _Action(), fBlockNumber, + out.Print("block cache %p, %s %" B_PRIu64 ", %c%c%c transaction %" B_PRId32 + " (previous id %" B_PRId32 ")\n", fCache, _Action(), fBlockNumber, fIsDirty ? 'd' : '-', fHasOriginal ? 'o' : '-', fHasParent ? 'p' : '-', fTransactionID, fPreviousID); } @@ -388,7 +388,7 @@ public: virtual void AddDump(TraceOutput& out) { - out.Print("block cache %p, error %Ld, %s%s%s", + out.Print("block cache %p, error %" B_PRIu64 ", %s%s%s", fCache, fBlockNumber, fMessage, fStatus != B_OK ? ": " : "", fStatus != B_OK ? strerror(fStatus) : ""); } @@ -430,7 +430,7 @@ public: virtual void AddDump(TraceOutput& out) { - out.Print("block cache %p, block %Ld, data %c%c%c: %s", + out.Print("block cache %p, block %" B_PRIu64 ", data %c%c%c: %s", fCache, fBlockNumber, fCurrent != NULL ? 'c' : '-', fParent != NULL ? 'p' : '-', fOriginal != NULL ? 'o' : '-', fMessage); @@ -456,7 +456,7 @@ public: void DumpBlock(uint32 which, uint32 offset, uint32 size) { if (offset > fSize) { - kprintf("invalid offset (block size %lu)\n", fSize); + kprintf("invalid offset (block size %" B_PRIu32 ")\n", fSize); return; } if (offset + size > fSize) @@ -477,7 +477,7 @@ public: } else return; - kprintf("%s: offset %lu, %lu bytes\n", label, offset, size); + kprintf("%s: offset %" B_PRIu32 ", %" B_PRIu32 " bytes\n", label, offset, size); static const uint32 kBlockSize = 16; data += offset; @@ -485,7 +485,7 @@ public: for (uint32 i = 0; i < size;) { int start = i; - kprintf(" %04lx ", i); + kprintf(" %04" B_PRIx32 " ", i); for (; i < start + kBlockSize; i++) { if (!(i % 4)) kprintf(" "); @@ -559,9 +559,9 @@ public: virtual void AddDump(TraceOutput& out) { - out.Print("block cache %p, %s transaction %p (id %ld)%s" - ", %ld/%ld blocks", fCache, fLabel, fTransaction, fID, - fSub ? " sub" : "", fNumBlocks, fSubNumBlocks); + out.Print("block cache %p, %s transaction %p (id %" B_PRId32 ")%s" + ", %" B_PRId32 "/%" B_PRId32 " blocks", fCache, fLabel, fTransaction, + fID, fSub ? " sub" : "", fNumBlocks, fSubNumBlocks); } private: @@ -591,8 +591,8 @@ public: virtual void AddDump(TraceOutput& out) { - out.Print("block cache %p, detach transaction %p (id %ld)" - "from transaction %p (id %ld)%s", + out.Print("block cache %p, detach transaction %p (id %" B_PRId32 ")" + "from transaction %p (id %" B_PRId32 ")%s", fCache, fNewTransaction, fNewID, fTransaction, fID, fSub ? " sub" : ""); } @@ -639,9 +639,9 @@ public: virtual void AddDump(TraceOutput& out) { out.Print("block cache %p, abort transaction " - "%p (id %ld), blocks", fCache, fTransaction, fID); + "%p (id %" B_PRId32 "), blocks", fCache, fTransaction, fID); for (int32 i = 0; i < fNumBlocks && !out.IsFull(); i++) - out.Print(" %Ld", fBlocks[i]); + out.Print(" %" B_PRIdOFF, fBlocks[i]); } #if KTRACE_PRINTF_STACK_TRACE @@ -1200,7 +1200,7 @@ BlockWriter::_WriteBlock(cached_block* block) { ASSERT(block->busy_writing); - TRACE(("BlockWriter::_WriteBlock(block %Ld)\n", block->block_number)); + TRACE(("BlockWriter::_WriteBlock(block %" B_PRIdOFF ")\n", block->block_number)); TB(Write(fCache, block)); TB2(BlockData(fCache, block, "before write")); @@ -1211,7 +1211,7 @@ BlockWriter::_WriteBlock(cached_block* block) if (written != (ssize_t)blockSize) { TB(Error(fCache, block->block_number, "write failed", written)); - FATAL(("could not write back block %Ld (%s)\n", block->block_number, + FATAL(("could not write back block %" B_PRIdOFF " (%s)\n", block->block_number, strerror(errno))); if (written < 0) return errno; @@ -1253,7 +1253,7 @@ BlockWriter::_BlockDone(cached_block* block, hash_iterator* iterator) // Has the previous transation been finished with that write? if (--previous->num_blocks == 0) { - TRACE(("cache transaction %ld finished!\n", previous->id)); + TRACE(("cache transaction %" B_PRId32 " finished!\n", previous->id)); T(Action("written", fCache, previous)); notify_transaction_listeners(fCache, previous, @@ -1394,7 +1394,7 @@ block_cache::FreeBlock(cached_block* block) Free(block->current_data); if (block->original_data != NULL || block->parent_data != NULL) { - panic("block_cache::FreeBlock(): %Ld, original %p, parent %p\n", + panic("block_cache::FreeBlock(): %" B_PRIdOFF ", original %p, parent %p\n", block->block_number, block->original_data, block->parent_data); } @@ -1478,7 +1478,7 @@ block_cache::RemoveUnusedBlocks(int32 count, int32 minSecondsOld) continue; TB(Flush(this, block)); - TRACE((" remove block %Ld, last accessed %" B_PRId32 "\n", + TRACE((" remove block %" B_PRIdOFF ", last accessed %" B_PRId32 "\n", block->block_number, block->last_accessed)); // this can only happen if no transactions are used @@ -1533,7 +1533,7 @@ block_cache::DiscardBlock(cached_block* block) void block_cache::_LowMemoryHandler(void* data, uint32 resources, int32 level) { - TRACE(("block_cache: low memory handler called with level %ld\n", level)); + TRACE(("block_cache: low memory handler called with level %" B_PRId32 "\n", level)); // free some blocks according to the low memory state // (if there is enough memory left, we don't free any) @@ -1573,8 +1573,8 @@ block_cache::_LowMemoryHandler(void* data, uint32 resources, int32 level) cache->RemoveUnusedBlocks(free, secondsOld); - TRACE(("block_cache::_LowMemoryHandler(): %p: unused: %lu -> %lu\n", cache, - oldUnused, cache->unused_block_count)); + TRACE(("block_cache::_LowMemoryHandler(): %p: unused: %" B_PRIu32 " -> %" B_PRIu32 "\n", + cache, oldUnused, cache->unused_block_count)); } @@ -1775,7 +1775,7 @@ static void put_cached_block(block_cache* cache, off_t blockNumber) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - panic("put_cached_block: invalid block number %lld (max %lld)", + panic("put_cached_block: invalid block number %" B_PRIdOFF " (max %" B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); } @@ -1806,7 +1806,7 @@ get_cached_block(block_cache* cache, off_t blockNumber, bool* _allocated, ASSERT_LOCKED_MUTEX(&cache->lock); if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - panic("get_cached_block: invalid block number %lld (max %lld)", + panic("get_cached_block: invalid block number %" B_PRIdOFF " (max %" B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); return NULL; } @@ -1831,7 +1831,7 @@ retry: } if (block->unused) { - //TRACE(("remove block %Ld from unused\n", blockNumber)); + //TRACE(("remove block %" B_PRIdOFF " from unused\n", blockNumber)); block->unused = false; cache->unused_blocks.Remove(block); cache->unused_block_count--; @@ -1852,7 +1852,7 @@ retry: cache->RemoveBlock(block); TB(Error(cache, blockNumber, "read failed", bytesRead)); - FATAL(("could not read block %Ld: bytesRead: %ld, error: %s\n", + FATAL(("could not read block %" B_PRIdOFF ": bytesRead: %zd, error: %s\n", blockNumber, bytesRead, strerror(errno))); return NULL; } @@ -1879,11 +1879,11 @@ static void* get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base, off_t length, int32 transactionID, bool cleared) { - TRACE(("get_writable_cached_block(blockNumber = %Ld, transaction = %ld)\n", + TRACE(("get_writable_cached_block(blockNumber = %" B_PRIdOFF ", transaction = %" B_PRId32 ")\n", blockNumber, transactionID)); if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - panic("get_writable_cached_block: invalid block number %lld (max %lld)", + panic("get_writable_cached_block: invalid block number %" B_PRIdOFF " (max %" B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); } @@ -1927,7 +1927,8 @@ get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base, if (transaction != NULL && transaction->id != transactionID) { // TODO: we have to wait here until the other transaction is done. // Maybe we should even panic, since we can't prevent any deadlocks. - panic("get_writable_cached_block(): asked to get busy writable block (transaction %ld)\n", block->transaction->id); + panic("get_writable_cached_block(): asked to get busy writable block (transaction %" B_PRId32 ")\n", + block->transaction->id); put_cached_block(cache, block); return NULL; } @@ -1935,7 +1936,7 @@ get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base, // get new transaction transaction = lookup_transaction(cache, transactionID); if (transaction == NULL) { - panic("get_writable_cached_block(): invalid transaction %ld!\n", + panic("get_writable_cached_block(): invalid transaction %" B_PRId32 "!\n", transactionID); put_cached_block(cache, block); return NULL; @@ -2025,7 +2026,8 @@ get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base, static void dump_block(cached_block* block) { - kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c%c%c %08lx %08lx\n", + kprintf("%08lx %9" B_PRIdOFF " %08lx %08lx %08lx %5" B_PRId32 " %6" B_PRId32 + " %c%c%c%c%c%c %08lx %08lx\n", (addr_t)block, block->block_number, (addr_t)block->current_data, (addr_t)block->original_data, (addr_t)block->parent_data, block->ref_count, block->LastAccess(), @@ -2047,8 +2049,8 @@ dump_block_long(cached_block* block) #if BLOCK_CACHE_DEBUG_CHANGED kprintf(" compare data: %p\n", block->compare); #endif - kprintf(" ref_count: %ld\n", block->ref_count); - kprintf(" accessed: %ld\n", block->LastAccess()); + kprintf(" ref_count: %" B_PRId32 "\n", block->ref_count); + kprintf(" accessed: %" B_PRId32 "\n", block->LastAccess()); kprintf(" flags: "); if (block->busy_reading) kprintf(" busy_reading"); @@ -2064,15 +2066,15 @@ dump_block_long(cached_block* block) kprintf(" discard"); kprintf("\n"); if (block->transaction != NULL) { - kprintf(" transaction: %p (%ld)\n", block->transaction, + kprintf(" transaction: %p (%" B_PRId32 ")\n", block->transaction, block->transaction->id); if (block->transaction_next != NULL) { - kprintf(" next in transaction: %Ld\n", + kprintf(" next in transaction: %" B_PRIdOFF "\n", block->transaction_next->block_number); } } if (block->previous_transaction != NULL) { - kprintf(" previous transaction: %p (%ld)\n", + kprintf(" previous transaction: %p (%" B_PRId32 ")\n", block->previous_transaction, block->previous_transaction->id); } @@ -2138,20 +2140,20 @@ dump_cache(int argc, char** argv) if (block != NULL) dump_block_long(block); else - kprintf("block %Ld not found\n", blockNumber); + kprintf("block %" B_PRIdOFF " not found\n", blockNumber); return 0; } kprintf("BLOCK CACHE: %p\n", cache); kprintf(" fd: %d\n", cache->fd); - kprintf(" max_blocks: %Ld\n", cache->max_blocks); - kprintf(" block_size: %lu\n", cache->block_size); - kprintf(" next_transaction_id: %ld\n", cache->next_transaction_id); + kprintf(" max_blocks: %" B_PRIdOFF "\n", cache->max_blocks); + kprintf(" block_size: %zu\n", cache->block_size); + kprintf(" next_transaction_id: %" B_PRId32 "\n", cache->next_transaction_id); kprintf(" buffer_cache: %p\n", cache->buffer_cache); - kprintf(" busy_reading: %lu, %s waiters\n", cache->busy_reading_count, + kprintf(" busy_reading: %" B_PRIu32 ", %s waiters\n", cache->busy_reading_count, cache->busy_reading_waiters ? "has" : "no"); - kprintf(" busy_writing: %lu, %s waiters\n", cache->busy_writing_count, + kprintf(" busy_writing: %" B_PRIu32 ", %s waiters\n", cache->busy_writing_count, cache->busy_writing_waiters ? "has" : "no"); if (!cache->pending_notifications.IsEmpty()) { @@ -2162,7 +2164,7 @@ dump_cache(int argc, char** argv) while (iterator.HasNext()) { cache_notification* notification = iterator.Next(); - kprintf(" %p %5lx %p - %p\n", notification, + kprintf(" %p %5" B_PRIx32 " %p - %p\n", notification, notification->events_pending, notification->hook, notification->data); } @@ -2178,8 +2180,8 @@ dump_cache(int argc, char** argv) cache_transaction* transaction; while ((transaction = (cache_transaction*)hash_next( cache->transaction_hash, &iterator)) != NULL) { - kprintf("%p %5ld %-7s %5ld %5ld %5ld\n", transaction, - transaction->id, transaction->open ? "open" : "closed", + kprintf("%p %5" B_PRId32 " %-7s %5" B_PRId32 " %5" B_PRId32 " %5" B_PRId32 "\n", + transaction, transaction->id, transaction->open ? "open" : "closed", transaction->num_blocks, transaction->main_num_blocks, transaction->sub_num_blocks); } @@ -2211,9 +2213,10 @@ dump_cache(int argc, char** argv) count++; } - kprintf(" %ld blocks total, %ld dirty, %ld discarded, %ld referenced, %ld " - "busy, %" B_PRIu32 " in unused.\n", count, dirty, discarded, referenced, - cache->busy_reading_count, cache->unused_block_count); + kprintf(" %" B_PRIu32 " blocks total, %" B_PRIu32 " dirty, %" B_PRIu32 " discarded" + ", %" B_PRIu32 " referenced, %" B_PRIu32 " busy, %" B_PRIu32 " in unused.\n", + count, dirty, discarded, referenced, cache->busy_reading_count, + cache->unused_block_count); hash_close(cache->hash, &iterator, false); return 0; @@ -2244,20 +2247,20 @@ dump_transaction(int argc, char** argv) int32 id = parse_expression(argv[i + 1]); transaction = lookup_transaction(cache, id); if (transaction == NULL) { - kprintf("No transaction with ID %ld found.\n", id); + kprintf("No transaction with ID %" B_PRId32 " found.\n", id); return 0; } } kprintf("TRANSACTION %p\n", transaction); - kprintf(" id: %ld\n", transaction->id); - kprintf(" num block: %ld\n", transaction->num_blocks); - kprintf(" main num block: %ld\n", transaction->main_num_blocks); - kprintf(" sub num block: %ld\n", transaction->sub_num_blocks); + kprintf(" id: %" B_PRId32 "\n", transaction->id); + kprintf(" num block: %" B_PRId32 "\n", transaction->num_blocks); + kprintf(" main num block: %" B_PRId32 "\n", transaction->main_num_blocks); + kprintf(" sub num block: %" B_PRId32 "\n", transaction->sub_num_blocks); kprintf(" has sub: %d\n", transaction->has_sub_transaction); kprintf(" state: %s\n", transaction->open ? "open" : "closed"); - kprintf(" idle: %Ld secs\n", + kprintf(" idle: %" B_PRId64 " secs\n", (system_time() - transaction->last_used) / 1000000); kprintf(" listeners:\n"); @@ -2266,7 +2269,7 @@ dump_transaction(int argc, char** argv) while (iterator.HasNext()) { cache_listener* listener = iterator.Next(); - kprintf(" %p %5lx %p - %p\n", listener, listener->events_pending, + kprintf(" %p %5" B_PRIx32 " %p - %p\n", listener, listener->events_pending, listener->hook, listener->data); } @@ -2400,7 +2403,7 @@ dump_block_data(int argc, char** argv) if (length > 0 && dump[length - 1] == '\n') length--; - kprintf("%5ld. %.*s\n", index, length, dump); + kprintf("%5" B_PRId32 ". %.*s\n", index, length, dump); if (printStackTrace) { out.Clear(); @@ -2673,7 +2676,7 @@ cache_start_transaction(void* _cache) TransactionLocker locker(cache); if (cache->last_transaction && cache->last_transaction->open) { - panic("last transaction (%ld) still open!\n", + panic("last transaction (%" B_PRId32 ") still open!\n", cache->last_transaction->id); } @@ -2684,7 +2687,7 @@ cache_start_transaction(void* _cache) transaction->id = atomic_add(&cache->next_transaction_id, 1); cache->last_transaction = transaction; - TRACE(("cache_start_transaction(): id %ld started\n", transaction->id)); + TRACE(("cache_start_transaction(): id %" B_PRId32 " started\n", transaction->id)); T(Action("start", cache, transaction)); hash_insert_grow(cache->transaction_hash, transaction); @@ -2699,7 +2702,7 @@ cache_sync_transaction(void* _cache, int32 id) block_cache* cache = (block_cache*)_cache; bool hadBusy; - TRACE(("cache_sync_transaction(id %ld)\n", id)); + TRACE(("cache_sync_transaction(id %" B_PRId32 ")\n", id)); do { TransactionLocker locker(cache); @@ -2754,7 +2757,7 @@ cache_end_transaction(void* _cache, int32 id, block_cache* cache = (block_cache*)_cache; TransactionLocker locker(cache); - TRACE(("cache_end_transaction(id = %ld)\n", id)); + TRACE(("cache_end_transaction(id = %" B_PRId32 ")\n", id)); cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { @@ -2830,7 +2833,7 @@ cache_abort_transaction(void* _cache, int32 id) block_cache* cache = (block_cache*)_cache; TransactionLocker locker(cache); - TRACE(("cache_abort_transaction(id = %ld)\n", id)); + TRACE(("cache_abort_transaction(id = %" B_PRId32 ")\n", id)); cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { @@ -2849,8 +2852,8 @@ cache_abort_transaction(void* _cache, int32 id) next = block->transaction_next; if (block->original_data != NULL) { - TRACE(("cache_abort_transaction(id = %ld): restored contents of " - "block %Ld\n", transaction->id, block->block_number)); + TRACE(("cache_abort_transaction(id = %" B_PRId32 "): restored contents of " + "block %" B_PRIdOFF "\n", transaction->id, block->block_number)); memcpy(block->current_data, block->original_data, cache->block_size); cache->Free(block->original_data); @@ -2884,7 +2887,7 @@ cache_detach_sub_transaction(void* _cache, int32 id, block_cache* cache = (block_cache*)_cache; TransactionLocker locker(cache); - TRACE(("cache_detach_sub_transaction(id = %ld)\n", id)); + TRACE(("cache_detach_sub_transaction(id = %" B_PRId32 ")\n", id)); cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { @@ -2995,7 +2998,7 @@ cache_abort_sub_transaction(void* _cache, int32 id) block_cache* cache = (block_cache*)_cache; TransactionLocker locker(cache); - TRACE(("cache_abort_sub_transaction(id = %ld)\n", id)); + TRACE(("cache_abort_sub_transaction(id = %" B_PRId32 ")\n", id)); cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { @@ -3023,8 +3026,8 @@ cache_abort_sub_transaction(void* _cache, int32 id) cache->block_size); } else if (block->parent_data != block->current_data) { // the block has been changed and must be restored - TRACE(("cache_abort_sub_transaction(id = %ld): restored contents " - "of block %Ld\n", transaction->id, block->block_number)); + TRACE(("cache_abort_sub_transaction(id = %" B_PRId32 "): restored contents " + "of block %" B_PRIdOFF "\n", transaction->id, block->block_number)); memcpy(block->current_data, block->parent_data, cache->block_size); cache->Free(block->parent_data); } @@ -3047,11 +3050,11 @@ cache_start_sub_transaction(void* _cache, int32 id) block_cache* cache = (block_cache*)_cache; TransactionLocker locker(cache); - TRACE(("cache_start_sub_transaction(id = %ld)\n", id)); + TRACE(("cache_start_sub_transaction(id = %" B_PRId32 ")\n", id)); cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { - panic("cache_start_sub_transaction(): invalid transaction ID %ld\n", + panic("cache_start_sub_transaction(): invalid transaction ID %" B_PRId32 "\n", id); return B_BAD_VALUE; } @@ -3353,7 +3356,7 @@ block_cache_sync_etc(void* _cache, off_t blockNumber, size_t numBlocks) // transaction or no transaction only if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - panic("block_cache_sync_etc: invalid block number %Ld (max %Ld)", + panic("block_cache_sync_etc: invalid block number %" B_PRIdOFF " (max %" B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); return B_BAD_VALUE; } @@ -3424,7 +3427,7 @@ block_cache_discard(void* _cache, off_t blockNumber, size_t numBlocks) } else { if (block->transaction != NULL && block->parent_data != NULL && block->parent_data != block->current_data) { - panic("Discarded block %Ld has already been changed in this " + panic("Discarded block %" B_PRIdOFF " has already been changed in this " "transaction!", blockNumber); } @@ -3465,7 +3468,7 @@ block_cache_get_writable_etc(void* _cache, off_t blockNumber, off_t base, block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); - TRACE(("block_cache_get_writable_etc(block = %Ld, transaction = %ld)\n", + TRACE(("block_cache_get_writable_etc(block = %" B_PRIdOFF ", transaction = %" B_PRId32 ")\n", blockNumber, transaction)); if (cache->read_only) panic("tried to get writable block on a read-only cache!"); @@ -3489,7 +3492,7 @@ block_cache_get_empty(void* _cache, off_t blockNumber, int32 transaction) block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); - TRACE(("block_cache_get_empty(block = %Ld, transaction = %ld)\n", + TRACE(("block_cache_get_empty(block = %" B_PRIdOFF ", transaction = %" B_PRId32 ")\n", blockNumber, transaction)); if (cache->read_only) panic("tried to get empty writable block on a read-only cache!"); diff --git a/src/system/kernel/cache/file_cache.cpp b/src/system/kernel/cache/file_cache.cpp index 2825ef1a60..01257d792b 100644 --- a/src/system/kernel/cache/file_cache.cpp +++ b/src/system/kernel/cache/file_cache.cpp @@ -555,7 +555,7 @@ write_to_cache(file_cache_ref* ref, void* cookie, off_t offset, generic_addr_t last = vecs[vecCount - 1].base + vecs[vecCount - 1].length - B_PAGE_SIZE; - if (offset + pageOffset + bufferSize == ref->cache->virtual_end) { + if ((off_t)(offset + pageOffset + bufferSize) == ref->cache->virtual_end) { // the space in the page after this write action needs to be cleaned vm_memset_physical(last + lastPageOffset, 0, B_PAGE_SIZE - lastPageOffset); @@ -724,7 +724,7 @@ cache_io(void* _cacheRef, void* cookie, off_t offset, addr_t buffer, size_t size = *_size; offset -= pageOffset; - if (offset + pageOffset + size > fileSize) { + if ((off_t)(offset + pageOffset + size) > fileSize) { // adapt size to be within the file's offsets size = fileSize - pageOffset - offset; *_size = size; @@ -951,7 +951,7 @@ cache_prefetch_vnode(struct vnode* vnode, off_t offset, size_t size) file_cache_ref* ref = ((VMVnodeCache*)cache)->FileCacheRef(); off_t fileSize = cache->virtual_end; - if (offset + size > fileSize) + if ((off_t)(offset + size) > fileSize) size = fileSize - offset; // "offset" and "size" are always aligned to B_PAGE_SIZE, @@ -1088,7 +1088,7 @@ file_cache_init_post_boot_device(void) if (get_module("file_cache/launch_speedup/v1", (module_info**)&sCacheModule) == B_OK) { - dprintf("** opened launch speedup: %Ld\n", system_time()); + dprintf("** opened launch speedup: %" B_PRId64 "\n", system_time()); } return B_OK; } diff --git a/src/system/kernel/cache/file_map.cpp b/src/system/kernel/cache/file_map.cpp index d9e0ddca01..931bc0f516 100644 --- a/src/system/kernel/cache/file_map.cpp +++ b/src/system/kernel/cache/file_map.cpp @@ -412,10 +412,10 @@ FileMap::Translate(off_t offset, size_t size, file_io_vec* vecs, size_t* _count, *_count = 0; return B_OK; } - if (offset + size > fSize) { + if ((off_t)(offset + size) > fSize) { if (align > 1) { off_t alignedSize = (fSize + align - 1) & ~(off_t)(align - 1); - if (offset + size >= alignedSize) + if ((off_t)(offset + size) >= alignedSize) padLastVec = alignedSize - fSize; } size = fSize - offset; @@ -441,7 +441,7 @@ FileMap::Translate(off_t offset, size_t size, file_io_vec* vecs, size_t* _count, vecs[0].offset = -1; vecs[0].length = fileExtent->disk.length - offset; - if (vecs[0].length >= size) { + if (vecs[0].length >= (off_t)size) { vecs[0].length = size + padLastVec; *_count = 1; return B_OK; @@ -457,7 +457,7 @@ FileMap::Translate(off_t offset, size_t size, file_io_vec* vecs, size_t* _count, vecs[vecIndex++] = fileExtent->disk; - if (size <= fileExtent->disk.length) { + if ((off_t)size <= fileExtent->disk.length) { vecs[vecIndex - 1].length = size + padLastVec; break; } @@ -499,7 +499,7 @@ dump_file_map(int argc, char** argv) } kprintf("FileMap %p\n", map); - kprintf(" size %Ld\n", map->Size()); + kprintf(" size %" B_PRIdOFF "\n", map->Size()); kprintf(" count %lu\n", map->Count()); if (!printExtents) @@ -508,8 +508,9 @@ dump_file_map(int argc, char** argv) for (uint32 i = 0; i < map->Count(); i++) { file_extent* extent = map->ExtentAt(i); - kprintf(" [%lu] offset %Ld, disk offset %Ld, length %Ld\n", - i, extent->offset, extent->disk.offset, extent->disk.length); + kprintf(" [%" B_PRIu32 "] offset %" B_PRIdOFF ", disk offset %" + B_PRIdOFF ", length %" B_PRIdOFF "\n", i, extent->offset, + extent->disk.offset, extent->disk.length); } return 0; @@ -555,9 +556,10 @@ dump_file_map_stats(int argc, char** argv) count++; } - kprintf("%ld file maps (%ld empty), %Ld file bytes in total, %Ld bytes " - "cached, %lu extents\n", count, emptyCount, size, mapSize, extents); - kprintf("average %lu extents per map for %Ld bytes.\n", + kprintf("%" B_PRId32 " file maps (%" B_PRIu32 " empty), %" B_PRIdOFF " file" + " bytes in total, %" B_PRIdOFF " bytes cached, %" B_PRIu32 " extents\n", + count, emptyCount, size, mapSize, extents); + kprintf("average %" B_PRIu32 " extents per map for %" B_PRIdOFF " bytes.\n", extents / (count - emptyCount), mapSize / (count - emptyCount)); return 0; diff --git a/src/system/kernel/condition_variable.cpp b/src/system/kernel/condition_variable.cpp index ef0dcd28d0..47215606b1 100644 --- a/src/system/kernel/condition_variable.cpp +++ b/src/system/kernel/condition_variable.cpp @@ -315,7 +315,7 @@ ConditionVariable::Dump() const for (EntryList::ConstIterator it = fEntries.GetIterator(); ConditionVariableEntry* entry = it.Next();) { - kprintf(" %ld", entry->fThread->id); + kprintf(" %" B_PRId32, entry->fThread->id); } kprintf("\n"); } @@ -330,7 +330,7 @@ ConditionVariable::_Notify(bool all, bool schedulerLocked, status_t result) if (!fEntries.IsEmpty()) { if (result > B_OK) { - panic("tried to notify with invalid result %ld\n", result); + panic("tried to notify with invalid result %" B_PRId32 "\n", result); result = B_ERROR; } diff --git a/src/system/kernel/elf.cpp b/src/system/kernel/elf.cpp index ad3c291ce2..64dd51aec4 100644 --- a/src/system/kernel/elf.cpp +++ b/src/system/kernel/elf.cpp @@ -9,6 +9,8 @@ /*! Contains the ELF loader */ +#ifndef __x86_64__ + #include #include @@ -2587,3 +2589,4 @@ _user_read_kernel_image_symbols(image_id id, struct Elf32_Sym* symbolTable, return B_OK; } +#endif \ No newline at end of file diff --git a/src/system/kernel/heap.cpp b/src/system/kernel/heap.cpp index 38c4dea880..a2815bff6a 100644 --- a/src/system/kernel/heap.cpp +++ b/src/system/kernel/heap.cpp @@ -313,8 +313,9 @@ dump_page(heap_page *page) count++; kprintf("\t\tpage %p: bin_index: %u; free_count: %u; empty_index: %u; " - "free_list %p (%lu entr%s)\n", page, page->bin_index, page->free_count, - page->empty_index, page->free_list, count, count == 1 ? "y" : "ies"); + "free_list %p (%" B_PRIu32 " entr%s)\n", page, page->bin_index, + page->free_count, page->empty_index, page->free_list, count, + count == 1 ? "y" : "ies"); } @@ -325,8 +326,9 @@ dump_bin(heap_bin *bin) for (heap_page *page = bin->page_list; page != NULL; page = page->next) count++; - kprintf("\telement_size: %lu; max_free_count: %u; page_list %p (%lu pages" - ");\n", bin->element_size, bin->max_free_count, bin->page_list, count); + kprintf("\telement_size: %" B_PRIu32 "; max_free_count: %u; page_list %p " + "(%" B_PRIu32 " pages);\n", bin->element_size, bin->max_free_count, + bin->page_list, count); for (heap_page *page = bin->page_list; page != NULL; page = page->next) dump_page(page); @@ -347,10 +349,11 @@ dump_allocator_areas(heap_allocator *heap) { heap_area *area = heap->all_areas; while (area) { - kprintf("\tarea %p: area: %ld; base: 0x%08lx; size: %lu; page_count: " - "%lu; free_pages: %p (%lu entr%s)\n", area, area->area, area->base, - area->size, area->page_count, area->free_pages, - area->free_page_count, area->free_page_count == 1 ? "y" : "ies"); + kprintf("\tarea %p: area: %" B_PRId32 "; base: %p; size: %zu; page_count: " + "%" B_PRIu32 "; free_pages: %p (%" B_PRIu32 " entr%s)\n", area, + area->area, (void *)area->base, area->size, area->page_count, + area->free_pages, area->free_page_count, + area->free_page_count == 1 ? "y" : "ies"); area = area->all_next; } @@ -361,10 +364,11 @@ dump_allocator_areas(heap_allocator *heap) static void dump_allocator(heap_allocator *heap, bool areas, bool bins) { - kprintf("allocator %p: name: %s; page_size: %lu; bin_count: %lu; pages: " - "%lu; free_pages: %lu; empty_areas: %lu\n", heap, heap->name, - heap->page_size, heap->bin_count, heap->total_pages, - heap->total_free_pages, heap->empty_areas); + kprintf("allocator %p: name: %s; page_size: %" B_PRIu32 "; bin_count: " + "%" B_PRIu32 "; pages: %" B_PRIu32 "; free_pages: %" B_PRIu32 "; " + "empty_areas: %" B_PRIu32 "\n", heap, heap->name, heap->page_size, + heap->bin_count, heap->total_pages, heap->total_free_pages, + heap->empty_areas); if (areas) dump_allocator_areas(heap); @@ -481,8 +485,8 @@ dump_allocations(int argc, char **argv) continue; if (!statsOnly) { - kprintf("address: 0x%08lx; size: %lu bytes\n", - base, elementSize); + kprintf("address: 0x%p; size: %lu bytes\n", + (void *)base, elementSize); } totalSize += elementSize; @@ -502,7 +506,7 @@ dump_allocations(int argc, char **argv) size_t size = pageCount * heap->page_size; if (!statsOnly) { - kprintf("address: 0x%08lx; size: %lu bytes\n", base, + kprintf("address: %p; size: %lu bytes\n", (void *)base, size); } @@ -521,7 +525,7 @@ dump_allocations(int argc, char **argv) break; } - kprintf("total allocations: %lu; total bytes: %lu\n", totalCount, totalSize); + kprintf("total allocations: %" B_PRIu32 "; total bytes: %zu\n", totalCount, totalSize); return 0; } @@ -1096,9 +1100,9 @@ heap_add_area(heap_allocator *heap, area_id areaID, addr_t base, size_t size) pageLocker.Unlock(); areaWriteLocker.Unlock(); - dprintf("heap_add_area: area %ld added to %s heap %p - usable range 0x%08lx " - "- 0x%08lx\n", area->area, heap->name, heap, area->base, - area->base + area->size); + dprintf("heap_add_area: area %" B_PRId32 " added to %s heap %p - usable " + "range %p - %p\n", area->area, heap->name, heap, (void *)area->base, + (void *)(area->base + area->size)); } @@ -1142,9 +1146,9 @@ heap_remove_area(heap_allocator *heap, heap_area *area) heap->total_pages -= area->page_count; heap->total_free_pages -= area->free_page_count; - dprintf("heap_remove_area: area %ld with range 0x%08lx - 0x%08lx removed " - "from %s heap %p\n", area->area, area->base, area->base + area->size, - heap->name, heap); + dprintf("heap_remove_area: area %" B_PRId32 " with range %p - %p removed " + "from %s heap %p\n", area->area, (void *)area->base, + (void *)(area->base + area->size), heap->name, heap); return B_OK; } @@ -1659,7 +1663,7 @@ heap_free(heap_allocator *heap, void *address) if (((addr_t)address - area->base - page->index * heap->page_size) % bin->element_size != 0) { panic("free(): passed invalid pointer %p supposed to be in bin for " - "element size %ld\n", address, bin->element_size); + "element size %" B_PRIu32 "\n", address, bin->element_size); return B_ERROR; } diff --git a/src/system/kernel/image.cpp b/src/system/kernel/image.cpp index 05bd513f06..787124db81 100644 --- a/src/system/kernel/image.cpp +++ b/src/system/kernel/image.cpp @@ -254,21 +254,22 @@ dump_images_list(int argc, char **argv) team_id id = strtol(argv[1], NULL, 0); team = team_get_team_struct_locked(id); if (team == NULL) { - kprintf("No team with ID %ld found\n", id); + kprintf("No team with ID %" B_PRId32 " found\n", id); return 1; } } else team = thread_get_current_thread()->team; - kprintf("Registered images of team %ld\n", team->id); + kprintf("Registered images of team %" B_PRId32 "\n", team->id); kprintf(" ID text size data size name\n"); while ((image = (struct image*)list_get_next_item(&team->image_list, image)) != NULL) { image_info *info = &image->info; - kprintf("%6ld %p %-7ld %p %-7ld %s\n", info->id, info->text, info->text_size, - info->data, info->data_size, info->name); + kprintf("%6" B_PRId32 " %p %-7" B_PRId32 " %p %-7" B_PRId32 " %s\n", + info->id, info->text, info->text_size, info->data, info->data_size, + info->name); } return 0; @@ -417,8 +418,8 @@ _user_image_relocated(image_id id) // get an image info error = _get_image_info(id, &info, sizeof(image_info)); if (error != B_OK) { - dprintf("_user_image_relocated(%ld): Failed to get image info: %lx\n", - id, error); + dprintf("_user_image_relocated(%" B_PRId32 "): Failed to get image " + "info: %" B_PRIx32 "\n", id, error); return; } diff --git a/src/system/kernel/int.cpp b/src/system/kernel/int.cpp index d30b320cf2..59c9671814 100644 --- a/src/system/kernel/int.cpp +++ b/src/system/kernel/int.cpp @@ -80,7 +80,7 @@ dump_int_statistics(int argc, char **argv) && sVectors[i].handler_list == NULL) continue; - kprintf("int %3d, enabled %ld, handled %8lld, unhandled %8lld%s%s\n", + kprintf("int %3d, enabled %" B_PRId32 ", handled %8lld, unhandled %8lld%s%s\n", i, sVectors[i].enable_count, sVectors[i].handled_count, sVectors[i].unhandled_count, B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) ? ", ACTIVE" : "", diff --git a/src/system/kernel/low_resource_manager.cpp b/src/system/kernel/low_resource_manager.cpp index d64b675d71..55962db93d 100644 --- a/src/system/kernel/low_resource_manager.cpp +++ b/src/system/kernel/low_resource_manager.cpp @@ -59,9 +59,9 @@ static off_t sWarnMemoryLimit; static off_t sCriticalMemoryLimit; // address space limits -static const off_t kMinNoteSpaceLimit = 128 * 1024 * 1024; -static const off_t kMinWarnSpaceLimit = 64 * 1024 * 1024; -static const off_t kMinCriticalSpaceLimit = 32 * 1024 * 1024; +static const size_t kMinNoteSpaceLimit = 128 * 1024 * 1024; +static const size_t kMinWarnSpaceLimit = 64 * 1024 * 1024; +static const size_t kMinCriticalSpaceLimit = 32 * 1024 * 1024; static int32 sLowPagesState = B_NO_LOW_RESOURCE; @@ -310,8 +310,8 @@ dump_handlers(int argc, char** argv) handler->resources & B_KERNEL_RESOURCE_SEMAPHORES ? 's' : ' ', handler->resources & B_KERNEL_RESOURCE_ADDRESS_SPACE ? 'a' : ' '); - kprintf("%p %p %s %4ld %s\n", handler->function, handler->data, - resources, handler->priority, symbol); + kprintf("%p %p %s %4" B_PRId32 " %s\n", handler->function, + handler->data, resources, handler->priority, symbol); } return 0; diff --git a/src/system/kernel/main.cpp b/src/system/kernel/main.cpp index a5797d8940..6ce9648e39 100644 --- a/src/system/kernel/main.cpp +++ b/src/system/kernel/main.cpp @@ -361,7 +361,7 @@ main2(void *unused) resume_thread(thread); TRACE("Bootscript started\n"); } else - dprintf("error starting \"%s\" error = %ld \n", args[0], thread); + dprintf("error starting \"%s\" error = %" B_PRId32 " \n", args[0], thread); } return 0; diff --git a/src/system/kernel/module.cpp b/src/system/kernel/module.cpp index 0c0be15553..202fb7c239 100644 --- a/src/system/kernel/module.cpp +++ b/src/system/kernel/module.cpp @@ -457,7 +457,7 @@ unload_module_image(module_image* moduleImage, bool remove) ASSERT_LOCKED_RECURSIVE(&sModulesLock); if (moduleImage->ref_count != 0) { - FATAL(("Can't unload %s due to ref_cnt = %ld\n", moduleImage->path, + FATAL(("Can't unload %s due to ref_cnt = %" B_PRId32 "\n", moduleImage->path, moduleImage->ref_count)); return B_ERROR; } @@ -1172,8 +1172,8 @@ dump_modules(int argc, char** argv) while ((module = (struct module*)hash_next(sModulesHash, &iterator)) != NULL) { - kprintf("%p: \"%s\", \"%s\" (%ld), refcount = %ld, state = %d, " - "mimage = %p\n", module, module->name, + kprintf("%p: \"%s\", \"%s\" (%" B_PRId32 "), refcount = %" B_PRId32 ", " + "state = %d, mimage = %p\n", module, module->name, module->module_image ? module->module_image->path : "", module->offset, module->ref_count, module->state, module->module_image); @@ -1184,8 +1184,9 @@ dump_modules(int argc, char** argv) while ((image = (struct module_image*)hash_next(sModuleImagesHash, &iterator)) != NULL) { - kprintf("%p: \"%s\" (image_id = %ld), info = %p, refcount = %ld\n", - image, image->path, image->image, image->info, image->ref_count); + kprintf("%p: \"%s\" (image_id = %" B_PRId32 "), info = %p, refcount = " + "%" B_PRId32 "\n", image, image->path, image->image, image->info, + image->ref_count); } return 0; } diff --git a/src/system/kernel/port.cpp b/src/system/kernel/port.cpp index fd66ec22af..26fb39d1e3 100644 --- a/src/system/kernel/port.cpp +++ b/src/system/kernel/port.cpp @@ -403,8 +403,9 @@ dump_port_list(int argc, char** argv) || (name != NULL && strstr(port->lock.name, name) == NULL)) continue; - kprintf("%p %8ld %4ld %9ld %9ld %8ld %6ld %s\n", port, - port->id, port->capacity, port->read_count, port->write_count, + kprintf("%p %8" B_PRId32 " %4" B_PRId32 " %9" B_PRIu32 " %9" B_PRId32 + " %8" B_PRId32 " %6" B_PRId32 " %s\n", port, port->id, + port->capacity, port->read_count, port->write_count, port->total_count, port->owner, port->lock.name); } @@ -416,20 +417,20 @@ static void _dump_port_info(Port* port) { kprintf("PORT: %p\n", port); - kprintf(" id: %ld\n", port->id); + kprintf(" id: %" B_PRId32 "\n", port->id); kprintf(" name: \"%s\"\n", port->lock.name); - kprintf(" owner: %ld\n", port->owner); - kprintf(" capacity: %ld\n", port->capacity); - kprintf(" read_count: %ld\n", port->read_count); - kprintf(" write_count: %ld\n", port->write_count); - kprintf(" total count: %ld\n", port->total_count); + kprintf(" owner: %" B_PRId32 "\n", port->owner); + kprintf(" capacity: %" B_PRId32 "\n", port->capacity); + kprintf(" read_count: %" B_PRIu32 "\n", port->read_count); + kprintf(" write_count: %" B_PRId32 "\n", port->write_count); + kprintf(" total count: %" B_PRId32 "\n", port->total_count); if (!port->messages.IsEmpty()) { kprintf("messages:\n"); MessageList::Iterator iterator = port->messages.GetIterator(); while (port_message* message = iterator.Next()) { - kprintf(" %p %08lx %ld\n", message, message->code, message->size); + kprintf(" %p %08" B_PRIx32 " %ld\n", message, message->code, message->size); } } @@ -463,7 +464,8 @@ dump_port_info(int argc, char** argv) int32 num = parse_expression(argv[1]); Port* port = sPorts.Lookup(num); if (port == NULL) { - kprintf("port %ld (%#lx) doesn't exist!\n", num, num); + kprintf("port %" B_PRId32 " (%#" B_PRIx32 ") doesn't exist!\n", + num, num); return 0; } _dump_port_info(port); @@ -1180,7 +1182,7 @@ _get_port_message_info_etc(port_id id, port_message_info* info, // determine tail & get the length of the message port_message* message = port->messages.Head(); if (message == NULL) { - panic("port %ld: no messages found\n", port->id); + panic("port %" B_PRId32 ": no messages found\n", port->id); return B_ERROR; } @@ -1289,7 +1291,7 @@ read_port_etc(port_id id, int32* _code, void* buffer, size_t bufferSize, // determine tail & get the length of the message port_message* message = port->messages.Head(); if (message == NULL) { - panic("port %ld: no messages found\n", port->id); + panic("port %" B_PRId32 ": no messages found\n", port->id); return B_ERROR; } diff --git a/src/system/kernel/real_time_clock.cpp b/src/system/kernel/real_time_clock.cpp index 6f99492af8..b73c8f920f 100644 --- a/src/system/kernel/real_time_clock.cpp +++ b/src/system/kernel/real_time_clock.cpp @@ -86,7 +86,7 @@ rtc_debug(int argc, char **argv) currentTime = (systemTimeOffset + system_time()) / 1000000; dprintf("system_time: %Ld\n", system_time()); dprintf("system_time_offset: %Ld\n", systemTimeOffset); - dprintf("current_time: %lu\n", currentTime); + dprintf("current_time: %" B_PRIu32 "\n", currentTime); } else { // If there was an argument, reset the system and hw time. set_real_time_clock(strtoul(argv[1], NULL, 10)); diff --git a/src/system/kernel/sem.cpp b/src/system/kernel/sem.cpp index ad32ddd349..5a5a20af43 100644 --- a/src/system/kernel/sem.cpp +++ b/src/system/kernel/sem.cpp @@ -163,8 +163,8 @@ dump_sem_list(int argc, char** argv) || (owner != -1 && sem->u.used.owner != owner)) continue; - kprintf("%p %6ld %5ld %6ld " - "%6ld " + kprintf("%p %6" B_PRId32 " %5" B_PRId32 " %6" B_PRId32 " " + "%6" B_PRId32 " " " %s\n", sem, sem->id, sem->u.used.count, sem->u.used.owner, sem->u.used.last_acquirer > 0 ? sem->u.used.last_acquirer : 0, @@ -179,16 +179,16 @@ static void dump_sem(struct sem_entry* sem) { kprintf("SEM: %p\n", sem); - kprintf("id: %ld (%#lx)\n", sem->id, sem->id); + kprintf("id: %" B_PRId32 " (%#" B_PRIx32 ")\n", sem->id, sem->id); if (sem->id >= 0) { kprintf("name: '%s'\n", sem->u.used.name); - kprintf("owner: %ld\n", sem->u.used.owner); - kprintf("count: %ld\n", sem->u.used.count); + kprintf("owner: %" B_PRId32 "\n", sem->u.used.owner); + kprintf("count: %" B_PRId32 "\n", sem->u.used.count); kprintf("queue: "); if (!sem->queue.IsEmpty()) { ThreadQueue::Iterator it = sem->queue.GetIterator(); while (queued_thread* entry = it.Next()) - kprintf(" %ld", entry->thread->id); + kprintf(" %" B_PRId32, entry->thread->id); kprintf("\n"); } else kprintf(" -\n"); @@ -198,9 +198,9 @@ dump_sem(struct sem_entry* sem) set_debug_variable("_owner", sem->u.used.owner); #if DEBUG_SEM_LAST_ACQUIRER - kprintf("last acquired by: %ld, count: %ld\n", + kprintf("last acquired by: %" B_PRId32 ", count: %" B_PRId32 "\n", sem->u.used.last_acquirer, sem->u.used.last_acquire_count); - kprintf("last released by: %ld, count: %ld\n", + kprintf("last released by: %" B_PRId32 ", count: %" B_PRId32 "\n", sem->u.used.last_releaser, sem->u.used.last_release_count); if (sem->u.used.last_releaser != 0) @@ -217,7 +217,7 @@ dump_sem(struct sem_entry* sem) unset_debug_variable("_acquirer"); } else { kprintf("next: %p\n", sem->u.unused.next); - kprintf("next_id: %ld\n", sem->u.unused.next_id); + kprintf("next_id: %" B_PRId32 "\n", sem->u.unused.next_id); } } @@ -378,8 +378,8 @@ delete_sem_internal(sem_id id, bool checkPermission) RELEASE_SEM_LOCK(sSems[slot]); RELEASE_SEM_LIST_LOCK(); restore_interrupts(state); - dprintf("thread %ld tried to delete kernel semaphore %ld.\n", - thread_get_current_thread_id(), id); + dprintf("thread %" B_PRId32 " tried to delete kernel semaphore " + "%" B_PRId32 ".\n", thread_get_current_thread_id(), id); return B_NOT_ALLOWED; } @@ -387,7 +387,7 @@ delete_sem_internal(sem_id id, bool checkPermission) list_remove_link(&sSems[slot].u.used.team_link); sSems[slot].u.used.owner = -1; } else - panic("sem %ld has no owner", id); + panic("sem %" B_PRId32 " has no owner", id); RELEASE_SEM_LIST_LOCK(); @@ -769,8 +769,8 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count, return B_NO_MORE_SEMS; if (!are_interrupts_enabled()) { - panic("switch_sem_etc: called with interrupts disabled for sem %ld\n", - id); + panic("switch_sem_etc: called with interrupts disabled for sem " + "%" B_PRId32 "\n", id); } if (id < 0) @@ -793,8 +793,8 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count, // doesn't have any use outside the kernel if ((flags & B_CHECK_PERMISSION) != 0 && sSems[slot].u.used.owner == team_get_kernel_team_id()) { - dprintf("thread %ld tried to acquire kernel semaphore %ld.\n", - thread_get_current_thread_id(), id); + dprintf("thread %" B_PRId32 " tried to acquire kernel semaphore " + "%" B_PRId32 ".\n", thread_get_current_thread_id(), id); status = B_NOT_ALLOWED; goto err; } @@ -945,7 +945,7 @@ release_sem_etc(sem_id id, int32 count, uint32 flags) // doesn't have any use outside the kernel if ((flags & B_CHECK_PERMISSION) != 0 && sSems[slot].u.used.owner == team_get_kernel_team_id()) { - dprintf("thread %ld tried to release kernel semaphore.\n", + dprintf("thread %" B_PRId32 " tried to release kernel semaphore.\n", thread_get_current_thread_id()); return B_NOT_ALLOWED; } diff --git a/src/system/kernel/smp.cpp b/src/system/kernel/smp.cpp index 899d81c259..7c4a6b963f 100644 --- a/src/system/kernel/smp.cpp +++ b/src/system/kernel/smp.cpp @@ -234,10 +234,10 @@ dump_ici_messages(int argc, char** argv) message = message->next; } - kprintf("ICI broadcast messages: %ld, first: %p\n", count, + kprintf("ICI broadcast messages: %" B_PRId32 ", first: %p\n", count, sBroadcastMessages); - kprintf(" done: %ld\n", doneCount); - kprintf(" unreferenced: %ld\n", unreferencedCount); + kprintf(" done: %" B_PRId32 "\n", doneCount); + kprintf(" unreferenced: %" B_PRId32 "\n", unreferencedCount); // count per-CPU messages for (int32 i = 0; i < sNumCPUs; i++) { @@ -248,8 +248,8 @@ dump_ici_messages(int argc, char** argv) message = message->next; } - kprintf("CPU %ld messages: %ld, first: %p\n", i, count, - sCPUMessages[i]); + kprintf("CPU %" B_PRId32 " messages: %" B_PRId32 ", first: %p\n", i, + count, sCPUMessages[i]); } return 0; @@ -271,15 +271,15 @@ dump_ici_message(int argc, char** argv) smp_msg* message = (smp_msg*)(addr_t)address; kprintf("ICI message %p:\n", message); kprintf(" next: %p\n", message->next); - kprintf(" message: %ld\n", message->message); - kprintf(" data: %ld\n", message->data); - kprintf(" data2: %ld\n", message->data2); - kprintf(" data3: %ld\n", message->data3); + kprintf(" message: %" B_PRId32 "\n", message->message); + kprintf(" data: %" B_PRIu32 "\n", message->data); + kprintf(" data2: %" B_PRIu32 "\n", message->data2); + kprintf(" data3: %" B_PRIu32 "\n", message->data3); kprintf(" data_ptr: %p\n", message->data_ptr); - kprintf(" flags: %lx\n", message->flags); - kprintf(" ref_count: %lx\n", message->ref_count); + kprintf(" flags: %" B_PRIx32 "\n", message->flags); + kprintf(" ref_count: %" B_PRIx32 "\n", message->ref_count); kprintf(" done: %s\n", message->done ? "true" : "false"); - kprintf(" proc_bitmap: %lx\n", message->proc_bitmap); + kprintf(" proc_bitmap: %" B_PRIx32 "\n", message->proc_bitmap); return 0; } @@ -361,7 +361,7 @@ acquire_spinlock(spinlock* lock) oldValue = atomic_or((int32*)lock, 1); if (oldValue != 0) { panic("acquire_spinlock: attempt to acquire lock %p twice on " - "non-SMP system (last caller: %p, value %ld)", lock, + "non-SMP system (last caller: %p, value %" B_PRId32 ")", lock, find_lock_caller(lock), oldValue); } @@ -458,7 +458,7 @@ acquire_spinlock_cpu(int32 currentCPU, spinlock *lock) oldValue = atomic_or((int32*)lock, 1); if (oldValue != 0) { panic("acquire_spinlock_cpu(): attempt to acquire lock %p twice on " - "non-SMP system (last caller: %p, value %ld)", lock, + "non-SMP system (last caller: %p, value %" B_PRId32 ")", lock, find_lock_caller(lock), oldValue); } @@ -755,8 +755,8 @@ process_pending_ici(int32 currentCPU) } default: - dprintf("smp_intercpu_int_handler: got unknown message %ld\n", - msg->message); + dprintf("smp_intercpu_int_handler: got unknown message %" B_PRId32 + "\n", msg->message); break; } diff --git a/src/system/kernel/system_info.cpp b/src/system/kernel/system_info.cpp index 0315c0d7ea..a97cdcad10 100644 --- a/src/system/kernel/system_info.cpp +++ b/src/system/kernel/system_info.cpp @@ -50,20 +50,23 @@ dump_info(int argc, char **argv) __VERSION__); kprintf("revision: %s\n\n", get_haiku_revision()); - kprintf("cpu count: %ld, active times:\n", smp_get_num_cpus()); + kprintf("cpu count: %" B_PRId32 ", active times:\n", smp_get_num_cpus()); for (int32 i = 0; i < smp_get_num_cpus(); i++) - kprintf(" [%ld] %Ld\n", i + 1, gCPU[i].active_time); + kprintf(" [%" B_PRId32 "] %" B_PRId64 "\n", i + 1, gCPU[i].active_time); // ToDo: Add page_faults kprintf("pages:\t\t%" B_PRIuPHYSADDR " (%" B_PRIuPHYSADDR " max)\n", vm_page_num_pages() - vm_page_num_free_pages(), vm_page_num_pages()); - kprintf("sems:\t\t%ld (%ld max)\n", sem_used_sems(), sem_max_sems()); - kprintf("ports:\t\t%ld (%ld max)\n", port_used_ports(), port_max_ports()); - kprintf("threads:\t%ld (%ld max)\n", thread_used_threads(), - thread_max_threads()); - kprintf("teams:\t\t%ld (%ld max)\n", team_used_teams(), team_max_teams()); + kprintf("sems:\t\t%" B_PRId32 " (%" B_PRId32 " max)\n", sem_used_sems(), + sem_max_sems()); + kprintf("ports:\t\t%" B_PRId32 " (%" B_PRId32 " max)\n", port_used_ports(), + port_max_ports()); + kprintf("threads:\t%" B_PRId32 " (%" B_PRId32 " max)\n", + thread_used_threads(), thread_max_threads()); + kprintf("teams:\t\t%" B_PRId32 " (%" B_PRId32 " max)\n", team_used_teams(), + team_max_teams()); return 0; }