* Throughout, fix format specifiers in debug statements to accommodate
x86_64.
This commit is contained in:
		| @@ -1,3 +1,8 @@ | |||||||
|  | 2014-03-12  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* Throughout, fix format specifiers in debug statements to accommodate | ||||||
|  | 	x86_64. | ||||||
|  |  | ||||||
| 2014-03-06  Corinna Vinschen  <corinna@vinschen.de> | 2014-03-06  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
| 	* setpwd.cc (client_request_setpwd::serve): Use RtlSecureZeroMemory to | 	* setpwd.cc (client_request_setpwd::serve): Use RtlSecureZeroMemory to | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* bsd_helper.cc | /* bsd_helper.cc | ||||||
|  |  | ||||||
|    Copyright 2003, 2004, 2005, 2007, 2012 Red Hat Inc. |    Copyright 2003, 2004, 2005, 2007, 2012, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
| This file is part of Cygwin. | This file is part of Cygwin. | ||||||
|  |  | ||||||
| @@ -200,7 +200,7 @@ ipcexit_creat_hookthread (struct thread *td) | |||||||
| 			GetCurrentProcess (), &shs->process_hdl, | 			GetCurrentProcess (), &shs->process_hdl, | ||||||
| 			0, FALSE, DUPLICATE_SAME_ACCESS)) | 			0, FALSE, DUPLICATE_SAME_ACCESS)) | ||||||
|     { |     { | ||||||
|       log (LOG_CRIT, "failed to duplicate process handle, error = %lu", |       log (LOG_CRIT, "failed to duplicate process handle, error = %u", | ||||||
| 		      GetLastError ()); | 		      GetLastError ()); | ||||||
|       return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, |       return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, | ||||||
| 			      GetLastError (), ENOMEM); | 			      GetLastError (), ENOMEM); | ||||||
| @@ -209,7 +209,7 @@ ipcexit_creat_hookthread (struct thread *td) | |||||||
|   HANDLE thread = CreateThread (NULL, 0, ipcexit_hookthread, shs, 0, &tid); |   HANDLE thread = CreateThread (NULL, 0, ipcexit_hookthread, shs, 0, &tid); | ||||||
|   if (!thread) |   if (!thread) | ||||||
|     { |     { | ||||||
|       log (LOG_CRIT, "failed to create thread, error = %lu", GetLastError ()); |       log (LOG_CRIT, "failed to create thread, error = %u", GetLastError ()); | ||||||
|       return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, |       return cygwin_internal (CW_GET_ERRNO_FROM_WINERROR, | ||||||
| 			      GetLastError (), ENOMEM); | 			      GetLastError (), ENOMEM); | ||||||
|     } |     } | ||||||
| @@ -235,7 +235,7 @@ init_admin_sid (void) | |||||||
|   SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY}; |   SID_IDENTIFIER_AUTHORITY nt_auth = {SECURITY_NT_AUTHORITY}; | ||||||
|   if (! AllocateAndInitializeSid (&nt_auth, 2, 32, 544, 0, 0, 0, 0, 0, 0, |   if (! AllocateAndInitializeSid (&nt_auth, 2, 32, 544, 0, 0, 0, 0, 0, 0, | ||||||
| 				  &admininstrator_group_sid)) | 				  &admininstrator_group_sid)) | ||||||
|     panic ("failed to create well known sids, error = %lu", |     panic ("failed to create well known sids, error = %u", | ||||||
| 	   GetLastError ()); | 	   GetLastError ()); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -451,7 +451,7 @@ _vm_pager_allocate (int size, int shmflg) | |||||||
|   vm_object_t object = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_all_nih, |   vm_object_t object = CreateFileMapping (INVALID_HANDLE_VALUE, &sec_all_nih, | ||||||
| 					  PAGE_READWRITE, 0, size, NULL); | 					  PAGE_READWRITE, 0, size, NULL); | ||||||
|   if (!object) |   if (!object) | ||||||
|     panic ("CreateFileMapping in _vm_pager_allocate failed, %lu", GetLastError ()); |     panic ("CreateFileMapping in _vm_pager_allocate failed, %u", GetLastError ()); | ||||||
|   return object; |   return object; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -462,7 +462,7 @@ vm_object_duplicate (struct thread *td, vm_object_t object) | |||||||
|   if (!DuplicateHandle (GetCurrentProcess (), object, |   if (!DuplicateHandle (GetCurrentProcess (), object, | ||||||
| 		        td->client->handle (), &dup_object, | 		        td->client->handle (), &dup_object, | ||||||
| 		        0, TRUE, DUPLICATE_SAME_ACCESS)) | 		        0, TRUE, DUPLICATE_SAME_ACCESS)) | ||||||
|     panic ("!DuplicateHandle in vm_object_duplicate failed, %lu", GetLastError ()); |     panic ("!DuplicateHandle in vm_object_duplicate failed, %u", GetLastError ()); | ||||||
|   return dup_object; |   return dup_object; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -668,7 +668,7 @@ tunable_int_fetch (const char *name, int32_t *tunable_target) | |||||||
|   if (!s->value.ival)		/* Not set in config file */ |   if (!s->value.ival)		/* Not set in config file */ | ||||||
|     return; |     return; | ||||||
|   *tunable_target = s->value.ival; |   *tunable_target = s->value.ival; | ||||||
|   debug ("\nSet %s to %lu\n", name, *tunable_target); |   debug ("\nSet %s to %u\n", name, *tunable_target); | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* bsd_mutex.cc | /* bsd_mutex.cc | ||||||
|  |  | ||||||
|    Copyright 2003, 2004, 2005, 2007, 2012 Red Hat Inc. |    Copyright 2003, 2004, 2005, 2007, 2012, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
| This file is part of Cygwin. | This file is part of Cygwin. | ||||||
|  |  | ||||||
| @@ -34,7 +34,7 @@ mtx_init (mtx *m, const char *name, const void *, int) | |||||||
|      unlockable by the lock owner. */ |      unlockable by the lock owner. */ | ||||||
|   m->h = CreateSemaphore (NULL, 1, 1, NULL); |   m->h = CreateSemaphore (NULL, 1, 1, NULL); | ||||||
|   if (!m->h) |   if (!m->h) | ||||||
|     panic ("couldn't allocate %s mutex, %lu\n", name, GetLastError ()); |     panic ("couldn't allocate %s mutex, %u\n", name, GetLastError ()); | ||||||
| } | } | ||||||
|  |  | ||||||
| void | void | ||||||
| @@ -43,7 +43,7 @@ _mtx_lock (mtx *m, DWORD winpid, const char *file, int line) | |||||||
|   _log (file, line, LOG_DEBUG, "Try locking mutex %s (%u) (hold: %u)", |   _log (file, line, LOG_DEBUG, "Try locking mutex %s (%u) (hold: %u)", | ||||||
| 	m->name, winpid, m->owner); | 	m->name, winpid, m->owner); | ||||||
|   if (WaitForSingleObject (m->h, INFINITE) != WAIT_OBJECT_0) |   if (WaitForSingleObject (m->h, INFINITE) != WAIT_OBJECT_0) | ||||||
|     _panic (file, line, "wait for %s in %d failed, %lu", m->name, winpid, |     _panic (file, line, "wait for %s in %d failed, %u", m->name, winpid, | ||||||
| 	    GetLastError ()); | 	    GetLastError ()); | ||||||
|   m->owner = winpid; |   m->owner = winpid; | ||||||
|   _log (file, line, LOG_DEBUG, "Locked      mutex %s/%u (%u)", |   _log (file, line, LOG_DEBUG, "Locked      mutex %s/%u (%u)", | ||||||
| @@ -86,7 +86,7 @@ _mtx_unlock (mtx *m, const char *file, int line) | |||||||
|     { |     { | ||||||
|       /* Check if the semaphore was already on it's max value. */ |       /* Check if the semaphore was already on it's max value. */ | ||||||
|       if (GetLastError () != ERROR_TOO_MANY_POSTS) |       if (GetLastError () != ERROR_TOO_MANY_POSTS) | ||||||
| 	_panic (file, line, "release of mutex %s failed, %lu", m->name, | 	_panic (file, line, "release of mutex %s failed, %u", m->name, | ||||||
| 		GetLastError ()); | 		GetLastError ()); | ||||||
|     } |     } | ||||||
|   _log (file, line, LOG_DEBUG, "Unlocked    mutex %s/%u (owner: %u)", |   _log (file, line, LOG_DEBUG, "Unlocked    mutex %s/%u (owner: %u)", | ||||||
| @@ -141,7 +141,7 @@ set_priority (int priority) | |||||||
|   int old_prio = GetThreadPriority (GetCurrentThread ()); |   int old_prio = GetThreadPriority (GetCurrentThread ()); | ||||||
|   if (!SetThreadPriority (GetCurrentThread (), win_priority (priority))) |   if (!SetThreadPriority (GetCurrentThread (), win_priority (priority))) | ||||||
|     log (LOG_WARNING, |     log (LOG_WARNING, | ||||||
|     	  "Warning: Setting thread priority to %d failed with error %lu\n", |     	  "Warning: Setting thread priority to %d failed with error %u\n", | ||||||
| 	  win_priority (priority), GetLastError ()); | 	  win_priority (priority), GetLastError ()); | ||||||
|   return old_prio; |   return old_prio; | ||||||
| } | } | ||||||
| @@ -201,7 +201,7 @@ class msleep_sync_array | |||||||
|     a[i].ident = ident; |     a[i].ident = ident; | ||||||
|     a[i].wakeup_evt = CreateEvent (NULL, TRUE, FALSE, NULL); |     a[i].wakeup_evt = CreateEvent (NULL, TRUE, FALSE, NULL); | ||||||
|     if (!a[i].wakeup_evt) |     if (!a[i].wakeup_evt) | ||||||
|       panic ("CreateEvent failed: %lu", GetLastError ()); |       panic ("CreateEvent failed: %u", GetLastError ()); | ||||||
|     debug ("i = %d, CreateEvent: %x", i, a[i].wakeup_evt); |     debug ("i = %d, CreateEvent: %x", i, a[i].wakeup_evt); | ||||||
|     a[i].threads = 1; |     a[i].threads = 1; | ||||||
|     ++cnt; |     ++cnt; | ||||||
| @@ -284,7 +284,7 @@ msleep_init (void) | |||||||
|  |  | ||||||
|   msleep_glob_evt = CreateEvent (NULL, TRUE, FALSE, NULL); |   msleep_glob_evt = CreateEvent (NULL, TRUE, FALSE, NULL); | ||||||
|   if (!msleep_glob_evt) |   if (!msleep_glob_evt) | ||||||
|     panic ("CreateEvent in msleep_init failed: %lu", GetLastError ()); |     panic ("CreateEvent in msleep_init failed: %u", GetLastError ()); | ||||||
|   int32_t msgmni = support_msgqueues ? msginfo.msgmni : 0; |   int32_t msgmni = support_msgqueues ? msginfo.msgmni : 0; | ||||||
|   int32_t semmni = support_semaphores ? seminfo.semmni : 0; |   int32_t semmni = support_semaphores ? seminfo.semmni : 0; | ||||||
|   TUNABLE_INT_FETCH ("kern.ipc.msgmni", &msgmni); |   TUNABLE_INT_FETCH ("kern.ipc.msgmni", &msgmni); | ||||||
| @@ -348,8 +348,8 @@ _msleep (void *ident, struct mtx *mtx, int priority, | |||||||
| 	   treat an ERROR_INVALID_HANDLE as a normal process termination and | 	   treat an ERROR_INVALID_HANDLE as a normal process termination and | ||||||
| 	   hope for the best. */ | 	   hope for the best. */ | ||||||
| 	if (GetLastError () != ERROR_INVALID_HANDLE) | 	if (GetLastError () != ERROR_INVALID_HANDLE) | ||||||
| 	  panic ("wait in msleep (%s) failed, %lu", wmesg, GetLastError ()); | 	  panic ("wait in msleep (%s) failed, %u", wmesg, GetLastError ()); | ||||||
| 	debug ("wait in msleep (%s) failed for %d, %lu", wmesg, | 	debug ("wait in msleep (%s) failed for %d, %u", wmesg, | ||||||
| 	       td->td_proc->winpid, GetLastError ()); | 	       td->td_proc->winpid, GetLastError ()); | ||||||
| 	ret = EIDRM; | 	ret = EIDRM; | ||||||
| 	break; | 	break; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* client.cc | /* client.cc | ||||||
|  |  | ||||||
|    Copyright 2001, 2002, 2003, 2004, 2008, 2009, 2012, 2013 Red Hat Inc. |    Copyright 2001, 2002, 2003, 2004, 2008, 2009, 2012, 2013, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
|    Written by Egor Duda <deo@logos-m.ru> |    Written by Egor Duda <deo@logos-m.ru> | ||||||
|  |  | ||||||
| @@ -60,7 +60,7 @@ client_request_get_version::check_version () const | |||||||
|   if (!ok) |   if (!ok) | ||||||
|     syscall_printf (("incompatible version of cygwin server: " |     syscall_printf (("incompatible version of cygwin server: " | ||||||
| 		     "client version %d.%d.%d.%d, " | 		     "client version %d.%d.%d.%d, " | ||||||
| 		     "server version %ld.%ld.%ld.%ld"), | 		     "server version %d.%d.%d.%d"), | ||||||
| 		    CYGWIN_SERVER_VERSION_MAJOR, | 		    CYGWIN_SERVER_VERSION_MAJOR, | ||||||
| 		    CYGWIN_SERVER_VERSION_API, | 		    CYGWIN_SERVER_VERSION_API, | ||||||
| 		    CYGWIN_SERVER_VERSION_MINOR, | 		    CYGWIN_SERVER_VERSION_MINOR, | ||||||
| @@ -83,8 +83,8 @@ client_request_attach_tty::client_request_attach_tty (DWORD nmaster_pid, | |||||||
|   req.from_master = nfrom_master; |   req.from_master = nfrom_master; | ||||||
|   req.to_master = nto_master; |   req.to_master = nto_master; | ||||||
|  |  | ||||||
|   syscall_printf (("created: pid = %lu, master_pid = %lu, " |   syscall_printf (("created: pid = %u, master_pid = %u, " | ||||||
| 		   "from_master = %lu, to_master = %lu"), | 		   "from_master = %p, to_master = %p"), | ||||||
| 		  req.pid, req.master_pid, req.from_master, req.to_master); | 		  req.pid, req.master_pid, req.from_master, req.to_master); | ||||||
| } | } | ||||||
| #endif /* __INSIDE_CYGWIN__ */ | #endif /* __INSIDE_CYGWIN__ */ | ||||||
| @@ -139,8 +139,8 @@ client_request::send (transport_layer_base * const conn) | |||||||
| 	assert (errno); | 	assert (errno); | ||||||
| 	error_code (errno); | 	error_code (errno); | ||||||
| 	syscall_printf (("request header write failure: " | 	syscall_printf (("request header write failure: " | ||||||
| 			 "only %ld bytes sent of %ld, " | 			 "only %lu bytes sent of %lu, " | ||||||
| 			 "error = %d(%lu)"), | 			 "error = %d(%u)"), | ||||||
| 			count, sizeof (_header), | 			count, sizeof (_header), | ||||||
| 			errno, GetLastError ()); | 			errno, GetLastError ()); | ||||||
| 	return; | 	return; | ||||||
| @@ -156,17 +156,14 @@ client_request::send (transport_layer_base * const conn) | |||||||
| 	  assert (errno); | 	  assert (errno); | ||||||
| 	  error_code (errno); | 	  error_code (errno); | ||||||
| 	  syscall_printf (("request body write failure: " | 	  syscall_printf (("request body write failure: " | ||||||
| 			   "only %ld bytes sent of %ld, " | 			   "only %lu bytes sent of %lu, " | ||||||
| 			   "error = %d(%lu)"), | 			   "error = %d(%u)"), | ||||||
| 			  count, msglen (), | 			  count, msglen (), | ||||||
| 			  errno, GetLastError ()); | 			  errno, GetLastError ()); | ||||||
| 	  return; | 	  return; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   // verbose: syscall_printf ("request sent (%ld + %ld bytes)", |  | ||||||
|   //			      sizeof (_header), msglen ()); |  | ||||||
|  |  | ||||||
|   { |   { | ||||||
|     const ssize_t count = conn->read (&_header, sizeof (_header)); |     const ssize_t count = conn->read (&_header, sizeof (_header)); | ||||||
|  |  | ||||||
| @@ -175,8 +172,8 @@ client_request::send (transport_layer_base * const conn) | |||||||
| 	assert (errno); | 	assert (errno); | ||||||
| 	error_code (errno); | 	error_code (errno); | ||||||
| 	syscall_printf (("reply header read failure: " | 	syscall_printf (("reply header read failure: " | ||||||
| 			 "only %ld bytes received of %ld, " | 			 "only %lu bytes received of %lu, " | ||||||
| 			 "error = %d(%lu)"), | 			 "error = %d(%u)"), | ||||||
| 			count, sizeof (_header), | 			count, sizeof (_header), | ||||||
| 			errno, GetLastError ()); | 			errno, GetLastError ()); | ||||||
| 	return; | 	return; | ||||||
| @@ -185,7 +182,7 @@ client_request::send (transport_layer_base * const conn) | |||||||
|  |  | ||||||
|   if (msglen () && !_buf) |   if (msglen () && !_buf) | ||||||
|     { |     { | ||||||
|       system_printf ("no client buffer for reply body: %ld bytes needed", |       system_printf ("no client buffer for reply body: %lu bytes needed", | ||||||
| 		     msglen ()); | 		     msglen ()); | ||||||
|       error_code (EINVAL); |       error_code (EINVAL); | ||||||
|       return; |       return; | ||||||
| @@ -194,7 +191,7 @@ client_request::send (transport_layer_base * const conn) | |||||||
|   if (msglen () > _buflen) |   if (msglen () > _buflen) | ||||||
|     { |     { | ||||||
|       system_printf (("client buffer too small for reply body: " |       system_printf (("client buffer too small for reply body: " | ||||||
| 		      "have %ld bytes and need %ld"), | 		      "have %lu bytes and need %lu"), | ||||||
| 		     _buflen, msglen ()); | 		     _buflen, msglen ()); | ||||||
|       error_code (EINVAL); |       error_code (EINVAL); | ||||||
|       return; |       return; | ||||||
| @@ -209,16 +206,13 @@ client_request::send (transport_layer_base * const conn) | |||||||
| 	  assert (errno); | 	  assert (errno); | ||||||
| 	  error_code (errno); | 	  error_code (errno); | ||||||
| 	  syscall_printf (("reply body read failure: " | 	  syscall_printf (("reply body read failure: " | ||||||
| 			   "only %ld bytes received of %ld, " | 			   "only %lu bytes received of %lu, " | ||||||
| 			   "error = %d(%lu)"), | 			   "error = %d(%u)"), | ||||||
| 			  count, msglen (), | 			  count, msglen (), | ||||||
| 			  errno, GetLastError ()); | 			  errno, GetLastError ()); | ||||||
| 	  return; | 	  return; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   // verbose: syscall_printf ("reply received (%ld + %ld bytes)", |  | ||||||
|   //			      sizeof (_header), msglen ()); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef __OUTSIDE_CYGWIN__ | #ifdef __OUTSIDE_CYGWIN__ | ||||||
| @@ -258,14 +252,12 @@ client_request::handle_request (transport_layer_base *const conn, | |||||||
|     if (count != sizeof (header)) |     if (count != sizeof (header)) | ||||||
|       { |       { | ||||||
| 	syscall_printf (("request header read failure: " | 	syscall_printf (("request header read failure: " | ||||||
| 			 "only %ld bytes received of %ld, " | 			 "only %lu bytes received of %lu, " | ||||||
| 			 "error = %d(%lu)"), | 			 "error = %d(%u)"), | ||||||
| 			count, sizeof (header), | 			count, sizeof (header), | ||||||
| 			errno, GetLastError ()); | 			errno, GetLastError ()); | ||||||
| 	return; | 	return; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       // verbose: debug_printf ("got header (%ld)", count); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   client_request *req = NULL; |   client_request *req = NULL; | ||||||
| @@ -330,7 +322,7 @@ client_request::handle (transport_layer_base *const conn, | |||||||
| { | { | ||||||
|   if (msglen () && !_buf) |   if (msglen () && !_buf) | ||||||
|     { |     { | ||||||
|       system_printf ("no buffer for request body: %ld bytes needed", |       system_printf ("no buffer for request body: %lu bytes needed", | ||||||
| 		     msglen ()); | 		     msglen ()); | ||||||
|       error_code (EINVAL); |       error_code (EINVAL); | ||||||
|       return; |       return; | ||||||
| @@ -339,7 +331,7 @@ client_request::handle (transport_layer_base *const conn, | |||||||
|   if (msglen () > _buflen) |   if (msglen () > _buflen) | ||||||
|     { |     { | ||||||
|       system_printf (("buffer too small for request body: " |       system_printf (("buffer too small for request body: " | ||||||
| 		      "have %ld bytes and need %ld"), | 		      "have %lu bytes and need %lu"), | ||||||
| 		     _buflen, msglen ()); | 		     _buflen, msglen ()); | ||||||
|       error_code (EINVAL); |       error_code (EINVAL); | ||||||
|       return; |       return; | ||||||
| @@ -354,17 +346,14 @@ client_request::handle (transport_layer_base *const conn, | |||||||
| 	  assert (errno); | 	  assert (errno); | ||||||
| 	  error_code (errno); | 	  error_code (errno); | ||||||
| 	  syscall_printf (("request body read failure: " | 	  syscall_printf (("request body read failure: " | ||||||
| 			   "only %ld bytes received of %ld, " | 			   "only %lu bytes received of %lu, " | ||||||
| 			   "error = %d(%lu)"), | 			   "error = %d(%u)"), | ||||||
| 			  count, msglen (), | 			  count, msglen (), | ||||||
| 			  errno, GetLastError ()); | 			  errno, GetLastError ()); | ||||||
| 	  return; | 	  return; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   // verbose: syscall_printf ("request received (%ld + %ld bytes)", |  | ||||||
|   //			      sizeof (_header), msglen ()); |  | ||||||
|  |  | ||||||
|   error_code (0);		// Overwrites the _header.request_code field. |   error_code (0);		// Overwrites the _header.request_code field. | ||||||
|  |  | ||||||
|   /* |   /* | ||||||
| @@ -381,8 +370,8 @@ client_request::handle (transport_layer_base *const conn, | |||||||
| 	assert (errno); | 	assert (errno); | ||||||
| 	error_code (errno); | 	error_code (errno); | ||||||
| 	syscall_printf (("reply header write failure: " | 	syscall_printf (("reply header write failure: " | ||||||
| 			 "only %ld bytes sent of %ld, " | 			 "only %lu bytes sent of %lu, " | ||||||
| 			 "error = %d(%lu)"), | 			 "error = %d(%u)"), | ||||||
| 			count, sizeof (_header), | 			count, sizeof (_header), | ||||||
| 			errno, GetLastError ()); | 			errno, GetLastError ()); | ||||||
| 	return; | 	return; | ||||||
| @@ -398,16 +387,13 @@ client_request::handle (transport_layer_base *const conn, | |||||||
| 	  assert (errno); | 	  assert (errno); | ||||||
| 	  error_code (errno); | 	  error_code (errno); | ||||||
| 	  syscall_printf (("reply body write failure: " | 	  syscall_printf (("reply body write failure: " | ||||||
| 			   "only %ld bytes sent of %ld, " | 			   "only %lu bytes sent of %lu, " | ||||||
| 			   "error = %d(%lu)"), | 			   "error = %d(%u)"), | ||||||
| 			  count, msglen (), | 			  count, msglen (), | ||||||
| 			  errno, GetLastError ()); | 			  errno, GetLastError ()); | ||||||
| 	  return; | 	  return; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   // verbose: syscall_printf ("reply sent (%ld + %ld bytes)", |  | ||||||
|   //			      sizeof (_header), msglen ()); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| /* The server side implementation of make_request.  Very simple. */ | /* The server side implementation of make_request.  Very simple. */ | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* cygserver.cc | /* cygserver.cc | ||||||
|  |  | ||||||
|    Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2011, 2012 Red Hat Inc. |    Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2011, 2012, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
|    Written by Egor Duda <deo@logos-m.ru> |    Written by Egor Duda <deo@logos-m.ru> | ||||||
|  |  | ||||||
| @@ -180,10 +180,10 @@ client_request_attach_tty::serve (transport_layer_base *const conn, | |||||||
|  |  | ||||||
|   msglen (0);			// Until we fill in some fields. |   msglen (0);			// Until we fill in some fields. | ||||||
|  |  | ||||||
|   debug ("pid %ld:(%p,%p) -> pid %ld", req.master_pid, req.from_master, |   debug ("pid %d:(%p,%p) -> pid %d", req.master_pid, req.from_master, | ||||||
| 				       req.to_master, req.pid); | 				       req.to_master, req.pid); | ||||||
|  |  | ||||||
|   debug ("opening process %ld", req.master_pid); |   debug ("opening process %d", req.master_pid); | ||||||
|  |  | ||||||
|   const HANDLE from_process_handle = |   const HANDLE from_process_handle = | ||||||
|     OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid); |     OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.master_pid); | ||||||
| @@ -195,7 +195,7 @@ client_request_attach_tty::serve (transport_layer_base *const conn, | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   debug ("opening process %ld", req.pid); |   debug ("opening process %d", req.pid); | ||||||
|  |  | ||||||
|   const HANDLE to_process_handle = |   const HANDLE to_process_handle = | ||||||
|     OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.pid); |     OpenProcess (PROCESS_DUP_HANDLE, FALSE, req.pid); | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* process.cc | /* process.cc | ||||||
|  |  | ||||||
|    Copyright 2001, 2002, 2003, 2004, 2005 Red Hat Inc. |    Copyright 2001, 2002, 2003, 2004, 2005, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
|    Written by Robert Collins <rbtcollins@hotmail.com> |    Written by Robert Collins <rbtcollins@hotmail.com> | ||||||
|  |  | ||||||
| @@ -52,16 +52,16 @@ process::process (const pid_t cygpid, const DWORD winpid, HANDLE signal_arrived) | |||||||
|   _hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, winpid); |   _hProcess = OpenProcess (PROCESS_ALL_ACCESS, FALSE, winpid); | ||||||
|   if (!_hProcess) |   if (!_hProcess) | ||||||
|     { |     { | ||||||
|       system_printf ("unable to obtain handle for new cache process %d(%lu)", |       system_printf ("unable to obtain handle for new cache process %d(%u)", | ||||||
| 		     _cygpid, _winpid); | 		     _cygpid, _winpid); | ||||||
|       _hProcess = INVALID_HANDLE_VALUE; |       _hProcess = INVALID_HANDLE_VALUE; | ||||||
|       _exit_status = 0; |       _exit_status = 0; | ||||||
|     } |     } | ||||||
|   else |   else | ||||||
|     debug_printf ("got handle %p for new cache process %d(%lu)", |     debug_printf ("got handle %p for new cache process %d(%u)", | ||||||
| 		  _hProcess, _cygpid, _winpid); | 		  _hProcess, _cygpid, _winpid); | ||||||
|   if (!signal_arrived) |   if (!signal_arrived) | ||||||
|     system_printf ("signal_arrived NULL for process %d(%lu)", |     system_printf ("signal_arrived NULL for process %d(%u)", | ||||||
| 		   _cygpid, _winpid); | 		   _cygpid, _winpid); | ||||||
|   else if (signal_arrived != INVALID_HANDLE_VALUE) |   else if (signal_arrived != INVALID_HANDLE_VALUE) | ||||||
|     { |     { | ||||||
| @@ -69,18 +69,18 @@ process::process (const pid_t cygpid, const DWORD winpid, HANDLE signal_arrived) | |||||||
| 			    GetCurrentProcess (), &_signal_arrived, | 			    GetCurrentProcess (), &_signal_arrived, | ||||||
| 			    0, FALSE, DUPLICATE_SAME_ACCESS)) | 			    0, FALSE, DUPLICATE_SAME_ACCESS)) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("error getting signal_arrived to server (%lu)", | 	  system_printf ("error getting signal_arrived to server (%u)", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  _signal_arrived = INVALID_HANDLE_VALUE; | 	  _signal_arrived = INVALID_HANDLE_VALUE; | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|   InitializeCriticalSection (&_access); |   InitializeCriticalSection (&_access); | ||||||
|   debug ("initialized (%lu)", _cygpid); |   debug ("initialized (%u)", _cygpid); | ||||||
| } | } | ||||||
|  |  | ||||||
| process::~process () | process::~process () | ||||||
| { | { | ||||||
|   debug ("deleting (%lu)", _cygpid); |   debug ("deleting (%u)", _cygpid); | ||||||
|   DeleteCriticalSection (&_access); |   DeleteCriticalSection (&_access); | ||||||
|   if (_signal_arrived && _signal_arrived != INVALID_HANDLE_VALUE) |   if (_signal_arrived && _signal_arrived != INVALID_HANDLE_VALUE) | ||||||
|     CloseHandle (_signal_arrived); |     CloseHandle (_signal_arrived); | ||||||
| @@ -100,7 +100,7 @@ process::check_exit_code () | |||||||
|       && _exit_status == STILL_ACTIVE |       && _exit_status == STILL_ACTIVE | ||||||
|       && !GetExitCodeProcess (_hProcess, &_exit_status)) |       && !GetExitCodeProcess (_hProcess, &_exit_status)) | ||||||
|     { |     { | ||||||
|       system_printf ("failed to retrieve exit code for %d(%lu), error = %lu", |       system_printf ("failed to retrieve exit code for %d(%u), error = %u", | ||||||
| 		     _cygpid, _winpid, GetLastError ()); | 		     _cygpid, _winpid, GetLastError ()); | ||||||
|       _hProcess = INVALID_HANDLE_VALUE; |       _hProcess = INVALID_HANDLE_VALUE; | ||||||
|     } |     } | ||||||
| @@ -218,7 +218,7 @@ process_cache::process_cache (const size_t max_procs, | |||||||
|  |  | ||||||
|   if (!_cache_add_trigger) |   if (!_cache_add_trigger) | ||||||
|     { |     { | ||||||
|       system_printf ("failed to create cache add trigger, error = %lu", |       system_printf ("failed to create cache add trigger, error = %u", | ||||||
| 		     GetLastError ()); | 		     GetLastError ()); | ||||||
|       abort (); |       abort (); | ||||||
|     } |     } | ||||||
| @@ -256,7 +256,7 @@ process_cache::process (const pid_t cygpid, const DWORD winpid, | |||||||
| 	{ | 	{ | ||||||
| 	  LeaveCriticalSection (&_cache_write_access); | 	  LeaveCriticalSection (&_cache_write_access); | ||||||
| 	  system_printf (("process limit (%d processes) reached; " | 	  system_printf (("process limit (%d processes) reached; " | ||||||
| 			  "new connection refused for %d(%lu)"), | 			  "new connection refused for %d(%u)"), | ||||||
| 			 _max_process_count, cygpid, winpid); | 			 _max_process_count, cygpid, winpid); | ||||||
| 	  return NULL; | 	  return NULL; | ||||||
| 	} | 	} | ||||||
| @@ -326,7 +326,7 @@ process_cache::wait_for_processes (const HANDLE interrupt_event) | |||||||
|       rc = WaitForMultipleObjects (count, _wait_array, FALSE, INFINITE); |       rc = WaitForMultipleObjects (count, _wait_array, FALSE, INFINITE); | ||||||
|       if (rc == WAIT_FAILED) |       if (rc == WAIT_FAILED) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("could not wait on the process handles, error = %lu", | 	  system_printf ("could not wait on the process handles, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  abort (); | 	  abort (); | ||||||
| 	} | 	} | ||||||
| @@ -349,7 +349,7 @@ process_cache::wait_for_processes (const HANDLE interrupt_event) | |||||||
|       rc = WaitForMultipleObjects (mcount, main_wait_array, FALSE, INFINITE); |       rc = WaitForMultipleObjects (mcount, main_wait_array, FALSE, INFINITE); | ||||||
|       if (rc == WAIT_FAILED) |       if (rc == WAIT_FAILED) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("could not wait on the process handles, error = %lu", | 	  system_printf ("could not wait on the process handles, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  abort (); | 	  abort (); | ||||||
| 	} | 	} | ||||||
| @@ -358,7 +358,7 @@ process_cache::wait_for_processes (const HANDLE interrupt_event) | |||||||
|       GetExitCodeThread (main_wait_array[rc], &rc); |       GetExitCodeThread (main_wait_array[rc], &rc); | ||||||
|       if (rc == WAIT_FAILED) |       if (rc == WAIT_FAILED) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("could not wait on the process handles, error = %lu", | 	  system_printf ("could not wait on the process handles, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  abort (); | 	  abort (); | ||||||
| 	} | 	} | ||||||
| @@ -453,7 +453,7 @@ process_cache::check_and_remove_process (const size_t index) | |||||||
|   if (process->check_exit_code () == STILL_ACTIVE) |   if (process->check_exit_code () == STILL_ACTIVE) | ||||||
|     return; |     return; | ||||||
|  |  | ||||||
|   debug_printf ("process %d(%lu) has left the building ($? = %lu)", |   debug_printf ("process %d(%u) has left the building ($? = %u)", | ||||||
| 		process->_cygpid, process->_winpid, process->_exit_status); | 		process->_cygpid, process->_winpid, process->_exit_status); | ||||||
|  |  | ||||||
|   /* Unlink the process object from the process list. */ |   /* Unlink the process object from the process list. */ | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* threaded_queue.cc | /* threaded_queue.cc | ||||||
|  |  | ||||||
|    Copyright 2001, 2002, 2003 Red Hat Inc. |    Copyright 2001, 2002, 2003, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
|    Written by Robert Collins <rbtcollins@hotmail.com> |    Written by Robert Collins <rbtcollins@hotmail.com> | ||||||
|  |  | ||||||
| @@ -55,7 +55,7 @@ threaded_queue::threaded_queue (const size_t initial_workers) | |||||||
|   if (!_requests_sem) |   if (!_requests_sem) | ||||||
|     { |     { | ||||||
|       system_printf (("failed to create the request queue semaphore, " |       system_printf (("failed to create the request queue semaphore, " | ||||||
| 		      "error = %lu"), | 		      "error = %u"), | ||||||
| 		     GetLastError ()); | 		     GetLastError ()); | ||||||
|       abort (); |       abort (); | ||||||
|     } |     } | ||||||
| @@ -145,7 +145,7 @@ threaded_queue::stop () | |||||||
|       while (_workers_count) |       while (_workers_count) | ||||||
| 	{ | 	{ | ||||||
| 	  debug_printf (("waiting for worker threads to terminate: " | 	  debug_printf (("waiting for worker threads to terminate: " | ||||||
| 			 "%lu still running"), | 			 "%u still running"), | ||||||
| 			_workers_count); | 			_workers_count); | ||||||
| 	  Sleep (1000); | 	  Sleep (1000); | ||||||
| 	} | 	} | ||||||
| @@ -228,7 +228,7 @@ threaded_queue::create_workers (const size_t initial_workers) | |||||||
|  |  | ||||||
|       if (!hThread) |       if (!hThread) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("failed to create thread, error = %lu", | 	  system_printf ("failed to create thread, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  abort (); | 	  abort (); | ||||||
| 	} | 	} | ||||||
| @@ -245,7 +245,7 @@ threaded_queue::worker_loop () | |||||||
|       const DWORD rc = WaitForSingleObject (_requests_sem, INFINITE); |       const DWORD rc = WaitForSingleObject (_requests_sem, INFINITE); | ||||||
|       if (rc == WAIT_FAILED) |       if (rc == WAIT_FAILED) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("wait for request semaphore failed, error = %lu", | 	  system_printf ("wait for request semaphore failed, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  return; | 	  return; | ||||||
| 	} | 	} | ||||||
| @@ -297,7 +297,7 @@ queue_submission_loop::queue_submission_loop (threaded_queue *const queue, | |||||||
|  |  | ||||||
|       if (!_interrupt_event) |       if (!_interrupt_event) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("failed to create interrupt event, error = %lu", | 	  system_printf ("failed to create interrupt event, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  abort (); | 	  abort (); | ||||||
| 	} | 	} | ||||||
| @@ -329,7 +329,7 @@ queue_submission_loop::start () | |||||||
|       _hThread = CreateThread (NULL, 0, start_routine, this, 0, &_tid); |       _hThread = CreateThread (NULL, 0, start_routine, this, 0, &_tid); | ||||||
|       if (!_hThread) |       if (!_hThread) | ||||||
| 	{ | 	{ | ||||||
| 	  system_printf ("failed to create thread, error = %lu", | 	  system_printf ("failed to create thread, error = %u", | ||||||
| 			 GetLastError ()); | 			 GetLastError ()); | ||||||
| 	  abort (); | 	  abort (); | ||||||
| 	} | 	} | ||||||
| @@ -359,14 +359,14 @@ queue_submission_loop::stop () | |||||||
|  |  | ||||||
| 	  if (WaitForSingleObject (_hThread, 1000) == WAIT_TIMEOUT) | 	  if (WaitForSingleObject (_hThread, 1000) == WAIT_TIMEOUT) | ||||||
| 	    { | 	    { | ||||||
| 	      system_printf (("request loop thread %lu failed to shutdown " | 	      system_printf (("request loop thread %u failed to shutdown " | ||||||
| 			      "when asked politely: about to get heavy"), | 			      "when asked politely: about to get heavy"), | ||||||
| 			     _tid); | 			     _tid); | ||||||
|  |  | ||||||
| 	      if (!TerminateThread (_hThread, 0)) | 	      if (!TerminateThread (_hThread, 0)) | ||||||
| 		{ | 		{ | ||||||
| 		  system_printf (("failed to kill request loop thread %lu" | 		  system_printf (("failed to kill request loop thread %u" | ||||||
| 				  ", error = %lu"), | 				  ", error = %u"), | ||||||
| 				 _tid, GetLastError ()); | 				 _tid, GetLastError ()); | ||||||
| 		  abort (); | 		  abort (); | ||||||
| 		} | 		} | ||||||
| @@ -378,11 +378,11 @@ queue_submission_loop::stop () | |||||||
| 	  // the submission loop is no longer running and shuts down | 	  // the submission loop is no longer running and shuts down | ||||||
| 	  // voluntarily. | 	  // voluntarily. | ||||||
|  |  | ||||||
| 	  debug_printf ("killing request loop thread %lu", _tid); | 	  debug_printf ("killing request loop thread %u", _tid); | ||||||
|  |  | ||||||
| 	  if (!TerminateThread (_hThread, 0)) | 	  if (!TerminateThread (_hThread, 0)) | ||||||
| 	    system_printf (("failed to kill request loop thread %lu" | 	    system_printf (("failed to kill request loop thread %u" | ||||||
| 			    ", error = %lu"), | 			    ", error = %u"), | ||||||
| 			   _tid, GetLastError ()); | 			   _tid, GetLastError ()); | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* transport_pipes.cc | /* transport_pipes.cc | ||||||
|  |  | ||||||
|    Copyright 2001, 2002, 2003, 2004, 2009, 2012 Red Hat Inc. |    Copyright 2001, 2002, 2003, 2004, 2009, 2012, 2014 Red Hat Inc. | ||||||
|  |  | ||||||
|    Written by Robert Collins <rbtcollins@hotmail.com> |    Written by Robert Collins <rbtcollins@hotmail.com> | ||||||
|  |  | ||||||
| @@ -137,7 +137,7 @@ transport_layer_pipes::accept (bool *const recoverable) | |||||||
|  |  | ||||||
|   if (accept_pipe == INVALID_HANDLE_VALUE) |   if (accept_pipe == INVALID_HANDLE_VALUE) | ||||||
|     { |     { | ||||||
|       debug_printf ("error creating pipe (%lu).", GetLastError ()); |       debug_printf ("error creating pipe (%u).", GetLastError ()); | ||||||
|       *recoverable = true;	// FIXME: case analysis? |       *recoverable = true;	// FIXME: case analysis? | ||||||
|       return NULL; |       return NULL; | ||||||
|     } |     } | ||||||
| @@ -145,7 +145,7 @@ transport_layer_pipes::accept (bool *const recoverable) | |||||||
|   if (!ConnectNamedPipe (accept_pipe, NULL) |   if (!ConnectNamedPipe (accept_pipe, NULL) | ||||||
|       && GetLastError () != ERROR_PIPE_CONNECTED) |       && GetLastError () != ERROR_PIPE_CONNECTED) | ||||||
|     { |     { | ||||||
|       debug_printf ("error connecting to pipe (%lu)", GetLastError ()); |       debug_printf ("error connecting to pipe (%u)", GetLastError ()); | ||||||
|       (void) CloseHandle (accept_pipe); |       (void) CloseHandle (accept_pipe); | ||||||
|       *recoverable = true;	// FIXME: case analysis? |       *recoverable = true;	// FIXME: case analysis? | ||||||
|       return NULL; |       return NULL; | ||||||
| @@ -199,7 +199,7 @@ transport_layer_pipes::read (void *const buf, const size_t len) | |||||||
|   DWORD count; |   DWORD count; | ||||||
|   if (!ReadFile (_hPipe, buf, len, &count, NULL)) |   if (!ReadFile (_hPipe, buf, len, &count, NULL)) | ||||||
|     { |     { | ||||||
|       debug_printf ("error reading from pipe (%lu)", GetLastError ()); |       debug_printf ("error reading from pipe (%u)", GetLastError ()); | ||||||
|       SET_ERRNO (EINVAL);	// FIXME? |       SET_ERRNO (EINVAL);	// FIXME? | ||||||
|       return -1; |       return -1; | ||||||
|     } |     } | ||||||
| @@ -219,7 +219,7 @@ transport_layer_pipes::write (void *const buf, const size_t len) | |||||||
|   DWORD count; |   DWORD count; | ||||||
|   if (!WriteFile (_hPipe, buf, len, &count, NULL)) |   if (!WriteFile (_hPipe, buf, len, &count, NULL)) | ||||||
|     { |     { | ||||||
|       debug_printf ("error writing to pipe, error = %lu", GetLastError ()); |       debug_printf ("error writing to pipe, error = %u", GetLastError ()); | ||||||
|       SET_ERRNO (EINVAL);	// FIXME? |       SET_ERRNO (EINVAL);	// FIXME? | ||||||
|       return -1; |       return -1; | ||||||
|     } |     } | ||||||
| @@ -273,7 +273,7 @@ transport_layer_pipes::connect () | |||||||
|  |  | ||||||
|       if (!assume_cygserver && GetLastError () != ERROR_PIPE_BUSY) |       if (!assume_cygserver && GetLastError () != ERROR_PIPE_BUSY) | ||||||
| 	{ | 	{ | ||||||
| 	  debug_printf ("Error opening the pipe (%lu)", GetLastError ()); | 	  debug_printf ("Error opening the pipe (%u)", GetLastError ()); | ||||||
| 	  return -1; | 	  return -1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -294,7 +294,7 @@ transport_layer_pipes::connect () | |||||||
|  |  | ||||||
|   assert (retries == MAX_WAIT_NAMED_PIPE_RETRY); |   assert (retries == MAX_WAIT_NAMED_PIPE_RETRY); | ||||||
|  |  | ||||||
|   system_printf ("lost connection to cygserver, error = %lu", |   system_printf ("lost connection to cygserver, error = %u", | ||||||
| 		 GetLastError ()); | 		 GetLastError ()); | ||||||
|  |  | ||||||
|   assume_cygserver = false; |   assume_cygserver = false; | ||||||
| @@ -313,7 +313,7 @@ transport_layer_pipes::impersonate_client () | |||||||
|  |  | ||||||
|   if (_hPipe && !ImpersonateNamedPipeClient (_hPipe)) |   if (_hPipe && !ImpersonateNamedPipeClient (_hPipe)) | ||||||
|     { |     { | ||||||
|       debug_printf ("Failed to Impersonate client, (%lu)", GetLastError ()); |       debug_printf ("Failed to Impersonate client, (%u)", GetLastError ()); | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -327,7 +327,7 @@ transport_layer_pipes::revert_to_self () | |||||||
|  |  | ||||||
|   if (!RevertToSelf ()) |   if (!RevertToSelf ()) | ||||||
|     { |     { | ||||||
|       debug_printf ("Failed to RevertToSelf, (%lu)", GetLastError ()); |       debug_printf ("Failed to RevertToSelf, (%u)", GetLastError ()); | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|   return true; |   return true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user