Fix spacing, copyrights.

This commit is contained in:
Christopher Faylor 2001-03-18 21:11:25 +00:00
parent 51cb7ca7ac
commit 94b03f2380
10 changed files with 116 additions and 120 deletions

View File

@ -42,7 +42,6 @@ static char **lastenviron = NULL;
(CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) \ (CYGWIN_VERSION_DLL_MAKE_COMBINED (user_data->api_major, user_data->api_minor) \
<= CYGWIN_VERSION_DLL_MALLOC_ENV) <= CYGWIN_VERSION_DLL_MALLOC_ENV)
/* List of names which are converted from dos to unix /* List of names which are converted from dos to unix
on the way in and back again on the way out. on the way in and back again on the way out.
@ -400,21 +399,21 @@ codepage_init (const char *buf)
if (!buf || !*buf) if (!buf || !*buf)
return; return;
if (strcmp (buf, "oem")== 0 ) if (strcmp (buf, "oem")== 0)
{ {
current_codepage = oem_cp; current_codepage = oem_cp;
SetFileApisToOEM (); 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; current_codepage = ansi_cp;
SetFileApisToANSI (); SetFileApisToANSI ();
debug_printf ("File APIs set to ANSI" ); debug_printf ("File APIs set to ANSI");
} }
else else
{ {
debug_printf ("Wrong codepage name: %s", buf ); debug_printf ("Wrong codepage name: %s", buf);
} }
} }

View File

@ -1,8 +1,8 @@
/* pthread.cc: posix pthread interface for Cygwin /* 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. This file is part of Cygwin.
@ -59,27 +59,27 @@ pthread_exit (void * value_ptr)
} }
int 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 int
pthread_detach(pthread_t thread) pthread_detach (pthread_t thread)
{ {
return __pthread_detach(&thread); return __pthread_detach (&thread);
} }
int int
pthread_suspend(pthread_t thread) pthread_suspend (pthread_t thread)
{ {
return __pthread_suspend(&thread); return __pthread_suspend (&thread);
} }
int int
pthread_continue(pthread_t thread) pthread_continue (pthread_t thread)
{ {
return __pthread_continue(&thread); return __pthread_continue (&thread);
} }
unsigned long unsigned long
@ -174,49 +174,50 @@ pthread_mutex_destroy (pthread_mutex_t * mutex)
/* Synchronisation */ /* Synchronisation */
int int
pthread_cond_destroy(pthread_cond_t *cond) pthread_cond_destroy (pthread_cond_t *cond)
{ {
return __pthread_cond_destroy (cond); return __pthread_cond_destroy (cond);
} }
int 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); return __pthread_cond_init (cond, attr);
} }
int int
pthread_cond_signal(pthread_cond_t *cond) pthread_cond_signal (pthread_cond_t *cond)
{ {
return __pthread_cond_signal (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); return __pthread_cond_broadcast (cond);
} }
int int
pthread_cond_timedwait(pthread_cond_t *cond, pthread_cond_timedwait (pthread_cond_t *cond,
pthread_mutex_t *mutex, const struct timespec *abstime) pthread_mutex_t *mutex, const struct timespec *abstime)
{ {
return __pthread_cond_timedwait (cond, mutex, abstime); return __pthread_cond_timedwait (cond, mutex, abstime);
} }
int 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); return __pthread_cond_wait (cond, mutex);
} }
int int
pthread_condattr_init(pthread_condattr_t *condattr) pthread_condattr_init (pthread_condattr_t *condattr)
{ {
return __pthread_condattr_init (condattr); return __pthread_condattr_init (condattr);
} }
int int
pthread_condattr_destroy(pthread_condattr_t *condattr) pthread_condattr_destroy (pthread_condattr_t *condattr)
{ {
return __pthread_condattr_destroy (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); 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); return __pthread_condattr_setpshared (attr, pshared);
} }

View File

@ -782,7 +782,7 @@ fhandler_tty_slave::ready_for_read (int fd, DWORD howlong, int ignra)
case WAIT_OBJECT_0 + 1: case WAIT_OBJECT_0 + 1:
return 1; return 1;
case WAIT_FAILED: case WAIT_FAILED:
select_printf ( "wait failed %E" ); select_printf ("wait failed %E");
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
case WAIT_TIMEOUT: case WAIT_TIMEOUT:
default: default:

View File

@ -44,8 +44,8 @@ shared_name (const char *str, int num)
char envbuf[6]; char envbuf[6];
__small_sprintf (buf, "%s.%s.%d", cygwin_version.shared_id, str, num); __small_sprintf (buf, "%s.%s.%d", cygwin_version.shared_id, str, num);
if (GetEnvironmentVariable("CYGWIN_TESTING", envbuf, 5)) if (GetEnvironmentVariable ("CYGWIN_TESTING", envbuf, 5))
strcat(buf, cygwin_version.dll_build_date); strcat (buf, cygwin_version.dll_build_date);
return buf; return buf;
} }
@ -260,37 +260,37 @@ sec_user (PVOID sa_buf, PSID sid2, BOOL inherit)
+ GetLengthSid (sid2); + GetLengthSid (sid2);
if (! InitializeAcl (acl, acl_len, ACL_REVISION)) if (! InitializeAcl (acl, acl_len, ACL_REVISION))
debug_printf("InitializeAcl %E"); debug_printf ("InitializeAcl %E");
if (! AddAccessAllowedAce (acl, ACL_REVISION, if (! AddAccessAllowedAce (acl, ACL_REVISION,
SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL,
sid)) sid))
debug_printf("AddAccessAllowedAce(%s) %E", getlogin()); debug_printf ("AddAccessAllowedAce(%s) %E", getlogin ());
if (! AddAccessAllowedAce (acl, ACL_REVISION, if (! AddAccessAllowedAce (acl, ACL_REVISION,
SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL,
get_admin_sid ())) get_admin_sid ()))
debug_printf("AddAccessAllowedAce(admin) %E"); debug_printf ("AddAccessAllowedAce(admin) %E");
if (! AddAccessAllowedAce (acl, ACL_REVISION, if (! AddAccessAllowedAce (acl, ACL_REVISION,
SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL,
get_system_sid ())) get_system_sid ()))
debug_printf("AddAccessAllowedAce(system) %E"); debug_printf ("AddAccessAllowedAce(system) %E");
if (! AddAccessAllowedAce (acl, ACL_REVISION, if (! AddAccessAllowedAce (acl, ACL_REVISION,
SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL,
get_creator_owner_sid ())) get_creator_owner_sid ()))
debug_printf("AddAccessAllowedAce(creator_owner) %E"); debug_printf ("AddAccessAllowedAce(creator_owner) %E");
if (sid2) if (sid2)
if (! AddAccessAllowedAce (acl, ACL_REVISION, if (! AddAccessAllowedAce (acl, ACL_REVISION,
SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL, SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL,
sid2)) sid2))
debug_printf("AddAccessAllowedAce(sid2) %E"); debug_printf ("AddAccessAllowedAce(sid2) %E");
if (! InitializeSecurityDescriptor (psd, if (! InitializeSecurityDescriptor (psd,
SECURITY_DESCRIPTOR_REVISION)) SECURITY_DESCRIPTOR_REVISION))
debug_printf("InitializeSecurityDescriptor %E"); debug_printf ("InitializeSecurityDescriptor %E");
/* /*
* Setting the owner lets the created security attribute not work * 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 0
if (! SetSecurityDescriptorOwner (psd, sid, FALSE)) if (! SetSecurityDescriptorOwner (psd, sid, FALSE))
debug_printf("SetSecurityDescriptorOwner %E"); debug_printf ("SetSecurityDescriptorOwner %E");
#endif #endif
if (! SetSecurityDescriptorDacl (psd, TRUE, acl, FALSE)) if (! SetSecurityDescriptorDacl (psd, TRUE, acl, FALSE))
debug_printf("SetSecurityDescriptorDacl %E"); debug_printf ("SetSecurityDescriptorDacl %E");
psa->nLength = sizeof (SECURITY_ATTRIBUTES); psa->nLength = sizeof (SECURITY_ATTRIBUTES);
psa->lpSecurityDescriptor = psd; psa->lpSecurityDescriptor = psd;

View File

@ -52,7 +52,7 @@ close_all_files (void)
fhandler_base *fh; fhandler_base *fh;
for (int i = 0; i < (int) fdtab.size; i++) for (int i = 0; i < (int) fdtab.size; i++)
if ( (fh = fdtab[i]) != NULL) if ((fh = fdtab[i]) != NULL)
{ {
fh->close (); fh->close ();
fdtab.release (i); fdtab.release (i);
@ -434,14 +434,14 @@ _open (const char *unix_path, int flags, ...)
if (fd < 0) if (fd < 0)
set_errno (ENMFILE); 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 res = -1; // errno already set
else if (!fh->open (unix_path, flags, (mode & 0777) & ~cygheap->umask)) else if (!fh->open (unix_path, flags, (mode & 0777) & ~cygheap->umask))
{ {
fdtab.release (fd); fdtab.release (fd);
res = -1; res = -1;
} }
else if ( (res = fd) <= 2) else if ((res = fd) <= 2)
set_std_handle (res); set_std_handle (res);
ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open"); ReleaseResourceLock (LOCK_FD_LIST,WRITE_LOCK|READ_LOCK," open");
} }
@ -940,7 +940,7 @@ num_entries (const char *win32_name)
count ++; count ++;
while (FindNextFileA (handle, &buf)) while (FindNextFileA (handle, &buf))
{ {
if ( (buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) if ((buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
count ++; count ++;
} }
FindClose (handle); FindClose (handle);
@ -1074,7 +1074,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf,
strcpy (root, real_path.get_win32 ()); strcpy (root, real_path.get_win32 ());
dtype = GetDriveType (rootdir (root)); dtype = GetDriveType (rootdir (root));
if ( (atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) || if ((atts == -1 || ! (atts & FILE_ATTRIBUTE_DIRECTORY) ||
(os_being_run == winNT (os_being_run == winNT
&& dtype != DRIVE_NO_ROOT_DIR && dtype != DRIVE_NO_ROOT_DIR
&& dtype != DRIVE_UNKNOWN))) && 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, &buf->st_uid, &buf->st_gid))
{ {
buf->st_mode |= STD_RBITS | STD_XBITS; buf->st_mode |= STD_RBITS | STD_XBITS;
if ( (atts & FILE_ATTRIBUTE_READONLY) == 0) if ((atts & FILE_ATTRIBUTE_READONLY) == 0)
buf->st_mode |= STD_WBITS; buf->st_mode |= STD_WBITS;
if (real_path.issymlink ()) if (real_path.issymlink ())
buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO; buf->st_mode |= S_IRWXU | S_IRWXG | S_IRWXO;
get_file_attribute (FALSE, real_path.get_win32 (), get_file_attribute (FALSE, real_path.get_win32 (),
NULL, &buf->st_uid, &buf->st_gid); 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) != INVALID_HANDLE_VALUE)
{ {
buf->st_atime = to_time_t (&wfd.ftLastAccessTime); 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_ctime = to_time_t (&wfd.ftCreationTime);
buf->st_size = wfd.nFileSizeLow; buf->st_size = wfd.nFileSizeLow;
buf->st_blksize = S_BLKSIZE; 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; S_BLKSIZE-1) / S_BLKSIZE;
FindClose (handle); FindClose (handle);
} }
@ -1392,7 +1392,7 @@ system (const char *cmdstring)
command[2] = cmdstring; command[2] = cmdstring;
command[3] = (const char *) NULL; 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 // when exec fails, return value should be as if shell
// executed exit (127) // executed exit (127)
@ -2201,7 +2201,7 @@ login (struct utmp *ut)
(void) write (fd, (char *) ut, sizeof (struct utmp)); (void) write (fd, (char *) ut, sizeof (struct utmp));
(void) close (fd); (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) write (fd, (char *) ut, sizeof (struct utmp));
(void) close (fd); (void) close (fd);
@ -2241,7 +2241,7 @@ logout (char *line)
while (!res && ReadFile (ut_fd, ut_buf, sizeof ut_buf, &rd, NULL) while (!res && ReadFile (ut_fd, ut_buf, sizeof ut_buf, &rd, NULL)
&& rd != 0) && 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)) for (ut = ut_buf; ut < ut_end; ut++, pos += sizeof (*ut))
if (ut->ut_name[0] if (ut->ut_name[0]
@ -2255,7 +2255,7 @@ logout (char *line)
/* Now seek back to the position in utmp at which UT occured, /* Now seek back to the position in utmp at which UT occured,
and write the new version of UT there. */ 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), && (WriteFile (ut_fd, (char *) ut, sizeof (*ut),
&rd, NULL))) &rd, NULL)))
{ {

View File

@ -2,7 +2,7 @@
Copyright 1998, 1999, 2000, 2001 Red Hat, Inc. 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. This file is part of Cygwin.
@ -186,7 +186,6 @@ ResourceLocks::Delete ()
} }
} }
// Thread interface // Thread interface
void void
@ -275,7 +274,6 @@ MTinterface::Init (int forked)
#endif #endif
reent_index = TlsAlloc (); reent_index = TlsAlloc ();
reents._clib = _impure_ptr; reents._clib = _impure_ptr;
reents._winsup = &winsup_reent; reents._winsup = &winsup_reent;
@ -490,8 +488,7 @@ MTinterface::CreateCond (pthread_cond_t * cond, const pthread_condattr_t * attr)
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, /* auto signal reset - which I think is pthreads like ? */
false, /* start non signaled */ false, /* start non signaled */
NULL /* no name */ ); NULL /* no name */);
CHECKHANDLE (NULL, 1); CHECKHANDLE (NULL, 1);
@ -504,7 +501,7 @@ MTinterface::CreateCond (pthread_cond_t * cond, const pthread_condattr_t * attr)
int int
CondItem::Signal () CondItem::Signal ()
{ {
return !PulseEvent(win32_obj_id); return !PulseEvent (win32_obj_id);
} }
int int
@ -535,19 +532,19 @@ CondItem::BroadCast ()
{ {
if (!mutexitem) if (!mutexitem)
return 0; return 0;
PulseEvent(win32_obj_id); PulseEvent (win32_obj_id);
while (InterlockedDecrement(&waiting)!=0) while (InterlockedDecrement (&waiting)!=0)
PulseEvent(win32_obj_id); PulseEvent (win32_obj_id);
mutexitem=NULL; mutexitem=NULL;
return 0; return 0;
} }
////////////////////////// Pthreads /* Pthreads */
void * void *
thread_init_wrapper (void *_arg) 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; ThreadItem *thread = (ThreadItem *) _arg;
struct __reent_t local_reent; struct __reent_t local_reent;
@ -558,7 +555,7 @@ thread_init_wrapper (void *_arg)
sigset_t _sig_mask; /* one set for everything to ignore. */ sigset_t _sig_mask; /* one set for everything to ignore. */
LONG _sigtodo[NSIG + __SIGOFFSET]; LONG _sigtodo[NSIG + __SIGOFFSET];
// setup signal structures // setup signal structures
thread->sigs = _sigs; thread->sigs = _sigs;
thread->sigmask = &_sig_mask; thread->sigmask = &_sig_mask;
thread->sigtodo = _sigtodo; thread->sigtodo = _sigtodo;
@ -576,7 +573,6 @@ thread_init_wrapper (void *_arg)
local_winsup._process_logmask = LOG_UPTO (LOG_DEBUG); local_winsup._process_logmask = LOG_UPTO (LOG_DEBUG);
if (!TlsSetValue (MT_INTERFACE->reent_index, &local_reent)) if (!TlsSetValue (MT_INTERFACE->reent_index, &local_reent))
system_printf ("local storage for thread couldn't be set"); 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"); system_printf ("local storage for thread isn't setup correctly");
#endif #endif
thread_printf ("started thread %p %p %p %p %p %p", _arg, &local_clib, _impure_ptr, thread, thread->function, thread->arg); 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); 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; thread->return_ptr = ret;
ExitThread (0); ExitThread (0);
} }
@ -731,9 +725,6 @@ __pthread_continue (pthread_t * thread)
return 0; return 0;
} }
unsigned long unsigned long
__pthread_getsequence_np (pthread_t * thread) __pthread_getsequence_np (pthread_t * thread)
{ {
@ -767,7 +758,7 @@ __pthread_getspecific (pthread_key_t */*key*/)
/* Thread synchronisation */ /* Thread synchronisation */
int 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"); SetResourceLock (LOCK_COND_LIST, READ_LOCK | WRITE_LOCK, "__pthread_cond_destroy");
@ -785,7 +776,7 @@ __pthread_cond_destroy(pthread_cond_t *cond)
} }
int 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)) if (attr && (attr->valid != 0xf341))
return EINVAL; 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"); GETCOND("_pthread_cond_lock");
item->BroadCast(); item->BroadCast ();
return 0; return 0;
} }
int __pthread_cond_signal(pthread_cond_t *cond) int
__pthread_cond_signal (pthread_cond_t *cond)
{ {
GETCOND("_pthread_cond_lock"); GETCOND("_pthread_cond_lock");
item->Signal(); item->Signal ();
return 0; 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; int rv;
if (!abstime) if (!abstime)
@ -836,16 +830,17 @@ int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, const
return EINVAL; return EINVAL;
item->mutexitem=mutexitem; item->mutexitem=mutexitem;
InterlockedIncrement(&item->waiting); InterlockedIncrement (&item->waiting);
rv = item->TimedWait(abstime->tv_sec*1000); rv = item->TimedWait (abstime->tv_sec*1000);
mutexitem->Lock(); mutexitem->Lock ();
if (InterlockedDecrement(&item->waiting)==0) if (InterlockedDecrement (&item->waiting)==0)
item->mutexitem=NULL; item->mutexitem=NULL;
return rv; 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; int rv;
SetResourceLock (LOCK_MUTEX_LIST, READ_LOCK, "_ptherad_mutex_lock"); SetResourceLock (LOCK_MUTEX_LIST, READ_LOCK, "_ptherad_mutex_lock");
@ -861,10 +856,10 @@ int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
return EINVAL; return EINVAL;
item->mutexitem=mutexitem; item->mutexitem=mutexitem;
InterlockedIncrement(&item->waiting); InterlockedIncrement (&item->waiting);
rv = item->Wait(); rv = item->Wait ();
mutexitem->Lock(); mutexitem->Lock ();
if (InterlockedDecrement(&item->waiting)==0) if (InterlockedDecrement (&item->waiting)==0)
item->mutexitem=NULL; item->mutexitem=NULL;
return rv; return rv;
@ -890,7 +885,7 @@ __pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared)
int int
__pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared) __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; return EINVAL;
attr->shared = pshared; attr->shared = pshared;
return 0; return 0;
@ -909,8 +904,8 @@ __pthread_condattr_destroy (pthread_condattr_t * condattr)
int int
__pthread_kill (pthread_t * thread, int sig) __pthread_kill (pthread_t * thread, int sig)
{ {
// lock myself, for the use of thread2signal // lock myself, for the use of thread2signal
// two differ kills might clash: FIX ME // two differ kills might clash: FIXME
GETTHREAD ("__pthread_kill"); GETTHREAD ("__pthread_kill");
if (item->sigs) if (item->sigs)
@ -918,7 +913,7 @@ __pthread_kill (pthread_t * thread, int sig)
int rval = _kill (myself->pid, sig); int rval = _kill (myself->pid, sig);
// unlock myself // unlock myself
return rval; return rval;
} }
@ -929,15 +924,15 @@ __pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set)
ThreadItem *item = MT_INTERFACE->GetCallingThread (); ThreadItem *item = MT_INTERFACE->GetCallingThread ();
ReleaseResourceLock (LOCK_THREAD_LIST, READ_LOCK, "__pthread_sigmask"); ReleaseResourceLock (LOCK_THREAD_LIST, READ_LOCK, "__pthread_sigmask");
// lock this myself, for the use of thread2signal // lock this myself, for the use of thread2signal
// two differt kills might clash: FIX ME // two differt kills might clash: FIXME
if (item->sigs) if (item->sigs)
myself->setthread2signal (item); myself->setthread2signal (item);
int rval = sigprocmask (operation, set, old_set); int rval = sigprocmask (operation, set, old_set);
// unlock this myself // unlock this myself
return rval; return rval;
} }
@ -1182,27 +1177,27 @@ extern "C"
{ {
return -1; return -1;
} }
int __pthread_cond_destroy(pthread_cond_t *) int __pthread_cond_destroy (pthread_cond_t *)
{ {
return -1; 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; return -1;
} }
int __pthread_cond_signal(pthread_cond_t *) int __pthread_cond_signal (pthread_cond_t *)
{ {
return -1; return -1;
} }
int __pthread_cond_broadcast(pthread_cond_t *) int __pthread_cond_broadcast (pthread_cond_t *)
{ {
return -1; 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; return -1;
} }
int __pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) int __pthread_cond_wait (pthread_cond_t *, pthread_mutex_t *)
{ {
return -1; return -1;
} }

View File

@ -433,6 +433,6 @@ tty::common_init (fhandler_pty_master *ptym)
winsize.ws_col = 80; winsize.ws_col = 80;
winsize.ws_row = 25; winsize.ws_row = 25;
termios_printf("tty%d opened", ntty); termios_printf ("tty%d opened", ntty);
return TRUE; return TRUE;
} }

View File

@ -146,7 +146,7 @@ internal_getlogin (cygheap_user &user)
/* If that failes, too, as a last resort try to get the SID from /* If that failes, too, as a last resort try to get the SID from
the logon server. */ the logon server. */
if (!ret && !(ret = lookup_name(user.name (), user.logsrv (), if (!ret && !(ret = lookup_name (user.name (), user.logsrv (),
user.sid ()))) user.sid ())))
debug_printf ("Couldn't retrieve SID from '%s'!", user.logsrv ()); debug_printf ("Couldn't retrieve SID from '%s'!", user.logsrv ());
@ -213,7 +213,7 @@ extern "C" char *
getlogin (void) getlogin (void)
{ {
#ifdef _MT_SAFE #ifdef _MT_SAFE
char *this_username=_reent_winsup()->_username; char *this_username=_reent_winsup ()->_username;
#else #else
static NO_COPY char this_username[MAX_USER_NAME]; static NO_COPY char this_username[MAX_USER_NAME];
#endif #endif

View File

@ -70,9 +70,9 @@ beg:
w->pid = intpid; w->pid = intpid;
w->options = options; w->options = options;
w->rusage = r; 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); w->pid, w->options);
if (!proc_subproc(PROC_WAIT, (DWORD)w)) if (!proc_subproc (PROC_WAIT, (DWORD)w))
{ {
set_errno (ENOSYS); set_errno (ENOSYS);
paranoid_printf ("proc_subproc returned 0"); paranoid_printf ("proc_subproc returned 0");
@ -119,6 +119,6 @@ done:
intpid, status, w->status, options, res); intpid, status, w->status, options, res);
w->status = -1; w->status = -1;
if (res < 0) if (res < 0)
sigproc_printf("*** errno = %d", get_errno()); sigproc_printf ("*** errno = %d", get_errno ());
return res; return res;
} }

View File

@ -56,7 +56,7 @@ WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
start_time = GetTickCount (); start_time = GetTickCount ();
itv.it_value = itv.it_interval; itv.it_value = itv.it_interval;
} }
raise(SIGALRM); raise (SIGALRM);
} }
return 0; return 0;
case WM_ASYNCIO: case WM_ASYNCIO:
@ -169,7 +169,7 @@ setitimer (int which, const struct itimerval *value, struct itimerval *oldvalue)
} }
if (timer_active) if (timer_active)
{ {
KillTimer (gethwnd(), timer_active); KillTimer (gethwnd (), timer_active);
timer_active = 0; timer_active = 0;
} }
if (oldvalue) if (oldvalue)
@ -186,7 +186,7 @@ setitimer (int which, const struct itimerval *value, struct itimerval *oldvalue)
elapse = 1; elapse = 1;
else else
return 0; return 0;
if (!(timer_active = SetTimer (gethwnd(), 1, elapse, NULL))) if (!(timer_active = SetTimer (gethwnd (), 1, elapse, NULL)))
{ {
__seterrno (); __seterrno ();
return -1; return -1;