Throughout, remove extra space after function name from debugging output.

Throughout, change syscalls to report on return values using new %R format
option.
* smallprint.cc (__small_vsprintf): Add parsing for %R to report on return
values and possible errno from syscalls.
* errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
* fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use
shorter name to reduce debuggging output.
* select.cc (start_thread_pipe): Ditto.
(start_thread_serial): Ditto.
(start_thread_socket): Ditto.
(start_thread_mailslot): Ditto.
* sigproc.cc (talktome): Ditto.
This commit is contained in:
Christopher Faylor 2011-12-03 21:43:27 +00:00
parent 8b25478267
commit b9aa81491f
42 changed files with 224 additions and 188 deletions

View File

@ -1,3 +1,22 @@
2011-12-03 Christopher Faylor <me.cygwin2011@cgf.cx>
Throughout, remove extra space after function name from debugging
output.
Throughout, change syscalls to report on return values using new %R
format option.
* smallprint.cc (__small_vsprintf): Add parsing for %R to report on
return values and possible errno from syscalls.
* errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
* fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread
use shorter name to reduce debuggging output.
* select.cc (start_thread_pipe): Ditto.
(start_thread_serial): Ditto.
(start_thread_socket): Ditto.
(start_thread_mailslot): Ditto.
* sigproc.cc (talktome): Ditto.
2011-12-03 Corinna Vinschen <vinschen@redhat.com> 2011-12-03 Corinna Vinschen <vinschen@redhat.com>
* fhandler.cc (fhandler_base::open): Fix comment a bit more. * fhandler.cc (fhandler_base::open): Fix comment a bit more.

View File

@ -257,7 +257,7 @@ closedir (DIR *dir)
if (dir->__d_cookie != __DIRENT_COOKIE) if (dir->__d_cookie != __DIRENT_COOKIE)
{ {
set_errno (EBADF); set_errno (EBADF);
syscall_printf ("-1 = closedir (%p)", dir); syscall_printf ("%R = closedir(%p)", -1, dir);
return -1; return -1;
} }
@ -271,7 +271,7 @@ closedir (DIR *dir)
free (dir->__d_dirname); free (dir->__d_dirname);
free (dir->__d_dirent); free (dir->__d_dirent);
free (dir); free (dir);
syscall_printf ("%d = closedir (%p)", res); syscall_printf ("%R = closedir(%p)", res);
return res; return res;
} }
@ -320,7 +320,7 @@ mkdir (const char *dir, mode_t mode)
delete fh; delete fh;
done: done:
syscall_printf ("%d = mkdir (%s, %d)", res, dir, mode); syscall_printf ("%R = mkdir(%s, %d)", res, dir, mode);
return res; return res;
} }
@ -353,6 +353,6 @@ rmdir (const char *dir)
delete fh; delete fh;
done: done:
syscall_printf ("%d = rmdir (%s)", res, dir); syscall_printf ("%R = rmdir(%s)", res, dir);
return res; return res;
} }

View File

@ -757,7 +757,7 @@ dtable::dup3 (int oldfd, int newfd, int flags)
done: done:
MALLOC_CHECK; MALLOC_CHECK;
unlock (); unlock ();
syscall_printf ("%d = dup3 (%d, %d, %p)", res, oldfd, newfd, flags); syscall_printf ("%R = dup3(%d, %d, %p)", res, oldfd, newfd, flags);
return res; return res;
} }

View File

@ -156,6 +156,7 @@ static NO_COPY struct
X (WAIT_NO_CHILDREN, ECHILD), X (WAIT_NO_CHILDREN, ECHILD),
X (WORKING_SET_QUOTA, EAGAIN), X (WORKING_SET_QUOTA, EAGAIN),
X (WRITE_PROTECT, EROFS), X (WRITE_PROTECT, EROFS),
X (PRIVILEGE_NOT_HELD, EPERM),
{ 0, NULL, 0} { 0, NULL, 0}
}; };

View File

@ -67,7 +67,7 @@ fcntl64 (int fd, int cmd, ...)
break; break;
} }
done: done:
syscall_printf ("%d = fcntl (%d, %d, %p)", res, fd, cmd, arg); syscall_printf ("%R = fcntl(%d, %d, %p)", res, fd, cmd, arg);
return res; return res;
} }

View File

@ -707,7 +707,7 @@ done:
status, fh, access, pc.get_nt_native_path (), file_attributes, status, fh, access, pc.get_nt_native_path (), file_attributes,
shared, create_disposition, options); shared, create_disposition, options);
syscall_printf ("%d = fhandler_base::open (%S, %p)", syscall_printf ("%d = fhandler_base::open(%S, %p)",
res, pc.get_nt_native_path (), flags); res, pc.get_nt_native_path (), flags);
return res; return res;
} }
@ -1251,7 +1251,7 @@ fhandler_base::ioctl (unsigned int cmd, void *buf)
break; break;
} }
syscall_printf ("%d = ioctl (%x, %p)", res, cmd, buf); syscall_printf ("%d = ioctl(%x, %p)", res, cmd, buf);
return res; return res;
} }

View File

@ -953,7 +953,7 @@ fhandler_console::output_tcsetattr (int, struct termios const *t)
int res = SetConsoleMode (get_output_handle (), flags) ? 0 : -1; int res = SetConsoleMode (get_output_handle (), flags) ? 0 : -1;
if (res) if (res)
__seterrno_from_win_error (GetLastError ()); __seterrno_from_win_error (GetLastError ());
syscall_printf ("%d = tcsetattr (,%x) (ENABLE FLAGS %x) (lflag %x oflag %x)", syscall_printf ("%d = tcsetattr(,%x) (ENABLE FLAGS %x) (lflag %x oflag %x)",
res, t, flags, t->c_lflag, t->c_oflag); res, t, flags, t->c_lflag, t->c_oflag);
return res; return res;
} }
@ -1015,7 +1015,7 @@ fhandler_console::input_tcsetattr (int, struct termios const *t)
res = SetConsoleMode (get_io_handle (), flags) ? 0 : -1; res = SetConsoleMode (get_io_handle (), flags) ? 0 : -1;
if (res < 0) if (res < 0)
__seterrno (); __seterrno ();
syscall_printf ("%d = tcsetattr (,%x) enable flags %p, c_lflag %p iflag %p", syscall_printf ("%d = tcsetattr(,%x) enable flags %p, c_lflag %p iflag %p",
res, t, flags, t->c_lflag, t->c_iflag); res, t, flags, t->c_lflag, t->c_iflag);
} }
@ -1066,7 +1066,7 @@ fhandler_console::tcgetattr (struct termios *t)
/* All the output bits we can ignore */ /* All the output bits we can ignore */
res = 0; res = 0;
} }
syscall_printf ("%d = tcgetattr (%p) enable flags %p, t->lflag %p, t->iflag %p", syscall_printf ("%d = tcgetattr(%p) enable flags %p, t->lflag %p, t->iflag %p",
res, t, flags, t->c_lflag, t->c_iflag); res, t, flags, t->c_lflag, t->c_iflag);
return res; return res;
} }
@ -2101,7 +2101,7 @@ fhandler_console::write (const void *vsrc, size_t len)
} }
} }
syscall_printf ("%d = fhandler_console::write (...)", len); syscall_printf ("%d = fhandler_console::write(...)", len);
return len; return len;
} }

View File

@ -765,7 +765,7 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs)
out: out:
if (opened) if (opened)
NtClose (fh); NtClose (fh);
syscall_printf ("%d = fstatvfs (%s, %p)", ret, get_name (), sfs); syscall_printf ("%d = fstatvfs(%s, %p)", ret, get_name (), sfs);
return ret; return ret;
} }
@ -1445,7 +1445,7 @@ fhandler_base::open_fs (int flags, mode_t mode)
NtAllocateLocallyUniqueId ((PLUID) &unique_id); NtAllocateLocallyUniqueId ((PLUID) &unique_id);
out: out:
syscall_printf ("%d = fhandler_disk_file::open (%S, %p)", res, syscall_printf ("%d = fhandler_disk_file::open(%S, %p)", res,
pc.get_nt_native_path (), flags); pc.get_nt_native_path (), flags);
return res; return res;
} }
@ -1583,7 +1583,7 @@ non_atomic:
else else
res = -1; res = -1;
} }
debug_printf ("%d = pread (%p, %d, %d)\n", res, buf, count, offset); debug_printf ("%d = pread(%p, %d, %d)\n", res, buf, count, offset);
return res; return res;
} }
@ -1627,7 +1627,7 @@ non_atomic:
if (lseek (curpos, SEEK_SET) < 0) if (lseek (curpos, SEEK_SET) < 0)
res = -1; res = -1;
} }
debug_printf ("%d = pwrite (%p, %d, %d)\n", res, buf, count, offset); debug_printf ("%d = pwrite(%p, %d, %d)\n", res, buf, count, offset);
return res; return res;
} }
@ -2287,7 +2287,7 @@ go_ahead:
res = 0; res = 0;
} }
syscall_printf ("%d = readdir (%p, %p) (L\"%lS\" > \"%ls\") (attr %p > type %d)", syscall_printf ("%d = readdir(%p, %p) (L\"%lS\" > \"%ls\") (attr %p > type %d)",
res, dir, &de, res ? NULL : &fname, res ? "***" : de->d_name, res, dir, &de, res ? NULL : &fname, res ? "***" : de->d_name,
FileAttributes, de->d_type); FileAttributes, de->d_type);
return res; return res;
@ -2361,7 +2361,7 @@ fhandler_disk_file::closedir (DIR *dir)
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
res = -1; res = -1;
} }
syscall_printf ("%d = closedir (%p, %s)", res, dir, get_name ()); syscall_printf ("%d = closedir(%p, %s)", res, dir, get_name ());
return res; return res;
} }

View File

@ -377,7 +377,7 @@ fhandler_dev_dsp::Audio_out::query (int rate, int bits, int channels)
fillFormat (&format, rate, bits, channels); fillFormat (&format, rate, bits, channels);
rc = waveOutOpen (NULL, WAVE_MAPPER, &format, 0L, 0L, WAVE_FORMAT_QUERY); rc = waveOutOpen (NULL, WAVE_MAPPER, &format, 0L, 0L, WAVE_FORMAT_QUERY);
debug_printf ("%d = waveOutOpen (freq=%d bits=%d channels=%d)", rc, rate, bits, channels); debug_printf ("%d = waveOutOpen(freq=%d bits=%d channels=%d)", rc, rate, bits, channels);
return (rc == MMSYSERR_NOERROR); return (rc == MMSYSERR_NOERROR);
} }
@ -404,7 +404,7 @@ fhandler_dev_dsp::Audio_out::start ()
if (rc == MMSYSERR_NOERROR) if (rc == MMSYSERR_NOERROR)
init (bSize); init (bSize);
debug_printf ("%d = waveOutOpen (freq=%d bits=%d channels=%d)", rc, freq_, bits_, channels_); debug_printf ("%d = waveOutOpen(freq=%d bits=%d channels=%d)", rc, freq_, bits_, channels_);
return (rc == MMSYSERR_NOERROR); return (rc == MMSYSERR_NOERROR);
} }
@ -425,15 +425,15 @@ fhandler_dev_dsp::Audio_out::stop (bool immediately)
} }
rc = waveOutReset (dev_); rc = waveOutReset (dev_);
debug_printf ("%d = waveOutReset ()", rc); debug_printf ("%d = waveOutReset()", rc);
while (Qisr2app_->recv (&pHdr)) while (Qisr2app_->recv (&pHdr))
{ {
rc = waveOutUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR)); rc = waveOutUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveOutUnprepareHeader (0x%08x)", rc, pHdr); debug_printf ("%d = waveOutUnprepareHeader(0x%08x)", rc, pHdr);
} }
rc = waveOutClose (dev_); rc = waveOutClose (dev_);
debug_printf ("%d = waveOutClose ()", rc); debug_printf ("%d = waveOutClose()", rc);
Qisr2app_->dellock (); Qisr2app_->dellock ();
} }
@ -564,7 +564,7 @@ fhandler_dev_dsp::Audio_out::waitforspace ()
/* Errors are ignored here. They will probbaly cause a failure /* Errors are ignored here. They will probbaly cause a failure
in the subsequent PrepareHeader */ in the subsequent PrepareHeader */
rc = waveOutUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR)); rc = waveOutUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveOutUnprepareHeader (0x%08x)", rc, pHdr); debug_printf ("%d = waveOutUnprepareHeader(0x%08x)", rc, pHdr);
} }
pHdr_ = pHdr; pHdr_ = pHdr;
bufferIndex_ = 0; bufferIndex_ = 0;
@ -599,11 +599,11 @@ fhandler_dev_dsp::Audio_out::sendcurrent ()
// Send internal buffer out to the soundcard // Send internal buffer out to the soundcard
pHdr->dwBufferLength = bufferIndex_; pHdr->dwBufferLength = bufferIndex_;
rc = waveOutPrepareHeader (dev_, pHdr, sizeof (WAVEHDR)); rc = waveOutPrepareHeader (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveOutPrepareHeader (0x%08x)", rc, pHdr); debug_printf ("%d = waveOutPrepareHeader(0x%08x)", rc, pHdr);
if (rc == MMSYSERR_NOERROR) if (rc == MMSYSERR_NOERROR)
{ {
rc = waveOutWrite (dev_, pHdr, sizeof (WAVEHDR)); rc = waveOutWrite (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveOutWrite (0x%08x)", rc, pHdr); debug_printf ("%d = waveOutWrite(0x%08x)", rc, pHdr);
} }
if (rc == MMSYSERR_NOERROR) if (rc == MMSYSERR_NOERROR)
return true; return true;
@ -752,7 +752,7 @@ fhandler_dev_dsp::Audio_in::query (int rate, int bits, int channels)
fillFormat (&format, rate, bits, channels); fillFormat (&format, rate, bits, channels);
rc = waveInOpen (NULL, WAVE_MAPPER, &format, 0L, 0L, WAVE_FORMAT_QUERY); rc = waveInOpen (NULL, WAVE_MAPPER, &format, 0L, 0L, WAVE_FORMAT_QUERY);
debug_printf ("%d = waveInOpen (freq=%d bits=%d channels=%d)", rc, rate, bits, channels); debug_printf ("%d = waveInOpen(freq=%d bits=%d channels=%d)", rc, rate, bits, channels);
return (rc == MMSYSERR_NOERROR); return (rc == MMSYSERR_NOERROR);
} }
@ -776,7 +776,7 @@ fhandler_dev_dsp::Audio_in::start (int rate, int bits, int channels)
fillFormat (&format, rate, bits, channels); fillFormat (&format, rate, bits, channels);
rc = waveInOpen (&dev_, WAVE_MAPPER, &format, (DWORD) waveIn_callback, rc = waveInOpen (&dev_, WAVE_MAPPER, &format, (DWORD) waveIn_callback,
(DWORD) this, CALLBACK_FUNCTION); (DWORD) this, CALLBACK_FUNCTION);
debug_printf ("%d = waveInOpen (rate=%d bits=%d channels=%d)", rc, rate, bits, channels); debug_printf ("%d = waveInOpen(rate=%d bits=%d channels=%d)", rc, rate, bits, channels);
if (rc == MMSYSERR_NOERROR) if (rc == MMSYSERR_NOERROR)
{ {
@ -800,16 +800,16 @@ fhandler_dev_dsp::Audio_in::stop ()
we must not call into the wave API from the callback. we must not call into the wave API from the callback.
Otherwise we end up in a deadlock. */ Otherwise we end up in a deadlock. */
rc = waveInReset (dev_); rc = waveInReset (dev_);
debug_printf ("%d = waveInReset ()", rc); debug_printf ("%d = waveInReset()", rc);
while (Qisr2app_->recv (&pHdr)) while (Qisr2app_->recv (&pHdr))
{ {
rc = waveInUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR)); rc = waveInUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveInUnprepareHeader (0x%08x)", rc, pHdr); debug_printf ("%d = waveInUnprepareHeader(0x%08x)", rc, pHdr);
} }
rc = waveInClose (dev_); rc = waveInClose (dev_);
debug_printf ("%d = waveInClose ()", rc); debug_printf ("%d = waveInClose()", rc);
Qisr2app_->dellock (); Qisr2app_->dellock ();
} }
@ -820,11 +820,11 @@ fhandler_dev_dsp::Audio_in::queueblock (WAVEHDR *pHdr)
{ {
MMRESULT rc; MMRESULT rc;
rc = waveInPrepareHeader (dev_, pHdr, sizeof (WAVEHDR)); rc = waveInPrepareHeader (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveInPrepareHeader (0x%08x)", rc, pHdr); debug_printf ("%d = waveInPrepareHeader(0x%08x)", rc, pHdr);
if (rc == MMSYSERR_NOERROR) if (rc == MMSYSERR_NOERROR)
{ {
rc = waveInAddBuffer (dev_, pHdr, sizeof (WAVEHDR)); rc = waveInAddBuffer (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveInAddBuffer (0x%08x)", rc, pHdr); debug_printf ("%d = waveInAddBuffer(0x%08x)", rc, pHdr);
} }
if (rc == MMSYSERR_NOERROR) if (rc == MMSYSERR_NOERROR)
return true; return true;
@ -854,7 +854,7 @@ fhandler_dev_dsp::Audio_in::init (unsigned blockSize)
} }
pHdr_ = NULL; pHdr_ = NULL;
rc = waveInStart (dev_); rc = waveInStart (dev_);
debug_printf ("%d = waveInStart (), queued=%d", rc, i); debug_printf ("%d = waveInStart(), queued=%d", rc, i);
return (rc == MMSYSERR_NOERROR); return (rc == MMSYSERR_NOERROR);
} }
@ -944,7 +944,7 @@ fhandler_dev_dsp::Audio_in::waitfordata ()
/* Errors are ignored here. They will probbaly cause a failure /* Errors are ignored here. They will probbaly cause a failure
in the subsequent PrepareHeader */ in the subsequent PrepareHeader */
rc = waveInUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR)); rc = waveInUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR));
debug_printf ("%d = waveInUnprepareHeader (0x%08x)", rc, pHdr); debug_printf ("%d = waveInUnprepareHeader(0x%08x)", rc, pHdr);
} }
pHdr_ = pHdr; pHdr_ = pHdr;
bufferIndex_ = 0; bufferIndex_ = 0;

View File

@ -254,7 +254,7 @@ fhandler_netdrive::readdir (DIR *dir, dirent *de)
res = 0; res = 0;
} }
out: out:
syscall_printf ("%d = readdir (%p, %p)", res, dir, de); syscall_printf ("%d = readdir(%p, %p)", res, dir, de);
return res; return res;
} }
@ -318,7 +318,7 @@ fhandler_netdrive::open (int flags, mode_t mode)
set_flags ((flags & ~O_TEXT) | O_BINARY | O_DIROPEN); set_flags ((flags & ~O_TEXT) | O_BINARY | O_DIROPEN);
set_open_status (); set_open_status ();
out: out:
syscall_printf ("%d = fhandler_netdrive::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_netdrive::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -269,7 +269,7 @@ fhandler_proc::readdir (DIR *dir, dirent *de)
} }
} }
syscall_printf ("%d = readdir (%p, %p) (%s)", res, dir, de, de->d_name); syscall_printf ("%d = readdir(%p, %p) (%s)", res, dir, de, de->d_name);
return res; return res;
} }
@ -376,7 +376,7 @@ success:
set_flags ((flags & ~O_TEXT) | O_BINARY); set_flags ((flags & ~O_TEXT) | O_BINARY);
set_open_status (); set_open_status ();
out: out:
syscall_printf ("%d = fhandler_proc::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_proc::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -236,7 +236,7 @@ fhandler_process::readdir (DIR *dir, dirent *de)
dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot;
res = 0; res = 0;
out: out:
syscall_printf ("%d = readdir (%p, %p) (%s)", res, dir, de, de->d_name); syscall_printf ("%d = readdir(%p, %p) (%s)", res, dir, de, de->d_name);
return res; return res;
} }
@ -313,7 +313,7 @@ success:
set_flags ((flags & ~O_TEXT) | O_BINARY); set_flags ((flags & ~O_TEXT) | O_BINARY);
set_open_status (); set_open_status ();
out: out:
syscall_printf ("%d = fhandler_proc::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_proc::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -123,7 +123,7 @@ fhandler_procnet::readdir (DIR *dir, dirent *de)
dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot;
res = 0; res = 0;
out: out:
syscall_printf ("%d = readdir (%p, %p) (%s)", res, dir, de, de->d_name); syscall_printf ("%d = readdir(%p, %p) (%s)", res, dir, de, de->d_name);
return res; return res;
} }
@ -194,7 +194,7 @@ success:
set_flags ((flags & ~O_TEXT) | O_BINARY); set_flags ((flags & ~O_TEXT) | O_BINARY);
set_open_status (); set_open_status ();
out: out:
syscall_printf ("%d = fhandler_proc::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_proc::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -364,7 +364,7 @@ fhandler_procsys::readdir (DIR *dir, dirent *de)
res = 0; res = 0;
} }
} }
syscall_printf ("%d = readdir (%p, %p)", res, dir, de); syscall_printf ("%d = readdir(%p, %p)", res, dir, de);
return res; return res;
} }
@ -446,7 +446,7 @@ fhandler_procsys::open (int flags, mode_t mode)
break; break;
} }
} }
syscall_printf ("%d = fhandler_procsys::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_procsys::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -130,7 +130,7 @@ fhandler_procsysvipc::readdir (DIR *dir, dirent *de)
dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot;
res = 0; res = 0;
out: out:
syscall_printf ("%d = readdir (%p, %p) (%s)", res, dir, de, de->d_name); syscall_printf ("%d = readdir(%p, %p) (%s)", res, dir, de, de->d_name);
return res; return res;
} }
@ -202,7 +202,7 @@ success:
set_flags ((flags & ~O_TEXT) | O_BINARY); set_flags ((flags & ~O_TEXT) | O_BINARY);
set_open_status (); set_open_status ();
out: out:
syscall_printf ("%d = fhandler_proc::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_proc::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -643,7 +643,7 @@ retry:
res = 0; res = 0;
out: out:
syscall_printf ("%d = readdir (%p, %p)", res, dir, de); syscall_printf ("%d = readdir(%p, %p)", res, dir, de);
return res; return res;
} }
@ -690,7 +690,7 @@ fhandler_registry::closedir (DIR * dir)
res = -1; res = -1;
} }
} }
syscall_printf ("%d = closedir (%p)", res, dir); syscall_printf ("%d = closedir(%p)", res, dir);
return 0; return 0;
} }
@ -833,7 +833,7 @@ success:
set_flags ((flags & ~O_TEXT) | O_BINARY); set_flags ((flags & ~O_TEXT) | O_BINARY);
set_open_status (); set_open_status ();
out: out:
syscall_printf ("%d = fhandler_registry::open (%p, %d)", res, flags, mode); syscall_printf ("%d = fhandler_registry::open(%p, %d)", res, flags, mode);
return res; return res;
} }

View File

@ -557,7 +557,7 @@ fhandler_serial::ioctl (unsigned int cmd, void *buf)
break; break;
} }
termios_printf ("%d = ioctl (%p, %p)", res, cmd, buf); termios_printf ("%d = ioctl(%p, %p)", res, cmd, buf);
# undef ibuf # undef ibuf
# undef ipbuf # undef ipbuf
return res; return res;

View File

@ -1020,7 +1020,7 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen)
int ret = ::setsockopt (get_socket (), SOL_SOCKET, int ret = ::setsockopt (get_socket (), SOL_SOCKET,
~(SO_REUSEADDR), ~(SO_REUSEADDR),
(const char *) &on, sizeof on); (const char *) &on, sizeof on);
debug_printf ("%d = setsockopt (SO_EXCLUSIVEADDRUSE), %E", ret); debug_printf ("%d = setsockopt(SO_EXCLUSIVEADDRUSE), %E", ret);
} }
if (::bind (get_socket (), name, namelen)) if (::bind (get_socket (), name, namelen))
set_winsock_errno (); set_winsock_errno ();
@ -1998,7 +1998,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p)
res = ioctlsocket (get_socket (), cmd, (unsigned long *) p); res = ioctlsocket (get_socket (), cmd, (unsigned long *) p);
break; break;
} }
syscall_printf ("%d = ioctl_socket (%x, %x)", res, cmd, p); syscall_printf ("%d = ioctl_socket(%x, %x)", res, cmd, p);
return res; return res;
} }

View File

@ -1033,7 +1033,7 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg)
} }
out: out:
termios_printf ("%d = ioctl (%x)", retval, cmd); termios_printf ("%d = ioctl(%x)", retval, cmd);
return retval; return retval;
} }
@ -1679,7 +1679,7 @@ fhandler_pty_master::setup ()
errstr = "pty master control pipe"; errstr = "pty master control pipe";
goto err; goto err;
} }
master_thread = new cygthread (::pty_master_thread, this, "pty_master"); master_thread = new cygthread (::pty_master_thread, this, "ptym");
if (!master_thread) if (!master_thread)
{ {
errstr = "pty master control thread"; errstr = "pty master control thread";

View File

@ -1520,7 +1520,7 @@ flock (int fd, int operation)
if ((res == -1) && ((get_errno () == EAGAIN) || (get_errno () == EACCES))) if ((res == -1) && ((get_errno () == EAGAIN) || (get_errno () == EACCES)))
set_errno (EWOULDBLOCK); set_errno (EWOULDBLOCK);
done: done:
syscall_printf ("%d = flock (%d, %d)", res, fd, operation); syscall_printf ("%R = flock(%d, %d)", res, fd, operation);
return res; return res;
} }
@ -1576,6 +1576,6 @@ lockf (int filedes, int function, _off64_t size)
} }
res = cfd->lock (cmd, &fl); res = cfd->lock (cmd, &fl);
done: done:
syscall_printf ("%d = lockf (%d, %d, %D)", res, filedes, function, size); syscall_printf ("%R = lockf(%d, %d, %D)", res, filedes, function, size);
return res; return res;
} }

View File

@ -685,7 +685,7 @@ fork ()
set_errno (grouped.this_errno); set_errno (grouped.this_errno);
} }
syscall_printf ("%d = fork()", res); syscall_printf ("%R = fork()", res);
return res; return res;
} }
#ifdef DEBUGGING #ifdef DEBUGGING

View File

@ -456,7 +456,7 @@ initgroups32 (const char *user, __gid32_t gid)
new_gsids.count (tmp_gsids.count ()); new_gsids.count (tmp_gsids.count ());
cygheap->user.groups.update_supp (new_gsids); cygheap->user.groups.update_supp (new_gsids);
} }
syscall_printf ( "%d = initgroups (%s, %u)", ret, user, gid); syscall_printf ( "%d = initgroups(%s, %u)", ret, user, gid);
return ret; return ret;
} }
@ -497,7 +497,7 @@ getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups)
ret = -1; ret = -1;
*ngroups = cnt; *ngroups = cnt;
} }
syscall_printf ( "%d = getgrouplist (%s, %u, %p, %d)", syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)",
ret, user, gid, groups, *ngroups); ret, user, gid, groups, *ngroups);
return ret; return ret;
} }

View File

@ -1244,7 +1244,7 @@ msync (void *addr, size_t len, int flags)
out: out:
LIST_UNLOCK (); LIST_UNLOCK ();
syscall_printf ("%d = msync()", ret); syscall_printf ("%R = msync()", ret);
return ret; return ret;
} }
@ -1337,7 +1337,7 @@ mprotect (void *addr, size_t len, int prot)
out: out:
syscall_printf ("%d = mprotect ()", ret ? 0 : -1); syscall_printf ("%R = mprotect ()", ret ? 0 : -1);
return ret ? 0 : -1; return ret ? 0 : -1;
} }

View File

@ -881,7 +881,7 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
int rc = normalize_win32_path (src_path, pathbuf, tail); int rc = normalize_win32_path (src_path, pathbuf, tail);
if (rc != 0) if (rc != 0)
{ {
debug_printf ("%d = conv_to_posix_path (%s)", rc, src_path); debug_printf ("%d = conv_to_posix_path(%s)", rc, src_path);
return rc; return rc;
} }
@ -1801,7 +1801,7 @@ mount (const char *win32_path, const char *posix_path, unsigned flags)
res = mount_table->add_item (w32_path, posix_path, flags); res = mount_table->add_item (w32_path, posix_path, flags);
} }
syscall_printf ("%d = mount (%s, %s, %p)", res, win32_path, posix_path, flags); syscall_printf ("%R = mount(%s, %s, %p)", res, win32_path, posix_path, flags);
return res; return res;
} }
@ -1836,7 +1836,7 @@ cygwin_umount (const char *path, unsigned flags)
if (!(flags & MOUNT_CYGDRIVE)) if (!(flags & MOUNT_CYGDRIVE))
res = mount_table->del_item (path, flags & ~MOUNT_SYSTEM); res = mount_table->del_item (path, flags & ~MOUNT_SYSTEM);
syscall_printf ("%d = cygwin_umount (%s, %d)", res, path, flags); syscall_printf ("%R = cygwin_umount(%s, %d)", res, path, flags);
return res; return res;
} }

View File

@ -661,7 +661,7 @@ cygwin_socket (int af, int type, int protocol)
} }
done: done:
syscall_printf ("%d = socket (%d, %d (flags %p), %d)", syscall_printf ("%R = socket(%d, %d (flags %p), %d)",
res, af, type, flags, protocol); res, af, type, flags, protocol);
return res; return res;
} }
@ -681,7 +681,7 @@ cygwin_sendto (int fd, const void *buf, size_t len, int flags,
else else
res = fh->sendto (buf, len, flags, to, tolen); res = fh->sendto (buf, len, flags, to, tolen);
syscall_printf ("%d = sendto (%d, %p, %d, %x, %p, %d)", syscall_printf ("%R = sendto(%d, %p, %d, %x, %p, %d)",
res, fd, buf, len, flags, to, tolen); res, fd, buf, len, flags, to, tolen);
return res; return res;
} }
@ -701,7 +701,7 @@ cygwin_recvfrom (int fd, void *buf, size_t len, int flags,
else if ((res = len) != 0) else if ((res = len) != 0)
res = fh->recvfrom (buf, len, flags, from, fromlen); res = fh->recvfrom (buf, len, flags, from, fromlen);
syscall_printf ("%d = recvfrom (%d, %p, %d, %x, %p, %p)", syscall_printf ("%R = recvfrom(%d, %p, %d, %x, %p, %p)",
res, fd, buf, len, flags, from, fromlen); res, fd, buf, len, flags, from, fromlen);
return res; return res;
} }
@ -816,7 +816,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
} }
} }
syscall_printf ("%d = setsockopt (%d, %d, %x, %p, %d)", syscall_printf ("%R = setsockopt(%d, %d, %x, %p, %d)",
res, fd, level, optname, optval, optlen); res, fd, level, optname, optval, optlen);
return res; return res;
} }
@ -876,7 +876,7 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval,
} }
} }
syscall_printf ("%d = getsockopt (%d, %d, 0x%x, %p, %p)", syscall_printf ("%R = getsockopt(%d, %d, 0x%x, %p, %p)",
res, fd, level, optname, optval, optlen); res, fd, level, optname, optval, optlen);
return res; return res;
} }
@ -904,7 +904,7 @@ cygwin_connect (int fd, const struct sockaddr *name, socklen_t namelen)
else else
res = fh->connect (name, namelen); res = fh->connect (name, namelen);
syscall_printf ("%d = connect (%d, %p, %d)", res, fd, name, namelen); syscall_printf ("%R = connect(%d, %p, %d)", res, fd, name, namelen);
return res; return res;
} }
@ -1280,7 +1280,7 @@ cygwin_accept (int fd, struct sockaddr *peer, socklen_t *len)
else else
res = fh->accept4 (peer, len, fh->is_nonblocking () ? SOCK_NONBLOCK : 0); res = fh->accept4 (peer, len, fh->is_nonblocking () ? SOCK_NONBLOCK : 0);
syscall_printf ("%d = accept (%d, %p, %p)", res, fd, peer, len); syscall_printf ("%R = accept(%d, %p, %p)", res, fd, peer, len);
return res; return res;
} }
@ -1302,7 +1302,7 @@ accept4 (int fd, struct sockaddr *peer, socklen_t *len, int flags)
else else
res = fh->accept4 (peer, len, flags); res = fh->accept4 (peer, len, flags);
syscall_printf ("%d = accept4 (%d, %p, %p, %p)", res, fd, peer, len, flags); syscall_printf ("%R = accept4(%d, %p, %p, %p)", res, fd, peer, len, flags);
return res; return res;
} }
@ -1319,7 +1319,7 @@ cygwin_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
else else
res = fh->bind (my_addr, addrlen); res = fh->bind (my_addr, addrlen);
syscall_printf ("%d = bind (%d, %p, %d)", res, fd, my_addr, addrlen); syscall_printf ("%R = bind(%d, %p, %d)", res, fd, my_addr, addrlen);
return res; return res;
} }
@ -1337,7 +1337,7 @@ cygwin_getsockname (int fd, struct sockaddr *addr, socklen_t *namelen)
else else
res = fh->getsockname (addr, namelen); res = fh->getsockname (addr, namelen);
syscall_printf ("%d = getsockname (%d, %p, %p)", res, fd, addr, namelen); syscall_printf ("%R =getsockname (%d, %p, %p)", res, fd, addr, namelen);
return res; return res;
} }
@ -1353,7 +1353,7 @@ cygwin_listen (int fd, int backlog)
else else
res = fh->listen (backlog); res = fh->listen (backlog);
syscall_printf ("%d = listen (%d, %d)", res, fd, backlog); syscall_printf ("%R = listen(%d, %d)", res, fd, backlog);
return res; return res;
} }
@ -1370,7 +1370,7 @@ cygwin_shutdown (int fd, int how)
else else
res = fh->shutdown (how); res = fh->shutdown (how);
syscall_printf ("%d = shutdown (%d, %d)", res, fd, how); syscall_printf ("%R = shutdown(%d, %d)", res, fd, how);
return res; return res;
} }
@ -1436,7 +1436,7 @@ cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len)
else else
res = fh->getpeername (name, len); res = fh->getpeername (name, len);
syscall_printf ("%d = getpeername (%d) %d", res, fd, (fh ? fh->get_socket () : -1)); syscall_printf ("%R = getpeername(%d) %d", res, fd, (fh ? fh->get_socket () : -1));
return res; return res;
} }
@ -1454,7 +1454,7 @@ cygwin_recv (int fd, void *buf, size_t len, int flags)
else if ((res = len) != 0) else if ((res = len) != 0)
res = fh->recvfrom (buf, len, flags, NULL, NULL); res = fh->recvfrom (buf, len, flags, NULL, NULL);
syscall_printf ("%d = recv (%d, %p, %d, %x)", res, fd, buf, len, flags); syscall_printf ("%R = recv(%d, %p, %d, %x)", res, fd, buf, len, flags);
return res; return res;
} }
@ -1472,7 +1472,7 @@ cygwin_send (int fd, const void *buf, size_t len, int flags)
else else
res = fh->sendto (buf, len, flags, NULL, 0); res = fh->sendto (buf, len, flags, NULL, 0);
syscall_printf ("%d = send (%d, %p, %d, %x)", res, fd, buf, len, flags); syscall_printf ("%R = send(%d, %p, %d, %x)", res, fd, buf, len, flags);
return res; return res;
} }
@ -2782,7 +2782,7 @@ socketpair (int family, int type, int protocol, int *sb)
} }
done: done:
syscall_printf ("%d = socketpair (...)", res); syscall_printf ("%R = socketpair(...)", res);
return res; return res;
} }
@ -2816,7 +2816,7 @@ cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
res = fh->recvmsg (msg, flags); res = fh->recvmsg (msg, flags);
} }
syscall_printf ("%d = recvmsg (%d, %p, %x)", res, fd, msg, flags); syscall_printf ("%R = recvmsg(%d, %p, %x)", res, fd, msg, flags);
return res; return res;
} }
@ -2838,7 +2838,7 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
res = fh->sendmsg (msg, flags); res = fh->sendmsg (msg, flags);
} }
syscall_printf ("%d = sendmsg (%d, %p, %x)", res, fd, msg, flags); syscall_printf ("%R = sendmsg(%d, %p, %x)", res, fd, msg, flags);
return res; return res;
} }

View File

@ -210,7 +210,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size)
out: out:
if (!hdl) if (!hdl)
CloseHandle (h); CloseHandle (h);
debug_printf ("%d = read_ea (%S, %s, %p, %lu)", debug_printf ("%d = read_ea(%S, %s, %p, %lu)",
ret, attr.ObjectName, name, value, size); ret, attr.ObjectName, name, value, size);
return ret; return ret;
} }
@ -344,7 +344,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value,
out: out:
if (!hdl) if (!hdl)
CloseHandle (h); CloseHandle (h);
debug_printf ("%d = write_ea (%S, %s, %p, %lu, %d)", debug_printf ("%d = write_ea(%S, %s, %p, %lu, %d)",
ret, attr.ObjectName, name, value, size, flags); ret, attr.ObjectName, name, value, size, flags);
return ret; return ret;
} }

View File

@ -1739,7 +1739,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
NtClose (fh); NtClose (fh);
done: done:
syscall_printf ("%d = symlink_worker (%s, %s, %d, %d)", res, oldpath, syscall_printf ("%d = symlink_worker(%s, %s, %d, %d)", res, oldpath,
newpath, mk_winsym, isdevice); newpath, mk_winsym, isdevice);
if (has_trailing_dirsep) if (has_trailing_dirsep)
free ((void *) newpath); free ((void *) newpath);
@ -2714,7 +2714,7 @@ restart:
NtClose (h); NtClose (h);
} }
syscall_printf ("%d = symlink.check (%s, %p) (%p)", syscall_printf ("%d = symlink.check(%s, %p) (%p)",
res, suffix.path, contents, pflags); res, suffix.path, contents, pflags);
return res; return res;
} }
@ -2890,7 +2890,7 @@ chdir (const char *in_dir)
/* Note that we're accessing cwd.posix without a lock here. I didn't think /* Note that we're accessing cwd.posix without a lock here. I didn't think
it was worth locking just for strace. */ it was worth locking just for strace. */
syscall_printf ("%d = chdir() cygheap->cwd.posix '%s' native '%S'", res, syscall_printf ("%R = chdir() cygheap->cwd.posix '%s' native '%S'", res,
cygheap->cwd.get_posix (), path.get_nt_native_path ()); cygheap->cwd.get_posix (), path.get_nt_native_path ());
MALLOC_CHECK; MALLOC_CHECK;
return res; return res;
@ -2906,7 +2906,7 @@ fchdir (int fd)
else else
res = -1; res = -1;
syscall_printf ("%d = fchdir (%d)", res, fd); syscall_printf ("%R = fchdir(%d)", res, fd);
return res; return res;
} }

View File

@ -348,7 +348,7 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode)
res = 0; res = 0;
} }
syscall_printf ("%d = pipe ([%p, %p], %d, %p)", res, fhs[0], fhs[1], psize, mode); syscall_printf ("%R = pipe([%p, %p], %d, %p)", res, fhs[0], fhs[1], psize, mode);
return res; return res;
} }

View File

@ -108,7 +108,7 @@ getrusage (int intwho, struct rusage *rusage_in)
res = -1; res = -1;
} }
syscall_printf ("%d = getrusage (%d, %p)", res, intwho, rusage_in); syscall_printf ("%R = getrusage(%d, %p)", res, intwho, rusage_in);
return res; return res;
} }

View File

@ -440,7 +440,7 @@ getacl (HANDLE handle, path_conv &pc, int nentries, __aclent32_t *aclbufp)
aclbufp[i].a_perm &= ~(DENY_R | DENY_W | DENY_X); aclbufp[i].a_perm &= ~(DENY_R | DENY_W | DENY_X);
aclsort32 (pos, 0, aclbufp); aclsort32 (pos, 0, aclbufp);
} }
syscall_printf ("%d = getacl (%S)", pos, pc.get_nt_native_path ()); syscall_printf ("%R = getacl(%S)", pos, pc.get_nt_native_path ());
return pos; return pos;
} }
@ -462,7 +462,7 @@ acl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp)
res = fh->facl (cmd, nentries, aclbufp); res = fh->facl (cmd, nentries, aclbufp);
delete fh; delete fh;
syscall_printf ("%d = acl (%s)", res, path); syscall_printf ("%R = acl(%s)", res, path);
return res; return res;
} }
@ -484,7 +484,7 @@ facl32 (int fd, int cmd, int nentries, __aclent32_t *aclbufp)
return -1; return -1;
} }
int res = cfd->facl (cmd, nentries, aclbufp); int res = cfd->facl (cmd, nentries, aclbufp);
syscall_printf ("%d = facl (%s) )", res, cfd->get_name ()); syscall_printf ("%R = facl(%s) )", res, cfd->get_name ());
return res; return res;
} }

View File

@ -169,7 +169,7 @@ cygwin_logon_user (const struct passwd *pw, const char *password)
hToken = INVALID_HANDLE_VALUE; hToken = INVALID_HANDLE_VALUE;
} }
cygheap->user.reimpersonate (); cygheap->user.reimpersonate ();
debug_printf ("%d = logon_user(%s,...)", hToken, pw->pw_name); debug_printf ("%R = logon_user(%s,...)", hToken, pw->pw_name);
return hToken; return hToken;
} }

View File

@ -434,7 +434,7 @@ set_privilege (HANDLE token, DWORD privilege, bool enable)
out: out:
if (ret < 0) if (ret < 0)
debug_printf ("%d = set_privilege ((token %x) %W, %d)", ret, token, debug_printf ("%d = set_privilege((token %x) %W, %d)", ret, token,
privilege_name (new_priv.Privileges[0].Luid), enable); privilege_name (new_priv.Privileges[0].Luid), enable);
return ret; return ret;
} }

View File

@ -968,7 +968,7 @@ set_file_attribute (HANDLE handle, path_conv &pc,
} }
else else
ret = 0; ret = 0;
syscall_printf ("%d = set_file_attribute (%S, %d, %d, %p)", syscall_printf ("%d = set_file_attribute(%S, %d, %d, %p)",
ret, pc.get_nt_native_path (), uid, gid, attribute); ret, pc.get_nt_native_path (), uid, gid, attribute);
return ret; return ret;
} }

View File

@ -654,7 +654,7 @@ start_thread_pipe (select_record *me, select_stuff *stuff)
{ {
pi->start = &stuff->start; pi->start = &stuff->start;
pi->stop_thread = false; pi->stop_thread = false;
pi->thread = new cygthread (thread_pipe, pi, "select_pipe"); pi->thread = new cygthread (thread_pipe, pi, "pipesel");
me->h = *pi->thread; me->h = *pi->thread;
if (!me->h) if (!me->h)
return 0; return 0;
@ -1138,7 +1138,7 @@ start_thread_serial (select_record *me, select_stuff *stuff)
select_serial_info *si = new select_serial_info; select_serial_info *si = new select_serial_info;
si->start = &stuff->start; si->start = &stuff->start;
si->stop_thread = false; si->stop_thread = false;
si->thread = new cygthread (thread_serial, si, "select_serial"); si->thread = new cygthread (thread_serial, si, "sersel");
me->h = *si->thread; me->h = *si->thread;
stuff->device_specific_serial = si; stuff->device_specific_serial = si;
} }
@ -1407,7 +1407,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
stuff->device_specific_socket = si; stuff->device_specific_socket = si;
si->start = &stuff->start; si->start = &stuff->start;
select_printf ("stuff_start %p", &stuff->start); select_printf ("stuff_start %p", &stuff->start);
si->thread = new cygthread (thread_socket, si, "select_socket"); si->thread = new cygthread (thread_socket, si, "socksel");
me->h = *si->thread; me->h = *si->thread;
return 1; return 1;
} }
@ -1645,7 +1645,7 @@ start_thread_mailslot (select_record *me, select_stuff *stuff)
select_mailslot_info *mi = new select_mailslot_info; select_mailslot_info *mi = new select_mailslot_info;
mi->start = &stuff->start; mi->start = &stuff->start;
mi->stop_thread = false; mi->stop_thread = false;
mi->thread = new cygthread (thread_mailslot, mi, "select_mailslot"); mi->thread = new cygthread (thread_mailslot, mi, "mailsel");
me->h = *mi->thread; me->h = *mi->thread;
if (!me->h) if (!me->h)
return 0; return 0;

View File

@ -154,7 +154,7 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp,
rmtp->tv_nsec = (long) ((timeout.QuadPart % NSPERSEC) * 100LL); rmtp->tv_nsec = (long) ((timeout.QuadPart % NSPERSEC) * 100LL);
} }
syscall_printf ("%d = clock_nanosleep (%lu, %d, %ld.%09ld, %ld.%09.ld)", syscall_printf ("%d = clock_nanosleep(%lu, %d, %ld.%09ld, %ld.%09.ld)",
res, clk_id, flags, rqtp->tv_sec, rqtp->tv_nsec, res, clk_id, flags, rqtp->tv_sec, rqtp->tv_nsec,
rmtp ? rmtp->tv_sec : 0, rmtp ? rmtp->tv_nsec : 0); rmtp ? rmtp->tv_sec : 0, rmtp ? rmtp->tv_nsec : 0);
return res; return res;
@ -376,7 +376,7 @@ kill_pgrp (pid_t pid, siginfo_t& si)
set_errno (ESRCH); set_errno (ESRCH);
res = -1; res = -1;
} }
syscall_printf ("%d = kill (%d, %d)", res, pid, si.si_signo); syscall_printf ("%R = kill(%d, %d)", res, pid, si.si_signo);
return res; return res;
} }

View File

@ -1241,7 +1241,7 @@ talktome (siginfo_t *si)
pinfo pi (si->si_pid); pinfo pi (si->si_pid);
if (pi) if (pi)
new cygthread (commune_process, size, si, "commune_process"); new cygthread (commune_process, size, si, "commune");
} }
void void

View File

@ -73,6 +73,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
DWORD err = GetLastError (); DWORD err = GetLastError ();
long Rval = 0;
while (*fmt) while (*fmt)
{ {
int i, n = 0x7fff; int i, n = 0x7fff;
@ -146,8 +147,14 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
strcpy (dst, "Win32 error "); strcpy (dst, "Win32 error ");
dst = __rn (dst + sizeof ("Win32 error"), 10, 0, err, len, pad, LMASK); dst = __rn (dst + sizeof ("Win32 error"), 10, 0, err, len, pad, LMASK);
break; break;
case 'R':
case 'd': case 'd':
dst = rnarg (dst, 10, addsign, len, pad); {
long val = va_arg (ap, long);
dst = __rn (dst, 10, addsign, val, len, pad, LMASK);
if (c == 'R')
Rval = val;
}
break; break;
case 'D': case 'D':
dst = rnargLL (dst, 10, addsign, len, pad); dst = rnargLL (dst, 10, addsign, len, pad);
@ -241,6 +248,12 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
} }
} }
} }
if (Rval < 0)
{
strcpy (dst, ", errno ");
dst += strlen (", errno ");
dst = __rn (dst, 10, false, get_errno (), 0, 0, LMASK);
}
*dst = 0; *dst = 0;
SetLastError (err); SetLastError (err);
return dst - orig; return dst - orig;

View File

@ -707,7 +707,7 @@ loop:
cygpid = myself->pid; cygpid = myself->pid;
/* We print the original program name here so the user can see that too. */ /* We print the original program name here so the user can see that too. */
syscall_printf ("%d = child_info_spawn::worker (%s, %.9500s)", syscall_printf ("%d = child_info_spawn::worker(%s, %.9500s)",
rc ? cygpid : (unsigned int) -1, prog_arg, one_line.buf); rc ? cygpid : (unsigned int) -1, prog_arg, one_line.buf);
/* Name the handle similarly to proc_subproc. */ /* Name the handle similarly to proc_subproc. */

View File

@ -137,10 +137,10 @@ dup2 (int oldfd, int newfd)
cygheap_fdget cfd (oldfd); cygheap_fdget cfd (oldfd);
if (cfd < 0) if (cfd < 0)
{ {
syscall_printf ("-1 = dup2 (%d, %d) (oldfd not open)", oldfd, newfd); syscall_printf ("%R = dup2(%d,%d) (oldfd not open)", -1, oldfd, newfd);
return -1; return -1;
} }
syscall_printf ("%d = dup2 (%d, %d) (newfd==oldfd)", oldfd, oldfd, newfd); syscall_printf ("%R = dup2(%d, %d) (newfd==oldfd)", oldfd, oldfd, newfd);
return oldfd; return oldfd;
} }
return cygheap->fdtab.dup3 (oldfd, newfd, 0); return cygheap->fdtab.dup3 (oldfd, newfd, 0);
@ -934,7 +934,7 @@ unlink (const char *ourname)
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
done: done:
syscall_printf ("%d = unlink (%s)", res, ourname); syscall_printf ("%R = unlink(%s)", res, ourname);
return res; return res;
} }
@ -946,7 +946,7 @@ _remove_r (struct _reent *, const char *ourname)
if (win32_name.error) if (win32_name.error)
{ {
set_errno (win32_name.error); set_errno (win32_name.error);
syscall_printf ("-1 = remove (%s)", ourname); syscall_printf ("%R = remove(%s)",-1, ourname);
return -1; return -1;
} }
@ -1074,8 +1074,7 @@ read (int fd, void *ptr, size_t len)
cfd->read (ptr, res = len); cfd->read (ptr, res = len);
done: done:
syscall_printf ("%d = read (%d, %p, %d), errno %d", res, fd, ptr, len, syscall_printf ("%R = read(%d, %p, %d)", res, fd, ptr, len);
get_errno ());
MALLOC_CHECK; MALLOC_CHECK;
return (ssize_t) res; return (ssize_t) res;
} }
@ -1119,8 +1118,7 @@ readv (int fd, const struct iovec *const iov, const int iovcnt)
res = cfd->readv (iov, iovcnt, tot); res = cfd->readv (iov, iovcnt, tot);
done: done:
syscall_printf ("%d = readv (%d, %p, %d), errno %d", res, fd, iov, iovcnt, syscall_printf ("%R = readv(%d, %p, %d)", res, fd, iov, iovcnt);
get_errno ());
MALLOC_CHECK; MALLOC_CHECK;
return res; return res;
} }
@ -1137,8 +1135,7 @@ pread (int fd, void *ptr, size_t len, _off64_t off)
else else
res = cfd->pread (ptr, len, off); res = cfd->pread (ptr, len, off);
syscall_printf ("%d = pread (%d, %p, %d, %d), errno %d", syscall_printf ("%R = pread(%d, %p, %d, %d)", res, fd, ptr, len, off);
res, fd, ptr, len, off, get_errno ());
return res; return res;
} }
@ -1173,11 +1170,9 @@ write (int fd, const void *ptr, size_t len)
done: done:
if (fd == 1 || fd == 2) if (fd == 1 || fd == 2)
paranoid_printf ("%d = write (%d, %p, %d), errno %d", paranoid_printf ("%R = write(%d, %p, %d)", res, fd, ptr, len);
res, fd, ptr, len, get_errno ());
else else
syscall_printf ("%d = write (%d, %p, %d), errno %d", syscall_printf ("%R = write(%d, %p, %d)", res, fd, ptr, len);
res, fd, ptr, len, get_errno ());
MALLOC_CHECK; MALLOC_CHECK;
return res; return res;
@ -1223,11 +1218,9 @@ writev (const int fd, const struct iovec *const iov, const int iovcnt)
done: done:
if (fd == 1 || fd == 2) if (fd == 1 || fd == 2)
paranoid_printf ("%d = writev (%d, %p, %d), errno %d", paranoid_printf ("%R = writev(%d, %p, %d)", res, fd, iov, iovcnt);
res, fd, iov, iovcnt, get_errno ());
else else
syscall_printf ("%d = writev (%d, %p, %d), errno %d", syscall_printf ("%R = writev(%d, %p, %d)", res, fd, iov, iovcnt);
res, fd, iov, iovcnt, get_errno ());
MALLOC_CHECK; MALLOC_CHECK;
return res; return res;
@ -1245,8 +1238,7 @@ pwrite (int fd, void *ptr, size_t len, _off64_t off)
else else
res = cfd->pwrite (ptr, len, off); res = cfd->pwrite (ptr, len, off);
syscall_printf ("%d = pwrite (%d, %p, %d, %d), errno %d", syscall_printf ("%R = pwrite(%d, %p, %d, %d)", res, fd, ptr, len, off);
res, fd, ptr, len, off, get_errno ());
return res; return res;
} }
@ -1328,7 +1320,7 @@ open (const char *unix_path, int flags, ...)
} }
} }
syscall_printf ("%d = open (%s, %p)", res, unix_path, flags); syscall_printf ("%R = open(%s, %p)", res, unix_path, flags);
return res; return res;
} }
@ -1387,7 +1379,7 @@ close (int fd)
cfd.release (); cfd.release ();
} }
syscall_printf ("%d = close (%d)", res, fd); syscall_printf ("%R = close(%d)", res, fd);
MALLOC_CHECK; MALLOC_CHECK;
return res; return res;
} }
@ -1404,7 +1396,7 @@ isatty (int fd)
res = 0; res = 0;
else else
res = cfd->is_tty (); res = cfd->is_tty ();
syscall_printf ("%d = isatty (%d)", res, fd); syscall_printf ("%R = isatty(%d)", res, fd);
return res; return res;
} }
EXPORT_ALIAS (isatty, _isatty) EXPORT_ALIAS (isatty, _isatty)
@ -1433,7 +1425,7 @@ link (const char *oldpath, const char *newpath)
delete fh; delete fh;
error: error:
syscall_printf ("%d = link (%s, %s)", res, oldpath, newpath); syscall_printf ("%R = link(%s, %s)", res, oldpath, newpath);
return res; return res;
} }
@ -1461,7 +1453,7 @@ chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid)
delete fh; delete fh;
error: error:
syscall_printf ("%d = %schown (%s,...)", syscall_printf ("%R = %schown(%s,...)",
res, (fmode & PC_SYM_NOFOLLOW) ? "l" : "", name); res, (fmode & PC_SYM_NOFOLLOW) ? "l" : "", name);
return res; return res;
} }
@ -1504,7 +1496,7 @@ fchown32 (int fd, __uid32_t uid, __gid32_t gid)
int res = cfd->fchown (uid, gid); int res = cfd->fchown (uid, gid);
syscall_printf ("%d = fchown (%s,...)", res, cfd->get_name ()); syscall_printf ("%R = fchown(%s,...)", res, cfd->get_name ());
return res; return res;
} }
@ -1553,7 +1545,7 @@ chmod (const char *path, mode_t mode)
delete fh; delete fh;
error: error:
syscall_printf ("%d = chmod (%s, %p)", res, path, mode); syscall_printf ("%R = chmod(%s, %p)", res, path, mode);
return res; return res;
} }
@ -1613,7 +1605,7 @@ fstat64 (int fd, struct __stat64 *buf)
} }
} }
syscall_printf ("%d = fstat (%d, %p)", res, fd, buf); syscall_printf ("%R = fstat(%d, %p)", res, fd, buf);
return res; return res;
} }
@ -1764,7 +1756,7 @@ stat_worker (path_conv &pc, struct __stat64 *buf)
error: error:
MALLOC_CHECK; MALLOC_CHECK;
syscall_printf ("%d = (%S, %p)", res, pc.get_nt_native_path (), buf); syscall_printf ("%d = (%S,%p)", res, pc.get_nt_native_path (), buf);
return res; return res;
} }
@ -2397,7 +2389,7 @@ out:
NtClose (fh); NtClose (fh);
if (wincap.has_transactions () && trans) if (wincap.has_transactions () && trans)
stop_transaction (status, old_trans, trans); stop_transaction (status, old_trans, trans);
syscall_printf ("%d = rename (%s, %s)", res, oldpath, newpath); syscall_printf ("%R = rename(%s, %s)", res, oldpath, newpath);
return res; return res;
} }
@ -2674,7 +2666,7 @@ posix_fadvise (int fd, _off64_t offset, _off64_t len, int advice)
res = cfd->fadvise (offset, len, advice); res = cfd->fadvise (offset, len, advice);
else else
set_errno (EBADF); set_errno (EBADF);
syscall_printf ("%d = posix_fadvice (%d, %D, %D, %d)", syscall_printf ("%R = posix_fadvice(%d, %D, %D, %d)",
res, fd, offset, len, advice); res, fd, offset, len, advice);
return res; return res;
} }
@ -2693,7 +2685,7 @@ posix_fallocate (int fd, _off64_t offset, _off64_t len)
else else
set_errno (EBADF); set_errno (EBADF);
} }
syscall_printf ("%d = posix_fallocate (%d, %D, %D)", res, fd, offset, len); syscall_printf ("%R = posix_fallocate(%d, %D, %D)", res, fd, offset, len);
return res; return res;
} }
@ -2706,7 +2698,7 @@ ftruncate64 (int fd, _off64_t length)
res = cfd->ftruncate (length, true); res = cfd->ftruncate (length, true);
else else
set_errno (EBADF); set_errno (EBADF);
syscall_printf ("%d = ftruncate (%d, %D)", res, fd, length); syscall_printf ("%R = ftruncate(%d, %D)", res, fd, length);
return res; return res;
} }
@ -2731,7 +2723,7 @@ truncate64 (const char *pathname, _off64_t length)
res = ftruncate64 (fd, length); res = ftruncate64 (fd, length);
close (fd); close (fd);
} }
syscall_printf ("%d = truncate (%s, %D)", res, pathname, length); syscall_printf ("%R = truncate(%s, %D)", res, pathname, length);
return res; return res;
} }
@ -2754,7 +2746,7 @@ get_osfhandle (int fd)
else else
res = -1; res = -1;
syscall_printf ("%d = get_osfhandle (%d)", res, fd); syscall_printf ("%R = get_osfhandle(%d)", res, fd);
return res; return res;
} }
@ -2800,7 +2792,7 @@ statvfs (const char *name, struct statvfs *sfs)
delete fh; delete fh;
error: error:
MALLOC_CHECK; MALLOC_CHECK;
syscall_printf ("%d = (%s, %p)", res, name, sfs); syscall_printf ("%R = statvfs(%s,%p)", res, name, sfs);
return res; return res;
} }
@ -3402,8 +3394,7 @@ chroot (const char *newroot)
ret = 0; ret = 0;
} }
syscall_printf ("%d = chroot (%s)", ret ? get_errno () : 0, syscall_printf ("%R = chroot(%s)", ret, newroot ?: "NULL");
newroot ? newroot : "NULL");
return ret; return ret;
} }

View File

@ -40,7 +40,7 @@ tcsendbreak (int fd, int duration)
res = cfd->tcsendbreak (duration); res = cfd->tcsendbreak (duration);
out: out:
syscall_printf ("%d = tcsendbreak (%d, %d)", res, fd, duration); syscall_printf ("%R = tcsendbreak(%d, %d)", res, fd, duration);
return res; return res;
} }
@ -64,7 +64,7 @@ tcdrain (int fd)
res = cfd->tcdrain (); res = cfd->tcdrain ();
out: out:
syscall_printf ("%d = tcdrain (%d)", res, fd); syscall_printf ("%R = tcdrain(%d)", res, fd);
return res; return res;
} }
@ -86,7 +86,7 @@ tcflush (int fd, int queue)
res = cfd->tcflush (queue); res = cfd->tcflush (queue);
out: out:
termios_printf ("%d = tcflush (%d, %d)", res, fd, queue); termios_printf ("%R = tcflush(%d, %d)", res, fd, queue);
return res; return res;
} }
@ -106,7 +106,7 @@ tcflow (int fd, int action)
res = cfd->tcflow (action); res = cfd->tcflow (action);
out: out:
syscall_printf ("%d = tcflow (%d, %d)", res, fd, action); syscall_printf ("%R = tcflow(%d, %d)", res, fd, action);
return res; return res;
} }
@ -162,7 +162,7 @@ tcsetattr (int fd, int a, const struct termios *t)
termios_printf ("iflag %p, oflag %p, cflag %p, lflag %p, VMIN %d, VTIME %d", termios_printf ("iflag %p, oflag %p, cflag %p, lflag %p, VMIN %d, VTIME %d",
t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN], t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
t->c_cc[VTIME]); t->c_cc[VTIME]);
termios_printf ("%d = tcsetattr (%d, %d, %x)", res, fd, a, t); termios_printf ("%R = tcsetattr(%d, %d, %x)", res, fd, a, t);
return res; return res;
} }
@ -182,7 +182,7 @@ tcgetattr (int fd, struct termios *in_t)
__toapp_termios (in_t, t); __toapp_termios (in_t, t);
if (res) if (res)
termios_printf ("%d = tcgetattr (%d, %p)", res, fd, in_t); termios_printf ("%R = tcgetattr(%d, %p)", res, fd, in_t);
else else
termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d", termios_printf ("iflag %x, oflag %x, cflag %x, lflag %x, VMIN %d, VTIME %d",
t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN], t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN],
@ -203,7 +203,7 @@ tcgetpgrp (int fd)
else else
res = cfd->tcgetpgrp (); res = cfd->tcgetpgrp ();
termios_printf ("%d = tcgetpgrp (%d)", res, fd); termios_printf ("%R = tcgetpgrp(%d)", res, fd);
return res; return res;
} }
@ -218,7 +218,7 @@ tcgetsid (int fd)
else else
res = cfd->tcgetsid (); res = cfd->tcgetsid ();
termios_printf ("%d = tcgetsid (%d)", res, fd); termios_printf ("%R = tcgetsid(%d)", res, fd);
return res; return res;
} }
@ -236,7 +236,7 @@ tcsetpgrp (int fd, pid_t pgid)
else else
res = cfd->tcsetpgrp (pgid); res = cfd->tcsetpgrp (pgid);
termios_printf ("%d = tcsetpgrp (%d, %d)", res, fd, pgid); termios_printf ("%R = tcsetpgrp(%d, %d)", res, fd, pgid);
return res; return res;
} }

View File

@ -377,26 +377,31 @@ fixup_timers_after_fork ()
extern "C" int extern "C" int
setitimer (int which, const struct itimerval *value, struct itimerval *ovalue) setitimer (int which, const struct itimerval *value, struct itimerval *ovalue)
{ {
int ret;
if (which != ITIMER_REAL) if (which != ITIMER_REAL)
{ {
set_errno (EINVAL); set_errno (EINVAL);
return -1; ret = -1;
} }
else
{
struct itimerspec spec_value, spec_ovalue; struct itimerspec spec_value, spec_ovalue;
int ret;
spec_value.it_interval.tv_sec = value->it_interval.tv_sec; spec_value.it_interval.tv_sec = value->it_interval.tv_sec;
spec_value.it_interval.tv_nsec = value->it_interval.tv_usec * 1000; spec_value.it_interval.tv_nsec = value->it_interval.tv_usec * 1000;
spec_value.it_value.tv_sec = value->it_value.tv_sec; spec_value.it_value.tv_sec = value->it_value.tv_sec;
spec_value.it_value.tv_nsec = value->it_value.tv_usec * 1000; spec_value.it_value.tv_nsec = value->it_value.tv_usec * 1000;
ret = timer_settime ((timer_t) &ttstart, 0, &spec_value, &spec_ovalue); ret = timer_settime ((timer_t) &ttstart, 0, &spec_value, &spec_ovalue);
if (!ret && ovalue) if (ret)
ret = -1;
else if (ovalue)
{ {
ovalue->it_interval.tv_sec = spec_ovalue.it_interval.tv_sec; ovalue->it_interval.tv_sec = spec_ovalue.it_interval.tv_sec;
ovalue->it_interval.tv_usec = spec_ovalue.it_interval.tv_nsec / 1000; ovalue->it_interval.tv_usec = spec_ovalue.it_interval.tv_nsec / 1000;
ovalue->it_value.tv_sec = spec_ovalue.it_value.tv_sec; ovalue->it_value.tv_sec = spec_ovalue.it_value.tv_sec;
ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000; ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000;
} }
syscall_printf ("%d = setitimer ()", ret); }
syscall_printf ("%R = setitimer()", ret);
return ret; return ret;
} }
@ -404,24 +409,33 @@ setitimer (int which, const struct itimerval *value, struct itimerval *ovalue)
extern "C" int extern "C" int
getitimer (int which, struct itimerval *ovalue) getitimer (int which, struct itimerval *ovalue)
{ {
int ret;
if (which != ITIMER_REAL) if (which != ITIMER_REAL)
{ {
set_errno (EINVAL); set_errno (EINVAL);
return -1; ret = -1;
} }
else
{
myfault efault; myfault efault;
if (efault.faulted (EFAULT)) if (efault.faulted (EFAULT))
return -1; ret = -1;
else
{
struct itimerspec spec_ovalue; struct itimerspec spec_ovalue;
int ret = timer_gettime ((timer_t) &ttstart, &spec_ovalue); int ret = timer_gettime ((timer_t) &ttstart, &spec_ovalue);
if (!ret) if (ret)
ret = -1;
else
{ {
ovalue->it_interval.tv_sec = spec_ovalue.it_interval.tv_sec; ovalue->it_interval.tv_sec = spec_ovalue.it_interval.tv_sec;
ovalue->it_interval.tv_usec = spec_ovalue.it_interval.tv_nsec / 1000; ovalue->it_interval.tv_usec = spec_ovalue.it_interval.tv_nsec / 1000;
ovalue->it_value.tv_sec = spec_ovalue.it_value.tv_sec; ovalue->it_value.tv_sec = spec_ovalue.it_value.tv_sec;
ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000; ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000;
} }
syscall_printf ("%d = getitimer ()", ret); }
}
syscall_printf ("%R = getitimer()", ret);
return ret; return ret;
} }
@ -437,7 +451,7 @@ alarm (unsigned int seconds)
newt.it_value.tv_sec = seconds; newt.it_value.tv_sec = seconds;
timer_settime ((timer_t) &ttstart, 0, &newt, &oldt); timer_settime ((timer_t) &ttstart, 0, &newt, &oldt);
int ret = oldt.it_value.tv_sec + (oldt.it_value.tv_nsec > 0); int ret = oldt.it_value.tv_sec + (oldt.it_value.tv_nsec > 0);
syscall_printf ("%d = alarm (%d)", ret, seconds); syscall_printf ("%d = alarm(%d)", ret, seconds);
return ret; return ret;
} }
@ -459,6 +473,6 @@ ualarm (useconds_t value, useconds_t interval)
} }
timer_settime ((timer_t) &ttstart, 0, &timer, &otimer); timer_settime ((timer_t) &ttstart, 0, &timer, &otimer);
useconds_t ret = otimer.it_value.tv_sec * 1000000 + (otimer.it_value.tv_nsec + 999) / 1000; useconds_t ret = otimer.it_value.tv_sec * 1000000 + (otimer.it_value.tv_nsec + 999) / 1000;
syscall_printf ("%d = ualarm (%d , %d)", ret, value, interval); syscall_printf ("%d = ualarm(%d , %d)", ret, value, interval);
return ret; return ret;
} }

View File

@ -130,11 +130,10 @@ settimeofday (const struct timeval *tv, const struct timezone *tz)
res = -!SetSystemTime (&st); res = -!SetSystemTime (&st);
gtod.reset (); gtod.reset ();
syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz); if (res)
if (res != 0)
set_errno (EPERM); set_errno (EPERM);
syscall_printf ("%R = settimeofday(%x, %x)", res, tv, tz);
return res; return res;
} }
@ -332,7 +331,7 @@ time (time_t * ptr)
if (ptr) if (ptr)
*ptr = res; *ptr = res;
syscall_printf ("%d = time (%x)", res, ptr); syscall_printf ("%d = time(%x)", res, ptr);
return res; return res;
} }
@ -380,8 +379,7 @@ utimens_worker (path_conv &win32, const struct timespec *tvp)
} }
error: error:
syscall_printf ("%d = utimes (%S, %p)", syscall_printf ("%R = utimes(%S, %p)", res, win32.get_nt_native_path (), tvp);
res, win32.get_nt_native_path (), tvp);
return res; return res;
} }
@ -416,7 +414,7 @@ futimens (int fd, const struct timespec *tvp)
res = cfd->utimens (tvp); res = cfd->utimens (tvp);
else else
res = utimens_worker (cfd->pc, tvp); res = utimens_worker (cfd->pc, tvp);
syscall_printf ("%d = futimens (%d, %p)", res, fd, tvp); syscall_printf ("%d = futimens(%d, %p)", res, fd, tvp);
return res; return res;
} }