Fix spacing, copyrights.
This commit is contained in:
		| @@ -42,10 +42,9 @@ static char **lastenviron = NULL; | ||||
|   (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) \ | ||||
| 	  <= CYGWIN_VERSION_DLL_MALLOC_ENV) | ||||
|  | ||||
|  | ||||
| /* List of names which are converted from dos to unix | ||||
|    on the way in and back again on the way out. | ||||
|    | ||||
|  | ||||
|    PATH needs to be here because CreateProcess uses it and gdb uses | ||||
|    CreateProcess.  HOME is here because most shells use it and would be | ||||
|    confused by Windows style path names.  */ | ||||
| @@ -400,21 +399,21 @@ codepage_init (const char *buf) | ||||
|   if (!buf || !*buf) | ||||
|     return; | ||||
|  | ||||
|   if (strcmp (buf, "oem")== 0 ) | ||||
|   if (strcmp (buf, "oem")== 0) | ||||
|     { | ||||
|       current_codepage = oem_cp; | ||||
|       SetFileApisToOEM (); | ||||
|       debug_printf ("File APIs set to OEM" ); | ||||
|       debug_printf ("File APIs set to OEM"); | ||||
|     } | ||||
|   else if (strcmp (buf, "ansi")== 0 ) | ||||
|   else if (strcmp (buf, "ansi")== 0) | ||||
|     { | ||||
|       current_codepage = ansi_cp; | ||||
|       SetFileApisToANSI (); | ||||
|       debug_printf ("File APIs set to ANSI" ); | ||||
|       debug_printf ("File APIs set to ANSI"); | ||||
|     } | ||||
|   else | ||||
|     { | ||||
|       debug_printf ("Wrong codepage name: %s", buf ); | ||||
|       debug_printf ("Wrong codepage name: %s", buf); | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /* pthread.cc: posix pthread interface for Cygwin | ||||
|  | ||||
|    Copyright 1998 Cygnus Solutions. | ||||
|    Copyright 1998, 1999, 2000, 2001 Red Hat, Inc. | ||||
|  | ||||
|    Written by Marco Fuykschot <marco@ddi.nl> | ||||
|    Originally written by Marco Fuykschot <marco@ddi.nl> | ||||
|  | ||||
|    This file is part of Cygwin. | ||||
|  | ||||
| @@ -59,27 +59,27 @@ pthread_exit (void * value_ptr) | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_join(pthread_t thread, void **return_val) | ||||
| pthread_join (pthread_t thread, void **return_val) | ||||
| { | ||||
|   return __pthread_join(&thread, (void **)return_val); | ||||
|   return __pthread_join (&thread, (void **)return_val); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_detach(pthread_t thread) | ||||
| pthread_detach (pthread_t thread) | ||||
| { | ||||
|   return __pthread_detach(&thread); | ||||
|   return __pthread_detach (&thread); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_suspend(pthread_t thread) | ||||
| pthread_suspend (pthread_t thread) | ||||
| { | ||||
|    return __pthread_suspend(&thread); | ||||
|    return __pthread_suspend (&thread); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_continue(pthread_t thread) | ||||
| pthread_continue (pthread_t thread) | ||||
| { | ||||
|    return __pthread_continue(&thread); | ||||
|    return __pthread_continue (&thread); | ||||
| } | ||||
|  | ||||
| unsigned long | ||||
| @@ -174,49 +174,50 @@ pthread_mutex_destroy (pthread_mutex_t * mutex) | ||||
| /* Synchronisation */ | ||||
|  | ||||
| int | ||||
| pthread_cond_destroy(pthread_cond_t *cond) | ||||
| pthread_cond_destroy (pthread_cond_t *cond) | ||||
| { | ||||
|   return  __pthread_cond_destroy (cond); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) | ||||
| pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr) | ||||
| { | ||||
|   return __pthread_cond_init (cond, attr); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_cond_signal(pthread_cond_t *cond) | ||||
| pthread_cond_signal (pthread_cond_t *cond) | ||||
| { | ||||
|   return __pthread_cond_signal (cond); | ||||
| } | ||||
|  | ||||
| int pthread_cond_broadcast(pthread_cond_t *cond) | ||||
| int | ||||
| pthread_cond_broadcast (pthread_cond_t *cond) | ||||
| { | ||||
|   return __pthread_cond_broadcast (cond); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_cond_timedwait(pthread_cond_t *cond, | ||||
| pthread_cond_timedwait (pthread_cond_t *cond, | ||||
| 	 pthread_mutex_t *mutex, const struct timespec *abstime) | ||||
| { | ||||
|   return __pthread_cond_timedwait (cond, mutex, abstime); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) | ||||
| pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) | ||||
| { | ||||
|   return __pthread_cond_wait (cond, mutex); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_condattr_init(pthread_condattr_t *condattr) | ||||
| pthread_condattr_init (pthread_condattr_t *condattr) | ||||
| { | ||||
|   return __pthread_condattr_init (condattr); | ||||
| } | ||||
|  | ||||
| int | ||||
| pthread_condattr_destroy(pthread_condattr_t *condattr) | ||||
| pthread_condattr_destroy (pthread_condattr_t *condattr) | ||||
| { | ||||
|   return __pthread_condattr_destroy (condattr); | ||||
| } | ||||
| @@ -227,7 +228,8 @@ pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared) | ||||
|   return __pthread_condattr_getpshared (attr, pshared); | ||||
| } | ||||
|  | ||||
| int pthread_condattr_setpshared (pthread_condattr_t *attr, int pshared) | ||||
| int | ||||
| pthread_condattr_setpshared (pthread_condattr_t *attr, int pshared) | ||||
| { | ||||
|   return __pthread_condattr_setpshared (attr, pshared); | ||||
| } | ||||
|   | ||||
| @@ -782,7 +782,7 @@ fhandler_tty_slave::ready_for_read (int fd, DWORD howlong, int ignra) | ||||
|     case WAIT_OBJECT_0 + 1: | ||||
|       return 1; | ||||
|     case WAIT_FAILED: | ||||
|       select_printf ( "wait failed %E" ); | ||||
|       select_printf ("wait failed %E"); | ||||
|     case WAIT_OBJECT_0: | ||||
|     case WAIT_TIMEOUT: | ||||
|     default: | ||||
|   | ||||
| @@ -44,8 +44,8 @@ shared_name (const char *str, int num) | ||||
|   char envbuf[6]; | ||||
|  | ||||
|   __small_sprintf (buf, "%s.%s.%d", cygwin_version.shared_id, str, num); | ||||
|   if (GetEnvironmentVariable("CYGWIN_TESTING", envbuf, 5)) | ||||
|     strcat(buf, cygwin_version.dll_build_date); | ||||
|   if (GetEnvironmentVariable ("CYGWIN_TESTING", envbuf, 5)) | ||||
|     strcat (buf, cygwin_version.dll_build_date); | ||||
|   return buf; | ||||
| } | ||||
|  | ||||
| @@ -260,37 +260,37 @@ sec_user (PVOID sa_buf, PSID sid2, BOOL inherit) | ||||
| 	       + GetLengthSid (sid2); | ||||
|  | ||||
|   if (! InitializeAcl (acl, acl_len, ACL_REVISION)) | ||||
|     debug_printf("InitializeAcl %E"); | ||||
|     debug_printf ("InitializeAcl %E"); | ||||
|  | ||||
|   if (! AddAccessAllowedAce (acl, ACL_REVISION, | ||||
| 			     SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, | ||||
| 			     sid)) | ||||
|     debug_printf("AddAccessAllowedAce(%s) %E", getlogin()); | ||||
|     debug_printf ("AddAccessAllowedAce(%s) %E", getlogin ()); | ||||
|  | ||||
|   if (! AddAccessAllowedAce (acl, ACL_REVISION, | ||||
| 			     SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, | ||||
| 			     get_admin_sid ())) | ||||
|     debug_printf("AddAccessAllowedAce(admin) %E"); | ||||
|     debug_printf ("AddAccessAllowedAce(admin) %E"); | ||||
|  | ||||
|   if (! AddAccessAllowedAce (acl, ACL_REVISION, | ||||
| 			     SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, | ||||
| 			     get_system_sid ())) | ||||
|     debug_printf("AddAccessAllowedAce(system) %E"); | ||||
|     debug_printf ("AddAccessAllowedAce(system) %E"); | ||||
|  | ||||
|   if (! AddAccessAllowedAce (acl, ACL_REVISION, | ||||
| 			     SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, | ||||
| 			     get_creator_owner_sid ())) | ||||
|     debug_printf("AddAccessAllowedAce(creator_owner) %E"); | ||||
|     debug_printf ("AddAccessAllowedAce(creator_owner) %E"); | ||||
|  | ||||
|   if (sid2) | ||||
|     if (! AddAccessAllowedAce (acl, ACL_REVISION, | ||||
| 			       SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, | ||||
| 			       sid2)) | ||||
|       debug_printf("AddAccessAllowedAce(sid2) %E"); | ||||
|       debug_printf ("AddAccessAllowedAce(sid2) %E"); | ||||
|  | ||||
|   if (! InitializeSecurityDescriptor (psd, | ||||
| 				      SECURITY_DESCRIPTOR_REVISION)) | ||||
|     debug_printf("InitializeSecurityDescriptor %E"); | ||||
|     debug_printf ("InitializeSecurityDescriptor %E"); | ||||
|  | ||||
| /* | ||||
|  * Setting the owner lets the created security attribute not work | ||||
| @@ -299,11 +299,11 @@ sec_user (PVOID sa_buf, PSID sid2, BOOL inherit) | ||||
| */ | ||||
| #if 0 | ||||
|   if (! SetSecurityDescriptorOwner (psd, sid, FALSE)) | ||||
|     debug_printf("SetSecurityDescriptorOwner %E"); | ||||
|     debug_printf ("SetSecurityDescriptorOwner %E"); | ||||
| #endif | ||||
|  | ||||
|   if (! SetSecurityDescriptorDacl (psd, TRUE, acl, FALSE)) | ||||
|     debug_printf("SetSecurityDescriptorDacl %E"); | ||||
|     debug_printf ("SetSecurityDescriptorDacl %E"); | ||||
|  | ||||
|   psa->nLength = sizeof (SECURITY_ATTRIBUTES); | ||||
|   psa->lpSecurityDescriptor = psd; | ||||
|   | ||||
| @@ -52,7 +52,7 @@ close_all_files (void) | ||||
|  | ||||
|   fhandler_base *fh; | ||||
|   for (int i = 0; i < (int) fdtab.size; i++) | ||||
|     if ( (fh = fdtab[i]) != NULL) | ||||
|     if ((fh = fdtab[i]) != NULL) | ||||
|       { | ||||
| 	fh->close (); | ||||
| 	fdtab.release (i); | ||||
| @@ -434,14 +434,14 @@ _open (const char *unix_path, int flags, ...) | ||||
|  | ||||
|       if (fd < 0) | ||||
| 	set_errno (ENMFILE); | ||||
|       else if ( (fh = fdtab.build_fhandler (fd, unix_path, NULL)) == NULL) | ||||
|       else if ((fh = fdtab.build_fhandler (fd, unix_path, NULL)) == NULL) | ||||
| 	res = -1;		// errno already set | ||||
|       else if (!fh->open (unix_path, flags, (mode & 0777) & ~cygheap->umask)) | ||||
| 	{ | ||||
| 	  fdtab.release (fd); | ||||
| 	  res = -1; | ||||
| 	} | ||||
|       else if ( (res = fd) <= 2) | ||||
|       else if ((res = fd) <= 2) | ||||
| 	set_std_handle (res); | ||||
|       ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open"); | ||||
|     } | ||||
| @@ -940,7 +940,7 @@ num_entries (const char *win32_name) | ||||
|   count ++; | ||||
|   while (FindNextFileA (handle, &buf)) | ||||
|     { | ||||
|       if ( (buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) | ||||
|       if ((buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) | ||||
| 	count ++; | ||||
|     } | ||||
|   FindClose (handle); | ||||
| @@ -1074,7 +1074,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf, | ||||
|   strcpy (root, real_path.get_win32 ()); | ||||
|   dtype = GetDriveType (rootdir (root)); | ||||
|  | ||||
|   if ( (atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) || | ||||
|   if ((atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) || | ||||
|        (os_being_run == winNT | ||||
| 	&& dtype != DRIVE_NO_ROOT_DIR | ||||
| 	&& dtype != DRIVE_UNKNOWN))) | ||||
| @@ -1140,14 +1140,14 @@ stat_worker (const char *caller, const char *name, struct stat *buf, | ||||
| 				 &buf->st_mode, &buf->st_uid, &buf->st_gid)) | ||||
| 	{ | ||||
| 	  buf->st_mode |= STD_RBITS | STD_XBITS; | ||||
| 	  if ( (atts & FILE_ATTRIBUTE_READONLY) == 0) | ||||
| 	  if ((atts & FILE_ATTRIBUTE_READONLY) == 0) | ||||
| 	    buf->st_mode |= STD_WBITS; | ||||
| 	  if (real_path.issymlink ()) | ||||
| 	    buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO; | ||||
| 	  get_file_attribute (FALSE, real_path.get_win32 (), | ||||
| 			      NULL, &buf->st_uid, &buf->st_gid); | ||||
| 	} | ||||
|       if ( (handle = FindFirstFile (real_path.get_win32 (), &wfd)) | ||||
|       if ((handle = FindFirstFile (real_path.get_win32 (), &wfd)) | ||||
| 	  != INVALID_HANDLE_VALUE) | ||||
| 	{ | ||||
| 	  buf->st_atime   = to_time_t (&wfd.ftLastAccessTime); | ||||
| @@ -1155,7 +1155,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf, | ||||
| 	  buf->st_ctime   = to_time_t (&wfd.ftCreationTime); | ||||
| 	  buf->st_size    = wfd.nFileSizeLow; | ||||
| 	  buf->st_blksize = S_BLKSIZE; | ||||
| 	  buf->st_blocks  = ( (unsigned long) buf->st_size + | ||||
| 	  buf->st_blocks  = ((unsigned long) buf->st_size + | ||||
| 			    S_BLKSIZE-1) / S_BLKSIZE; | ||||
| 	  FindClose (handle); | ||||
| 	} | ||||
| @@ -1392,7 +1392,7 @@ system (const char *cmdstring) | ||||
|   command[2] = cmdstring; | ||||
|   command[3] = (const char *) NULL; | ||||
|  | ||||
|   if ( (res = spawnvp (_P_WAIT, "sh", command)) == -1) | ||||
|   if ((res = spawnvp (_P_WAIT, "sh", command)) == -1) | ||||
|     { | ||||
|       // when exec fails, return value should be as if shell | ||||
|       // executed exit (127) | ||||
| @@ -2201,7 +2201,7 @@ login (struct utmp *ut) | ||||
|       (void) write (fd, (char *) ut, sizeof (struct utmp)); | ||||
|       (void) close (fd); | ||||
|     } | ||||
|   if ( (fd = open (_PATH_WTMP, O_WRONLY | O_APPEND | O_BINARY, 0)) >= 0) | ||||
|   if ((fd = open (_PATH_WTMP, O_WRONLY | O_APPEND | O_BINARY, 0)) >= 0) | ||||
|     { | ||||
|       (void) write (fd, (char *) ut, sizeof (struct utmp)); | ||||
|       (void) close (fd); | ||||
| @@ -2241,7 +2241,7 @@ logout (char *line) | ||||
|       while (!res && ReadFile (ut_fd, ut_buf, sizeof ut_buf, &rd, NULL) | ||||
| 	     && rd != 0) | ||||
| 	{ | ||||
| 	  struct utmp *ut_end = (struct utmp *) ( (char *) ut_buf + rd); | ||||
| 	  struct utmp *ut_end = (struct utmp *) ((char *) ut_buf + rd); | ||||
|  | ||||
| 	  for (ut = ut_buf; ut < ut_end; ut++, pos += sizeof (*ut)) | ||||
| 	    if (ut->ut_name[0] | ||||
| @@ -2255,7 +2255,7 @@ logout (char *line) | ||||
|  | ||||
| 		/* Now seek back to the position in utmp at which UT occured, | ||||
| 		   and write the new version of UT there.  */ | ||||
| 		if ( (SetFilePointer (ut_fd, pos, 0, FILE_BEGIN) != 0xFFFFFFFF) | ||||
| 		if ((SetFilePointer (ut_fd, pos, 0, FILE_BEGIN) != 0xFFFFFFFF) | ||||
| 		    && (WriteFile (ut_fd, (char *) ut, sizeof (*ut), | ||||
| 				   &rd, NULL))) | ||||
| 		  { | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  | ||||
|    Copyright 1998, 1999, 2000, 2001 Red Hat, Inc. | ||||
|  | ||||
|    Written by Marco Fuykschot <marco@ddi.nl> | ||||
|    Originally written by Marco Fuykschot <marco@ddi.nl> | ||||
|  | ||||
| This file is part of Cygwin. | ||||
|  | ||||
| @@ -186,7 +186,6 @@ ResourceLocks::Delete () | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| // Thread interface | ||||
|  | ||||
| void | ||||
| @@ -275,7 +274,6 @@ MTinterface::Init (int forked) | ||||
| #endif | ||||
|  | ||||
|   reent_index = TlsAlloc (); | ||||
|  | ||||
|   reents._clib = _impure_ptr; | ||||
|   reents._winsup = &winsup_reent; | ||||
|  | ||||
| @@ -487,11 +485,10 @@ MTinterface::CreateCond (pthread_cond_t * cond, const pthread_condattr_t * attr) | ||||
|   item->mutexitem=NULL; | ||||
|   item->waiting=0; | ||||
|  | ||||
|   item->win32_obj_id = ::CreateEvent (&sec_none_nih,  | ||||
|   item->win32_obj_id = ::CreateEvent (&sec_none_nih, | ||||
| 	false, /* auto signal reset - which I think is pthreads like ? */ | ||||
| 	false, /* start non signaled */ | ||||
| 	NULL /* no name */ ); | ||||
|  | ||||
| 	NULL /* no name */); | ||||
|  | ||||
|   CHECKHANDLE (NULL, 1); | ||||
|  | ||||
| @@ -504,7 +501,7 @@ MTinterface::CreateCond (pthread_cond_t * cond, const pthread_condattr_t * attr) | ||||
| int | ||||
| CondItem::Signal () | ||||
| { | ||||
|   return !PulseEvent(win32_obj_id); | ||||
|   return !PulseEvent (win32_obj_id); | ||||
| } | ||||
|  | ||||
| int | ||||
| @@ -535,19 +532,19 @@ CondItem::BroadCast () | ||||
| { | ||||
|   if (!mutexitem) | ||||
|     return 0; | ||||
|   PulseEvent(win32_obj_id); | ||||
|   while (InterlockedDecrement(&waiting)!=0) | ||||
|     PulseEvent(win32_obj_id); | ||||
|   PulseEvent (win32_obj_id); | ||||
|   while (InterlockedDecrement (&waiting)!=0) | ||||
|     PulseEvent (win32_obj_id); | ||||
|   mutexitem=NULL; | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| //////////////////////////  Pthreads | ||||
| /*  Pthreads */ | ||||
|  | ||||
| void * | ||||
| thread_init_wrapper (void *_arg) | ||||
| { | ||||
| // Setup the local/global storage of this thread | ||||
|   // Setup the local/global storage of this thread | ||||
|  | ||||
|   ThreadItem *thread = (ThreadItem *) _arg; | ||||
|   struct __reent_t local_reent; | ||||
| @@ -558,7 +555,7 @@ thread_init_wrapper (void *_arg) | ||||
|   sigset_t _sig_mask;		/* one set for everything to ignore. */ | ||||
|   LONG _sigtodo[NSIG + __SIGOFFSET]; | ||||
|  | ||||
| // setup signal structures | ||||
|   // setup signal structures | ||||
|   thread->sigs = _sigs; | ||||
|   thread->sigmask = &_sig_mask; | ||||
|   thread->sigtodo = _sigtodo; | ||||
| @@ -576,7 +573,6 @@ thread_init_wrapper (void *_arg) | ||||
|  | ||||
|   local_winsup._process_logmask = LOG_UPTO (LOG_DEBUG); | ||||
|  | ||||
|  | ||||
|   if (!TlsSetValue (MT_INTERFACE->reent_index, &local_reent)) | ||||
|     system_printf ("local storage for thread couldn't be set"); | ||||
|  | ||||
| @@ -585,16 +581,14 @@ thread_init_wrapper (void *_arg) | ||||
|     system_printf ("local storage for thread isn't setup correctly"); | ||||
| #endif | ||||
|  | ||||
|  | ||||
|   thread_printf ("started thread %p %p %p %p %p %p", _arg, &local_clib, _impure_ptr, thread, thread->function, thread->arg); | ||||
|  | ||||
|  | ||||
| // call the user's thread | ||||
|   // call the user's thread | ||||
|   void *ret = thread->function (thread->arg); | ||||
|  | ||||
| // FIX ME : cleanup code | ||||
|   // FIXME : cleanup code | ||||
|  | ||||
| //  thread->used = false;	// release thread entry | ||||
|   //  thread->used = false;	// release thread entry | ||||
|     thread->return_ptr = ret; | ||||
|   ExitThread (0); | ||||
| } | ||||
| @@ -731,9 +725,6 @@ __pthread_continue (pthread_t * thread) | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| unsigned long | ||||
| __pthread_getsequence_np (pthread_t * thread) | ||||
| { | ||||
| @@ -767,7 +758,7 @@ __pthread_getspecific (pthread_key_t */*key*/) | ||||
| /* Thread synchronisation */ | ||||
|  | ||||
| int | ||||
| __pthread_cond_destroy(pthread_cond_t *cond) | ||||
| __pthread_cond_destroy (pthread_cond_t *cond) | ||||
| { | ||||
|   SetResourceLock (LOCK_COND_LIST, READ_LOCK | WRITE_LOCK, "__pthread_cond_destroy"); | ||||
|  | ||||
| @@ -785,7 +776,7 @@ __pthread_cond_destroy(pthread_cond_t *cond) | ||||
| } | ||||
|  | ||||
| int | ||||
| __pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) | ||||
| __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *attr) | ||||
| { | ||||
|   if (attr && (attr->valid != 0xf341)) | ||||
|     return EINVAL; | ||||
| @@ -800,25 +791,28 @@ __pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) | ||||
|  | ||||
| } | ||||
|  | ||||
| int __pthread_cond_broadcast(pthread_cond_t *cond) | ||||
| int | ||||
| __pthread_cond_broadcast (pthread_cond_t *cond) | ||||
| { | ||||
|   GETCOND("_pthread_cond_lock"); | ||||
|    | ||||
|   item->BroadCast(); | ||||
|  | ||||
|   item->BroadCast (); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int __pthread_cond_signal(pthread_cond_t *cond) | ||||
| int | ||||
| __pthread_cond_signal (pthread_cond_t *cond) | ||||
| { | ||||
|   GETCOND("_pthread_cond_lock"); | ||||
|  | ||||
|   item->Signal(); | ||||
|   item->Signal (); | ||||
|  | ||||
|   return 0; | ||||
| } | ||||
|  | ||||
| int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) | ||||
| int | ||||
| __pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime) | ||||
| { | ||||
|   int rv; | ||||
|   if (!abstime) | ||||
| @@ -836,37 +830,38 @@ int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const | ||||
|     return EINVAL; | ||||
|  | ||||
|   item->mutexitem=mutexitem; | ||||
|   InterlockedIncrement(&item->waiting); | ||||
|   rv = item->TimedWait(abstime->tv_sec*1000); | ||||
|   mutexitem->Lock(); | ||||
|   if (InterlockedDecrement(&item->waiting)==0) | ||||
|   InterlockedIncrement (&item->waiting); | ||||
|   rv = item->TimedWait (abstime->tv_sec*1000); | ||||
|   mutexitem->Lock (); | ||||
|   if (InterlockedDecrement (&item->waiting)==0) | ||||
|     item->mutexitem=NULL; | ||||
|  | ||||
|   return rv; | ||||
| } | ||||
|  | ||||
| int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) | ||||
| {  | ||||
| int | ||||
| __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) | ||||
| { | ||||
|   int rv; | ||||
|   SetResourceLock (LOCK_MUTEX_LIST, READ_LOCK, "_ptherad_mutex_lock");  | ||||
|   MutexItem* mutexitem=user_data->threadinterface->GetMutex (mutex);  | ||||
|   ReleaseResourceLock (LOCK_MUTEX_LIST, READ_LOCK, "_ptherad_mutex_lock");  | ||||
|   if (!mutexitem) return EINVAL;   | ||||
|   SetResourceLock (LOCK_MUTEX_LIST, READ_LOCK, "_ptherad_mutex_lock"); | ||||
|   MutexItem* mutexitem=user_data->threadinterface->GetMutex (mutex); | ||||
|   ReleaseResourceLock (LOCK_MUTEX_LIST, READ_LOCK, "_ptherad_mutex_lock"); | ||||
|   if (!mutexitem) return EINVAL; | ||||
|   if (!mutexitem->HandleOke ()) | ||||
|   {  | ||||
|     return EINVAL;  | ||||
|   { | ||||
|     return EINVAL; | ||||
|   } | ||||
|   GETCOND("_pthread_cond_lock"); | ||||
|   if (item->mutexitem && (item->mutexitem != mutexitem)) | ||||
|     return EINVAL; | ||||
|    | ||||
|  | ||||
|   item->mutexitem=mutexitem; | ||||
|   InterlockedIncrement(&item->waiting); | ||||
|   rv = item->Wait();   | ||||
|   mutexitem->Lock(); | ||||
|   if (InterlockedDecrement(&item->waiting)==0) | ||||
|   InterlockedIncrement (&item->waiting); | ||||
|   rv = item->Wait (); | ||||
|   mutexitem->Lock (); | ||||
|   if (InterlockedDecrement (&item->waiting)==0) | ||||
|     item->mutexitem=NULL; | ||||
|   | ||||
|  | ||||
|   return rv; | ||||
| } | ||||
|  | ||||
| @@ -890,7 +885,7 @@ __pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared) | ||||
| int | ||||
| __pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared) | ||||
| { | ||||
|   if (!attr || (attr->valid != 0xf341) || (pshared <0) || (pshared > 1 )) | ||||
|   if (!attr || (attr->valid != 0xf341) || (pshared <0) || (pshared > 1)) | ||||
|     return EINVAL; | ||||
|   attr->shared = pshared; | ||||
|   return 0; | ||||
| @@ -909,8 +904,8 @@ __pthread_condattr_destroy (pthread_condattr_t * condattr) | ||||
| int | ||||
| __pthread_kill (pthread_t * thread, int sig) | ||||
| { | ||||
| // lock myself, for the use of thread2signal | ||||
|   // two differ kills might clash: FIX ME | ||||
|   // lock myself, for the use of thread2signal | ||||
|   // two differ kills might clash: FIXME | ||||
|   GETTHREAD ("__pthread_kill"); | ||||
|  | ||||
|   if (item->sigs) | ||||
| @@ -918,7 +913,7 @@ __pthread_kill (pthread_t * thread, int sig) | ||||
|  | ||||
|   int rval = _kill (myself->pid, sig); | ||||
|  | ||||
| // unlock myself | ||||
|   // unlock myself | ||||
|   return rval; | ||||
| } | ||||
|  | ||||
| @@ -929,15 +924,15 @@ __pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set) | ||||
|   ThreadItem *item = MT_INTERFACE->GetCallingThread (); | ||||
|   ReleaseResourceLock (LOCK_THREAD_LIST, READ_LOCK, "__pthread_sigmask"); | ||||
|  | ||||
| // lock this myself, for the use of thread2signal | ||||
|   // two differt kills might clash: FIX ME | ||||
|   // lock this myself, for the use of thread2signal | ||||
|   // two differt kills might clash: FIXME | ||||
|  | ||||
|   if (item->sigs) | ||||
|     myself->setthread2signal (item); | ||||
|  | ||||
|   int rval = sigprocmask (operation, set, old_set); | ||||
|  | ||||
| // unlock this myself | ||||
|   // unlock this myself | ||||
|  | ||||
|   return rval; | ||||
| } | ||||
| @@ -1182,27 +1177,27 @@ extern "C" | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   int __pthread_cond_destroy(pthread_cond_t *) | ||||
|   int __pthread_cond_destroy (pthread_cond_t *) | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   int __pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *) | ||||
|   int __pthread_cond_init (pthread_cond_t *, const pthread_condattr_t *) | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   int __pthread_cond_signal(pthread_cond_t *) | ||||
|   int __pthread_cond_signal (pthread_cond_t *) | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   int __pthread_cond_broadcast(pthread_cond_t *) | ||||
|   int __pthread_cond_broadcast (pthread_cond_t *) | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   int __pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *) | ||||
|   int __pthread_cond_timedwait (pthread_cond_t *, pthread_mutex_t *, const struct timespec *) | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   int __pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) | ||||
|   int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *) | ||||
|   { | ||||
|     return -1; | ||||
|   } | ||||
|   | ||||
| @@ -433,6 +433,6 @@ tty::common_init (fhandler_pty_master *ptym) | ||||
|   winsize.ws_col = 80; | ||||
|   winsize.ws_row = 25; | ||||
|  | ||||
|   termios_printf("tty%d opened", ntty); | ||||
|   termios_printf ("tty%d opened", ntty); | ||||
|   return TRUE; | ||||
| } | ||||
|   | ||||
| @@ -146,7 +146,7 @@ internal_getlogin (cygheap_user &user) | ||||
|  | ||||
| 	  /* If that failes, too, as a last resort try to get the SID from | ||||
| 	     the logon server. */ | ||||
| 	  if (!ret && !(ret = lookup_name(user.name (), user.logsrv (), | ||||
| 	  if (!ret && !(ret = lookup_name (user.name (), user.logsrv (), | ||||
| 					  user.sid ()))) | ||||
| 	    debug_printf ("Couldn't retrieve SID from '%s'!", user.logsrv ()); | ||||
|  | ||||
| @@ -213,7 +213,7 @@ extern "C" char * | ||||
| getlogin (void) | ||||
| { | ||||
| #ifdef _MT_SAFE | ||||
|   char *this_username=_reent_winsup()->_username; | ||||
|   char *this_username=_reent_winsup ()->_username; | ||||
| #else | ||||
|   static NO_COPY char this_username[MAX_USER_NAME]; | ||||
| #endif | ||||
|   | ||||
| @@ -70,9 +70,9 @@ beg: | ||||
|   w->pid = intpid; | ||||
|   w->options = options; | ||||
|   w->rusage = r; | ||||
|   sigproc_printf("calling proc_subproc, pid %d, options %d", | ||||
|   sigproc_printf ("calling proc_subproc, pid %d, options %d", | ||||
| 		 w->pid, w->options); | ||||
|   if (!proc_subproc(PROC_WAIT, (DWORD)w)) | ||||
|   if (!proc_subproc (PROC_WAIT, (DWORD)w)) | ||||
|     { | ||||
|       set_errno (ENOSYS); | ||||
|       paranoid_printf ("proc_subproc returned 0"); | ||||
| @@ -119,6 +119,6 @@ done: | ||||
| 		  intpid, status, w->status, options, res); | ||||
|   w->status = -1; | ||||
|   if (res < 0) | ||||
|     sigproc_printf("*** errno = %d", get_errno()); | ||||
|     sigproc_printf ("*** errno = %d", get_errno ()); | ||||
|   return res; | ||||
| } | ||||
|   | ||||
| @@ -56,7 +56,7 @@ WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||||
| 	      start_time = GetTickCount (); | ||||
| 	      itv.it_value = itv.it_interval; | ||||
| 	    } | ||||
| 	  raise(SIGALRM); | ||||
| 	  raise (SIGALRM); | ||||
| 	} | ||||
|       return 0; | ||||
|     case WM_ASYNCIO: | ||||
| @@ -169,7 +169,7 @@ setitimer (int which, const struct itimerval *value, struct itimerval *oldvalue) | ||||
|     } | ||||
|   if (timer_active) | ||||
|     { | ||||
|       KillTimer (gethwnd(), timer_active); | ||||
|       KillTimer (gethwnd (), timer_active); | ||||
|       timer_active = 0; | ||||
|     } | ||||
|   if (oldvalue) | ||||
| @@ -186,7 +186,7 @@ setitimer (int which, const struct itimerval *value, struct itimerval *oldvalue) | ||||
|       elapse = 1; | ||||
|     else | ||||
|       return 0; | ||||
|   if (!(timer_active = SetTimer (gethwnd(), 1, elapse, NULL))) | ||||
|   if (!(timer_active = SetTimer (gethwnd (), 1, elapse, NULL))) | ||||
|     { | ||||
|       __seterrno (); | ||||
|       return -1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user