More GNUify non-GNU formatted functions calls throughout.

This commit is contained in:
Christopher Faylor 2002-09-23 00:31:31 +00:00
parent c87c8a533f
commit f0227ea3c7
23 changed files with 77 additions and 78 deletions

View File

@ -1,3 +1,7 @@
2002-09-22 Christopher Faylor <cgf@redhat.com>
More GNUify non-GNU formatted functions calls throughout.
2002-09-22 Christopher Faylor <cgf@redhat.com> 2002-09-22 Christopher Faylor <cgf@redhat.com>
* Makefile.in (DLL_O_FILES): Restore formatting. * Makefile.in (DLL_O_FILES): Restore formatting.

View File

@ -263,7 +263,7 @@ _crealloc (void *ptr, int size)
/* End Copyright (C) 1997 DJ Delorie */ /* End Copyright (C) 1997 DJ Delorie */
#define sizeof_cygheap(n) ((n) + sizeof(cygheap_entry)) #define sizeof_cygheap(n) ((n) + sizeof (cygheap_entry))
#define N ((cygheap_entry *) NULL) #define N ((cygheap_entry *) NULL)
#define tocygheap(s) ((cygheap_entry *) (((char *) (s)) - (int) (N->data))) #define tocygheap(s) ((cygheap_entry *) (((char *) (s)) - (int) (N->data)))

View File

@ -24,7 +24,7 @@ void
delqueue_list::init () delqueue_list::init ()
{ {
empty = 1; empty = 1;
memset(inuse, 0, MAX_DELQUEUES_PENDING); memset (inuse, 0, MAX_DELQUEUES_PENDING);
} }
void void
@ -43,7 +43,7 @@ delqueue_list::queue_file (const char *dosname)
{ {
/* check for duplicates */ /* check for duplicates */
for (int i=0; i < MAX_DELQUEUES_PENDING; i++) for (int i=0; i < MAX_DELQUEUES_PENDING; i++)
if (inuse[i] && strcmp(name[i], temp) == 0) if (inuse[i] && strcmp (name[i], temp) == 0)
return; return;
} }
@ -52,7 +52,7 @@ delqueue_list::queue_file (const char *dosname)
{ {
/* set the name first, in case someone else is running the /* set the name first, in case someone else is running the
queue they'll get a valid name */ queue they'll get a valid name */
strcpy(name[i], temp); strcpy (name[i], temp);
inuse[i] = 1; inuse[i] = 1;
empty = 0; empty = 0;
debug_printf ("adding '%s' to queue %d", temp, i); debug_printf ("adding '%s' to queue %d", temp, i);

View File

@ -240,7 +240,7 @@ mkdir (const char *dir, mode_t mode)
goto done; goto done;
} }
nofinalslash(real_dir.get_win32 (), real_dir.get_win32 ()); nofinalslash (real_dir.get_win32 (), real_dir.get_win32 ());
if (! writable_directory (real_dir.get_win32 ())) if (! writable_directory (real_dir.get_win32 ()))
goto done; goto done;

View File

@ -29,7 +29,7 @@ static int dll_global_dtors_recorded;
/* Run destructors for all DLLs on exit. */ /* Run destructors for all DLLs on exit. */
static void static void
dll_global_dtors() dll_global_dtors ()
{ {
for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ()) for (dll *d = dlls.istart (DLL_ANY); d; d = dlls.inext ())
d->p.run_dtors (); d->p.run_dtors ();

View File

@ -691,7 +691,7 @@ dtable::vfork_child_fixup ()
} }
#define DEVICE_PREFIX "\\device\\" #define DEVICE_PREFIX "\\device\\"
#define DEVICE_PREFIX_LEN sizeof(DEVICE_PREFIX) - 1 #define DEVICE_PREFIX_LEN sizeof (DEVICE_PREFIX) - 1
#define REMOTE "\\Device\\LanmanRedirector\\" #define REMOTE "\\Device\\LanmanRedirector\\"
#define REMOTE_LEN sizeof (REMOTE) - 1 #define REMOTE_LEN sizeof (REMOTE) - 1

View File

@ -622,7 +622,7 @@ regopt (const char *name)
/* FIXME: should not be under mount */ /* FIXME: should not be under mount */
reg_key r (KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL); reg_key r (KEY_READ, CYGWIN_INFO_PROGRAM_OPTIONS_NAME, NULL);
char buf[MAX_PATH]; char buf[MAX_PATH];
char lname[strlen(name) + 1]; char lname[strlen (name) + 1];
strlwr (strcpy (lname, name)); strlwr (strcpy (lname, name));
if (r.get_string (lname, buf, sizeof (buf) - 1, "") == ERROR_SUCCESS) if (r.get_string (lname, buf, sizeof (buf) - 1, "") == ERROR_SUCCESS)
@ -665,8 +665,8 @@ environ_init (char **envp, int envc)
{ {
for (int i = 0; conv_envvars[i].name != NULL; i++) for (int i = 0; conv_envvars[i].name != NULL; i++)
{ {
conv_start_chars[cyg_tolower(conv_envvars[i].name[0])] = 1; conv_start_chars[cyg_tolower (conv_envvars[i].name[0])] = 1;
conv_start_chars[cyg_toupper(conv_envvars[i].name[0])] = 1; conv_start_chars[cyg_toupper (conv_envvars[i].name[0])] = 1;
} }
initted = 1; initted = 1;
} }
@ -728,8 +728,8 @@ environ_init (char **envp, int envc)
ucenv (newp, eq); ucenv (newp, eq);
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0) if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
sawTERM = 1; sawTERM = 1;
if (*newp == 'C' && strncmp (newp, "CYGWIN=", sizeof("CYGWIN=") - 1) == 0) if (*newp == 'C' && strncmp (newp, "CYGWIN=", sizeof ("CYGWIN=") - 1) == 0)
parse_options (newp + sizeof("CYGWIN=") - 1); parse_options (newp + sizeof ("CYGWIN=") - 1);
if (*eq && conv_start_chars[(unsigned char)envp[i][0]]) if (*eq && conv_start_chars[(unsigned char)envp[i][0]])
posify (envp + i, *++eq ? eq : --eq); posify (envp + i, *++eq ? eq : --eq);
debug_printf ("%p: %s", envp[i], envp[i]); debug_printf ("%p: %s", envp[i], envp[i]);

View File

@ -617,7 +617,7 @@ fhandler_base::write (const void *ptr, size_t len)
fill in the gap with zeros. - DJ */ fill in the gap with zeros. - DJ */
char zeros[512]; char zeros[512];
int number_of_zeros_to_write = current_position - actual_length; int number_of_zeros_to_write = current_position - actual_length;
memset(zeros, 0, 512); memset (zeros, 0, 512);
SetFilePointer (get_handle (), 0, 0, FILE_END); SetFilePointer (get_handle (), 0, 0, FILE_END);
while (number_of_zeros_to_write > 0) while (number_of_zeros_to_write > 0)
{ {

View File

@ -116,7 +116,7 @@ fhandler_dev_mem::open (path_conv *, int flags, mode_t)
HANDLE mem; HANDLE mem;
NTSTATUS ret = NtOpenSection (&mem, section_access, &attr); NTSTATUS ret = NtOpenSection (&mem, section_access, &attr);
if (!NT_SUCCESS(ret)) if (!NT_SUCCESS (ret))
{ {
__seterrno_from_win_error (RtlNtStatusToDosError (ret)); __seterrno_from_win_error (RtlNtStatusToDosError (ret));
set_io_handle (NULL); set_io_handle (NULL);
@ -166,7 +166,7 @@ fhandler_dev_mem::write (const void *ptr, size_t ulen)
memcpy ((char *) viewmem + (pos - phys.QuadPart), ptr, ulen); memcpy ((char *) viewmem + (pos - phys.QuadPart), ptr, ulen);
if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem))) if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
{ {
__seterrno_from_win_error (RtlNtStatusToDosError (ret)); __seterrno_from_win_error (RtlNtStatusToDosError (ret));
return -1; return -1;
@ -214,7 +214,7 @@ fhandler_dev_mem::read (void *ptr, size_t ulen)
memcpy (ptr, (char *) viewmem + (pos - phys.QuadPart), ulen); memcpy (ptr, (char *) viewmem + (pos - phys.QuadPart), ulen);
if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem))) if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, viewmem)))
{ {
__seterrno_from_win_error (RtlNtStatusToDosError (ret)); __seterrno_from_win_error (RtlNtStatusToDosError (ret));
return -1; return -1;
@ -304,7 +304,7 @@ fhandler_dev_mem::mmap (caddr_t *addr, size_t len, DWORD access,
HANDLE h; HANDLE h;
NTSTATUS ret = NtOpenSection (&h, section_access, &attr); NTSTATUS ret = NtOpenSection (&h, section_access, &attr);
if (!NT_SUCCESS(ret)) if (!NT_SUCCESS (ret))
{ {
__seterrno_from_win_error (RtlNtStatusToDosError (ret)); __seterrno_from_win_error (RtlNtStatusToDosError (ret));
syscall_printf ("-1 = mmap(): NtOpenSection failed with %E"); syscall_printf ("-1 = mmap(): NtOpenSection failed with %E");
@ -348,7 +348,7 @@ int
fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len) fhandler_dev_mem::munmap (HANDLE h, caddr_t addr, size_t len)
{ {
NTSTATUS ret; NTSTATUS ret;
if (!NT_SUCCESS(ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr))) if (!NT_SUCCESS (ret = NtUnmapViewOfSection (INVALID_HANDLE_VALUE, addr)))
{ {
__seterrno_from_win_error (RtlNtStatusToDosError (ret)); __seterrno_from_win_error (RtlNtStatusToDosError (ret));
return -1; return -1;

View File

@ -62,7 +62,7 @@ static const char * const process_listing[] =
}; };
static const int PROCESS_LINK_COUNT = static const int PROCESS_LINK_COUNT =
(sizeof(process_listing) / sizeof(const char *)) - 1; (sizeof (process_listing) / sizeof (const char *)) - 1;
static off_t format_process_stat (_pinfo *p, char *destbuf, size_t maxsize); 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_status (_pinfo *p, char *destbuf, size_t maxsize);
@ -475,7 +475,7 @@ format_process_stat (_pinfo *p, char *destbuf, size_t maxsize)
} }
else else
{ {
start_time = (GetTickCount() / 1000 - time(NULL) + p->start_time) * HZ; start_time = (GetTickCount () / 1000 - time (NULL) + p->start_time) * HZ;
} }
return __small_sprintf (destbuf, "%d (%s) %c " return __small_sprintf (destbuf, "%d (%s) %c "
"%d %d %d %d %d " "%d %d %d %d %d "

View File

@ -225,11 +225,11 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
if (tc->ti.c_lflag & ISIG) if (tc->ti.c_lflag & ISIG)
{ {
int sig; int sig;
if (CCEQ(tc->ti.c_cc[VINTR], c)) if (CCEQ (tc->ti.c_cc[VINTR], c))
sig = SIGINT; sig = SIGINT;
else if (CCEQ(tc->ti.c_cc[VQUIT], c)) else if (CCEQ (tc->ti.c_cc[VQUIT], c))
sig = SIGQUIT; sig = SIGQUIT;
else if (CCEQ(tc->ti.c_cc[VSUSP], c)) else if (CCEQ (tc->ti.c_cc[VSUSP], c))
sig = SIGTSTP; sig = SIGTSTP;
else else
goto not_a_sig; goto not_a_sig;
@ -244,7 +244,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
not_a_sig: not_a_sig:
if (tc->ti.c_iflag & IXON) if (tc->ti.c_iflag & IXON)
{ {
if (CCEQ(tc->ti.c_cc[VSTOP], c)) if (CCEQ (tc->ti.c_cc[VSTOP], c))
{ {
if (!tc->output_stopped) if (!tc->output_stopped)
{ {
@ -253,7 +253,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
} }
continue; continue;
} }
else if (CCEQ(tc->ti.c_cc[VSTART], c)) else if (CCEQ (tc->ti.c_cc[VSTART], c))
{ {
restart_output: restart_output:
tc->output_stopped = 0; tc->output_stopped = 0;
@ -263,20 +263,20 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
else if ((tc->ti.c_iflag & IXANY) && tc->output_stopped) else if ((tc->ti.c_iflag & IXANY) && tc->output_stopped)
goto restart_output; goto restart_output;
} }
if (iscanon && tc->ti.c_lflag & IEXTEN && CCEQ(tc->ti.c_cc[VDISCARD], c)) if (iscanon && tc->ti.c_lflag & IEXTEN && CCEQ (tc->ti.c_cc[VDISCARD], c))
{ {
tc->ti.c_lflag ^= FLUSHO; tc->ti.c_lflag ^= FLUSHO;
continue; continue;
} }
if (!iscanon) if (!iscanon)
/* nothing */; /* nothing */;
else if (CCEQ(tc->ti.c_cc[VERASE], c)) else if (CCEQ (tc->ti.c_cc[VERASE], c))
{ {
if (eat_readahead (1)) if (eat_readahead (1))
echo_erase (); echo_erase ();
continue; continue;
} }
else if (CCEQ(tc->ti.c_cc[VWERASE], c)) else if (CCEQ (tc->ti.c_cc[VWERASE], c))
{ {
int ch; int ch;
do do
@ -287,7 +287,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
while ((ch = peek_readahead (1)) >= 0 && !isspace (ch)); while ((ch = peek_readahead (1)) >= 0 && !isspace (ch));
continue; continue;
} }
else if (CCEQ(tc->ti.c_cc[VKILL], c)) else if (CCEQ (tc->ti.c_cc[VKILL], c))
{ {
int nchars = eat_readahead (-1); int nchars = eat_readahead (-1);
if (tc->ti.c_lflag & ECHO) if (tc->ti.c_lflag & ECHO)
@ -295,7 +295,7 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
echo_erase (1); echo_erase (1);
continue; continue;
} }
else if (CCEQ(tc->ti.c_cc[VREPRINT], c)) else if (CCEQ (tc->ti.c_cc[VREPRINT], c))
{ {
if (tc->ti.c_lflag & ECHO) if (tc->ti.c_lflag & ECHO)
{ {
@ -304,14 +304,14 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept)
} }
continue; continue;
} }
else if (CCEQ(tc->ti.c_cc[VEOF], c)) else if (CCEQ (tc->ti.c_cc[VEOF], c))
{ {
termios_printf ("EOF"); termios_printf ("EOF");
input_done = 1; input_done = 1;
continue; continue;
} }
else if (CCEQ(tc->ti.c_cc[VEOL], c) || else if (CCEQ (tc->ti.c_cc[VEOL], c) ||
CCEQ(tc->ti.c_cc[VEOL2], c) || CCEQ (tc->ti.c_cc[VEOL2], c) ||
c == '\n') c == '\n')
{ {
set_input_done (1); set_input_done (1);

View File

@ -19,10 +19,10 @@ extern "C"
/* Notes: we return a valid key even if id's low order 8 bits are 0. */ /* Notes: we return a valid key even if id's low order 8 bits are 0. */
key_t key_t
ftok(const char *path, int id) ftok (const char *path, int id)
{ {
struct stat statbuf; struct stat statbuf;
if (stat(path, &statbuf)) if (stat (path, &statbuf))
{ {
/* stat set the appropriate errno for us */ /* stat set the appropriate errno for us */
return (key_t) -1; return (key_t) -1;

View File

@ -777,8 +777,8 @@ tzload(const char *name, struct state *sp)
if (fid == -2) if (fid == -2)
{ {
memcpy(u.buf, _posixrules_data, sizeof(_posixrules_data)); memcpy(u.buf, _posixrules_data, sizeof (_posixrules_data));
i = sizeof(_posixrules_data); i = sizeof (_posixrules_data);
} }
else else
{ {
@ -1473,7 +1473,7 @@ tzset P((void))
if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0)
return; return;
lcl_is_set = (strlen(name) < sizeof(lcl_TZname)); lcl_is_set = (strlen(name) < sizeof (lcl_TZname));
if (lcl_is_set) if (lcl_is_set)
(void) strcpy(lcl_TZname, name); (void) strcpy(lcl_TZname, name);

View File

@ -35,11 +35,6 @@ details. */
static int export_malloc_called; static int export_malloc_called;
static int use_internal_malloc = 1; static int use_internal_malloc = 1;
#undef in
#undef out
#define in(x)
#define out(x)
#ifdef MALLOC_DEBUG #ifdef MALLOC_DEBUG
extern "C" void * _sbrk (size_t incr_arg); extern "C" void * _sbrk (size_t incr_arg);

View File

@ -25,8 +25,8 @@ details. */
#define PAGE_CNT(bytes) howmany((bytes),getpagesize()) #define PAGE_CNT(bytes) howmany((bytes),getpagesize())
#define PGBITS (sizeof(DWORD)*8) #define PGBITS (sizeof (DWORD)*8)
#define MAPSIZE(pages) howmany((pages),PGBITS) #define MAPSIZE(pages) howmany ((pages), PGBITS)
#define MAP_SET(n) (map_map_[(n)/PGBITS] |= (1L << ((n) % PGBITS))) #define MAP_SET(n) (map_map_[(n)/PGBITS] |= (1L << ((n) % PGBITS)))
#define MAP_CLR(n) (map_map_[(n)/PGBITS] &= ~(1L << ((n) % PGBITS))) #define MAP_CLR(n) (map_map_[(n)/PGBITS] &= ~(1L << ((n) % PGBITS)))
@ -80,7 +80,7 @@ class mmap_record
void alloc_map () void alloc_map ()
{ {
/* Allocate one bit per page */ /* Allocate one bit per page */
map_map_ = (DWORD *) calloc (MAPSIZE(PAGE_CNT (size_to_map_)), map_map_ = (DWORD *) calloc (MAPSIZE (PAGE_CNT (size_to_map_)),
sizeof (DWORD)); sizeof (DWORD));
if (wincap.virtual_protect_works_on_shared_pages ()) if (wincap.virtual_protect_works_on_shared_pages ())
{ {
@ -191,7 +191,7 @@ mmap_record::unmap_map (caddr_t addr, DWORD len)
MAP_CLR (off); MAP_CLR (off);
/* Return TRUE if all pages are free'd which may result in unmapping /* Return TRUE if all pages are free'd which may result in unmapping
the whole chunk. */ the whole chunk. */
for (len = MAPSIZE(PAGE_CNT (size_to_map_)); len > 0; ) for (len = MAPSIZE (PAGE_CNT (size_to_map_)); len > 0; )
if (map_map_[--len]) if (map_map_[--len])
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -277,7 +277,7 @@ public:
list::list () list::list ()
: nrecs (0), maxrecs (10), fd (0), hash (0) : nrecs (0), maxrecs (10), fd (0), hash (0)
{ {
recs = (mmap_record *) malloc (10 * sizeof(mmap_record)); recs = (mmap_record *) malloc (10 * sizeof (mmap_record));
} }
list::~list () list::~list ()
@ -362,7 +362,7 @@ public:
map::map () map::map ()
{ {
lists = (list **) malloc (10 * sizeof(list *)); lists = (list **) malloc (10 * sizeof (list *));
nlists = 0; nlists = 0;
maxlists = 10; maxlists = 10;
} }

View File

@ -918,7 +918,7 @@ dup_hostent_ptr (struct hostent *src)
if (src->h_aliases && !(dst->h_aliases = dup_char_list (src->h_aliases))) if (src->h_aliases && !(dst->h_aliases = dup_char_list (src->h_aliases)))
goto out; goto out;
if (src->h_addr_list if (src->h_addr_list
&& !(dst->h_addr_list = dup_addr_list(src->h_addr_list, src->h_length))) && !(dst->h_addr_list = dup_addr_list (src->h_addr_list, src->h_length)))
goto out; goto out;
debug_printf ("hostent: copied %s", dst->h_name); debug_printf ("hostent: copied %s", dst->h_name);

View File

@ -1304,7 +1304,7 @@ slash_unc_prefix_p (const char *path)
&& isalpha (path[2]) && isalpha (path[2])
&& path[3] != 0 && path[3] != 0
&& !isdirsep (path[3]) && !isdirsep (path[3])
&& ((p = strpbrk(path + 3, "\\/")) != NULL)); && ((p = strpbrk (path + 3, "\\/")) != NULL));
if (!ret || p == NULL) if (!ret || p == NULL)
return ret; return ret;
return ret && isalnum (p[1]); return ret && isalnum (p[1]);

View File

@ -1,6 +1,6 @@
/* sched.cc: scheduler interface for Cygwin /* sched.cc: scheduler interface for Cygwin
Copyright 2001 Red Hat, Inc. Copyright 2001, 2002 Red Hat, Inc.
Written by Robert Collins <rbtcollins@hotmail.com> Written by Robert Collins <rbtcollins@hotmail.com>
@ -81,7 +81,7 @@ sched_get_priority_min (int policy)
/* Check a scheduler parameter struct for valid settings */ /* Check a scheduler parameter struct for valid settings */
int int
valid_sched_parameters(const struct sched_param *param) valid_sched_parameters (const struct sched_param *param)
{ {
if (param->sched_priority < -14 || param->sched_priority > 15) if (param->sched_priority < -14 || param->sched_priority > 15)
{ {
@ -283,7 +283,7 @@ sched_setparam (pid_t pid, const struct sched_param *param)
return -1; return -1;
} }
if (!valid_sched_parameters(param)) if (!valid_sched_parameters (param))
{ {
set_errno (EINVAL); set_errno (EINVAL);
return -1; return -1;
@ -400,7 +400,7 @@ sched_setparam (pid_t pid, const struct sched_param *param)
* a wide range of values is to allow more flexible code in the future. * a wide range of values is to allow more flexible code in the future.
*/ */
int int
sched_set_thread_priority(HANDLE thread, int priority) sched_set_thread_priority (HANDLE thread, int priority)
{ {
int real_pri; int real_pri;
real_pri = 16 - ((priority + 16) >> 1); real_pri = 16 - ((priority + 16) >> 1);
@ -418,7 +418,7 @@ sched_set_thread_priority(HANDLE thread, int priority)
else else
real_pri = THREAD_PRIORITY_HIGHEST; real_pri = THREAD_PRIORITY_HIGHEST;
if (!SetThreadPriority(thread, real_pri)) if (!SetThreadPriority (thread, real_pri))
/* invalid handle, no access are the only expected errors. */ /* invalid handle, no access are the only expected errors. */
return EPERM; return EPERM;
return 0; return 0;

View File

@ -555,9 +555,9 @@ out:
static int static int
start_thread_pipe (select_record *me, select_stuff *stuff) start_thread_pipe (select_record *me, select_stuff *stuff)
{ {
if (stuff->device_specific[FHDEVN(FH_PIPE)]) if (stuff->device_specific[FHDEVN (FH_PIPE)])
{ {
me->h = *((pipeinf *) stuff->device_specific[FHDEVN(FH_PIPE)])->thread; me->h = *((pipeinf *) stuff->device_specific[FHDEVN (FH_PIPE)])->thread;
return 1; return 1;
} }
pipeinf *pi = new pipeinf; pipeinf *pi = new pipeinf;
@ -567,20 +567,20 @@ start_thread_pipe (select_record *me, select_stuff *stuff)
me->h = *pi->thread; me->h = *pi->thread;
if (!me->h) if (!me->h)
return 0; return 0;
stuff->device_specific[FHDEVN(FH_PIPE)] = (void *)pi; stuff->device_specific[FHDEVN (FH_PIPE)] = (void *)pi;
return 1; return 1;
} }
static void static void
pipe_cleanup (select_record *, select_stuff *stuff) pipe_cleanup (select_record *, select_stuff *stuff)
{ {
pipeinf *pi = (pipeinf *)stuff->device_specific[FHDEVN(FH_PIPE)]; pipeinf *pi = (pipeinf *)stuff->device_specific[FHDEVN (FH_PIPE)];
if (pi && pi->thread) if (pi && pi->thread)
{ {
pi->stop_thread_pipe = true; pi->stop_thread_pipe = true;
pi->thread->detach (); pi->thread->detach ();
delete pi; delete pi;
stuff->device_specific[FHDEVN(FH_PIPE)] = NULL; stuff->device_specific[FHDEVN (FH_PIPE)] = NULL;
} }
} }
@ -976,9 +976,9 @@ thread_serial (void *arg)
static int static int
start_thread_serial (select_record *me, select_stuff *stuff) start_thread_serial (select_record *me, select_stuff *stuff)
{ {
if (stuff->device_specific[FHDEVN(FH_SERIAL)]) if (stuff->device_specific[FHDEVN (FH_SERIAL)])
{ {
me->h = *((serialinf *) stuff->device_specific[FHDEVN(FH_SERIAL)])->thread; me->h = *((serialinf *) stuff->device_specific[FHDEVN (FH_SERIAL)])->thread;
return 1; return 1;
} }
serialinf *si = new serialinf; serialinf *si = new serialinf;
@ -986,20 +986,20 @@ start_thread_serial (select_record *me, select_stuff *stuff)
si->stop_thread_serial = FALSE; si->stop_thread_serial = FALSE;
si->thread = new cygthread (thread_serial, (LPVOID)si, "select_serial"); si->thread = new cygthread (thread_serial, (LPVOID)si, "select_serial");
me->h = *si->thread; me->h = *si->thread;
stuff->device_specific[FHDEVN(FH_SERIAL)] = (void *)si; stuff->device_specific[FHDEVN (FH_SERIAL)] = (void *)si;
return 1; return 1;
} }
static void static void
serial_cleanup (select_record *, select_stuff *stuff) serial_cleanup (select_record *, select_stuff *stuff)
{ {
serialinf *si = (serialinf *)stuff->device_specific[FHDEVN(FH_SERIAL)]; serialinf *si = (serialinf *)stuff->device_specific[FHDEVN (FH_SERIAL)];
if (si && si->thread) if (si && si->thread)
{ {
si->stop_thread_serial = true; si->stop_thread_serial = true;
si->thread->detach (); si->thread->detach ();
delete si; delete si;
stuff->device_specific[FHDEVN(FH_SERIAL)] = NULL; stuff->device_specific[FHDEVN (FH_SERIAL)] = NULL;
} }
} }
@ -1247,7 +1247,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
{ {
socketinf *si; socketinf *si;
if ((si = (socketinf *)stuff->device_specific[FHDEVN(FH_SOCKET)])) if ((si = (socketinf *)stuff->device_specific[FHDEVN (FH_SOCKET)]))
{ {
me->h = *si->thread; me->h = *si->thread;
return 1; return 1;
@ -1315,7 +1315,7 @@ start_thread_socket (select_record *me, select_stuff *stuff)
select_printf ("exitsock %p", si->exitsock); select_printf ("exitsock %p", si->exitsock);
WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->readfds); WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->readfds);
WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->exceptfds); WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->exceptfds);
stuff->device_specific[FHDEVN(FH_SOCKET)] = (void *) si; stuff->device_specific[FHDEVN (FH_SOCKET)] = (void *) si;
si->start = &stuff->start; si->start = &stuff->start;
select_printf ("stuff_start %p", &stuff->start); select_printf ("stuff_start %p", &stuff->start);
si->thread = new cygthread (thread_socket, (LPVOID)si, "select_socket"); si->thread = new cygthread (thread_socket, (LPVOID)si, "select_socket");
@ -1331,7 +1331,7 @@ err:
void void
socket_cleanup (select_record *, select_stuff *stuff) socket_cleanup (select_record *, select_stuff *stuff)
{ {
socketinf *si = (socketinf *)stuff->device_specific[FHDEVN(FH_SOCKET)]; socketinf *si = (socketinf *)stuff->device_specific[FHDEVN (FH_SOCKET)];
select_printf ("si %p si->thread %p", si, si ? si->thread : NULL); select_printf ("si %p si->thread %p", si, si ? si->thread : NULL);
if (si && si->thread) if (si && si->thread)
{ {
@ -1359,7 +1359,7 @@ socket_cleanup (select_record *, select_stuff *stuff)
si->thread->detach (); si->thread->detach ();
shutdown (si->exitsock, SD_BOTH); shutdown (si->exitsock, SD_BOTH);
closesocket (si->exitsock); closesocket (si->exitsock);
stuff->device_specific[FHDEVN(FH_SOCKET)] = NULL; stuff->device_specific[FHDEVN (FH_SOCKET)] = NULL;
delete si; delete si;
} }
select_printf ("returning"); select_printf ("returning");

View File

@ -202,7 +202,7 @@ _kill (pid_t pid, int sig)
/* Silently ignore stop signals from a member of orphaned process group. /* Silently ignore stop signals from a member of orphaned process group.
FIXME: Why??? */ FIXME: Why??? */
if (ISSTATE(myself, PID_ORPHANED) && if (ISSTATE (myself, PID_ORPHANED) &&
(sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU)) (sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU))
sig = 0; sig = 0;
@ -230,7 +230,7 @@ kill_pgrp (pid_t pid, int sig)
/* Is it a process we want to kill? */ /* Is it a process we want to kill? */
if ((pid == 0 && (p->pgid != myself->pgid || p->ctty != myself->ctty)) || if ((pid == 0 && (p->pgid != myself->pgid || p->ctty != myself->ctty)) ||
(pid > 1 && p->pgid != pid) || (pid > 1 && p->pgid != pid) ||
(sig < 0 && NOTSTATE(p, PID_STOPPED))) (sig < 0 && NOTSTATE (p, PID_STOPPED)))
continue; continue;
sigproc_printf ("killing pid %d, pgrp %d, p->ctty %d, myself->ctty %d", sigproc_printf ("killing pid %d, pgrp %d, p->ctty %d, myself->ctty %d",
p->pid, p->pgid, p->ctty, myself->ctty); p->pid, p->pgid, p->ctty, myself->ctty);

View File

@ -20,8 +20,8 @@ details. */
#include "hires.h" #include "hires.h"
#include "cygthread.h" #include "cygthread.h"
#define PROTECT(x) x[sizeof(x)-1] = 0 #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; class strace NO_COPY strace;
@ -77,7 +77,7 @@ getfunc (char *in_dst, const char *func)
for (p = func; (pe = strchr (p, '(')); p = pe + 1) for (p = func; (pe = strchr (p, '(')); p = pe + 1)
if (isalnum ((int)pe[-1]) || pe[-1] == '_') if (isalnum ((int)pe[-1]) || pe[-1] == '_')
break; break;
else if (isspace((int)pe[-1])) else if (isspace ((int)pe[-1]))
{ {
pe--; pe--;
break; break;

View File

@ -334,7 +334,7 @@ corelocaltime (const time_t * tim_p)
int yleap; int yleap;
_CONST int *ip; _CONST int *ip;
#ifdef _MT_SAFE #ifdef _MT_SAFE
struct tm &localtime_buf=_reent_winsup()->_localtime_buf; struct tm &localtime_buf=_reent_winsup ()->_localtime_buf;
#else #else
static NO_COPY struct tm localtime_buf = {0}; static NO_COPY struct tm localtime_buf = {0};
#endif #endif
@ -416,7 +416,7 @@ localtime (const time_t *tim_p)
time_t tim = *tim_p; time_t tim = *tim_p;
struct tm *rtm; struct tm *rtm;
tzset(); tzset ();
tim -= _timezone; tim -= _timezone;

View File

@ -64,7 +64,7 @@ WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
} }
return 0; return 0;
case WM_ASYNCIO: case WM_ASYNCIO:
if (WSAGETSELECTEVENT(lParam) == FD_OOB) if (WSAGETSELECTEVENT (lParam) == FD_OOB)
raise (SIGURG); raise (SIGURG);
else else
raise (SIGIO); raise (SIGIO);