tty: fix TRACE build on x86_64.

Change-Id: Idcfa9bca4a5b450f7a7d2a060809999ee3e3ceaa
Reviewed-on: https://review.haiku-os.org/c/1416
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Jérôme Duval
2019-04-29 20:26:27 +00:00
committed by waddlesplash
parent 097bbc7fd2
commit e892b55b25
3 changed files with 45 additions and 37 deletions
+12 -10
View File
@@ -67,7 +67,8 @@ master_open(const char *name, uint32 flags, void **_cookie)
return B_ERROR; return B_ERROR;
} }
TRACE(("master_open: TTY index = %ld (name = %s)\n", index, name)); TRACE(("master_open: TTY index = %" B_PRId32 " (name = %s)\n", index,
name));
MutexLocker globalLocker(gGlobalTTYLock); MutexLocker globalLocker(gGlobalTTYLock);
@@ -146,7 +147,8 @@ master_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
{ {
master_cookie *cookie = (master_cookie *)_cookie; master_cookie *cookie = (master_cookie *)_cookie;
TRACE(("master_ioctl: cookie %p, op %lu, buffer %p, length %lu\n", _cookie, op, buffer, length)); TRACE(("master_ioctl: cookie %p, op %" B_PRIu32 ", buffer %p, length %lu"
"\n", _cookie, op, buffer, length));
return tty_ioctl(cookie, op, buffer, length); return tty_ioctl(cookie, op, buffer, length);
} }
@@ -157,13 +159,13 @@ master_read(void *_cookie, off_t offset, void *buffer, size_t *_length)
{ {
master_cookie *cookie = (master_cookie *)_cookie; master_cookie *cookie = (master_cookie *)_cookie;
TRACE(("master_read: cookie %p, offset %Ld, buffer %p, length %lu\n", TRACE(("master_read: cookie %p, offset %" B_PRIdOFF ", buffer %p, length "
_cookie, offset, buffer, *_length)); "%lu\n", _cookie, offset, buffer, *_length));
status_t result = tty_input_read(cookie, buffer, _length); status_t result = tty_input_read(cookie, buffer, _length);
TRACE(("master_read done: cookie %p, result: %lx, length %lu\n", _cookie, TRACE(("master_read done: cookie %p, result: %" B_PRIx32 ", length %lu\n",
result, *_length)); _cookie, result, *_length));
return result; return result;
} }
@@ -174,13 +176,13 @@ master_write(void *_cookie, off_t offset, const void *buffer, size_t *_length)
{ {
master_cookie *cookie = (master_cookie *)_cookie; master_cookie *cookie = (master_cookie *)_cookie;
TRACE(("master_write: cookie %p, offset %Ld, buffer %p, length %lu\n", TRACE(("master_write: cookie %p, offset %" B_PRIdOFF ", buffer %p, length "
_cookie, offset, buffer, *_length)); "%lu\n", _cookie, offset, buffer, *_length));
status_t result = tty_write_to_tty_master(cookie, buffer, _length); status_t result = tty_write_to_tty_master(cookie, buffer, _length);
TRACE(("master_write done: cookie %p, result: %lx, length %lu\n", _cookie, TRACE(("master_write done: cookie %p, result: %" B_PRIx32 ", length %lu\n",
result, *_length)); _cookie, result, *_length));
return result; return result;
} }
+10 -8
View File
@@ -45,7 +45,8 @@ slave_open(const char *name, uint32 flags, void **_cookie)
return B_ERROR; return B_ERROR;
} }
TRACE(("slave_open: TTY index = %ld (name = %s)\n", index, name)); TRACE(("slave_open: TTY index = %" B_PRId32 " (name = %s)\n", index,
name));
MutexLocker globalLocker(gGlobalTTYLock); MutexLocker globalLocker(gGlobalTTYLock);
@@ -161,7 +162,8 @@ slave_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
{ {
slave_cookie *cookie = (slave_cookie *)_cookie; slave_cookie *cookie = (slave_cookie *)_cookie;
TRACE(("slave_ioctl: cookie %p, op %lu, buffer %p, length %lu\n", _cookie, op, buffer, length)); TRACE(("slave_ioctl: cookie %p, op %" B_PRIu32 ", buffer %p, length %lu\n",
_cookie, op, buffer, length));
return tty_ioctl(cookie, op, buffer, length); return tty_ioctl(cookie, op, buffer, length);
} }
@@ -172,12 +174,12 @@ slave_read(void *_cookie, off_t offset, void *buffer, size_t *_length)
{ {
slave_cookie *cookie = (slave_cookie *)_cookie; slave_cookie *cookie = (slave_cookie *)_cookie;
TRACE(("slave_read: cookie %p, offset %Ld, buffer %p, length %lu\n", TRACE(("slave_read: cookie %p, offset %" B_PRIdOFF ", buffer %p, length "
_cookie, offset, buffer, *_length)); "%lu\n", _cookie, offset, buffer, *_length));
status_t result = tty_input_read(cookie, buffer, _length); status_t result = tty_input_read(cookie, buffer, _length);
TRACE(("slave_read done: cookie %p, result %lx, length %lu\n", TRACE(("slave_read done: cookie %p, result %" B_PRIx32 ", length %lu\n",
_cookie, result, *_length)); _cookie, result, *_length));
return result; return result;
@@ -189,12 +191,12 @@ slave_write(void *_cookie, off_t offset, const void *buffer, size_t *_length)
{ {
slave_cookie *cookie = (slave_cookie *)_cookie; slave_cookie *cookie = (slave_cookie *)_cookie;
TRACE(("slave_write: cookie %p, offset %Ld, buffer %p, length %lu\n", TRACE(("slave_write: cookie %p, offset %" B_PRIdOFF", buffer %p, length "
_cookie, offset, buffer, *_length)); "%lu\n", _cookie, offset, buffer, *_length));
status_t result = tty_write_to_tty_slave(cookie, buffer, _length); status_t result = tty_write_to_tty_slave(cookie, buffer, _length);
TRACE(("slave_write done: cookie %p, result %lx, length %lu\n", TRACE(("slave_write done: cookie %p, result %" B_PRIx32 ", length %lu\n",
_cookie, result, *_length)); _cookie, result, *_length));
return result; return result;
+23 -19
View File
@@ -181,7 +181,7 @@ public:
if (semaphore >= 0) { if (semaphore >= 0) {
TRACE(("TTYReference: cookie %p closed, last operation done, " TRACE(("TTYReference: cookie %p closed, last operation done, "
"releasing blocking sem %ld\n", cookie, semaphore)); "releasing blocking sem %" B_PRId32 "\n", cookie, semaphore));
release_sem(semaphore); release_sem(semaphore);
} }
@@ -430,8 +430,8 @@ RequestOwner::Wait(bool interruptable, bigtime_t timeout)
(interruptable ? B_CAN_INTERRUPT : 0) | B_RELATIVE_TIMEOUT, (interruptable ? B_CAN_INTERRUPT : 0) | B_RELATIVE_TIMEOUT,
timeout); timeout);
TRACE(("%p->RequestOwner::Wait(): condition occurred: %lx\n", this, TRACE(("%p->RequestOwner::Wait(): condition occurred: %" B_PRIx32 "\n",
error)); this, error));
// remove the condition variable // remove the condition variable
locker.Lock(); locker.Lock();
@@ -485,7 +485,8 @@ RequestOwner::Notify(Request* request)
void void
RequestOwner::NotifyError(Request* request, status_t error) RequestOwner::NotifyError(Request* request, status_t error)
{ {
TRACE(("%p->RequestOwner::NotifyError(%p, %lx)\n", this, request, error)); TRACE(("%p->RequestOwner::NotifyError(%p, %" B_PRIx32 ")\n", this, request,
error));
if (fError == B_OK) { if (fError == B_OK) {
fError = error; fError = error;
@@ -1033,7 +1034,7 @@ tty_close_cookie(struct tty_cookie* cookie)
// critical code // critical code
if (unblock) { if (unblock) {
TRACE(("tty_close_cookie(): cookie %p, there're still pending " TRACE(("tty_close_cookie(): cookie %p, there're still pending "
"operations, acquire blocking sem %ld\n", cookie, "operations, acquire blocking sem %" B_PRId32 "\n", cookie,
cookie->blocking_semaphore)); cookie->blocking_semaphore));
acquire_sem(cookie->blocking_semaphore); acquire_sem(cookie->blocking_semaphore);
@@ -1599,7 +1600,8 @@ tty_ioctl(tty_cookie* cookie, uint32 op, void* buffer, size_t length)
if (!ttyReference.IsLocked()) if (!ttyReference.IsLocked())
return B_FILE_ERROR; return B_FILE_ERROR;
TRACE(("tty_ioctl: tty %p, op %lu, buffer %p, length %lu\n", tty, op, buffer, length)); TRACE(("tty_ioctl: tty %p, op %" B_PRIu32 ", buffer %p, length %"
B_PRIuSIZE "\n", tty, op, buffer, length));
MutexLocker locker(tty->lock); MutexLocker locker(tty->lock);
// values marked BeOS are non-standard codes we support for legacy apps // values marked BeOS are non-standard codes we support for legacy apps
@@ -1623,9 +1625,10 @@ tty_ioctl(tty_cookie* cookie, uint32 op, void* buffer, size_t length)
case TCSETA: case TCSETA:
case TCSETAW: case TCSETAW:
case TCSETAF: case TCSETAF:
TRACE(("tty: set attributes (iflag = %lx, oflag = %lx, " TRACE(("tty: set attributes (iflag = %" B_PRIx32 ", oflag = %"
"cflag = %lx, lflag = %lx)\n", tty->settings->termios.c_iflag, B_PRIx32 ", cflag = %" B_PRIx32 ", lflag = %" B_PRIx32 ")\n",
tty->settings->termios.c_oflag, tty->settings->termios.c_cflag, tty->settings->termios.c_iflag, tty->settings->termios.c_oflag,
tty->settings->termios.c_cflag,
tty->settings->termios.c_lflag)); tty->settings->termios.c_lflag));
return user_memcpy(&tty->settings->termios, buffer, return user_memcpy(&tty->settings->termios, buffer,
@@ -1804,7 +1807,7 @@ tty_ioctl(tty_cookie* cookie, uint32 op, void* buffer, size_t length)
break; break;
} }
TRACE(("tty: unsupported opcode %lu\n", op)); TRACE(("tty: unsupported opcode %" B_PRIu32 "\n", op));
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -1822,7 +1825,8 @@ tty_input_read(tty_cookie* cookie, void* _buffer, size_t* _length)
bigtime_t interCharTimeout = 0; bigtime_t interCharTimeout = 0;
size_t bytesNeeded = 1; size_t bytesNeeded = 1;
TRACE(("tty_input_read(tty = %p, length = %lu, mode = %lu)\n", tty, length, mode)); TRACE(("tty_input_read(tty = %p, length = %lu, mode = %" B_PRIu32 ")\n",
tty, length, mode));
if (length == 0) if (length == 0)
return B_OK; return B_OK;
@@ -1841,8 +1845,8 @@ tty_input_read(tty_cookie* cookie, void* _buffer, size_t* _length)
// Non-blocking mode. Handle VMIN and VTIME. // Non-blocking mode. Handle VMIN and VTIME.
bytesNeeded = tty->settings->termios.c_cc[VMIN]; bytesNeeded = tty->settings->termios.c_cc[VMIN];
bigtime_t vtime = tty->settings->termios.c_cc[VTIME] * 100000; bigtime_t vtime = tty->settings->termios.c_cc[VTIME] * 100000;
TRACE(("tty_input_read: icanon vmin %lu, vtime %Ldus\n", bytesNeeded, TRACE(("tty_input_read: icanon vmin %lu, vtime %" B_PRIdBIGTIME
vtime)); "us\n", bytesNeeded, vtime));
if (bytesNeeded == 0) { if (bytesNeeded == 0) {
// In this case VTIME specifies a relative total timeout. We // In this case VTIME specifies a relative total timeout. We
@@ -1865,8 +1869,8 @@ tty_input_read(tty_cookie* cookie, void* _buffer, size_t* _length)
*_length = 0; *_length = 0;
do { do {
TRACE(("tty_input_read: AcquireReader(%Ldus, %ld)\n", timeout, TRACE(("tty_input_read: AcquireReader(%" B_PRIdBIGTIME "us, %ld)\n",
bytesNeeded)); timeout, bytesNeeded));
status = locker.AcquireReader(timeout, bytesNeeded); status = locker.AcquireReader(timeout, bytesNeeded);
if (status != B_OK) if (status != B_OK)
break; break;
@@ -1989,8 +1993,8 @@ tty_select(tty_cookie* cookie, uint8 event, uint32 ref, selectsync* sync)
{ {
struct tty* tty = cookie->tty; struct tty* tty = cookie->tty;
TRACE(("tty_select(cookie = %p, event = %u, ref = %lu, sync = %p)\n", TRACE(("tty_select(cookie = %p, event = %u, ref = %" B_PRIu32 ", sync = "
cookie, event, ref, sync)); "%p)\n", cookie, event, ref, sync));
// we don't support all kinds of events // we don't support all kinds of events
if (event < B_SELECT_READ || event > B_SELECT_ERROR) if (event < B_SELECT_READ || event > B_SELECT_ERROR)
@@ -2017,8 +2021,8 @@ tty_select(tty_cookie* cookie, uint8 event, uint32 ref, selectsync* sync)
// add the event to the TTY's pool // add the event to the TTY's pool
status_t error = add_select_sync_pool_entry(&tty->select_pool, sync, event); status_t error = add_select_sync_pool_entry(&tty->select_pool, sync, event);
if (error != B_OK) { if (error != B_OK) {
TRACE(("tty_select() done: add_select_sync_pool_entry() failed: %lx\n", TRACE(("tty_select() done: add_select_sync_pool_entry() failed: %"
error)); B_PRIx32 "\n", error));
return error; return error;
} }