From c90e1cf179187d5d188a3003db503ffd86d80cfe Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 22 Sep 2002 03:38:57 +0000 Subject: [PATCH] * fhandler.cc (fhandler_base::dup): Don't set handle on failure. Caller has already taken care of that. * fhandler_console.cc (fhandler_console::open): Initialize handles to NULL. (fhandler_console::close): Ditto. GNUify non-GNU formatted functions calls throughout. --- winsup/cygwin/ChangeLog | 12 ++++++++ winsup/cygwin/errno.cc | 2 +- winsup/cygwin/exceptions.cc | 6 ++-- winsup/cygwin/fhandler.cc | 43 +++++++++++++++-------------- winsup/cygwin/fhandler_console.cc | 8 +++--- winsup/cygwin/fhandler_disk_file.cc | 8 +++--- winsup/cygwin/fhandler_floppy.cc | 2 +- winsup/cygwin/fhandler_mem.cc | 14 +++++----- winsup/cygwin/fhandler_proc.cc | 4 +-- winsup/cygwin/fhandler_process.cc | 43 +++++++++++++++-------------- winsup/cygwin/fhandler_random.cc | 6 ++-- winsup/cygwin/fhandler_raw.cc | 4 +-- winsup/cygwin/fhandler_socket.cc | 2 +- winsup/cygwin/fhandler_tape.cc | 4 +-- winsup/cygwin/fhandler_termios.cc | 6 ++-- winsup/cygwin/fhandler_tty.cc | 2 +- winsup/cygwin/fhandler_zero.cc | 4 +-- winsup/cygwin/fork.cc | 14 +++++----- winsup/cygwin/grp.cc | 26 ++++++++--------- winsup/cygwin/heap.cc | 16 +++++------ winsup/cygwin/init.cc | 14 ++++++---- winsup/cygwin/mmap.cc | 36 ++++++++++++------------ winsup/cygwin/net.cc | 20 +++++++------- winsup/cygwin/passwd.cc | 14 +++++----- winsup/cygwin/path.cc | 18 ++++++------ winsup/cygwin/pinfo.cc | 3 +- winsup/cygwin/poll.cc | 8 +++--- winsup/cygwin/pthread.cc | 20 +++++++------- winsup/cygwin/resource.cc | 4 +-- winsup/cygwin/sec_acl.cc | 14 +++++----- winsup/cygwin/sec_helper.cc | 16 +++++------ winsup/cygwin/security.cc | 6 ++-- winsup/cygwin/select.cc | 8 +++--- winsup/cygwin/sigproc.cc | 6 ++-- winsup/cygwin/strace.cc | 8 +++--- winsup/cygwin/syscalls.cc | 16 +++++------ winsup/cygwin/sysconf.cc | 6 ++-- winsup/cygwin/syslog.cc | 12 ++++---- winsup/cygwin/termios.cc | 4 +-- winsup/cygwin/thread.cc | 6 ++-- winsup/cygwin/times.cc | 12 ++++---- winsup/cygwin/uinfo.cc | 4 +-- winsup/cygwin/wincap.cc | 4 +-- 43 files changed, 250 insertions(+), 235 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index cf4c5c0ef..ecae41c95 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,15 @@ +2002-09-21 Christopher Faylor + + * fhandler.cc (fhandler_base::dup): Don't set handle on failure. + Caller has already taken care of that. + * fhandler_console.cc (fhandler_console::open): Initialize handles to + NULL. + (fhandler_console::close): Ditto. + +2002-09-21 Christopher Faylor + + GNUify non-GNU formatted functions calls throughout. + 2002-09-21 Conrad Scott * cygwin_ipc.h: Move to "include/cygwin/ipc.h". diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc index 088f1a18d..7cc3684e0 100644 --- a/winsup/cygwin/errno.cc +++ b/winsup/cygwin/errno.cc @@ -673,7 +673,7 @@ strerror (int errnum) break; default: #ifdef _MT_SAFE - char *buf= _reent_winsup()->_strerror_buf; + char *buf= _reent_winsup ()->_strerror_buf; #else static NO_COPY char buf[20]; #endif diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index cadd6baaf..a1d7019fe 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -736,9 +736,9 @@ signal_fixup_after_exec (bool isspawn) /* Set up child's signal handlers */ for (int i = 0; i < NSIG; i++) { - myself->getsig(i).sa_mask = 0; - if (myself->getsig(i).sa_handler != SIG_IGN || isspawn) - myself->getsig(i).sa_handler = SIG_DFL; + myself->getsig (i).sa_mask = 0; + if (myself->getsig (i).sa_handler != SIG_IGN || isspawn) + myself->getsig (i).sa_handler = SIG_DFL; } } diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 2726a2ab0..e1271bc79 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -103,7 +103,7 @@ fhandler_base::set_readahead_valid (int val, int ch) if (!val) ralen = raixget = raixput = 0; if (ch != -1) - put_readahead(ch); + put_readahead (ch); } int @@ -160,7 +160,7 @@ fhandler_base::set_name (const char *unix_path, const char *win32_path, int unit else { const char *fmt = get_native_name (); - char *w = (char *) cmalloc (HEAP_STR, strlen(fmt) + 16); + char *w = (char *) cmalloc (HEAP_STR, strlen (fmt) + 16); __small_sprintf (w, fmt, unit); win32_path_name = w; } @@ -254,7 +254,7 @@ fhandler_base::raw_read (void *ptr, size_t ulen) { DWORD bytes_read; - if (!ReadFile (get_handle(), ptr, ulen, &bytes_read, 0)) + if (!ReadFile (get_handle (), ptr, ulen, &bytes_read, 0)) { int errcode; @@ -299,7 +299,7 @@ fhandler_base::raw_write (const void *ptr, size_t len) { DWORD bytes_written; - if (!WriteFile (get_handle(), ptr, len, &bytes_written, 0)) + if (!WriteFile (get_handle (), ptr, len, &bytes_written, 0)) { if (GetLastError () == ERROR_DISK_FULL && bytes_written > 0) return bytes_written; @@ -394,7 +394,7 @@ fhandler_base::open (path_conv *pc, int flags, mode_t mode) creation_distribution = CREATE_NEW; if (flags & O_APPEND) - set_append_p(); + set_append_p (); /* These flags are host dependent. */ shared = wincap.shared (); @@ -601,7 +601,7 @@ fhandler_base::write (const void *ptr, size_t len) int res; if (get_append_p ()) - SetFilePointer (get_handle(), 0, 0, FILE_END); + SetFilePointer (get_handle (), 0, 0, FILE_END); else if (wincap.has_lseek_bug () && get_check_win95_lseek_bug ()) { /* Note: this bug doesn't happen on NT4, even though the documentation @@ -855,7 +855,7 @@ fhandler_base::lseek (__off64_t offset, int whence) } debug_printf ("setting file pointer to %u (high), %u (low)", off_high, off_low); - res = SetFilePointer (get_handle(), off_low, poff_high, win32_whence); + res = SetFilePointer (get_handle (), off_low, poff_high, win32_whence); if (res == INVALID_SET_FILE_POINTER && GetLastError ()) { __seterrno (); @@ -881,12 +881,12 @@ fhandler_base::close () { int res = -1; - syscall_printf ("closing '%s' handle %p", get_name (), get_handle()); - if (get_nohandle () || CloseHandle (get_handle())) + syscall_printf ("closing '%s' handle %p", get_name (), get_handle ()); + if (get_nohandle () || CloseHandle (get_handle ())) res = 0; else { - paranoid_printf ("CloseHandle (%d <%s>) failed", get_handle(), + paranoid_printf ("CloseHandle (%d <%s>) failed", get_handle (), get_name ()); __seterrno (); @@ -914,7 +914,7 @@ fhandler_base::lock (int, struct flock *) } extern "C" char * __stdcall -rootdir(char *full_path) +rootdir (char *full_path) { /* Possible choices: * d:... -> d:/ @@ -1006,18 +1006,19 @@ fhandler_base::dup (fhandler_base *child) debug_printf ("in fhandler_base dup"); HANDLE nh; - if (get_nohandle ()) - nh = INVALID_HANDLE_VALUE; - else if (!DuplicateHandle (hMainProc, get_handle(), hMainProc, &nh, 0, TRUE, - DUPLICATE_SAME_ACCESS)) + if (!get_nohandle ()) { - system_printf ("dup(%s) failed, handle %x, %E", - get_name (), get_handle()); - __seterrno (); - return -1; - } + if (!DuplicateHandle (hMainProc, get_handle (), hMainProc, &nh, 0, TRUE, + DUPLICATE_SAME_ACCESS)) + { + system_printf ("dup(%s) failed, handle %x, %E", + get_name (), get_handle ()); + __seterrno (); + return -1; + } - child->set_io_handle (nh); + child->set_io_handle (nh); + } return 0; } diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 6a997f34a..2c48325fc 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -541,8 +541,8 @@ fhandler_console::open (path_conv *, int flags, mode_t) tcinit (get_tty_stuff (flags)); - set_io_handle (INVALID_HANDLE_VALUE); - set_output_handle (INVALID_HANDLE_VALUE); + set_io_handle (NULL); + set_output_handle (NULL); set_flags ((flags & ~O_TEXT) | O_BINARY); @@ -595,8 +595,8 @@ fhandler_console::close (void) { CloseHandle (get_io_handle ()); CloseHandle (get_output_handle ()); - set_io_handle (INVALID_HANDLE_VALUE); - set_output_handle (INVALID_HANDLE_VALUE); + set_io_handle (NULL); + set_output_handle (NULL); return 0; } diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index d6f84fd74..f8a7afca1 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -307,10 +307,10 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, /* First retrieve current position, set to beginning of file if not already there. */ - cur = SetFilePointer (get_handle(), 0, NULL, FILE_CURRENT); + cur = SetFilePointer (get_handle (), 0, NULL, FILE_CURRENT); if (cur != INVALID_SET_FILE_POINTER && (!cur || - SetFilePointer (get_handle(), 0, NULL, FILE_BEGIN) + SetFilePointer (get_handle (), 0, NULL, FILE_BEGIN) != INVALID_SET_FILE_POINTER)) { /* FIXME should we use /etc/magic ? */ @@ -321,7 +321,7 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc, set_execable_p (); pc->set_exec (); } - SetFilePointer (get_handle(), cur, NULL, FILE_BEGIN); + SetFilePointer (get_handle (), cur, NULL, FILE_BEGIN); } } if (pc->exec_state () == is_executable) @@ -453,7 +453,7 @@ fhandler_disk_file::lock (int cmd, struct flock *fl) case SEEK_END: { BY_HANDLE_FILE_INFORMATION finfo; - if (GetFileInformationByHandle (get_handle(), &finfo) == 0) + if (GetFileInformationByHandle (get_handle (), &finfo) == 0) { __seterrno (); return -1; diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index 3804fdf74..f0380dc88 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -93,7 +93,7 @@ fhandler_dev_floppy::lseek (__off64_t offset, int whence) PARTITION_INFORMATION pi; DWORD bytes_read; - if (!DeviceIoControl (get_handle(), + if (!DeviceIoControl (get_handle (), IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &di, sizeof (di), diff --git a/winsup/cygwin/fhandler_mem.cc b/winsup/cygwin/fhandler_mem.cc index 9a53b1a22..7613b11ec 100644 --- a/winsup/cygwin/fhandler_mem.cc +++ b/winsup/cygwin/fhandler_mem.cc @@ -93,9 +93,9 @@ fhandler_dev_mem::open (path_conv *, int flags, mode_t) RtlInitUnicodeString (&memstr, L"\\device\\physicalmemory"); OBJECT_ATTRIBUTES attr; - InitializeObjectAttributes(&attr, &memstr, - OBJ_CASE_INSENSITIVE | OBJ_INHERIT, - NULL, NULL); + InitializeObjectAttributes (&attr, &memstr, + OBJ_CASE_INSENSITIVE | OBJ_INHERIT, + NULL, NULL); ACCESS_MASK section_access; if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY) @@ -279,9 +279,9 @@ fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access, RtlInitUnicodeString (&memstr, L"\\device\\physicalmemory"); OBJECT_ATTRIBUTES attr; - InitializeObjectAttributes(&attr, &memstr, - OBJ_CASE_INSENSITIVE | OBJ_INHERIT, - NULL, NULL); + InitializeObjectAttributes (&attr, &memstr, + OBJ_CASE_INSENSITIVE | OBJ_INHERIT, + NULL, NULL); ACCESS_MASK section_access; ULONG protect; @@ -432,5 +432,5 @@ fhandler_dev_mem::dup (fhandler_base *child) void fhandler_dev_mem::dump () { - paranoid_printf("here, fhandler_dev_mem"); + paranoid_printf ("here, fhandler_dev_mem"); } diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 417b59a25..0338acd85 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -50,7 +50,7 @@ static const char *proc_listing[] = { NULL }; -static const int PROC_LINK_COUNT = (sizeof(proc_listing) / sizeof(const char *)) - 1; +static const int PROC_LINK_COUNT = (sizeof (proc_listing) / sizeof (const char *)) - 1; /* FH_PROC in the table below means the file/directory is handles by * fhandler_proc. @@ -412,7 +412,7 @@ format_proc_uptime (char *destbuf, size_t maxsize) NTSTATUS ret = NtQuerySystemInformation (SystemProcessorTimes, (PVOID) &spt, sizeof spt, NULL); if (!ret && GetLastError () == ERROR_PROC_NOT_FOUND) - uptime = GetTickCount() / 10; + uptime = GetTickCount () / 10; else if (ret != STATUS_SUCCESS) { __seterrno_from_win_error (RtlNtStatusToDosError (ret)); diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 23f0f9a5d..0633b0ebc 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -68,10 +68,10 @@ static off_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize); static off_t format_process_status (_pinfo *p, char *destbuf, size_t maxsize); static off_t format_process_statm (_pinfo *p, char *destbuf, size_t maxsize); static int get_process_state (DWORD dwProcessId); -static bool get_mem_values(DWORD dwProcessId, unsigned long *vmsize, - unsigned long *vmrss, unsigned long *vmtext, - unsigned long *vmdata, unsigned long *vmlib, - unsigned long *vmshare); +static bool get_mem_values (DWORD dwProcessId, unsigned long *vmsize, + unsigned long *vmrss, unsigned long *vmtext, + unsigned long *vmdata, unsigned long *vmlib, + unsigned long *vmshare); /* Returns 0 if path doesn't exist, >0 if path is a directory, * <0 if path is a file. @@ -126,7 +126,7 @@ fhandler_process::fstat (struct __stat64 *buf, path_conv *pc) case 2: buf->st_ctime = buf->st_mtime = p->start_time; buf->st_ctim.tv_nsec = buf->st_mtim.tv_nsec = 0; - time_as_timestruc_t(&buf->st_atim); + time_as_timestruc_t (&buf->st_atim); buf->st_uid = p->uid; buf->st_gid = p->gid; buf->st_mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; @@ -373,7 +373,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize) strcpy (cmd, ""); else { - strcpy(cmd, p->progname); + strcpy (cmd, p->progname); char *last_slash = strrchr (cmd, '\\'); if (last_slash != NULL) strcpy (cmd, last_slash + 1); @@ -434,7 +434,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize) { DWORD error = GetLastError (); __seterrno_from_win_error (error); - debug_printf("OpenProcess: ret = %d", + debug_printf ("OpenProcess: ret = %d", error); return 0; } @@ -449,7 +449,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize) if (ret != STATUS_SUCCESS) { __seterrno_from_win_error (RtlNtStatusToDosError (ret)); - debug_printf("NtQueryInformationProcess: ret = %d, " + debug_printf ("NtQueryInformationProcess: ret = %d, " "Dos(ret) = %d", ret, RtlNtStatusToDosError (ret)); return 0; @@ -468,7 +468,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize) */ start_time = (spt.KernelTime.QuadPart + spt.UserTime.QuadPart) * HZ / 10000000ULL; priority = pbi.BasePriority; - unsigned page_size = getpagesize(); + unsigned page_size = getpagesize (); vmsize = vmc.VirtualSize; vmrss = vmc.WorkingSetSize / page_size; vmmaxrss = ql.MaximumWorkingSetSize / page_size; @@ -507,7 +507,7 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize) strcpy (cmd, ""); else { - strcpy(cmd, p->progname); + strcpy (cmd, p->progname); char *last_slash = strrchr (cmd, '\\'); if (last_slash != NULL) strcpy (cmd, last_slash + 1); @@ -552,7 +552,7 @@ format_process_status (_pinfo *p, char *destbuf, size_t maxsize) { if (!get_mem_values (p->dwProcessId, &vmsize, &vmrss, &vmtext, &vmdata, &vmlib, &vmshare)) return 0; - unsigned page_size = getpagesize(); + unsigned page_size = getpagesize (); vmsize *= page_size; vmrss *= page_size; vmdata *= page_size; vmtext *= page_size; vmlib *= page_size; } @@ -623,7 +623,7 @@ get_process_state (DWORD dwProcessId) delete [] p, p = new ULONG[n *= 2]; if (ret != STATUS_SUCCESS) { - debug_printf("NtQuerySystemInformation: ret = %d, " + debug_printf ("NtQuerySystemInformation: ret = %d, " "Dos(ret) = %d", ret, RtlNtStatusToDosError (ret)); goto out; @@ -672,8 +672,9 @@ out: static bool -get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, unsigned long *vmtext, - unsigned long *vmdata, unsigned long *vmlib, unsigned long *vmshare) +get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, + unsigned long *vmtext, unsigned long *vmdata, + unsigned long *vmlib, unsigned long *vmshare) { bool res = true; NTSTATUS ret; @@ -682,14 +683,14 @@ get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, u MEMORY_WORKING_SET_LIST *mwsl; ULONG n = 0x1000, length; PULONG p = new ULONG[n]; - unsigned page_size = getpagesize(); + unsigned page_size = getpagesize (); hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, dwProcessId); if (hProcess == NULL) { - DWORD error = GetLastError(); + DWORD error = GetLastError (); __seterrno_from_win_error (error); - debug_printf("OpenProcess: ret = %d", + debug_printf ("OpenProcess: ret = %d", error); return false; } @@ -702,7 +703,7 @@ get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, u delete [] p, p = new ULONG[n *= 2]; if (ret != STATUS_SUCCESS) { - debug_printf("NtQueryVirtualMemory: ret = %d, " + debug_printf ("NtQueryVirtualMemory: ret = %d, " "Dos(ret) = %d", ret, RtlNtStatusToDosError (ret)); res = false; @@ -728,9 +729,9 @@ get_mem_values(DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss, u sizeof vmc, NULL); if (ret != STATUS_SUCCESS) { - debug_printf("NtQueryInformationProcess: ret = %d, " - "Dos(ret) = %d", - ret, RtlNtStatusToDosError (ret)); + debug_printf ("NtQueryInformationProcess: ret = %d, " + "Dos(ret) = %d", + ret, RtlNtStatusToDosError (ret)); res = false; goto out; } diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc index 73d798bd6..2447b4e78 100644 --- a/winsup/cygwin/fhandler_random.cc +++ b/winsup/cygwin/fhandler_random.cc @@ -24,7 +24,7 @@ details. */ #define PSEUDO_SHIFTVAL (21) fhandler_dev_random::fhandler_dev_random (int nunit) - : fhandler_base (FH_RANDOM), unit(nunit), crypt_prov((HCRYPTPROV) NULL) + : fhandler_base (FH_RANDOM), unit (nunit), crypt_prov ((HCRYPTPROV) NULL) { } @@ -145,7 +145,7 @@ fhandler_dev_random::close (void) if (crypt_prov) while (!CryptReleaseContext (crypt_prov, 0) && GetLastError () == ERROR_BUSY) - Sleep(10); + Sleep (10); return 0; } @@ -161,6 +161,6 @@ fhandler_dev_random::dup (fhandler_base *child) void fhandler_dev_random::dump () { - paranoid_printf("here, fhandler_dev_random"); + paranoid_printf ("here, fhandler_dev_random"); } diff --git a/winsup/cygwin/fhandler_raw.cc b/winsup/cygwin/fhandler_raw.cc index 2ce43c363..2b8470a36 100644 --- a/winsup/cygwin/fhandler_raw.cc +++ b/winsup/cygwin/fhandler_raw.cc @@ -56,7 +56,7 @@ static BOOL read_file (HANDLE fh, void *buf, DWORD to_read, BOOL ret; *err = 0; - if (!(ret = ReadFile(fh, buf, to_read, read, 0))) + if (!(ret = ReadFile (fh, buf, to_read, read, 0))) { if ((*err = GetLastError ()) == ERROR_MEDIA_CHANGED || *err == ERROR_BUS_RESET) @@ -136,7 +136,7 @@ fhandler_dev_raw::open (path_conv *real_path, int flags, mode_t) if (!wincap.has_raw_devices ()) { set_errno (ENOENT); - debug_printf("%s is accessible under NT/W2K only",real_path->get_win32()); + debug_printf ("%s is accessible under NT/W2K only",real_path->get_win32()); return 0; } diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 5b7e256ac..95633e4b5 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -502,7 +502,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len) if (len && ((unsigned) *len < sizeof (struct sockaddr_in))) *len = sizeof (struct sockaddr_in); - if (!is_nonblocking()) + if (!is_nonblocking ()) { ev[0] = WSACreateEvent (); diff --git a/winsup/cygwin/fhandler_tape.cc b/winsup/cygwin/fhandler_tape.cc index aaf1ed751..f5bb333bc 100644 --- a/winsup/cygwin/fhandler_tape.cc +++ b/winsup/cygwin/fhandler_tape.cc @@ -347,8 +347,8 @@ fhandler_dev_tape::ioctl (unsigned int cmd, void *buf) } if (devbufsiz > 1L && size > 1L) { - memcpy(buf, devbuf + devbufstart, - devbufend - devbufstart); + memcpy (buf, devbuf + devbufstart, + devbufend - devbufstart); devbufend -= devbufstart; } else diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index d631fad9a..c1cca494c 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -114,7 +114,7 @@ tty_min::set_ctty (int ttynum, int flags) (p == myself || !proc_exists (p))) { paranoid_printf ("resetting tty%d sid. Was %d, now %d. pgid was %d, now %d.", - ttynum, getsid(), myself->sid, getpgid (), myself->pgid); + ttynum, getsid (), myself->sid, getpgid (), myself->pgid); /* We are the session leader */ setsid (myself->sid); setpgid (myself->pgid); @@ -137,7 +137,7 @@ fhandler_termios::bg_check (int sig) if (sig < 0) sig = -sig; - termios_printf("bg I/O pgid %d, tpgid %d, ctty %d", + termios_printf ("bg I/O pgid %d, tpgid %d, ctty %d", myself->pgid, tc->getpgid (), myself->ctty); if (tc->getsid () == 0) @@ -154,7 +154,7 @@ fhandler_termios::bg_check (int sig) return with error */ int pgid_gone = !pid_exists (myself->pgid); int sigs_ignored = - ((void *) myself->getsig(sig).sa_handler == (void *) SIG_IGN) || + ((void *) myself->getsig (sig).sa_handler == (void *) SIG_IGN) || (myself->getsigmask () & SIGTOMASK (sig)); if (pgid_gone) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index f062b833b..fd83ef70c 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -708,7 +708,7 @@ fhandler_tty_slave::read (void *ptr, size_t len) termios_printf ("failed to acquire input mutex after input event arrived"); break; } - if (!PeekNamedPipe (get_handle (), peek_buf, sizeof(peek_buf), &bytes_in_pipe, NULL, NULL)) + if (!PeekNamedPipe (get_handle (), peek_buf, sizeof (peek_buf), &bytes_in_pipe, NULL, NULL)) { termios_printf ("PeekNamedPipe failed, %E"); _raise (SIGHUP); diff --git a/winsup/cygwin/fhandler_zero.cc b/winsup/cygwin/fhandler_zero.cc index 15c04d4b0..86b84fb30 100644 --- a/winsup/cygwin/fhandler_zero.cc +++ b/winsup/cygwin/fhandler_zero.cc @@ -38,7 +38,7 @@ fhandler_dev_zero::write (const void *, size_t len) int __stdcall fhandler_dev_zero::read (void *ptr, size_t len) { - memset(ptr, 0, len); + memset (ptr, 0, len); return len; } @@ -51,5 +51,5 @@ fhandler_dev_zero::lseek (__off64_t, int) void fhandler_dev_zero::dump () { - paranoid_printf("here, fhandler_dev_zero"); + paranoid_printf ("here, fhandler_dev_zero"); } diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 673d0d0ef..daca12109 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -194,7 +194,7 @@ resume_child (PROCESS_INFORMATION &pi, HANDLE forker_finished) Note that this has to be a macro since the parent may be messing with our stack. */ static void __stdcall -sync_with_parent(const char *s, bool hang_self) +sync_with_parent (const char *s, bool hang_self) { debug_printf ("signalling parent: %s", s); /* Tell our parent we're waiting. */ @@ -258,7 +258,7 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) if (GetEnvironmentVariable ("CYGWIN_FORK_SLEEP", buf, sizeof (buf))) { small_printf ("Sleeping %d after fork, pid %u\n", atoi (buf), GetCurrentProcessId ()); - Sleep (atoi(buf)); + Sleep (atoi (buf)); } #endif @@ -426,7 +426,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, si.cb = sizeof (STARTUPINFO); si.lpReserved2 = (LPBYTE)&ch; - si.cbReserved2 = sizeof(ch); + si.cbReserved2 = sizeof (ch); /* Remove impersonation */ if (cygheap->user.issetuid ()) @@ -475,8 +475,8 @@ fork_parent (HANDLE& hParent, dll *&first_dll, { __seterrno (); syscall_printf ("CreateProcessA failed, %E"); - ForceCloseHandle(subproc_ready); - ForceCloseHandle(forker_finished); + ForceCloseHandle (subproc_ready); + ForceCloseHandle (forker_finished); /* Restore impersonation */ if (cygheap->user.issetuid ()) ImpersonateLoggedOnUser (cygheap->user.token); @@ -503,7 +503,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, /* Initialize things that are done later in dll_crt0_1 that aren't done for the forkee. */ - strcpy(forked->progname, myself->progname); + strcpy (forked->progname, myself->progname); /* Restore impersonation */ if (cygheap->user.issetuid ()) @@ -517,7 +517,7 @@ fork_parent (HANDLE& hParent, dll *&first_dll, /* Fill in fields in the child's process table entry. */ forked->hProcess = pi.hProcess; forked->dwProcessId = pi.dwProcessId; - forked->copysigs(myself); + forked->copysigs (myself); /* Hopefully, this will succeed. The alternative to doing things this way is to reserve space prior to calling CreateProcess and then fill diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index 11b6953aa..175fd241f 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -35,7 +35,7 @@ static int max_lines; /* Position in the group cache */ #ifdef _MT_SAFE -#define grp_pos _reent_winsup()->_grp_pos +#define grp_pos _reent_winsup ()->_grp_pos #else static int grp_pos = 0; #endif @@ -45,7 +45,7 @@ static pwdgrp_check group_state; static int parse_grp (struct __group32 &grp, char *line) { - int len = strlen(line); + int len = strlen (line); if (line[--len] == '\r') line[len] = '\0'; @@ -157,7 +157,7 @@ read_etc_group () if (strlen (line)) add_grp_line (line); - group_state.set_last_modified (gr.get_fhandle(), gr.get_fname ()); + group_state.set_last_modified (gr.get_fhandle (), gr.get_fname ()); group_state = loaded; gr.close (); debug_printf ("Read /etc/group, %d lines", curr_lines); @@ -189,8 +189,8 @@ read_etc_group () snprintf (linebuf, sizeof (linebuf), "%s:%s:%lu:", group_name, tg.string (strbuf), - *GetSidSubAuthority(tg, - *GetSidSubAuthorityCount(tg) - 1)); + *GetSidSubAuthority (tg, + *GetSidSubAuthorityCount (tg) - 1)); debug_printf ("Emulating /etc/group: %s", linebuf); add_grp_line (linebuf); group_state = emulated; @@ -243,7 +243,7 @@ getgrgid32 (__gid32_t gid) { struct __group32 * default_grp = NULL; if (group_state <= initializing) - read_etc_group(); + read_etc_group (); for (int i = 0; i < curr_lines; i++) { @@ -270,7 +270,7 @@ struct __group32 * getgrnam32 (const char *name) { if (group_state <= initializing) - read_etc_group(); + read_etc_group (); for (int i = 0; i < curr_lines; i++) if (strcasematch (group_buf[i].gr_name, name)) @@ -291,17 +291,17 @@ getgrnam (const char *name) extern "C" void -endgrent() +endgrent () { grp_pos = 0; } extern "C" struct __group32 * -getgrent32() +getgrent32 () { if (group_state <= initializing) - read_etc_group(); + read_etc_group (); if (grp_pos < curr_lines) return group_buf + grp_pos++; @@ -311,7 +311,7 @@ getgrent32() extern "C" struct __group16 * -getgrent() +getgrent () { static struct __group16 g16; @@ -330,7 +330,7 @@ struct __group32 * internal_getgrent (int pos) { if (group_state <= initializing) - read_etc_group(); + read_etc_group (); if (pos < curr_lines) return group_buf + pos; @@ -347,7 +347,7 @@ getgroups32 (int gidsetsize, __gid32_t *grouplist, __gid32_t gid, struct __group32 *gr; if (group_state <= initializing) - read_etc_group(); + read_etc_group (); if (allow_ntsec && OpenProcessToken (hMainProc, TOKEN_QUERY, &hToken)) diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc index 5c301cc16..139b1d5a0 100644 --- a/winsup/cygwin/heap.cc +++ b/winsup/cygwin/heap.cc @@ -68,7 +68,7 @@ heap_init () /* Initialize page mask and default heap size. Preallocate a heap * to assure contiguous memory. */ cygheap->heapptr = cygheap->heaptop = cygheap->heapbase = - VirtualAlloc(NULL, cygwin_shared->heap_chunk_size (), MEM_RESERVE, + VirtualAlloc (NULL, cygwin_shared->heap_chunk_size (), MEM_RESERVE, PAGE_NOACCESS); if (cygheap->heapbase == NULL) api_fatal ("2. unable to allocate heap, heap_chunk_size %d, %E", @@ -86,7 +86,7 @@ heap_init () /* FIXME: This function no longer handles "split heaps". */ extern "C" void * -_sbrk(int n) +_sbrk (int n) { sigframe thisframe (mainthread); char *newtop, *newbrk; @@ -104,21 +104,21 @@ _sbrk(int n) if (n < 0) { /* Freeing memory */ - assert(newtop < cygheap->heaptop); + assert (newtop < cygheap->heaptop); n = (char *) cygheap->heaptop - newtop; - if (VirtualFree(newtop, n, MEM_DECOMMIT)) /* Give it back to OS */ + if (VirtualFree (newtop, n, MEM_DECOMMIT)) /* Give it back to OS */ goto good; /* Didn't take */ else goto err; } - assert(newtop > cygheap->heaptop); + assert (newtop > cygheap->heaptop); /* Need to grab more pages from the OS. If this fails it may be because * we have used up previously reserved memory. Or, we're just plumb out * of memory. */ commitbytes = pround (newtop - (char *) cygheap->heaptop); - if (VirtualAlloc(cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL) + if (VirtualAlloc (cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL) goto good; /* Couldn't allocate memory. Maybe we can reserve some more. @@ -128,8 +128,8 @@ _sbrk(int n) if ((newbrksize = cygwin_shared->heap_chunk_size ()) < commitbytes) newbrksize = commitbytes; - if ((VirtualAlloc(cygheap->heaptop, newbrksize, MEM_RESERVE, PAGE_NOACCESS) != NULL) && - (VirtualAlloc(cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL)) + if ((VirtualAlloc (cygheap->heaptop, newbrksize, MEM_RESERVE, PAGE_NOACCESS) != NULL) && + (VirtualAlloc (cygheap->heaptop, commitbytes, MEM_COMMIT, PAGE_READWRITE) != NULL)) goto good; err: diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index ca5e7176d..9c942f270 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -27,21 +27,23 @@ WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load) case DLL_THREAD_ATTACH: if (user_data->threadinterface) { - if (!TlsSetValue(user_data->threadinterface->reent_index, - &user_data->threadinterface->reents)) - api_fatal("Sig proc MT init failed\n"); + if (!TlsSetValue (user_data->threadinterface->reent_index, + &user_data->threadinterface->reents)) + api_fatal ("Sig proc MT init failed\n"); } break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_DETACH: - pthread *thisthread = (pthread *) TlsGetValue ( - user_data->threadinterface->thread_self_dwTlsIndex); +#if 0 + pthread *thisthread = (pthread *) + TlsGetValue (user_data->threadinterface->thread_self_dwTlsIndex); if (thisthread) { /* Some non-pthread call created this thread, * but we need to clean it up */ - thisthread->exit(0); + thisthread->exit (0); } +#endif break; } return 1; diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index d1bda79d8..e2684630e 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -448,7 +448,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) return MAP_FAILED; } - SetResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + SetResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); if (mmapped_areas == NULL) { @@ -458,7 +458,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) { set_errno (ENOMEM); syscall_printf ("-1 = mmap(): ENOMEM"); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return MAP_FAILED; } } @@ -481,7 +481,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) if (cfd < 0) { syscall_printf ("-1 = mmap(): EBADF"); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return MAP_FAILED; } fh = cfd; @@ -518,12 +518,12 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) { set_errno (ENOMEM); syscall_printf ("-1 = mmap(): ENOMEM"); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK|WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK|WRITE_LOCK, "mmap"); return MAP_FAILED; } caddr_t ret = rec->get_address () + off; syscall_printf ("%x = mmap() succeeded", ret); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return ret; } } @@ -547,7 +547,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) if (h == INVALID_HANDLE_VALUE) { - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return MAP_FAILED; } @@ -570,7 +570,7 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) fh->munmap (h, base, gran_len); set_errno (ENOMEM); syscall_printf ("-1 = mmap(): ENOMEM"); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return MAP_FAILED; } l = mmapped_areas->add_list (l, fd); @@ -584,12 +584,12 @@ mmap64 (caddr_t addr, size_t len, int prot, int flags, int fd, __off64_t off) l->erase (); set_errno (ENOMEM); syscall_printf ("-1 = mmap(): ENOMEM"); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return MAP_FAILED; } caddr_t ret = rec->get_address () + off; syscall_printf ("%x = mmap() succeeded", ret); - ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); return ret; } @@ -617,13 +617,13 @@ munmap (caddr_t addr, size_t len) return -1; } - SetResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); + SetResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); /* Check if a mmap'ed area was ever created */ if (mmapped_areas == NULL) { syscall_printf ("-1 = munmap(): mmapped_areas == NULL"); set_errno (EINVAL); - ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); return -1; } @@ -649,7 +649,7 @@ munmap (caddr_t addr, size_t len) l->erase (li); } syscall_printf ("0 = munmap(): %x", addr); - ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); return 0; } } @@ -658,7 +658,7 @@ munmap (caddr_t addr, size_t len) set_errno (EINVAL); syscall_printf ("-1 = munmap(): EINVAL"); - ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); + ReleaseResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "munmap"); return -1; } @@ -680,13 +680,13 @@ msync (caddr_t addr, size_t len, int flags) return -1; } - SetResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); + SetResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); /* Check if a mmap'ed area was ever created */ if (mmapped_areas == NULL) { syscall_printf ("-1 = msync(): mmapped_areas == NULL"); set_errno (EINVAL); - ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); + ReleaseResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); return -1; } @@ -716,7 +716,7 @@ msync (caddr_t addr, size_t len, int flags) else syscall_printf ("0 = msync()"); - ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); + ReleaseResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); return 0; } } @@ -728,7 +728,7 @@ invalid_address_range: set_errno (ENOMEM); syscall_printf ("-1 = msync(): ENOMEM"); - ReleaseResourceLock(LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); + ReleaseResourceLock (LOCK_MMAP_LIST, WRITE_LOCK | READ_LOCK, "msync"); return -1; } @@ -807,7 +807,7 @@ fhandler_disk_file::mmap (caddr_t *addr, size_t len, DWORD access, debug_printf ("named sharing"); if (!(h = OpenFileMapping (access, TRUE, namebuf))) - h = CreateFileMapping (get_handle(), &sec_none, protect, 0, 0, namebuf); + h = CreateFileMapping (get_handle (), &sec_none, protect, 0, 0, namebuf); } else h = CreateFileMapping (get_handle (), &sec_none, protect, 0, diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 70bae1413..32b4b2ef1 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -70,18 +70,18 @@ wsock_event::wait (int socket, LPDWORD flags) int ret = -1; WSAEVENT ev[2] = { event, signal_arrived }; - switch (WSAWaitForMultipleEvents(2, ev, FALSE, WSA_INFINITE, FALSE)) + switch (WSAWaitForMultipleEvents (2, ev, FALSE, WSA_INFINITE, FALSE)) { case WSA_WAIT_EVENT_0: DWORD len; - if (WSAGetOverlappedResult(socket, &ovr, &len, FALSE, flags)) + if (WSAGetOverlappedResult (socket, &ovr, &len, FALSE, flags)) ret = (int) len; break; case WSA_WAIT_EVENT_0 + 1: if (!CancelIo ((HANDLE)socket)) { debug_printf ("CancelIo() %E, fallback to blocking io"); - WSAGetOverlappedResult(socket, &ovr, &len, TRUE, flags); + WSAGetOverlappedResult (socket, &ovr, &len, TRUE, flags); } else WSASetLastError (WSAEINTR); @@ -417,9 +417,9 @@ dup_addr_list (char **src, unsigned int size) return NULL; while (cnt-- > 0) { - if (!(dst[cnt] = (char *) malloc(size))) + if (!(dst[cnt] = (char *) malloc (size))) return NULL; - memcpy(dst[cnt], src[cnt], size); + memcpy (dst[cnt], src[cnt], size); } return dst; } @@ -1229,12 +1229,12 @@ get_2k_ifconf (struct ifconf *ifc, int what) struct sockaddr_in *sa = NULL; struct sockaddr *so = NULL; - if (GetIfTable(NULL, &siz_if_table, TRUE) == ERROR_INSUFFICIENT_BUFFER && - GetIpAddrTable(NULL, &siz_ip_table, TRUE) == ERROR_INSUFFICIENT_BUFFER && + if (GetIfTable (NULL, &siz_if_table, TRUE) == ERROR_INSUFFICIENT_BUFFER && + GetIpAddrTable (NULL, &siz_ip_table, TRUE) == ERROR_INSUFFICIENT_BUFFER && (ift = (PMIB_IFTABLE) alloca (siz_if_table)) && (ipt = (PMIB_IPADDRTABLE) alloca (siz_ip_table)) && - !GetIfTable(ift, &siz_if_table, TRUE) && - !GetIpAddrTable(ipt, &siz_ip_table, TRUE)) + !GetIfTable (ift, &siz_if_table, TRUE) && + !GetIpAddrTable (ipt, &siz_ip_table, TRUE)) { /* Iterate over all known interfaces */ for (if_cnt = 0; if_cnt < ift->dwNumEntries; ++if_cnt) @@ -1903,7 +1903,7 @@ socketpair (int family, int type, int protocol, int *sb) cygheap_fdnew sb0; fhandler_socket *fh; - if (__check_null_invalid_struct_errno (sb, 2 * sizeof(int))) + if (__check_null_invalid_struct_errno (sb, 2 * sizeof (int))) return -1; if (family != AF_LOCAL && family != AF_INET) diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index ec7ed3a1e..22e8b3e20 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -153,7 +153,7 @@ read_etc_passwd () if (strlen (line)) add_pwd_line (line); - passwd_state.set_last_modified (pr.get_fhandle(), pr.get_fname ()); + passwd_state.set_last_modified (pr.get_fhandle (), pr.get_fname ()); passwd_state = loaded; pr.close (); debug_printf ("Read /etc/passwd, %d lines", curr_lines); @@ -179,9 +179,9 @@ read_etc_passwd () snprintf (linebuf, sizeof (linebuf), "%s::%lu:%lu:%s:%s:/bin/sh", cygheap->user.name (), - *GetSidSubAuthority(tu, + *GetSidSubAuthority (tu, *GetSidSubAuthorityCount(tu) - 1), - *GetSidSubAuthority(tg, + *GetSidSubAuthority (tg, *GetSidSubAuthorityCount(tg) - 1), tu.string (strbuf), getenv ("HOME") ?: "/"); debug_printf ("Emulating /etc/passwd: %s", linebuf); @@ -246,7 +246,7 @@ getpwuid32 (__uid32_t uid) if (passwd_state <= initializing) read_etc_passwd (); - pthread_testcancel(); + pthread_testcancel (); return search_for (uid, 0); } @@ -268,7 +268,7 @@ getpwuid_r32 (__uid32_t uid, struct passwd *pwd, char *buffer, size_t bufsize, s if (passwd_state <= initializing) read_etc_passwd (); - pthread_testcancel(); + pthread_testcancel (); struct passwd *temppw = search_for (uid, 0); @@ -311,7 +311,7 @@ getpwnam (const char *name) if (passwd_state <= initializing) read_etc_passwd (); - pthread_testcancel(); + pthread_testcancel (); return search_for (0, name); } @@ -332,7 +332,7 @@ getpwnam_r (const char *nam, struct passwd *pwd, char *buffer, size_t bufsize, s if (passwd_state <= initializing) read_etc_passwd (); - pthread_testcancel(); + pthread_testcancel (); struct passwd *temppw = search_for (0, nam); diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index eea04ab1b..a185e60e9 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -131,8 +131,8 @@ create_shortcut_header (void) (path_prefix_p (mount_table->cygdrive, (path), mount_table->cygdrive_len)) #define iscygdrive_device(path) \ - (isalpha(path[mount_table->cygdrive_len]) && \ - (isdirsep(path[mount_table->cygdrive_len + 1]) || \ + (isalpha (path[mount_table->cygdrive_len]) && \ + (isdirsep (path[mount_table->cygdrive_len + 1]) || \ !path[mount_table->cygdrive_len + 1])) #define isproc(path) \ @@ -843,7 +843,7 @@ static __inline int digits (const char *name) { char *p; - int n = strtol(name, &p, 10); + int n = strtol (name, &p, 10); return p > name && !*p ? n : -1; } @@ -1985,7 +1985,7 @@ mount_info::read_cygdrive_info_from_registry () error. */ cygdrive_flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_CYGDRIVE); slashify (cygdrive, cygdrive, 1); - cygdrive_len = strlen(cygdrive); + cygdrive_len = strlen (cygdrive); } } @@ -2043,7 +2043,7 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign { slashify (cygdrive_prefix, mount_table->cygdrive, 1); mount_table->cygdrive_flags = flags; - mount_table->cygdrive_len = strlen(mount_table->cygdrive); + mount_table->cygdrive_len = strlen (mount_table->cygdrive); } return 0; @@ -2334,7 +2334,7 @@ static mntent * fillout_mntent (const char *native_path, const char *posix_path, unsigned flags) { #ifdef _MT_SAFE - struct mntent &ret=_reent_winsup()->mntbuf; + struct mntent &ret=_reent_winsup ()->mntbuf; #else static NO_COPY struct mntent ret; #endif @@ -3220,7 +3220,7 @@ hashit: \a\b\. but allow a single \ if that's all there is. */ do { - int ch = cyg_tolower(*name); + int ch = cyg_tolower (*name); hash = (hash << 5) - hash + ch; } while (*++name != '\0' && @@ -3311,7 +3311,7 @@ chdir (const char *in_dir) path.get_win32 ()[3] = '\0'; } int res; - int devn = path.get_devn(); + int devn = path.get_devn (); if (!isvirtual_dev (devn)) res = SetCurrentDirectory (native_dir) ? 0 : -1; else if (!path.exists ()) @@ -3725,7 +3725,7 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen) else tocopy = posix; - debug_printf("posix %s", posix); + debug_printf ("posix %s", posix); if (strlen (tocopy) >= ulen) { set_errno (ERANGE); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 90c87c173..4591feded 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -61,8 +61,7 @@ set_myself (pid_t pid, HANDLE h) myself->process_state |= PID_IN_USE; myself->start_time = time (NULL); /* Register our starting time. */ - (void) GetModuleFileName (NULL, myself->progname, - sizeof(myself->progname)); + (void) GetModuleFileName (NULL, myself->progname, sizeof (myself->progname)); if (!strace.active) strace.hello (); return; diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index 36c61cfcc..3c61c565e 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -35,7 +35,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout) if (fds[i].fd > max_fd) max_fd = fds[i].fd; - size_t fds_size = howmany(max_fd + 1, NFDBITS) * sizeof (fd_mask); + size_t fds_size = howmany (max_fd + 1, NFDBITS) * sizeof (fd_mask); read_fds = (fd_set *) alloca (fds_size); write_fds = (fd_set *) alloca (fds_size); @@ -55,7 +55,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout) for (unsigned int i = 0; i < nfds; ++i) { fds[i].revents = 0; - if (!cygheap->fdtab.not_open(fds[i].fd)) + if (!cygheap->fdtab.not_open (fds[i].fd)) { if (fds[i].events & POLLIN) FD_SET(fds[i].fd, read_fds); @@ -81,7 +81,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout) { if (fds[i].fd >= 0) { - if (cygheap->fdtab.not_open(fds[i].fd)) + if (cygheap->fdtab.not_open (fds[i].fd)) fds[i].revents = POLLHUP; else { @@ -93,7 +93,7 @@ poll (struct pollfd *fds, unsigned int nfds, int timeout) if (!sock) fds[i].revents |= POLLIN; else - switch (sock->recvfrom (peek, sizeof(peek), MSG_PEEK, + switch (sock->recvfrom (peek, sizeof (peek), MSG_PEEK, NULL, NULL)) { case -1: /* Something weird happened */ diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc index 810fd1f20..cfa0c28ea 100644 --- a/winsup/cygwin/pthread.cc +++ b/winsup/cygwin/pthread.cc @@ -31,9 +31,9 @@ pthread_once (pthread_once_t * once_control, void (*init_routine) (void)) } int -pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) +pthread_atfork (void (*prepare)(void), void (*parent)(void), void (*child)(void)) { - return pthread::atfork(prepare, parent, child); + return pthread::atfork (prepare, parent, child); } int @@ -141,7 +141,7 @@ pthread_attr_getstackaddr (const pthread_attr_t * attr, void **stackaddr) void pthread_exit (void *value_ptr) { - return pthread::self()->exit (value_ptr); + return pthread::self ()->exit (value_ptr); } int @@ -176,7 +176,7 @@ pthread_getsequence_np (pthread_t * thread) { if (!pthread::isGoodObject (thread)) return EINVAL; - return (*thread)->getsequence_np(); + return (*thread)->getsequence_np (); } /* Thread SpecificData */ @@ -221,7 +221,7 @@ pthread_sigmask (int operation, const sigset_t * set, sigset_t * old_set) pthread_t pthread_self () { - return pthread::self(); + return pthread::self (); } int @@ -431,31 +431,31 @@ pthread_cancel (pthread_t thread) int pthread_setcancelstate (int state, int *oldstate) { - return pthread::self()->setcancelstate (state, oldstate); + return pthread::self ()->setcancelstate (state, oldstate); } int pthread_setcanceltype (int type, int *oldtype) { - return pthread::self()->setcanceltype (type, oldtype); + return pthread::self ()->setcanceltype (type, oldtype); } void pthread_testcancel (void) { - pthread::self()->testcancel (); + pthread::self ()->testcancel (); } void _pthread_cleanup_push (__pthread_cleanup_handler *handler) { - pthread::self()->push_cleanup_handler (handler); + pthread::self ()->push_cleanup_handler (handler); } void _pthread_cleanup_pop (int execute) { - pthread::self()->pop_cleanup_handler (execute); + pthread::self ()->pop_cleanup_handler (execute); } /* Semaphores */ diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index cd2962d56..0db6cd5b8 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -76,7 +76,7 @@ fill_rusage (struct rusage *r, HANDLE h) PROCESS_MEMORY_COUNTERS pmc; memset (&pmc, 0, sizeof (pmc)); - if (GetProcessMemoryInfo( h, &pmc, sizeof (pmc))) + if (GetProcessMemoryInfo (h, &pmc, sizeof (pmc))) { r->ru_maxrss += (long) (pmc.WorkingSetSize /1024); r->ru_majflt += pmc.PageFaultCount; @@ -165,7 +165,7 @@ setrlimit (int resource, const struct rlimit *rlp) // Check if the request is to actually change the resource settings. // If it does not result in a change, take no action and do not // fail. - if (getrlimit(resource, &oldlimits) < 0) + if (getrlimit (resource, &oldlimits) < 0) return -1; if (oldlimits.rlim_cur == rlp->rlim_cur && diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index cd20cfd54..90b6ef082 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -86,13 +86,13 @@ setacl (const char *file, int nentries, __aclent16_t *aclbufp) __seterrno (); return -1; } - if (!SetSecurityDescriptorOwner(&sd, owner, FALSE)) + if (!SetSecurityDescriptorOwner (&sd, owner, FALSE)) { __seterrno (); return -1; } if (group - && !SetSecurityDescriptorGroup(&sd, group, FALSE)) + && !SetSecurityDescriptorGroup (&sd, group, FALSE)) { __seterrno (); return -1; @@ -538,7 +538,7 @@ acl_worker (const char *path, int cmd, int nentries, __aclent16_t *aclbufp, switch (cmd) { case SETACL: - if (!aclsort(nentries, 0, aclbufp)) + if (!aclsort (nentries, 0, aclbufp)) return setacl (real_path.get_win32 (), nentries, aclbufp); break; @@ -732,9 +732,9 @@ extern "C" int acecmp (const void *a1, const void *a2) { #define ace(i) ((const __aclent16_t *) a##i) - int ret = ace(1)->a_type - ace(2)->a_type; + int ret = ace (1)->a_type - ace (2)->a_type; if (!ret) - ret = ace(1)->a_id - ace(2)->a_id; + ret = ace (1)->a_id - ace (2)->a_id; return ret; #undef ace } @@ -750,7 +750,7 @@ aclsort (int nentries, int, __aclent16_t *aclbufp) set_errno (EINVAL); return -1; } - qsort((void *) aclbufp, nentries, sizeof (__aclent16_t), acecmp); + qsort ((void *) aclbufp, nentries, sizeof (__aclent16_t), acecmp); return 0; } @@ -791,7 +791,7 @@ acltomode (__aclent16_t *aclbufp, int nentries, mode_t *modep) extern "C" int -aclfrommode(__aclent16_t *aclbufp, int nentries, mode_t *modep) +aclfrommode (__aclent16_t *aclbufp, int nentries, mode_t *modep) { int pos; diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index 6cc6f132c..fa0519371 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -69,11 +69,11 @@ cygsid::string (char *nsidstr) const if (!psid || !nsidstr) return NULL; strcpy (nsidstr, "S-1-"); - __small_sprintf(t, "%u", GetSidIdentifierAuthority (psid)->Value[5]); + __small_sprintf (t, "%u", GetSidIdentifierAuthority (psid)->Value[5]); strcat (nsidstr, t); for (i = 0; i < *GetSidSubAuthorityCount (psid); ++i) { - __small_sprintf(t, "-%lu", *GetSidSubAuthority (psid, i)); + __small_sprintf (t, "-%lu", *GetSidSubAuthority (psid, i)); strcat (nsidstr, t); } return nsidstr; @@ -90,7 +90,7 @@ cygsid::get_sid (DWORD s, DWORD cnt, DWORD *r) return NULL; } set (); - InitializeSid(psid, &sid_auth[s], cnt); + InitializeSid (psid, &sid_auth[s], cnt); for (i = 0; i < cnt; ++i) memcpy ((char *) psid + 8 + sizeof (DWORD) * i, &r[i], sizeof (DWORD)); return psid; @@ -198,7 +198,7 @@ cygsid::get_id (BOOL search_grp, int *type) } /* We use the RID as default UID/GID */ - int id = *GetSidSubAuthority(psid, *GetSidSubAuthorityCount(psid) - 1); + int id = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount (psid) - 1); /* * The RID maybe -1 if accountname == computername. @@ -325,13 +325,13 @@ lookup_name (const char *name, const char *logsrv, PSID ret_sid) if (LookupAccountName (NULL, domuser, sid, SIDLEN, dom, DOMLEN,&acc_type)) goto got_it; } - debug_printf ("LookupAccountName(%s) %E", name); + debug_printf ("LookupAccountName (%s) %E", name); __seterrno (); return FALSE; got_it: - debug_printf ("sid : [%d]", *GetSidSubAuthority((PSID) sid, - *GetSidSubAuthorityCount((PSID) sid) - 1)); + debug_printf ("sid : [%d]", *GetSidSubAuthority ((PSID) sid, + *GetSidSubAuthorityCount ((PSID) sid) - 1)); if (ret_sid) memcpy (ret_sid, sid, sidlen); @@ -376,7 +376,7 @@ set_process_privilege (const char *privilege, BOOL enable) goto out; } /* AdjustTokenPrivileges returns TRUE even if the privilege could not - be enabled. GetLastError() returns an correct error code, though. */ + be enabled. GetLastError () returns an correct error code, though. */ if (enable && GetLastError () == ERROR_NOT_ALL_ASSIGNED) { debug_printf ("Privilege %s couldn't be assigned", privilege); diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 779aee302..e9e8877a1 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1206,8 +1206,8 @@ write_sd (const char *file, PSECURITY_DESCRIPTOR sd_buf, DWORD sd_size) } static void -get_attribute_from_acl(int * attribute, PACL acl, PSID owner_sid, - PSID group_sid, BOOL grp_member) +get_attribute_from_acl (int * attribute, PACL acl, PSID owner_sid, + PSID group_sid, BOOL grp_member) { ACCESS_ALLOWED_ACE *ace; int allow = 0; @@ -1387,7 +1387,7 @@ get_file_attribute (int use_ntsec, const char *file, if (allow_ntea) { int oatt = *attribute; - res = NTReadEA (file, ".UNIXATTR", (char *)attribute, sizeof(*attribute)); + res = NTReadEA (file, ".UNIXATTR", (char *)attribute, sizeof (*attribute)); *attribute |= oatt; } else diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 34fa6c8b3..c540563fd 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -71,7 +71,7 @@ typedef long fd_mask; #define NULL_fd_set ((fd_set *) NULL) #define sizeof_fd_set(n) \ - ((unsigned) (NULL_fd_set->fds_bits + unix_howmany((n), UNIX_NFDBITS))) + ((unsigned) (NULL_fd_set->fds_bits + unix_howmany ((n), UNIX_NFDBITS))) #define UNIX_FD_SET(n, p) \ ((p)->fds_bits[(n)/UNIX_NFDBITS] |= (1L << ((n) % UNIX_NFDBITS))) #define UNIX_FD_CLR(n, p) \ @@ -1290,7 +1290,7 @@ start_thread_socket (select_record *me, select_stuff *stuff) int tmp = 1; (void) setsockopt (si->exitsock, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp)); - int sin_len = sizeof(si->sin); + int sin_len = sizeof (si->sin); memset (&si->sin, 0, sizeof (si->sin)); si->sin.sin_family = AF_INET; si->sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); @@ -1340,8 +1340,8 @@ socket_cleanup (select_record *, select_stuff *stuff) /* Set LINGER with 0 timeout for hard close */ struct linger tmp = {1, 0}; /* On, 0 delay */ - (void) setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof(tmp)); - (void) setsockopt (si->exitsock, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof(tmp)); + (void) setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof (tmp)); + (void) setsockopt (si->exitsock, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof (tmp)); /* Connecting to si->exitsock will cause any executing select to wake up. When this happens then the exitsock condition will cause the diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 8509ff8c4..091065241 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -461,7 +461,7 @@ proc_terminate (void) hwait_subproc->detach (); hwait_subproc = NULL; - sync_proc_subproc->acquire(WPSP); + sync_proc_subproc->acquire (WPSP); (void) proc_subproc (PROC_CLEARWAIT, 1); /* Clean out zombie processes from the pid list. */ @@ -474,7 +474,7 @@ proc_terminate (void) ForceCloseHandle1 (zombies[i]->pid_handle, pid_handle); } zombies[i]->process_state = PID_EXITED; /* CGF FIXME - still needed? */ - zombies[i].release(); // FIXME: this breaks older gccs for some reason + zombies[i].release (); // FIXME: this breaks older gccs for some reason } /* Disassociate my subprocesses */ @@ -564,7 +564,7 @@ sigproc_init () /* local event signaled when main thread has been dispatched to a signal handler function. */ - signal_arrived = CreateEvent(&sec_none_nih, TRUE, FALSE, NULL); + signal_arrived = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL); ProtectHandle (signal_arrived); hwait_sig = new cygthread (wait_sig, cygself, "sig"); diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 8e7d47cc5..4a8b48c3c 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -21,14 +21,14 @@ details. */ #include "cygthread.h" #define PROTECT(x) x[sizeof(x)-1] = 0 -#define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf("array bound exceeded %d\n", __LINE__); ExitProcess(1); } +#define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf ("array bound exceeded %d\n", __LINE__); ExitProcess (1); } class strace NO_COPY strace; #ifndef NOSTRACE void -strace::hello() +strace::hello () { char buf[30]; @@ -196,11 +196,11 @@ strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap int count; char buf[10000]; - PROTECT(buf); + PROTECT (buf); SetLastError (err); count = this->vsprntf (buf, func, fmt, ap); - CHECK(buf); + CHECK (buf); if (category & _STRACE_SYSTEM) { DWORD done; diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 650cad80a..167e9c0f9 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -783,7 +783,7 @@ chown_worker (const char *name, unsigned fmode, __uid32_t uid, __gid32_t gid) uid = old_uid; if (gid == ILLEGAL_GID) gid = old_gid; - if (win32_path.isdir()) + if (win32_path.isdir ()) attrib |= S_IFDIR; res = set_file_attribute (win32_path.has_acls (), win32_path, uid, gid, attrib); @@ -1969,7 +1969,7 @@ seteuid32 (__uid32_t uid) sav_token = cygheap->user.token; sav_impersonated = cygheap->user.impersonated; - RevertToSelf(); + RevertToSelf (); if (!OpenProcessToken (hMainProc, TOKEN_QUERY | TOKEN_ADJUST_DEFAULT, &ptok)) { __seterrno (); @@ -1979,7 +1979,7 @@ seteuid32 (__uid32_t uid) Currently we do not try to differentiate between internal tokens and others */ process_ok = verify_token (ptok, usersid, groups); - debug_printf("Process token %sverified", process_ok ? "" : "not "); + debug_printf ("Process token %sverified", process_ok ? "" : "not "); if (process_ok) { if (cygheap->user.issetuid ()) @@ -1996,7 +1996,7 @@ seteuid32 (__uid32_t uid) /* Verify if the current tokem is suitable */ BOOL token_ok = verify_token (cygheap->user.token, usersid, groups, &sav_token_is_internal_token); - debug_printf("Thread token %d %sverified", + debug_printf ("Thread token %d %sverified", cygheap->user.token, token_ok?"":"not "); if (!token_ok) cygheap->user.token = INVALID_HANDLE_VALUE; @@ -2014,8 +2014,8 @@ seteuid32 (__uid32_t uid) } /* Set process def dacl to allow access to impersonated token */ - char dacl_buf[MAX_DACL_LEN(5)]; - if (usersid != (origpsid = cygheap->user.orig_sid())) psid2 = usersid; + char dacl_buf[MAX_DACL_LEN (5)]; + if (usersid != (origpsid = cygheap->user.orig_sid ())) psid2 = usersid; if (sec_acl ((PACL) dacl_buf, FALSE, origpsid, psid2)) { TOKEN_DEFAULT_DACL tdacl; @@ -2030,7 +2030,7 @@ seteuid32 (__uid32_t uid) if (!process_ok && cygheap->user.token == INVALID_HANDLE_VALUE) { /* If no impersonation token is available, try to - authenticate using NtCreateToken() or subauthentication. */ + authenticate using NtCreateToken () or subauthentication. */ cygheap->user.token = create_token (usersid, groups, pw_new); if (cygheap->user.token != INVALID_HANDLE_VALUE) explicitly_created_token = TRUE; @@ -2059,7 +2059,7 @@ seteuid32 (__uid32_t uid) /* Try setting primary group in token to current group */ if (!SetTokenInformation (cygheap->user.token, TokenPrimaryGroup, - &groups.pgsid, sizeof(cygsid))) + &groups.pgsid, sizeof (cygsid))) debug_printf ("SetTokenInformation(user.token, " "TokenPrimaryGroup): %E"); } diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index 67099c282..0232faf39 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -72,9 +72,9 @@ sysconf (int in) != STATUS_SUCCESS) { __seterrno_from_win_error (RtlNtStatusToDosError (ret)); - debug_printf("NtQuerySystemInformation: ret = %d, " - "Dos(ret) = %d", - ret, RtlNtStatusToDosError (ret)); + debug_printf ("NtQuerySystemInformation: ret = %d, " + "Dos(ret) = %d", + ret, RtlNtStatusToDosError (ret)); return -1; } switch (in) diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index 11ae4b46c..f424a4f4e 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -42,11 +42,11 @@ get_win95_event_log_path () /* FIXME: For MT safe code these will need to be replaced */ #ifdef _MT_SAFE -#define process_ident _reent_winsup()->_process_ident -#define process_logopt _reent_winsup()->_process_logopt -#define process_facility _reent_winsup()->_process_facility +#define process_ident _reent_winsup ()->_process_ident +#define process_logopt _reent_winsup ()->_process_logopt +#define process_facility _reent_winsup ()->_process_facility /* Default priority logmask */ -#define process_logmask _reent_winsup()->_process_logmask +#define process_logmask _reent_winsup ()->_process_logmask #else static char *process_ident = 0; static int process_logopt = 0; @@ -303,7 +303,7 @@ syslog (int priority, const char *message, ...) if (process_logopt & LOG_PID) { if (pass.print ("Win32 Process Id = 0x%X : Cygwin Process Id = 0x%X : ", - GetCurrentProcessId(), getpid ()) == -1) + GetCurrentProcessId (), getpid ()) == -1) return; } @@ -389,7 +389,7 @@ syslog (int priority, const char *message, ...) HANDLE fHandle = cygheap->fdtab[fileno (fp)]->get_handle (); if (LockFile (fHandle, 0, 0, 1, 0) == FALSE) { - debug_printf ("failed to lock file %s", get_win95_event_log_path()); + debug_printf ("failed to lock file %s", get_win95_event_log_path ()); fclose (fp); return; } diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index 706a31a87..13b5e5251 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -238,14 +238,14 @@ tcsetpgrp (int fd, pid_t pgid) extern "C" speed_t cfgetospeed (struct termios *tp) { - return __tonew_termios(tp)->c_ospeed; + return __tonew_termios (tp)->c_ospeed; } /* cfgetispeed: POSIX96 7.1.3.1 */ extern "C" speed_t cfgetispeed (struct termios *tp) { - return __tonew_termios(tp)->c_ispeed; + return __tonew_termios (tp)->c_ispeed; } /* cfsetospeed: POSIX96 7.1.3.1 */ diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index e5e313044..84add47c5 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -308,7 +308,7 @@ pthread::precreate (pthread_attr *newattr) attr.stacksize = newattr->stacksize; } - if (!pthread_mutex::isGoodObject(&verifyable_mutex_obj)) + if (!pthread_mutex::isGoodObject (&verifyable_mutex_obj)) { thread_printf ("New thread object access mutex is not valid. this %p", this); @@ -1013,7 +1013,7 @@ pthread_key::set (const void *value) void * pthread_key::get () const { - int savedError = ::GetLastError(); + int savedError = ::GetLastError (); void *result = TlsGetValue (dwTlsIndex); ::SetLastError (savedError); return result; @@ -1038,7 +1038,7 @@ void pthread_key::run_destructor () const { if (destructor) - destructor (get()); + destructor (get ()); } /*pshared mutexs: diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index ed0680235..6bb981d1a 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -96,7 +96,7 @@ settimeofday (const struct timeval *tv, const struct timezone *tz) tz = tz; /* silence warning about unused variable */ - ptm = gmtime(&tv->tv_sec); + ptm = gmtime (&tv->tv_sec); st.wYear = ptm->tm_year + 1900; st.wMonth = ptm->tm_mon + 1; st.wDayOfWeek = ptm->tm_wday; @@ -106,7 +106,7 @@ settimeofday (const struct timeval *tv, const struct timezone *tz) st.wSecond = ptm->tm_sec; st.wMilliseconds = tv->tv_usec / 1000; - res = !SetSystemTime(&st); + res = !SetSystemTime (&st); syscall_printf ("%d = settimeofday (%x, %x)", res, tv, tz); @@ -118,13 +118,13 @@ extern "C" char * timezone () { #ifdef _MT_SAFE - char *b=_reent_winsup()->timezone_buf; + char *b=_reent_winsup ()->timezone_buf; #else static NO_COPY char b[20] = {0}; #endif - tzset(); - __small_sprintf (b,"GMT%+d:%02d", (int) (-_timezone / 3600), (int) (abs(_timezone / 60) % 60)); + tzset (); + __small_sprintf (b,"GMT%+d:%02d", (int) (-_timezone / 3600), (int) (abs (_timezone / 60) % 60)); return b; } @@ -158,7 +158,7 @@ gettimeofday (struct timeval *tv, struct timezone *tz) { if (!tzflag) { - tzset(); + tzset (); tzflag = true; } tz->tz_minuteswest = _timezone / 60; diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 6804c97a5..fc8b73cc6 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -118,7 +118,7 @@ uinfo_init () /* Real and effective uid/gid are identical on process start up. */ cygheap->user.orig_uid = cygheap->user.real_uid = myself->uid; cygheap->user.orig_gid = cygheap->user.real_gid = myself->gid; - cygheap->user.set_orig_sid(); /* Update the original sid */ + cygheap->user.set_orig_sid (); /* Update the original sid */ cygheap->user.token = INVALID_HANDLE_VALUE; /* No token present */ } @@ -259,7 +259,7 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw) { WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3]; sys_mbstowcs (wlogsrv, logsrv (), - sizeof (wlogsrv) / sizeof(*wlogsrv)); + sizeof (wlogsrv) / sizeof (*wlogsrv)); sys_mbstowcs (wuser, winname (), sizeof (wuser) / sizeof (*wuser)); if (!(ret = NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui))) { diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc index a702bfeea..01b6660b3 100644 --- a/winsup/cygwin/wincap.cc +++ b/winsup/cygwin/wincap.cc @@ -477,14 +477,14 @@ wincapc::init () { case 0: os = "95"; - if (strchr(version.szCSDVersion, 'C')) + if (strchr (version.szCSDVersion, 'C')) caps = &wincap_95osr2; else caps = &wincap_95; break; case 10: os = "98"; - if (strchr(version.szCSDVersion, 'A')) + if (strchr (version.szCSDVersion, 'A')) caps = &wincap_98se; else caps = &wincap_98;