diff options
author | Christopher Faylor <me@cgf.cx> | 2011-12-03 21:43:27 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-12-03 21:43:27 +0000 |
commit | b9aa81491f62f6053bb648f20143ba9e68051622 (patch) | |
tree | 4156e112e197c9d9e4de5d0eb3ba0e51b57b9364 /winsup/cygwin | |
parent | 8b2547826762b748ad5b2bbe4089c422c7cd312a (diff) | |
download | newlib-b9aa81491f62f6053bb648f20143ba9e68051622.zip newlib-b9aa81491f62f6053bb648f20143ba9e68051622.tar.gz newlib-b9aa81491f62f6053bb648f20143ba9e68051622.tar.bz2 |
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.
Diffstat (limited to 'winsup/cygwin')
42 files changed, 224 insertions, 188 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7477010..a66c13a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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> * fhandler.cc (fhandler_base::open): Fix comment a bit more. diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index 34777b9..10de6af 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -257,7 +257,7 @@ closedir (DIR *dir) if (dir->__d_cookie != __DIRENT_COOKIE) { set_errno (EBADF); - syscall_printf ("-1 = closedir (%p)", dir); + syscall_printf ("%R = closedir(%p)", -1, dir); return -1; } @@ -271,7 +271,7 @@ closedir (DIR *dir) free (dir->__d_dirname); free (dir->__d_dirent); free (dir); - syscall_printf ("%d = closedir (%p)", res); + syscall_printf ("%R = closedir(%p)", res); return res; } @@ -320,7 +320,7 @@ mkdir (const char *dir, mode_t mode) delete fh; done: - syscall_printf ("%d = mkdir (%s, %d)", res, dir, mode); + syscall_printf ("%R = mkdir(%s, %d)", res, dir, mode); return res; } @@ -353,6 +353,6 @@ rmdir (const char *dir) delete fh; done: - syscall_printf ("%d = rmdir (%s)", res, dir); + syscall_printf ("%R = rmdir(%s)", res, dir); return res; } diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index f8fbbd2..4da3a90 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -757,7 +757,7 @@ dtable::dup3 (int oldfd, int newfd, int flags) done: MALLOC_CHECK; 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; } diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc index c936ccd..44d9dc1 100644 --- a/winsup/cygwin/errno.cc +++ b/winsup/cygwin/errno.cc @@ -156,6 +156,7 @@ static NO_COPY struct X (WAIT_NO_CHILDREN, ECHILD), X (WORKING_SET_QUOTA, EAGAIN), X (WRITE_PROTECT, EROFS), + X (PRIVILEGE_NOT_HELD, EPERM), { 0, NULL, 0} }; diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index 84e5e54..9b27f17 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -67,7 +67,7 @@ fcntl64 (int fd, int cmd, ...) break; } 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; } diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index a2f3ba6..6049036 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -707,7 +707,7 @@ done: status, fh, access, pc.get_nt_native_path (), file_attributes, 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); return res; } @@ -1251,7 +1251,7 @@ fhandler_base::ioctl (unsigned int cmd, void *buf) break; } - syscall_printf ("%d = ioctl (%x, %p)", res, cmd, buf); + syscall_printf ("%d = ioctl(%x, %p)", res, cmd, buf); return res; } diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index b277bcf..0e9717b 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -953,7 +953,7 @@ fhandler_console::output_tcsetattr (int, struct termios const *t) int res = SetConsoleMode (get_output_handle (), flags) ? 0 : -1; if (res) __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); return res; } @@ -1015,7 +1015,7 @@ fhandler_console::input_tcsetattr (int, struct termios const *t) res = SetConsoleMode (get_io_handle (), flags) ? 0 : -1; if (res < 0) __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); } @@ -1066,7 +1066,7 @@ fhandler_console::tcgetattr (struct termios *t) /* All the output bits we can ignore */ 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); 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; } diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index e1ed4e1..7f92e8e 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -765,7 +765,7 @@ fhandler_disk_file::fstatvfs (struct statvfs *sfs) out: if (opened) NtClose (fh); - syscall_printf ("%d = fstatvfs (%s, %p)", ret, get_name (), sfs); + syscall_printf ("%d = fstatvfs(%s, %p)", ret, get_name (), sfs); return ret; } @@ -1445,7 +1445,7 @@ fhandler_base::open_fs (int flags, mode_t mode) NtAllocateLocallyUniqueId ((PLUID) &unique_id); 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); return res; } @@ -1583,7 +1583,7 @@ non_atomic: else 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; } @@ -1627,7 +1627,7 @@ non_atomic: if (lseek (curpos, SEEK_SET) < 0) 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; } @@ -2287,7 +2287,7 @@ go_ahead: 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, FileAttributes, de->d_type); return res; @@ -2361,7 +2361,7 @@ fhandler_disk_file::closedir (DIR *dir) __seterrno_from_nt_status (status); res = -1; } - syscall_printf ("%d = closedir (%p, %s)", res, dir, get_name ()); + syscall_printf ("%d = closedir(%p, %s)", res, dir, get_name ()); return res; } diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index fb17a26..fb363e1 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -377,7 +377,7 @@ fhandler_dev_dsp::Audio_out::query (int rate, int bits, int channels) fillFormat (&format, rate, bits, channels); 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); } @@ -404,7 +404,7 @@ fhandler_dev_dsp::Audio_out::start () if (rc == MMSYSERR_NOERROR) 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); } @@ -425,15 +425,15 @@ fhandler_dev_dsp::Audio_out::stop (bool immediately) } rc = waveOutReset (dev_); - debug_printf ("%d = waveOutReset ()", rc); + debug_printf ("%d = waveOutReset()", rc); while (Qisr2app_->recv (&pHdr)) { 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_); - debug_printf ("%d = waveOutClose ()", rc); + debug_printf ("%d = waveOutClose()", rc); Qisr2app_->dellock (); } @@ -564,7 +564,7 @@ fhandler_dev_dsp::Audio_out::waitforspace () /* Errors are ignored here. They will probbaly cause a failure in the subsequent PrepareHeader */ rc = waveOutUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR)); - debug_printf ("%d = waveOutUnprepareHeader (0x%08x)", rc, pHdr); + debug_printf ("%d = waveOutUnprepareHeader(0x%08x)", rc, pHdr); } pHdr_ = pHdr; bufferIndex_ = 0; @@ -599,11 +599,11 @@ fhandler_dev_dsp::Audio_out::sendcurrent () // Send internal buffer out to the soundcard pHdr->dwBufferLength = bufferIndex_; 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) { 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) return true; @@ -752,7 +752,7 @@ fhandler_dev_dsp::Audio_in::query (int rate, int bits, int channels) fillFormat (&format, rate, bits, channels); 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); } @@ -776,7 +776,7 @@ fhandler_dev_dsp::Audio_in::start (int rate, int bits, int channels) fillFormat (&format, rate, bits, channels); rc = waveInOpen (&dev_, WAVE_MAPPER, &format, (DWORD) waveIn_callback, (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) { @@ -800,16 +800,16 @@ fhandler_dev_dsp::Audio_in::stop () we must not call into the wave API from the callback. Otherwise we end up in a deadlock. */ rc = waveInReset (dev_); - debug_printf ("%d = waveInReset ()", rc); + debug_printf ("%d = waveInReset()", rc); while (Qisr2app_->recv (&pHdr)) { 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_); - debug_printf ("%d = waveInClose ()", rc); + debug_printf ("%d = waveInClose()", rc); Qisr2app_->dellock (); } @@ -820,11 +820,11 @@ fhandler_dev_dsp::Audio_in::queueblock (WAVEHDR *pHdr) { MMRESULT rc; 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) { 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) return true; @@ -854,7 +854,7 @@ fhandler_dev_dsp::Audio_in::init (unsigned blockSize) } pHdr_ = NULL; rc = waveInStart (dev_); - debug_printf ("%d = waveInStart (), queued=%d", rc, i); + debug_printf ("%d = waveInStart(), queued=%d", rc, i); return (rc == MMSYSERR_NOERROR); } @@ -944,7 +944,7 @@ fhandler_dev_dsp::Audio_in::waitfordata () /* Errors are ignored here. They will probbaly cause a failure in the subsequent PrepareHeader */ rc = waveInUnprepareHeader (dev_, pHdr, sizeof (WAVEHDR)); - debug_printf ("%d = waveInUnprepareHeader (0x%08x)", rc, pHdr); + debug_printf ("%d = waveInUnprepareHeader(0x%08x)", rc, pHdr); } pHdr_ = pHdr; bufferIndex_ = 0; diff --git a/winsup/cygwin/fhandler_netdrive.cc b/winsup/cygwin/fhandler_netdrive.cc index 18310b9..9b333e7 100644 --- a/winsup/cygwin/fhandler_netdrive.cc +++ b/winsup/cygwin/fhandler_netdrive.cc @@ -254,7 +254,7 @@ fhandler_netdrive::readdir (DIR *dir, dirent *de) res = 0; } out: - syscall_printf ("%d = readdir (%p, %p)", res, dir, de); + syscall_printf ("%d = readdir(%p, %p)", res, dir, de); return res; } @@ -318,7 +318,7 @@ fhandler_netdrive::open (int flags, mode_t mode) set_flags ((flags & ~O_TEXT) | O_BINARY | O_DIROPEN); set_open_status (); 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; } diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 33dfe2d..6291eec 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -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; } @@ -376,7 +376,7 @@ success: set_flags ((flags & ~O_TEXT) | O_BINARY); set_open_status (); 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; } diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 305bb9b..54a5a8b 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -236,7 +236,7 @@ fhandler_process::readdir (DIR *dir, dirent *de) dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; res = 0; 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; } @@ -313,7 +313,7 @@ success: set_flags ((flags & ~O_TEXT) | O_BINARY); set_open_status (); 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; } diff --git a/winsup/cygwin/fhandler_procnet.cc b/winsup/cygwin/fhandler_procnet.cc index cda0a65..836bf33 100644 --- a/winsup/cygwin/fhandler_procnet.cc +++ b/winsup/cygwin/fhandler_procnet.cc @@ -123,7 +123,7 @@ fhandler_procnet::readdir (DIR *dir, dirent *de) dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; res = 0; 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; } @@ -194,7 +194,7 @@ success: set_flags ((flags & ~O_TEXT) | O_BINARY); set_open_status (); 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; } diff --git a/winsup/cygwin/fhandler_procsys.cc b/winsup/cygwin/fhandler_procsys.cc index 943ffec..d1f34fa 100644 --- a/winsup/cygwin/fhandler_procsys.cc +++ b/winsup/cygwin/fhandler_procsys.cc @@ -364,7 +364,7 @@ fhandler_procsys::readdir (DIR *dir, dirent *de) res = 0; } } - syscall_printf ("%d = readdir (%p, %p)", res, dir, de); + syscall_printf ("%d = readdir(%p, %p)", res, dir, de); return res; } @@ -446,7 +446,7 @@ fhandler_procsys::open (int flags, mode_t mode) 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; } diff --git a/winsup/cygwin/fhandler_procsysvipc.cc b/winsup/cygwin/fhandler_procsysvipc.cc index 5812748..fa7c6b7 100644 --- a/winsup/cygwin/fhandler_procsysvipc.cc +++ b/winsup/cygwin/fhandler_procsysvipc.cc @@ -130,7 +130,7 @@ fhandler_procsysvipc::readdir (DIR *dir, dirent *de) dir->__flags |= dirent_saw_dot | dirent_saw_dot_dot; res = 0; 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; } @@ -202,7 +202,7 @@ success: set_flags ((flags & ~O_TEXT) | O_BINARY); set_open_status (); 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; } diff --git a/winsup/cygwin/fhandler_registry.cc b/winsup/cygwin/fhandler_registry.cc index b1b1c2d..50233a8 100644 --- a/winsup/cygwin/fhandler_registry.cc +++ b/winsup/cygwin/fhandler_registry.cc @@ -643,7 +643,7 @@ retry: res = 0; out: - syscall_printf ("%d = readdir (%p, %p)", res, dir, de); + syscall_printf ("%d = readdir(%p, %p)", res, dir, de); return res; } @@ -690,7 +690,7 @@ fhandler_registry::closedir (DIR * dir) res = -1; } } - syscall_printf ("%d = closedir (%p)", res, dir); + syscall_printf ("%d = closedir(%p)", res, dir); return 0; } @@ -833,7 +833,7 @@ success: set_flags ((flags & ~O_TEXT) | O_BINARY); set_open_status (); 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; } diff --git a/winsup/cygwin/fhandler_serial.cc b/winsup/cygwin/fhandler_serial.cc index f4be479..90494b8 100644 --- a/winsup/cygwin/fhandler_serial.cc +++ b/winsup/cygwin/fhandler_serial.cc @@ -557,7 +557,7 @@ fhandler_serial::ioctl (unsigned int cmd, void *buf) break; } - termios_printf ("%d = ioctl (%p, %p)", res, cmd, buf); + termios_printf ("%d = ioctl(%p, %p)", res, cmd, buf); # undef ibuf # undef ipbuf return res; diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 4d8673a..fff1083 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1020,7 +1020,7 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen) int ret = ::setsockopt (get_socket (), SOL_SOCKET, ~(SO_REUSEADDR), (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)) set_winsock_errno (); @@ -1998,7 +1998,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p) res = ioctlsocket (get_socket (), cmd, (unsigned long *) p); break; } - syscall_printf ("%d = ioctl_socket (%x, %x)", res, cmd, p); + syscall_printf ("%d = ioctl_socket(%x, %x)", res, cmd, p); return res; } diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 4b0538f..6b7ad80 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -1033,7 +1033,7 @@ fhandler_pty_slave::ioctl (unsigned int cmd, void *arg) } out: - termios_printf ("%d = ioctl (%x)", retval, cmd); + termios_printf ("%d = ioctl(%x)", retval, cmd); return retval; } @@ -1679,7 +1679,7 @@ fhandler_pty_master::setup () errstr = "pty master control pipe"; goto err; } - master_thread = new cygthread (::pty_master_thread, this, "pty_master"); + master_thread = new cygthread (::pty_master_thread, this, "ptym"); if (!master_thread) { errstr = "pty master control thread"; diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc index 940b8b7..d88cb41 100644 --- a/winsup/cygwin/flock.cc +++ b/winsup/cygwin/flock.cc @@ -1520,7 +1520,7 @@ flock (int fd, int operation) if ((res == -1) && ((get_errno () == EAGAIN) || (get_errno () == EACCES))) set_errno (EWOULDBLOCK); done: - syscall_printf ("%d = flock (%d, %d)", res, fd, operation); + syscall_printf ("%R = flock(%d, %d)", res, fd, operation); return res; } @@ -1576,6 +1576,6 @@ lockf (int filedes, int function, _off64_t size) } res = cfd->lock (cmd, &fl); 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; } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index a2728ce..b1347b8 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -685,7 +685,7 @@ fork () set_errno (grouped.this_errno); } - syscall_printf ("%d = fork()", res); + syscall_printf ("%R = fork()", res); return res; } #ifdef DEBUGGING diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 182732f..48efdb1 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -456,7 +456,7 @@ initgroups32 (const char *user, __gid32_t gid) new_gsids.count (tmp_gsids.count ()); 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; } @@ -497,7 +497,7 @@ getgrouplist (const char *user, gid_t gid, gid_t *groups, int *ngroups) ret = -1; *ngroups = cnt; } - syscall_printf ( "%d = getgrouplist (%s, %u, %p, %d)", + syscall_printf ( "%d = getgrouplist(%s, %u, %p, %d)", ret, user, gid, groups, *ngroups); return ret; } diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 7cc44fd..afbeb7a 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1244,7 +1244,7 @@ msync (void *addr, size_t len, int flags) out: LIST_UNLOCK (); - syscall_printf ("%d = msync()", ret); + syscall_printf ("%R = msync()", ret); return ret; } @@ -1337,7 +1337,7 @@ mprotect (void *addr, size_t len, int prot) out: - syscall_printf ("%d = mprotect ()", ret ? 0 : -1); + syscall_printf ("%R = mprotect ()", ret ? 0 : -1); return ret ? 0 : -1; } diff --git a/winsup/cygwin/mount.cc b/winsup/cygwin/mount.cc index b0fe6ee..8955925 100644 --- a/winsup/cygwin/mount.cc +++ b/winsup/cygwin/mount.cc @@ -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); 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; } @@ -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); } - 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; } @@ -1836,7 +1836,7 @@ cygwin_umount (const char *path, unsigned flags) if (!(flags & MOUNT_CYGDRIVE)) 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; } diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 7f41680..785e71a 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -661,7 +661,7 @@ cygwin_socket (int af, int type, int protocol) } done: - syscall_printf ("%d = socket (%d, %d (flags %p), %d)", + syscall_printf ("%R = socket(%d, %d (flags %p), %d)", res, af, type, flags, protocol); return res; } @@ -681,7 +681,7 @@ cygwin_sendto (int fd, const void *buf, size_t len, int flags, else 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); return res; } @@ -701,7 +701,7 @@ cygwin_recvfrom (int fd, void *buf, size_t len, int flags, else if ((res = len) != 0) 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); 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); 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); return res; } @@ -904,7 +904,7 @@ cygwin_connect (int fd, const struct sockaddr *name, socklen_t namelen) else 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; } @@ -1280,7 +1280,7 @@ cygwin_accept (int fd, struct sockaddr *peer, socklen_t *len) else 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; } @@ -1302,7 +1302,7 @@ accept4 (int fd, struct sockaddr *peer, socklen_t *len, int flags) else 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; } @@ -1319,7 +1319,7 @@ cygwin_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen) else 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; } @@ -1337,7 +1337,7 @@ cygwin_getsockname (int fd, struct sockaddr *addr, socklen_t *namelen) else 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; } @@ -1353,7 +1353,7 @@ cygwin_listen (int fd, int backlog) else res = fh->listen (backlog); - syscall_printf ("%d = listen (%d, %d)", res, fd, backlog); + syscall_printf ("%R = listen(%d, %d)", res, fd, backlog); return res; } @@ -1370,7 +1370,7 @@ cygwin_shutdown (int fd, int how) else res = fh->shutdown (how); - syscall_printf ("%d = shutdown (%d, %d)", res, fd, how); + syscall_printf ("%R = shutdown(%d, %d)", res, fd, how); return res; } @@ -1436,7 +1436,7 @@ cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len) else 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; } @@ -1454,7 +1454,7 @@ cygwin_recv (int fd, void *buf, size_t len, int flags) else if ((res = len) != 0) 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; } @@ -1472,7 +1472,7 @@ cygwin_send (int fd, const void *buf, size_t len, int flags) else 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; } @@ -2782,7 +2782,7 @@ socketpair (int family, int type, int protocol, int *sb) } done: - syscall_printf ("%d = socketpair (...)", res); + syscall_printf ("%R = socketpair(...)", res); return res; } @@ -2816,7 +2816,7 @@ cygwin_recvmsg (int fd, struct msghdr *msg, int 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; } @@ -2838,7 +2838,7 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int 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; } diff --git a/winsup/cygwin/ntea.cc b/winsup/cygwin/ntea.cc index f12c90f..b14f704 100644 --- a/winsup/cygwin/ntea.cc +++ b/winsup/cygwin/ntea.cc @@ -210,7 +210,7 @@ read_ea (HANDLE hdl, path_conv &pc, const char *name, char *value, size_t size) out: if (!hdl) 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); return ret; } @@ -344,7 +344,7 @@ write_ea (HANDLE hdl, path_conv &pc, const char *name, const char *value, out: if (!hdl) 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); return ret; } diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 4b15419..56b2194 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1739,7 +1739,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, NtClose (fh); 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); if (has_trailing_dirsep) free ((void *) newpath); @@ -2714,7 +2714,7 @@ restart: NtClose (h); } - syscall_printf ("%d = symlink.check (%s, %p) (%p)", + syscall_printf ("%d = symlink.check(%s, %p) (%p)", res, suffix.path, contents, pflags); 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 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 ()); MALLOC_CHECK; return res; @@ -2906,7 +2906,7 @@ fchdir (int fd) else res = -1; - syscall_printf ("%d = fchdir (%d)", res, fd); + syscall_printf ("%R = fchdir(%d)", res, fd); return res; } diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 11ba794..6cbba6a 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -348,7 +348,7 @@ fhandler_pipe::create (fhandler_pipe *fhs[2], unsigned psize, int mode) 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; } diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 3d436b4..aaa6913 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -108,7 +108,7 @@ getrusage (int intwho, struct rusage *rusage_in) res = -1; } - syscall_printf ("%d = getrusage (%d, %p)", res, intwho, rusage_in); + syscall_printf ("%R = getrusage(%d, %p)", res, intwho, rusage_in); return res; } diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index 3499476..b2fd3f4 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -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); 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; } @@ -462,7 +462,7 @@ acl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp) res = fh->facl (cmd, nentries, aclbufp); delete fh; - syscall_printf ("%d = acl (%s)", res, path); + syscall_printf ("%R = acl(%s)", res, path); return res; } @@ -484,7 +484,7 @@ facl32 (int fd, int cmd, int nentries, __aclent32_t *aclbufp) return -1; } 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; } diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc index 545f7d3..d4261ff 100644 --- a/winsup/cygwin/sec_auth.cc +++ b/winsup/cygwin/sec_auth.cc @@ -169,7 +169,7 @@ cygwin_logon_user (const struct passwd *pw, const char *password) hToken = INVALID_HANDLE_VALUE; } 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; } diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index d72c66b..e89f701 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -434,7 +434,7 @@ set_privilege (HANDLE token, DWORD privilege, bool enable) out: 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); return ret; } diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index fafa1f8..3afd2b4 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -968,7 +968,7 @@ set_file_attribute (HANDLE handle, path_conv &pc, } else 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); return ret; } diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index d92642b..4e68041 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -654,7 +654,7 @@ start_thread_pipe (select_record *me, select_stuff *stuff) { pi->start = &stuff->start; 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; if (!me->h) return 0; @@ -1138,7 +1138,7 @@ start_thread_serial (select_record *me, select_stuff *stuff) select_serial_info *si = new select_serial_info; si->start = &stuff->start; 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; stuff->device_specific_serial = si; } @@ -1407,7 +1407,7 @@ start_thread_socket (select_record *me, select_stuff *stuff) stuff->device_specific_socket = si; si->start = &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; return 1; } @@ -1645,7 +1645,7 @@ start_thread_mailslot (select_record *me, select_stuff *stuff) select_mailslot_info *mi = new select_mailslot_info; mi->start = &stuff->start; 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; if (!me->h) return 0; diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 9b45fee..8a475c1 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -154,7 +154,7 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, 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, rmtp ? rmtp->tv_sec : 0, rmtp ? rmtp->tv_nsec : 0); return res; @@ -376,7 +376,7 @@ kill_pgrp (pid_t pid, siginfo_t& si) set_errno (ESRCH); 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; } diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 38aa1cf..eef082f 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -1241,7 +1241,7 @@ talktome (siginfo_t *si) pinfo pi (si->si_pid); if (pi) - new cygthread (commune_process, size, si, "commune_process"); + new cygthread (commune_process, size, si, "commune"); } void diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 8ff0ac0..9e59cc7 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -73,6 +73,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) DWORD err = GetLastError (); + long Rval = 0; while (*fmt) { int i, n = 0x7fff; @@ -146,8 +147,14 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) strcpy (dst, "Win32 error "); dst = __rn (dst + sizeof ("Win32 error"), 10, 0, err, len, pad, LMASK); break; + case 'R': 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; case 'D': 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; SetLastError (err); return dst - orig; diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 6fd7fbe..75bde2a 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -707,7 +707,7 @@ loop: cygpid = myself->pid; /* 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); /* Name the handle similarly to proc_subproc. */ diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8ca0b0e..3a0681d 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -137,10 +137,10 @@ dup2 (int oldfd, int newfd) cygheap_fdget cfd (oldfd); 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; } - 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 cygheap->fdtab.dup3 (oldfd, newfd, 0); @@ -934,7 +934,7 @@ unlink (const char *ourname) __seterrno_from_nt_status (status); done: - syscall_printf ("%d = unlink (%s)", res, ourname); + syscall_printf ("%R = unlink(%s)", res, ourname); return res; } @@ -946,7 +946,7 @@ _remove_r (struct _reent *, const char *ourname) if (win32_name.error) { set_errno (win32_name.error); - syscall_printf ("-1 = remove (%s)", ourname); + syscall_printf ("%R = remove(%s)",-1, ourname); return -1; } @@ -1074,8 +1074,7 @@ read (int fd, void *ptr, size_t len) cfd->read (ptr, res = len); done: - syscall_printf ("%d = read (%d, %p, %d), errno %d", res, fd, ptr, len, - get_errno ()); + syscall_printf ("%R = read(%d, %p, %d)", res, fd, ptr, len); MALLOC_CHECK; 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); done: - syscall_printf ("%d = readv (%d, %p, %d), errno %d", res, fd, iov, iovcnt, - get_errno ()); + syscall_printf ("%R = readv(%d, %p, %d)", res, fd, iov, iovcnt); MALLOC_CHECK; return res; } @@ -1137,8 +1135,7 @@ pread (int fd, void *ptr, size_t len, _off64_t off) else res = cfd->pread (ptr, len, off); - syscall_printf ("%d = pread (%d, %p, %d, %d), errno %d", - res, fd, ptr, len, off, get_errno ()); + syscall_printf ("%R = pread(%d, %p, %d, %d)", res, fd, ptr, len, off); return res; } @@ -1173,11 +1170,9 @@ write (int fd, const void *ptr, size_t len) done: if (fd == 1 || fd == 2) - paranoid_printf ("%d = write (%d, %p, %d), errno %d", - res, fd, ptr, len, get_errno ()); + paranoid_printf ("%R = write(%d, %p, %d)", res, fd, ptr, len); else - syscall_printf ("%d = write (%d, %p, %d), errno %d", - res, fd, ptr, len, get_errno ()); + syscall_printf ("%R = write(%d, %p, %d)", res, fd, ptr, len); MALLOC_CHECK; return res; @@ -1223,11 +1218,9 @@ writev (const int fd, const struct iovec *const iov, const int iovcnt) done: if (fd == 1 || fd == 2) - paranoid_printf ("%d = writev (%d, %p, %d), errno %d", - res, fd, iov, iovcnt, get_errno ()); + paranoid_printf ("%R = writev(%d, %p, %d)", res, fd, iov, iovcnt); else - syscall_printf ("%d = writev (%d, %p, %d), errno %d", - res, fd, iov, iovcnt, get_errno ()); + syscall_printf ("%R = writev(%d, %p, %d)", res, fd, iov, iovcnt); MALLOC_CHECK; return res; @@ -1245,8 +1238,7 @@ pwrite (int fd, void *ptr, size_t len, _off64_t off) else res = cfd->pwrite (ptr, len, off); - syscall_printf ("%d = pwrite (%d, %p, %d, %d), errno %d", - res, fd, ptr, len, off, get_errno ()); + syscall_printf ("%R = pwrite(%d, %p, %d, %d)", res, fd, ptr, len, off); 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; } @@ -1387,7 +1379,7 @@ close (int fd) cfd.release (); } - syscall_printf ("%d = close (%d)", res, fd); + syscall_printf ("%R = close(%d)", res, fd); MALLOC_CHECK; return res; } @@ -1404,7 +1396,7 @@ isatty (int fd) res = 0; else res = cfd->is_tty (); - syscall_printf ("%d = isatty (%d)", res, fd); + syscall_printf ("%R = isatty(%d)", res, fd); return res; } EXPORT_ALIAS (isatty, _isatty) @@ -1433,7 +1425,7 @@ link (const char *oldpath, const char *newpath) delete fh; error: - syscall_printf ("%d = link (%s, %s)", res, oldpath, newpath); + syscall_printf ("%R = link(%s, %s)", res, oldpath, newpath); return res; } @@ -1461,7 +1453,7 @@ chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid) delete fh; error: - syscall_printf ("%d = %schown (%s,...)", + syscall_printf ("%R = %schown(%s,...)", res, (fmode & PC_SYM_NOFOLLOW) ? "l" : "", name); return res; } @@ -1504,7 +1496,7 @@ fchown32 (int fd, __uid32_t uid, __gid32_t 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; } @@ -1553,7 +1545,7 @@ chmod (const char *path, mode_t mode) delete fh; error: - syscall_printf ("%d = chmod (%s, %p)", res, path, mode); + syscall_printf ("%R = chmod(%s, %p)", res, path, mode); 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; } @@ -1764,7 +1756,7 @@ stat_worker (path_conv &pc, struct __stat64 *buf) error: 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; } @@ -2397,7 +2389,7 @@ out: NtClose (fh); if (wincap.has_transactions () && 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; } @@ -2674,7 +2666,7 @@ posix_fadvise (int fd, _off64_t offset, _off64_t len, int advice) res = cfd->fadvise (offset, len, advice); else 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); return res; } @@ -2693,7 +2685,7 @@ posix_fallocate (int fd, _off64_t offset, _off64_t len) else 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; } @@ -2706,7 +2698,7 @@ ftruncate64 (int fd, _off64_t length) res = cfd->ftruncate (length, true); else set_errno (EBADF); - syscall_printf ("%d = ftruncate (%d, %D)", res, fd, length); + syscall_printf ("%R = ftruncate(%d, %D)", res, fd, length); return res; } @@ -2731,7 +2723,7 @@ truncate64 (const char *pathname, _off64_t length) res = ftruncate64 (fd, length); close (fd); } - syscall_printf ("%d = truncate (%s, %D)", res, pathname, length); + syscall_printf ("%R = truncate(%s, %D)", res, pathname, length); return res; } @@ -2754,7 +2746,7 @@ get_osfhandle (int fd) else res = -1; - syscall_printf ("%d = get_osfhandle (%d)", res, fd); + syscall_printf ("%R = get_osfhandle(%d)", res, fd); return res; } @@ -2800,7 +2792,7 @@ statvfs (const char *name, struct statvfs *sfs) delete fh; error: MALLOC_CHECK; - syscall_printf ("%d = (%s, %p)", res, name, sfs); + syscall_printf ("%R = statvfs(%s,%p)", res, name, sfs); return res; } @@ -3402,8 +3394,7 @@ chroot (const char *newroot) ret = 0; } - syscall_printf ("%d = chroot (%s)", ret ? get_errno () : 0, - newroot ? newroot : "NULL"); + syscall_printf ("%R = chroot(%s)", ret, newroot ?: "NULL"); return ret; } diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index b95dca0..3096513 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -40,7 +40,7 @@ tcsendbreak (int fd, int duration) res = cfd->tcsendbreak (duration); out: - syscall_printf ("%d = tcsendbreak (%d, %d)", res, fd, duration); + syscall_printf ("%R = tcsendbreak(%d, %d)", res, fd, duration); return res; } @@ -64,7 +64,7 @@ tcdrain (int fd) res = cfd->tcdrain (); out: - syscall_printf ("%d = tcdrain (%d)", res, fd); + syscall_printf ("%R = tcdrain(%d)", res, fd); return res; } @@ -86,7 +86,7 @@ tcflush (int fd, int queue) res = cfd->tcflush (queue); out: - termios_printf ("%d = tcflush (%d, %d)", res, fd, queue); + termios_printf ("%R = tcflush(%d, %d)", res, fd, queue); return res; } @@ -106,7 +106,7 @@ tcflow (int fd, int action) res = cfd->tcflow (action); out: - syscall_printf ("%d = tcflow (%d, %d)", res, fd, action); + syscall_printf ("%R = tcflow(%d, %d)", res, fd, action); 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", t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN], 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; } @@ -182,7 +182,7 @@ tcgetattr (int fd, struct termios *in_t) __toapp_termios (in_t, t); if (res) - termios_printf ("%d = tcgetattr (%d, %p)", res, fd, in_t); + termios_printf ("%R = tcgetattr(%d, %p)", res, fd, in_t); else 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], @@ -203,7 +203,7 @@ tcgetpgrp (int fd) else res = cfd->tcgetpgrp (); - termios_printf ("%d = tcgetpgrp (%d)", res, fd); + termios_printf ("%R = tcgetpgrp(%d)", res, fd); return res; } @@ -218,7 +218,7 @@ tcgetsid (int fd) else res = cfd->tcgetsid (); - termios_printf ("%d = tcgetsid (%d)", res, fd); + termios_printf ("%R = tcgetsid(%d)", res, fd); return res; } @@ -236,7 +236,7 @@ tcsetpgrp (int fd, pid_t pgid) else res = cfd->tcsetpgrp (pgid); - termios_printf ("%d = tcsetpgrp (%d, %d)", res, fd, pgid); + termios_printf ("%R = tcsetpgrp(%d, %d)", res, fd, pgid); return res; } diff --git a/winsup/cygwin/timer.cc b/winsup/cygwin/timer.cc index 79e8966..f24ddbc 100644 --- a/winsup/cygwin/timer.cc +++ b/winsup/cygwin/timer.cc @@ -377,26 +377,31 @@ fixup_timers_after_fork () extern "C" int setitimer (int which, const struct itimerval *value, struct itimerval *ovalue) { + int ret; if (which != ITIMER_REAL) { set_errno (EINVAL); - return -1; + ret = -1; } - struct itimerspec spec_value, spec_ovalue; - int ret; - 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_value.tv_sec = value->it_value.tv_sec; - spec_value.it_value.tv_nsec = value->it_value.tv_usec * 1000; - ret = timer_settime ((timer_t) &ttstart, 0, &spec_value, &spec_ovalue); - if (!ret && ovalue) + else { - 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_value.tv_sec = spec_ovalue.it_value.tv_sec; - ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000; + struct itimerspec spec_value, spec_ovalue; + 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_value.tv_sec = value->it_value.tv_sec; + spec_value.it_value.tv_nsec = value->it_value.tv_usec * 1000; + ret = timer_settime ((timer_t) &ttstart, 0, &spec_value, &spec_ovalue); + if (ret) + ret = -1; + else if (ovalue) + { + 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_value.tv_sec = spec_ovalue.it_value.tv_sec; + ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000; + } } - syscall_printf ("%d = setitimer ()", ret); + syscall_printf ("%R = setitimer()", ret); return ret; } @@ -404,24 +409,33 @@ setitimer (int which, const struct itimerval *value, struct itimerval *ovalue) extern "C" int getitimer (int which, struct itimerval *ovalue) { + int ret; if (which != ITIMER_REAL) { set_errno (EINVAL); - return -1; + ret = -1; } - myfault efault; - if (efault.faulted (EFAULT)) - return -1; - struct itimerspec spec_ovalue; - int ret = timer_gettime ((timer_t) &ttstart, &spec_ovalue); - if (!ret) + else { - 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_value.tv_sec = spec_ovalue.it_value.tv_sec; - ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000; + myfault efault; + if (efault.faulted (EFAULT)) + ret = -1; + else + { + struct itimerspec spec_ovalue; + int ret = timer_gettime ((timer_t) &ttstart, &spec_ovalue); + if (ret) + ret = -1; + else + { + 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_value.tv_sec = spec_ovalue.it_value.tv_sec; + ovalue->it_value.tv_usec = spec_ovalue.it_value.tv_nsec / 1000; + } + } } - syscall_printf ("%d = getitimer ()", ret); + syscall_printf ("%R = getitimer()", ret); return ret; } @@ -437,7 +451,7 @@ alarm (unsigned int seconds) newt.it_value.tv_sec = seconds; timer_settime ((timer_t) &ttstart, 0, &newt, &oldt); 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; } @@ -459,6 +473,6 @@ ualarm (useconds_t value, useconds_t interval) } timer_settime ((timer_t) &ttstart, 0, &timer, &otimer); 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; } diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 34ec1d3..3fdab13 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -130,11 +130,10 @@ settimeofday (const struct timeval *tv, const struct timezone *tz) res = -!SetSystemTime (&st); gtod.reset (); - syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz); - - if (res != 0) + if (res) set_errno (EPERM); + syscall_printf ("%R = settimeofday(%x, %x)", res, tv, tz); return res; } @@ -332,7 +331,7 @@ time (time_t * ptr) if (ptr) *ptr = res; - syscall_printf ("%d = time (%x)", res, ptr); + syscall_printf ("%d = time(%x)", res, ptr); return res; } @@ -380,8 +379,7 @@ utimens_worker (path_conv &win32, const struct timespec *tvp) } error: - syscall_printf ("%d = utimes (%S, %p)", - res, win32.get_nt_native_path (), tvp); + syscall_printf ("%R = utimes(%S, %p)", res, win32.get_nt_native_path (), tvp); return res; } @@ -416,7 +414,7 @@ futimens (int fd, const struct timespec *tvp) res = cfd->utimens (tvp); else 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; } |