OSDN Git Service

fed985cf3f2778f76afc9c9b4968881e523d74b0
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / ChangeLog
1 2011-12-16  Christopher Faylor  <me.cygwin2011@cgf.cx>
2
3         Implement fhandler reference counting.
4         * cygheap.h (cygheap_fdmanip::release): Make virtual.
5         (cygheap_fdnew::~cygheap_fdnew): New destructor increments reference
6         count when fd has been allocated.
7         (cygheap_fdget::fh): New (old?) field.
8         (cygheap_fdget::cygheap_fdget): Increment reference count when we've
9         found an active fd.  Set fh appropriately.
10         (cygheap_fdget::~cygheap_fdget): Decrement reference count when
11         appropriate.  Delete fh if reference count goes to zero.
12         (cygheap_fdget::release): New function.  Do more bookkeping on release.
13         * dtable.cc (dtable::release): Change from void to boolean return.
14         Only delete the fhandler when its reference count is <= 0 (this should
15         be a fairly unusual case).  Return true if fhandler has been deleted.
16         (cygwin_attach_handle_to_fd): Increment reference count when fh is
17         assigned.
18         (dtable::init_std_file_from_handle): Ditto.
19         * dtable.h (dtable::release): Change return to boolean.
20         * fhandler.cc (fhandler_base::fhandler_base): Set new isclosed flag to
21         false.  Set _refcnt to zero.
22         (fhandler_base::close): Simplify paranoid debugging output.  Set new
23         isclosed() flag.
24         (fhandler_base_overlapped::wait_overlapped): Use isclosed() flag to
25         avoid querying the exception handle.
26         * fhandler.h (fhandler_base::_refcnt): New field.
27         (fhandler_base::refcnt): New function.
28         (fhandler_base::isclosed): Implement.
29         (fhandler_base::fhandler_base): Set isclosed to false.
30
31         * syscalls.cc: Remove space after function before parentheses for
32         several strace printfs.
33         (dup): Add standard strace "leaver" code.
34         (dup2): Ditto.
35         (dup3): Ditto.
36         (remove): Ditto.
37         (getpid): Ditto.
38         (getppid): Ditto.
39         (lseek64): Fix strace debugging to correctly use %R.
40
41         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Avoid sending
42         signals to other processes if we're debugging since it can cause a
43         deadlock with the calling debugger.
44
45         * exceptions.cc (_cygtls::call_signal_handler): Add debugging-only
46         strace output.
47
48 2011-12-16  Corinna Vinschen  <vinschen@redhat.com>
49
50         * dcrt0.cc (child_info_fork::alloc_stack): Correctly check if the
51         parent stack fits into the child stack.  Align comment.
52         * wow64.cc (wow64_eval_expected_main_stack): New function to fetch
53         expected addresses of main thread stack from PE/COFF image header
54         values.
55         (wow64_test_for_64bit_parent): Fix comment.  Check current stack
56         against real expected main thread stack addresses.
57         (wow64_revert_to_original_stack): Fix and add comments. Check memory
58         against real expected main thread stack addresses.  Use orignal stack
59         if reserved area is >= 256K.
60
61 2011-12-16  Christopher Faylor  <me.cygwin2011@cgf.cx>
62
63         * gendef (sigdelayed): Remember to pop all of the saved registers.
64         (sigreturn): Add "leave" label.
65
66 2011-12-16  Christopher Faylor  <me.cygwin2011@cgf.cx>
67
68         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Fix
69         unresolved access of wores in successful situations.
70
71 2011-12-16  Corinna Vinschen  <vinschen@redhat.com>
72
73         * Makefile.in (DLL_OFILES): Add wow64.o.
74         * dcrt0.cc (CYGWIN_GUARD): Drop execute permission for stack, it's
75         not used for stacks by the OS either.
76         (child_info_fork::alloc_stack_hard_way): Ditto.
77         (child_info_fork::alloc_stack): Don't alloc_stack_hard_way under WOW64
78         if forked from a 64 bit parent.  Set child's StackBase to parent's
79         StackBase.  Add comments to explain why.
80         (wow64_respawn): Move to wow64.cc.
81         (wow64_started_from_native64): Move to wow64.cc.
82         (respawn_wow64_process): Move to wow64.cc.
83         (dll_crt0_0): Drop wow64_test_stack_marker and move stack test into
84         wow64_test_for_64bit_parent function.  Don't return early if WOW64
85         process has been started from native 64 bit process.
86         (_dll_crt0): Implement moving stack for WOW64 processes started from
87         native 64 bit process.
88         * wow64.cc: New file.
89         (wow64_has_64bit_parent): Rename from wow64_respawn.
90         (wow64_test_for_64bit_parent): Rename from wow64_started_from_native64.
91         Change comment.
92         (wow64_revert_to_original_stack): New function.
93         (wow64_respawn_process): Rename from respawn_wow64_process for symmetry.
94         * wow64.h: New file.
95
96 2011-12-16  Christopher Faylor  <me.cygwin2011@cgf.cx>
97
98         * exceptions.cc (_cygtls::call_signal_handler): Fix debugging to not go
99         to console.
100         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Add temporary
101         kludge to work around problem of make closing an fhandle while it is
102         being read.
103         * gendef (sigdelayed): Don't call a function if sig has been cleared.
104
105         * sigproc.h (cygwait): Simplify slightly.
106
107 2011-12-14  Corinna Vinschen  <vinschen@redhat.com>
108
109         * autoload.cc (GetSystemWow64DirectoryW): Define.
110         (GetVolumePathNamesForVolumeNameW): Define.
111         * fhandler_process.cc (get_volume_path_names_for_volume_name): New
112         static function to workaround missing GetVolumePathNamesForVolumeNameW
113         function in Windows 2000.
114         (dos_drive_mappings::dos_drive_mappings): Call
115         get_volume_path_names_for_volume_name instead of
116         GetVolumePathNamesForVolumeNameW.
117
118 2011-12-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
119
120         * dcrt0.cc (init_windows_system_directory): Record
121         system_wow64_directory information.
122         * exceptions.cc (_cygtls::inside_kernel): Modernize comment.  Consider
123         executing a DLL from the Wow64 directory as being "in the kernel".
124         (_cygtls::call_signal_handler): For now, only deal with main_tls
125         signals if main_tls is known to be executing in the cygwin DLL.  To
126         more closely emulate linux, consider the operation to be restartable if
127         not executing in the main thread.
128         * globals.cc (windows_system_directory): Remove NO_COPY.
129         (windows_system_directory_length): Ditto.
130         (system_wow64_directory): New variable.
131         (system_wow64_directory_length): Ditto.
132
133         * select.cc (cygwin_select): Don't issue a EINTR on non-main threads
134         since that seems to be what Linux does.  Add missing break to signal
135         case/switch.
136         (select_stuff::wait): Don't issue a EINTR on non-main threads since
137         that seems to be what Linux does.  Remove now-unneeded accommodation
138         for WAIT_IO_COMPLETION.  Add a comment.
139         * sigproc.h (cygwait): Ditto.  Don't return if signal_received noticed
140         and it's not the main thread.
141
142         * signal.cc (sigprocmask): Add standard syscall debug stuff.
143         * thread.cc (pthread_sigmask): Ditto.
144
145 2011-12-13  Corinna Vinschen  <vinschen@redhat.com>
146
147         * netdb.cc (open_system_file): Avoid MS-DOS path warning.
148
149 2011-12-13  Corinna Vinschen  <vinschen@redhat.com>
150
151         * path.cc (conv_path_list): Fix a condition.
152         (cygwin_conv_path): Revert WIN_A conversion to current locale codeset.
153
154 2011-12-13  Corinna Vinschen  <vinschen@redhat.com>
155
156         * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Call
157         file_get_fnoi instead of NtQueryInformationFile.
158         * path.cc (file_get_fnoi): New helper function to collect a
159         FILE_NETWORK_OPEN_INFORMATION block.
160         (symlink_info::check): Call file_get_fnoi rather than
161         NtQueryInformationFile to collect a FILE_NETWORK_OPEN_INFORMATION block.
162         * path.h (file_get_fnoi): Declare.
163
164 2011-12-13  Dave Korn  <dave.korn.cygwin@gmail.com>
165
166         * times.cc (hires_ns::resolution): Don't return less than 1.
167
168 2011-12-12  Christopher Faylor  <me.cygwin2011@cgf.cx>
169
170         * cygthread.h (cygthread::name): Very minor formatting tweak.
171
172         * exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging
173         output.
174
175         * sigproc.h (cygwait): Call signal handler when signal is detected and
176         loop as appropriate.
177         * fhandler.h (fhandler_base_overlapped::wait_return): Remove
178         overlapped_signal.
179         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove
180         restartable signal accommodations in light of cygwait improvements.
181         (fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop
182         behavior.
183         (fhandler_base_overlapped::raw_write): Ditto.
184         * fhandler_console.cc (fhandler_console::read): Ditto.
185         * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
186         (fhandler_serial::raw_write): Ditto.
187         * fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
188
189         * ioctl.cc (ioctl): Add standard syscall introducer and leaver debug
190         output.
191
192 2011-12-12  Corinna Vinschen  <vinschen@redhat.com>
193
194         * fhandler_process.cc (dos_drive_mappings): Partially rewrite to
195         handle volumes mounted into juntion points correctly.
196
197 2011-12-12  Corinna Vinschen  <vinschen@redhat.com>
198
199         * fhandler_process.cc (dos_drive_mappings::dos_drive_mappings): Fully
200         resolve symbolic links returned by QueryDosDeviceW.  Explain why.
201
202 2011-12-12  Corinna Vinschen  <vinschen@redhat.com>
203
204         * mount.cc (fs_info::update): Set has_buggy_reopen for Netapps as well.
205
206 2011-12-12  Corinna Vinschen  <vinschen@redhat.com>
207             Christopher Faylor  <me.cygwin2011@cgf.cx>
208
209         * dcrt0.cc (wow64_respawn): New static variable.
210         (wow64_started_from_native64): New function to check if a WOW64
211         process got started from a native 64 bit process.
212         (respawn_wow64_process): New function to respawn process.
213         (dll_crt0_0): When started from a native parent, check if parent
214         is a 64 bit process.  If so, return early.
215         (_dll_crt0): Respawn WOW64 process here if required.
216         * init.cc (respawn_wow64_process): Remove.
217         (dll_entry): Rename wow64_test_stack_marker to test_stack_marker.
218         Drop WOW64 test here.
219
220 2011-12-11  Christopher Faylor  <me.cygwin2011@cgf.cx>
221
222         * pipe.cc (fhandler_pipe::create): Use debug_printf to print debugging
223         info since this isn't a "syscall".
224         (pipe_worker): New function created from _pipe().
225         (_pipe): Use pipe_worker to create a pipe.  Use standard syscall strace
226         reporting on exit.
227         (pipe): Ditto.
228         (pipe2): Ditto.
229
230 2011-12-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
231
232         * select.cc (select_stuff::wait): Very minor formatting fix.
233         (peek_windows): Report on HWND handle used in queries.
234         * select.h: Update copyright.
235         * sigproc.h (cygwait): Eliminate multi-argument variety since more
236         general implementation may cause odd problems in select.  Also force to
237         always be inline.
238
239 2011-12-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
240
241         * sigproc.h (cygwait): Delete duplicate va_start and add matching
242         va_end.
243
244 2011-12-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
245
246         * sigproc.h (cygwait): Tweak test for cancellable event to make it a
247         little more clear.
248
249 2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
250
251         * exceptions.cc (ctrl_c_handler): YA in a series or reversions.  Put
252         back _my_tls.remove along with a comment.
253         (sigpacket::process): Remove code which now causes a gdb deadlock.
254         * sigproc.cc (_cygtls::signal_exit): Signal debugger with signal number
255         earlier.
256
257 2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
258
259         * dllfixdbg: Work around annoying gdb warning about missing
260         .gnu_debuglink.
261
262 2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
263
264         Rename cygWFMO to cygwait throughout and use the magic of polymorphism
265         to "wait for stuff".
266         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use
267         simplified arg form of cygwait.
268         * fhandler_console.cc (fhandler_console::read): Ditto.
269         * fhandler_audio.cc (fhandler_dev_dsp::Audio_out::waitforspac): Ditto.
270         (fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
271         * fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
272         * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
273         (fhandler_serial::raw_write): Ditto.
274         * select.cc (cygwin_select): Ditto.
275         * sigproc.h (cygwait): Rename from cygWFMO.  Define two argument and
276         single argument forms of this function.
277
278         * fhandler_tty.cc (fhandler_pty_slave::open): Use method to query if
279         tty is open.
280         (fhandler_pty_slave::read): Send SIGHUP when master is detected as
281         closed.
282         (fhandler_pty_common::close): Close input_available_event in callers
283         since master may need to signal it first.
284         (fhandler_pty_master::close): Lie and set input_available_event when
285         closing, then close input_available_event.
286         (fhandler_pty_slave::close): Close input_available_event explicitly
287         here.
288         * tty.h (tty::is_master_closed): Declare new method.
289
290 2011-12-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
291
292         * sigproc.cc (signal_exit): Revert reversion of 2011-12-04 change
293         since, otherwise, you see hangs when the signal pipe is closed.
294
295 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
296
297         * select.cc (cygwin_select): Fifth time is the charm.
298
299 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
300
301         * select.cc (cygwin_select): Make sure that 0 is returned when sel.wait
302         times out.
303
304 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
305
306         * include/sys/wait.h: Add in all c++ functions.
307
308 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
309
310         * select.cc (select_stuff::wait): Temporarily disallow APCS.
311
312 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
313
314         * include/sys/wait.h: Ensure that C++ functions are only used when
315         using C++.
316
317 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
318
319         * select.cc (cygwin_select): Make sure that poll is called when
320         appropriate.
321
322 2011-12-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
323
324         * dll_init.cc (dll_dllcrt0): Don't try to initialize dll data if we're
325         dynamically loaded since fork() doesn't work in that scenario anyway.
326         (dll_dllcrt0_1): Don't accommodate dynamically loaded dlls.
327         * exceptions.cc (ctrl_c_handler): Don't lock the process; there's too
328         much risk of deadlock.
329         * sigproc.cc (_cygtls::remove_wq): Don't try to remove anything from
330         the waitq if there is obviously nothing there.
331         * strace.cc (strace::activate): Allow stracing dynamically loaded
332         cygwin1.dll.
333
334 2011-12-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
335
336         * fhandler_termios.cc (tty_min::kill_pgrp): Don't send __SIGSETPGRP
337         to ourselves since presumably we are already initialized.
338
339 2011-12-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
340
341         * select.cc (cygwin_select): Add common introducer and leaver debug
342         output.
343         (select_stuff::poll): Remove unneeded debugging.
344
345 2011-12-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
346
347         * exceptions.cc (ctrl_c_handler): Remove _my_tls.remove since it can
348         cause deadlocks during exec and will eventually be handled anyway.
349
350 2011-12-07  Corinna Vinschen  <vinschen@redhat.com>
351
352         * spawn.cc (child_info_spawn::worker): Add CREATE_BREAKAWAY_FROM_JOB
353         to all spawned processes.  Explain why.
354
355 2011-12-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
356
357         * fhandler_fifo.cc (fhandler_fifo::wait): Fix stupid typo and actually
358         wait for the handle.
359
360 2011-12-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
361
362         * sigproc.cc (close_my_readsig): New function.
363         (_cygtls::signal_exit): Close my_readsig via close_my_readsig(),
364         avoiding communication with the signal pipe.
365         (wait_sig): Close my_readsig via close_my_readsig().
366
367 2011-12-05  Corinna Vinschen  <vinschen@redhat.com>
368
369         * mmap.cc (mlock): Replace LOCK_VM_IN_WSL with correct MAP_PROCESS.
370         (munlock): Ditto.
371         * ntdll.h: Rearrange to have all preprocessor definitions at the start
372         of the file.  Add comments to each definition block.
373         (MAP_PROCESS): Rename from LOCK_VM_IN_WSL.
374         (MAP_SYSTEM): Rename from LOCK_VM_IN_RAM.
375
376 2011-12-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
377
378         * sigproc.h (cygWFMO): Don't assume that cancellable event is always
379         available.
380         * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::waitforspace): Use
381         cygWFMO instead of WaitForMultipleObjects.
382         (fhandler_dev_dsp::Audio_in::waitfordata): Ditto.
383         * fhandler_fifo.cc (fhandler_fifo::wait): Ditto.
384         * fhandler_serial.cc (fhandler_serial::raw_read): Ditto.
385         (fhandler_serial::raw_write): Ditto.
386         * fhandler_tty.cc (fhandler_pty_slave::read): Ditto.
387         * select.cc (cygwin_select): Ditto for degenerate case.
388
389 2011-12-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
390
391         * sigproc.h (cygWFMO): Move inside "INSIDE_CYGWIN" #ifdef.
392
393 2011-12-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
394
395         * exceptions.cc (exception::handle): Drop abbreviation for "exception"
396         since I never remember what it stands for.
397         (sig_handle_tty_stop): Remove obsolete call to reset_signal_arrived.
398         (_cygtls::call_signal_handler): Rework to grab signal information from
399         _main_tls if none is set for _my_tls.  Try harder to keep thread
400         locked.
401         (reset_signal_arrived): Delete.
402         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use new
403         cygWFMO call to wait for an event + standard cygwin stuff.  Modify
404         debug output to acccomodate new function.
405         * fhandler_console.cc (fhandler_console::read): Replace
406         WaitForMultipleObjects with cygWFMO.
407         * fhandler_socket.cc (get_inet_addr): Add comment.
408         * gendef (_sigdelayed): Remove call to reset_signal_arrived.
409         * sigproc.cc (_cygtls::signal_exit): Don't close my_readsig here unless
410         we're in the signal thread.
411         (create_signal_arrived): Create signal_arrived as auto-reset so that only
412         one thread is woken when a signal arrives.
413         * sigproc.h (cygWFMO): New function.
414         (reset_signal_arrived): Delete declaration.
415
416 2011-12-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
417
418         * mmap.cc (mlock): Add standard syscall return value debugging output.
419         (munlock): Ditto.
420         (posix_madvise): Ditto.
421
422         * signal.cc: Remove obsolete sigcatchers stuff throughout.
423         (sigaction_worker): Add function name parameter and use it to show
424         standard syscall return value debugging output.  Also add fault
425         protection.
426         (sigaction): Accommodate extra argument to sigaction_worker.
427         (siginterrupt): Ditto.
428         * syscalls.cc (read): Remove obsolete sigcatchers stuff.
429         (readv): Ditto.
430
431 2011-12-03  Corinna Vinschen  <vinschen@redhat.com>
432
433         * mmap.cc (mlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE.  Drop
434         outdated comment.  Call NtLockVirtualMemory with LOCK_VM_IN_WSL flag.
435         (munlock): Drop requesting SE_LOCK_MEMORY_PRIVILEGE.  Call
436         NtUnlockVirtualMemory with LOCK_VM_IN_WSL flag.
437
438 2011-12-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
439
440         Throughout, remove extra space after function name from debugging
441         output.
442         Throughout, change syscalls to report on return values using new %R
443         format option.
444         * smallprint.cc (__small_vsprintf): Add parsing for %R to report on
445         return values and possible errno from syscalls.
446
447         * errno.cc (errmap): Add PRIVILEGE_NOT_HELD.
448
449         * fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread
450         use shorter name to reduce debuggging output.
451         * select.cc (start_thread_pipe): Ditto.
452         (start_thread_serial): Ditto.
453         (start_thread_socket): Ditto.
454         (start_thread_mailslot): Ditto.
455         * sigproc.cc (talktome): Ditto.
456
457 2011-12-03  Corinna Vinschen  <vinschen@redhat.com>
458
459         * fhandler.cc (fhandler_base::open): Fix comment a bit more.
460
461 2011-12-03  Corinna Vinschen  <vinschen@redhat.com>
462
463         * fhandler.cc (fhandler_base::open): Fix typos in comment.
464
465 2011-12-02  Corinna Vinschen  <vinschen@redhat.com>
466
467         * path.cc (conv_path_list): Take cygwin_conv_path_t as third parameter.
468         Allow all types of CCP conversions.  Accommodate throughout.
469         (cygwin_conv_path): Use current ANSI or OEM codepage for WIN_A
470         conversions, depending on current file API codepage setting.
471         (cygwin_conv_path_list): Allow all CCP conversion types.
472         * include/sys/cygwin.h (CCP_CONVTYPE_MASK): Add to cygwin_conv_path_t
473         enum for convenience.
474
475 2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
476
477         * sigproc.cc (get_proc_lock): Remove extra NULL check.  Return false on
478         failure.
479
480 2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
481
482         * sync.cc: Fix comment.
483
484 2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
485
486         * dll_init.cc (dll_list::reserve_space): Use %p rather than %lx to show
487         reserved space.
488
489 2011-11-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
490
491         * sigproc.cc (remove_proc): Don't terminate the currently executing
492         thread.
493
494 2011-11-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
495
496         * cygheap.cc (cygheap_fixup_in_child): Accommodate new HEAP_3*
497         classifications for cleanup-after-fork.
498         * cygheap_malloc.h (cygheap_types): Add HEAP_2_MAX, HEAP_3_FHANDLER.
499         * fhandler.h: Throughout, change clone to take a cmalloc id.
500         (fhandler_base::delete): Inline.
501         (fhandler_base_overlapped): Mark flush_async_io as a friend.
502         (fhandler_base_overlapped::asio_done): Declare new static member.
503         (fhandler_base_overlapped::asio_close_counter): Ditto.
504         (fhandler_base_overlapped::check_later): Declare new function.
505         (fhandler_base_overlapped::flush_all_async_io): Ditto.
506         * fhandler.cc (fhandler_base_overlapped::asio_done): Declare.
507         (fhandler_base_overlapped::asio_close_counter): Ditto.
508         (flush_async_io): Declare new thread function.
509         (fhandler_base_overlapped::flush_all_async_io): Declare new function.
510         (fhandler_base_overlapped::check_later): Ditto.
511         (fhandler_base_overlapped::close): Call check_later to close
512         nonblocking fd asynchronously.  Assume that this completed
513         successfully.
514         * select.cc (pipe_data_available): Don't consider data to be
515         "available" if fd still has unflushed I/O.
516         * syscalls.cc (close_all_files): Call
517         fhandler_base_overlapped::flush_all_async_io to make sure that all
518         nonblocking pipe I/O has completed.
519
520 2011-11-28  Corinna Vinschen  <vinschen@redhat.com>
521
522         * external.cc (fillout_pinfo): Store program name as POSIX path in
523         ep.progname_long.
524
525 2011-11-28  Corinna Vinschen  <vinschen@redhat.com>
526
527         * pinfo.cc (pinfo::exit): Call TerminateProcess to avoid potential
528         busy loop in ntdll.dll when calling ExitProcess. Only call ExitProcess
529         as a fallback.
530
531 2011-11-27  Christopher Faylor  <me.cygwin2011@cgf.cx>
532
533         * init.cc (dll_entry): Revert previous change since it caused
534         inexplicable fork problems.
535
536 2011-11-26  Christopher Faylor  <me.cygwin2011@cgf.cx>
537
538         * init.cc (dll_entry): Don't bother calling through thread removal
539         cleanup if we are exiting.
540
541 2011-11-26  Christopher Faylor  <me.cygwin2011@cgf.cx>
542
543         * exceptions.cc (stackdump): Make global.
544         (signal_exit): Move to sigproc.cc.
545         * sigproc.cc (signal_exit): Move here.  Declare stackdump extern.  Set
546         my_sendsig to indicate that signals are no longer available.
547         (my_readsig): Make Static again.
548         (sig_send): Interpret ERROR_BROKEN_PIPE as ESRCH.  Remove special-case
549         EACCESS errno setting, just setting errno generally, even for "its_me"
550         case.
551
552 2011-11-25  Christopher Faylor  <me.cygwin2011@cgf.cx>
553
554         * exceptions.cc (sigpacket::process): Move signal_exit processing
555         into...
556         (_cygtls::signal_exit): ...here.  Close my_readsig and comment on why.
557         * pinfo.cc (pinfo::exit): Move sigproc_terminate earlier.  Set exiting
558         flag in lock_process.
559         * sigproc.cc (my_readsig): Make global.
560         * sync.cc (muto::exiting_thread): Delete.
561         (muto::acquire): Delete #if 0'ed code.
562         * sync.h (muto::exiting_thread): Delete.
563         (set_exiting_thread): Ditto.
564         (lock_process::lock_process): Don't worry about setting the exiting
565         thread since it had no meaning.
566
567 2011-11-24  Christopher Faylor  <me.cygwin2011@cgf.cx>
568
569         * cygthread.cc (cygthread::name): Default name to "main" if we are early
570         in the process of setting up the DLL and no name is known.
571         * dcrt0.cc (initial_env): Remove CYGWIN_SLEEP stuff.
572         (get_cygwin_startup_info): Activate strace here as appropriate.
573         (dll_crt0_0): Move get_cygwin_startup_info as early as possible to
574         avoid missing strace output.
575         * fork.cc (frok::child): Move debugging statement to point where ppid
576         will be set.
577         * pinfo.cc (pinfo::thisproc): Remove obsolete call to strace.hello.
578         Tweak debug output slightly.
579         * select.cc (select_stuff::wait): Allow APCS to be triggered while
580         waiting since we use them now.  Report when that happens.
581         * sigproc.cc (child_info::child_info): Use strace.active() rather than
582         strace.attached().
583         * spawn.cc (child_info_spawn::worker): Only write strace child pid
584         when we know it's a cygwin process.  Accommodate change to write_child
585         argument list.
586         * strace.cc (strace::hello): Delete.  Move functionality...
587         (strace::activate): ...to here.
588         (mypid): Just use raw GetCurrentProcessId () if myself isn't set.
589         (strace::write_childpid): Don't wait for subproc_ready.  Remove arg
590         which was required for it.
591         * include/sys/strace.h (strace::hello): Delete.
592         (strace::write_childpid): Delete first argument.
593
594 2011-11-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
595
596         * child_info.h (CURR_CHILD_INFO_MAGIC): Reset for previous changes.
597
598         * dcrt0.cc (get_cygwin_startup_info): Signal readiness when stracing
599         since strace::write_child relies on it.  Use strace.activate to notify
600         strace process, passing in arg indicating whether we're forked.
601         * sigproc.cc (wait_sig): Accommodate new strace::activate argument.
602         * spawn.cc (child_info_spawn::worker): Oops.  Previous suspended test
603         was actually correct.  Revert and document.
604         * strace.cc (strace::activate): Send additional flag indicating whether
605         this is an attempt to activate a forked process.
606         (strace::hello): Report on windows pid.
607         * include/sys/strace.h (strace::strace): Make a dummy.
608         (strace::activate): Modify declaration to accept an argument.
609         (strace::write_childpid): Set regparm.
610
611 2011-11-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
612
613         * pipe.cc (fhandler_pipe::create): Avoid derefencing a NULL pointer.
614
615         * child_info.h (child_info): Reorganize some elements so that the ones
616         which are initialized in a constructor are all together.
617         * sigproc.cc (child_info::child_info): Initialize values via the
618         constructor rather than as C statements and make sure that flags is set
619         to zero initially.
620
621         * spawn.cc (child_info_spawn::worker): Use iscygwin() test for
622         determining when to send strace info since it is more foolproof than
623         checking the suspend state.
624
625 2011-11-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
626
627         * fhandler.h (fhandler_pipe::create): Rename from the misnamed
628         "create_selectable".  Change return to DWORD.
629         (fhandler_pty_common::pipesize): New constant.
630         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect
631         create_selectable name change.
632         * miscfuncs.cc (CreatePipeOverlapped): Ditto.
633         * pipe.cc (fhandler_pipe::create): Ditto.
634         (fhandler_pipe::create): Rename from the misnamed "create_selectable".
635         Return DWORD.  Only set pipe size to default when it is passed in as
636         zero.
637         * fhandler_tty.cc (fhandler_pty_master::setup): Ditto.  Use
638         fhandler_pty_common::pipesize rather than a raw constant.
639         * tty.cc (tty::not_allocated): Ditto.
640
641         * sigproc.cc (sigproc_init): Use fhandler_pipe::create to create the
642         signal pipe to get a more appropriate message based pipe.
643
644 2011-11-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
645
646         * sigproc.cc (remove_proc): Don't do busy loop when exiting since it
647         doesn't matter.
648
649 2011-11-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
650
651         * sigproc.cc (remove_proc): Don't do busy loop when execing since
652         thread could have been terminated prior to setting flag.
653
654         * signal.cc (sigwaitinfo): Zero event before closing to signal other
655         threads that it is no longer available.
656
657 2011-11-18  Corinna Vinschen  <corinna@vinschen.de>
658
659         * shared.cc (get_shared_parent_dir): Use global shared_parent_dir
660         instead of local dir variable and create handle not inheritable to
661         avoid accumulating stray handles in child processes.
662         (get_session_parent_dir): Ditto with session_parent_dir variable.
663
664 2011-11-17  Corinna Vinschen  <corinna@vinschen.de>
665
666         * shared.cc (shared_info::create): Open global shared data section
667         non-inheritable to avoid accumulating stray handles in child processes.
668
669 2011-11-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
670
671         * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
672         (cygheap_exec_info::nchildren): Move from child_info_spawn.
673         (cygheap_exec_info::cchildren): Ditto.
674         (cygheap_exec_info::record_children): Declare new function.
675         (cygheap_exec_info::reattach_children): Ditto.
676         (cygheap_exec_info::alloc): Ditto.
677         (child_info_spawn::nchildren): Move to cygheap_exec_info.
678         (child_info_spawn::cchildren): Ditto.
679         * sigproc.cc (cygheap_exec_info::alloc): Define new function.
680         (child_info_spawn::cleanup): Accommodate move of children info to
681         cygheap_exec_info.
682         (cygheap_exec_info::record_children): Define new function.
683         (cygheap_exec_info::reattach_children): Ditto.
684         (child_info_spawn::record_children): Use
685         cygheap_exec_info function to accomplish this task.
686         (child_info_spawn::reattach_children): Ditto.
687         * spawn.cc (child_info_spawn::worker): Allocate moreinfo using
688         cygheap_exec_info::alloc.
689
690         * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Use abort for the
691         error to avoid a retry.
692
693 2011-11-14  Christopher Faylor  <me.cygwin2011@cgf.cx>
694
695         * pinfo.cc (_pinfo::dup_proc_pipe): Fatalize a warning when debugging.
696
697 2011-11-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
698
699         Remove erroneously checked-in debugging statements.
700         * cygheap.cc (cygheap_fixup_in_child): Here.
701         * debug.cc (delete_handle): Here.
702         * sigproc.cc (child_info_spawn::cleanup): Here.
703         * spawn.cc (child_info_spawn::worker): Here.
704
705 2011-11-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
706
707         Throughout, change "sig %d" in strace output to "signal %d" for
708         consistency.
709         * assert.cc (__assert_func): Output assertion string to strace too.
710         * fork.cc (frok::parent): Report ASAP on forked pid in debugging output.
711         * pinfo.cc (pinfo::_pinfo_release): Define new function.
712         (pinfo::init): Use _pinfo_release() rather than release() to release
713         shared memory stuff.
714         (pinfo::wait): Shorten name of process waiting thread for more concise
715         debugging.
716         (pinfo::release): Use pinfo_release to release shared memory part of
717         struct.
718         * pinfo.h (pinfo::__pinfo_release): Declare.
719
720 2011-11-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
721
722         Throughout use "have_execed" macro rather than "hExeced" global handle.
723         Throughout rename _PROC_* to _CH_*.
724         * child_info.h: Include "pinfo.h".
725         (child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with
726         similarly named constants.
727         (_PROC_*): Delete unneeded aliases.
728         (PROC_*): Ditto.
729         (CURR_CHILD_INFO_MAGIC): Ditto.
730         (cchildren): Define using "pinfo_minimal".
731         (child_info::set_saw_ctrl_c): Move to
732         (child_info_spawn::set_saw_ctrl_c): Here.
733         (child_info_spawn::lock): New field.
734         (child_info_spawn::hExeced): Ditto.
735         (child_info_spawn::ev): Ditto.
736         (child_info_spawn::~child_info_spawn): Move to sigproc.cc.
737         (child_info_spawn::child_info_spawn): Ditto.
738         (child_info_spawn::cleanup): Declare new function.
739         (child_info_spawn::set_saw_ctrl_c): Move to this class.  Set flag only
740         when execed and return true when we have set the flag.
741         (child_info_spawn::child_info_spawn::signal_myself_exited): New function.
742         (child_info_spawn::wait_for_myself): Ditto.
743         (child_info_spawn::has_execed_cygwin): Ditto.
744         (child_info_spawn::has_execed): Ditto.  Replaces "hExeced" test.
745         (child_info_spawn::operator HANDLE&): New operator.
746         (child_info_spawn::worker): Define old "spawn_guts" as class member.
747         (ch_spawn): Declare.
748         (have_execed): Define.
749         (have_execed_cygwin): Ditto.
750         * cygheap.h: Update comment.
751         * dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums.
752         (child_info_spawn::handle_spawn): Ditto.
753         (dll_crt0_0): Ditto.
754         (multiple_cygwin_problem): Ditto.
755         * exceptions.cc (chExeced): Delete obsolete declaration.
756         (ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global.
757         * globals.cc (hExeced): Delete.
758         * pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for
759         consistency in handle naming when -DDEBUGGING.
760         (pinfo::init): Accommodate case where myself.h is known but h0 is
761         passed in.
762         (pinfo::pinfo): New constructor for setting up a pinfo passed in by
763         previous exec'or.
764         (pinfo::proc_waiter): Don't handle subprocess if we're in the process
765         of exiting due to an exec of a cygwin process.  Don't close
766         rd_proc_pipe here.  Close it when we actually are finished with the
767         process.  Use new ch_spawn.signal_myself_exited function to let exec
768         stub know that subprocess has exited.
769         (pinfo::wait): Clarify debugging output.
770         (pinfo::release): Use "close_h" to close all handles to avoid races.
771         (winpids::add): Assume that elements of the array do not need to be
772         zeroed and are properly initialized or suffer problems on
773         pinfo::release.  Don't close hProcess since release does that now.
774         * pinfo.h: Update comment.
775         (pinfo_minimal): Move some elements from pinfo here so that
776         child_info_spawn can use them.
777         (pinfo): Inherit from pinfo_minimal.
778         (pinfo::pinfo): Modify to accommodate new pinfo_minimal.
779         (pinfo::allow_remove): New function.
780         * sigproc.cc (proc_subproc): Use boolean values for true/false.
781         Implement PROC_EXEC_CLEANUP.
782         (proc_terminate): Set ppid = 1 since the procs list will only be
783         iterated when the process has not execed.  Don't do any cleanup here
784         since it is now handled in pinfo::release.
785         (sigproc_init): Initialize sync_proc_subproc earlier.
786         (child_info::child_info): Assume that all important fields are properly
787         initialized and avoid memset().
788         (child_info_spawn::child_info_spawn): Specifically test for execing and
789         then set up appropriate fields in the struct.
790         (child_info_spawn::cleanup): Define new function.
791         (child_info_spawn::record_children): Specifically test for being execed
792         here.  Fill in pinfo_minimal part of children array.
793         (child_info_spawn::reattach_children): Use constructor to duplicate
794         information for previous exec'or.  Add more debugging output.
795         (remove_proc): Force deletion of thread when exiting due to exec.  Rely
796         on pinfo::cleanup in release.
797         * sigproc.h (PROC_EXEC_CLEANUP): New enum.
798         (PROC_DETACHED_CHILD): Delete.
799         * spawn.cc (chExeced): Delete.
800         (child_info_spawn::worker): Rename from spawn_guts.  Use elements of
801         child_info_spawn throughout rather than ch.whatever.  Use ::cygheap to
802         refer to global rather than element of child_info.  Use
803         wait_for_myself() rather than waitpid().  Call
804         child_info_spawn::cleanup on function return.
805         (spawnve): Reflect movement of spawn_guts functionality into
806         child_info_spawn::worker.
807         * syscalls.cc (popen): Ditto.
808         * winsup.h (spawn_guts): Delete declaration.
809
810 2011-11-08  Corinna Vinschen  <corinna@vinschen.de>
811
812         * posix.sgml (std-gnu): Add ptsname_r.
813
814 2011-11-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
815
816         * fhandler.h (__ptsname): New macro.
817         * dtable.cc (decode_tty): Use __ptsname to generate the slave pty name.
818         * fhandler_tty.cc (fhandler_pty_master::ptsname_r): Ditto.
819         * bsdlib.cc: Add needed includes for openpty() changes.
820         (openpty): Use __ptsname to generate the slave pty name.  Close slave
821         fd when aslave == NULL.
822
823 2011-11-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
824
825         * include/cygwin/stdlib.h: Update copyright.
826
827 2011-11-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
828
829         * cygwin.din (ptsname_r): Export.
830         * fhandler.cc (fhandler_base::ptsname_r): Define.
831         * fhandler.h (fhandler_base::ptsname): Delete.
832         (fhandler_base::ptsname_r): Declare.
833         (fhandler_pty_master::ptsname_r): Declare.
834         * fhandler_tty.cc (fhandler_pty_master::ptsname): Delete.
835         (fhandler_pty_master::ptsname_r): New reentrant function derived from
836         previous ptsname.
837         * syscalls.cc (ptsname_r): Implement new function with functionality
838         similar to Linux.
839         (ptsname): Use ptsname_r () to fill out buf.
840         * include/cygwin/stdlib.h (ptsname_r): Declare.
841         * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 255 to
842         reflect export of ptsname_r.
843
844         * pinfo.cc (pinfo::wait): Return bool rather than int.
845         * pinfo.h (info::wait): Ditto.
846         (pinfo::reattach): Define !defined(_SIGPROC_H) case for consistency.
847         * sigproc.cc (child_info_spawn::reattach_children): Use correct
848         dwProcessId rather than pid when duplicating handle.
849
850 2011-11-07  Corinna Vinschen  <corinna@vinschen.de>
851
852         * fhandler.cc (CHUNK_SIZE): Drop NO_COPY.
853
854 2011-11-07  Corinna Vinschen  <corinna@vinschen.de>
855
856         * syscalls.cc (check_dir_not_empty): Check surplus directory entries
857         by calling NtQueryAttributesFile.  Make STATUS_DIRECTORY_NOT_EMPTY
858         return value dependent on its status code.  Add long comment to explain.
859         (unlink_nt): Add comment to explain flaw in checking the sharing mode.
860         Set status to STATUS_SUCCESS instead of 0.  Add a retry loop to setting
861         the delete disposition and trying to move a directory to bin to
862         workaround rare cases of lingering, already deleted subdirectory
863         entries.  Add long comment to explain.
864         (rename): Set status to STATUS_SUCCESS instead of 0.
865
866 2011-11-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
867
868         * pinfo.cc (status_exit): Recognize STATUS_ILLEGAL_INSTRUCTION.
869         (child_info::proc_retry): Ditto.
870
871 2011-11-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
872
873         * pinfo.cc (status_exit): Return complete error code.  Handle
874         STATUS_ACCESS_VIOLATION correctly.
875         (pinfo::set_exit_code): Set self->exitcode directly from status_exit.
876
877 2011-11-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
878
879         * pinfo.h (pinfo::reattach): Only set destroy to false when
880         proc_subproc succeeds.  Return true for success.
881         * sigproc.cc (child_info_spawn::reattach_children): Try harder to clean
882         up on error by detecting reattach failures too.
883
884 2011-11-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
885
886         * sigproc.cc (child_info_spawn::reattach_children): Clean up handle
887         when can't open parent process or suffer handle leak.
888
889 2011-11-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
890
891         * sigproc.cc (child_info::sync): Report on exit code in strace output.
892         (child_info::proc_retry): Don't consider STATUS_ACCESS_VIOLATION as a
893         restartable event.
894
895 2011-11-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
896
897         * sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an
898         error when we can't duplicate from "parent" since it is probably ok if
899         children of the previous owner of the pid disappear.
900
901 2011-11-03  Corinna Vinschen  <corinna@vinschen.de>
902
903         * fhandler.cc (off_current): Define local in fhandler_base::raw_write.
904         Drop erroneous NO_COPY, add _RDATA to make R/O.
905         (off_append): Ditto.
906         * globals.cc (_RDATA): Move definition from here...
907         * winsup.h: ...to here.
908
909 2011-10-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
910
911         * fhandler.h (fhandler_pipe::create_selectable): Remove optional
912         argument, take an options argument for CreateNamedPipe/CreateFile.
913         Change handle arguments to expect pointers.
914         (fhandler_fifo::fifo_state): Delete.
915         (fhandler_fifo::dummy_client): Ditto.
916         (fhandler_fifo::open_nonserver): Ditto.
917         (fhandler_fifo::wait_state): Ditto.
918         (fhandler_fifo::raw_write): Ditto.
919         (fhandler_fifo::read_ready): New field.
920         (fhandler_fifo::write_ready): Ditto.
921         (fhandler_fifo::wait): Modify argument.
922         (fhandler_fifo::fifo_name): Add a new argument.
923         (fhandler_fifo::fixup_after_fork): New function.
924         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove
925         initialization of expunged elements.  Initialize new handles to NULL.
926         (fhandler_fifo::open_nonserver): Delete.
927         (fnevent): New macro for creating a named event.
928         (fnpipe): New macro for creating a unique named pipe name.
929         (create_pipe): New macro for simplification of named pipe creation.
930         (fhandler_fifo::fifo_name): Use new argument when creating a shared
931         name.
932         (fhandler_fifo::open): Rewrite.  Use events to synchronize.
933         (fhandler_fifo::wait): Rewrite to wait for new fifo events which are
934         supplied as a parameter.
935         (fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect
936         client-side disconnect.
937         (fhandler_fifo::raw_write): Delete.
938         (fhandler_fifo::close): Remove accommodations for expunged fields.
939         Close event handles.
940         (fhandler_fifo::dup): Remove accommodations for expunged fields.
941         Duplicate event handles.
942         (fhandler_fifo::fixup_after_fork): New function.  Perform fixups on
943         event handles.
944         (fhandler_fifo::set_close_on_exec): Remove accommodations for expunged
945         fields.  Set inheritance for new handle fields.
946         * miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in
947         fhandler_pipe::create_selectable.
948         * tty.cc (tty::not_allocated): Ditto.
949         * pipe.cc (fhandler_pipe::create): Ditto.
950         (fhandler_pipe::create_selectable): Accept an extra open_mode argument.
951         Pass arguments by reference and allow opening one end of the pipe at a
952         time.
953
954         * sys/strace.h (debug_only_printf): Define new macro which calls
955         debug_printf only when DEBUGGING is defined.
956
957 2011-10-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
958
959         * exceptions.cc (sigpacket::process): Avoid a potential deadlock when
960         exiting due to a signal.
961
962 2011-10-28  Corinna Vinschen  <corinna@vinschen.de>
963
964         * cygwin.din (getgrouplist): Export.
965         * grp.cc (get_groups): New static function to run the core functionality
966         of initgroups and getgrouplist.
967         (initgroups32): Call get_groups and just create supplementary group
968         list in cygheap.  Rename name of first argument to "user".  Add an
969         assertion to test for a NULL user name.
970         (initgroups): Rename name of first argument to "user".
971         (getgrouplist): New function.
972         * posix.sgml (std-bsd): Add getgrouplist.
973         * include/cygwin/grp.h (getgrouplist): Declare.
974         * include/cygwin/version.h: Bump API minor number.
975
976 2011-10-25  Christopher Faylor  <me.cygwin2011@cgf.cx>
977
978         * child_info.h (cchildren): New struct.
979         (child_info_spawn::nchildren): Rename from nprocs.
980         (child_info_spawn::children): Change type to cchildren for more
981         bookkeeping possibilities.
982         (child_info_spawn::child_info_spawn): Clear nchildren.
983         (child_info_spawn::record_children): Declare new function.
984         (child_info_spawn::reattach_children): Ditto.
985         * dcrt0.cc (child_info_spawn::handle_spawn): Call reattach_children to
986         gather list of processes we are potentially waiting for.
987         * pinfo.h (pinfo::pinfo): Make sure that rd_proc_pipe is always cleared.
988         (pinfo::reattach): New function.
989         * sigproc.cc: Move pinfo.h earlier so that it can be used in sigproc.h.
990         (get_proc_lock): Don't bother with a lock during DLL initialization.
991         (proc_subproc): Handle PROC_REATTACH_CHILD.
992         (proc_terminate): Orphan children only when we are not an execed
993         process or when the pid is about to be occupied by a non-cygwin
994         process.
995         (child_info_spawn::record_children): Define new function.
996         (child_info_spawn::reattach_children): Ditto.
997         * sigproc.h (procstuff): Define PROC_REATTACH_CHILD and renumber other
998         elements.
999         * spawn.cc (spawn_guts): Record any to-be-waited-for subprocesses if
1000         about to exec a cygwin process.
1001
1002         * sigproc.cc (sig_send): Fix harmless transposition of fifth and six
1003         arguments to DuplicateHandle().
1004         (child_info::child_info): Ditto.
1005
1006         * globals.cc (hExeced): Make NO_COPY.
1007
1008 2011-10-25  Corinna Vinschen  <corinna@vinschen.de>
1009
1010         * hookapi.cc (hook_or_detect_cygwin): Take additional handle
1011         to a file mapping as parameter.  If this handle is not NULL,
1012         create another file mapping for the IAT.
1013         * spawn.cc (av::fixup): Only map the first 64K of an image and
1014         keep the mapping handle to use as argument to hook_or_detect_cygwin.
1015         * winsup.h (hook_or_detect_cygwin): Add mapping handle as default
1016         parameter in declaration.
1017
1018 2011-10-24  Corinna Vinschen  <corinna@vinschen.de>
1019
1020         * syscalls.cc (unlink_nt): Fix a bug which overwrites the NT status
1021         value in case setting the delete disposition returns with
1022         STATUS_DIRECTORY_NOT_EMPTY.
1023
1024 2011-10-24  Corinna Vinschen  <corinna@vinschen.de>
1025
1026         * shared.cc (open_shared): Fix memory reservation of essential shared
1027         memory regions.  Drop delta computations since delta is always 0 in
1028         non-relocated case.  Add a comment.
1029
1030 2011-10-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
1031
1032         * fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for
1033         testing ReadFile return.
1034         * pipe.cc (fhandler_pipe::create_selectable): Open the write side of
1035         the pipe in message-mode to force writing as "chunks".  Explain why.
1036
1037 2011-10-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
1038
1039         * path.cc (path_conv::get_nt_native_path): Avoid dereferencing path
1040         when it is NULL.
1041
1042 2011-10-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
1043
1044         * dtable.cc (dtable::delete_archetype): Improve debugging output.
1045         (dtable::init_std_file_from_handle): Close console handle early, before
1046         initialization.  Build up openflags for passing to open_setup, just to
1047         be safe.
1048         (last_tty_dev): New variable.
1049         (fh_last_tty_dev): New macro.
1050         (fh_alloc): Try again to keep track of previously opened tty, this time
1051         by just saving the device and using that to potentially open an
1052         archetype.  Avoid setting the "/dev/tty" name if the creation of the
1053         fhandler failed.
1054         (build_fh_pc): Remove unused second argument.  Reorganize how and where
1055         the name is set.  Set last_tty_dev as appropriate.  Avoid a NULL
1056         dereference in a debug printf.
1057         * dtable.h (build_fh_pc): Reflect removal of second parameter.
1058         * fhandler.cc (fhandler_base::reset): Use new '<<' operator to copy pc
1059         since it preserves any potentially previously set name.
1060         (fhandler_base::set_name): Ditto.
1061         * fhandler.h (fhandler_*::clone): Throughout use ccalloc to allocate
1062         new fhandler, primarily to make sure that pc field is properly zeroed.
1063         (fhandler_termios::last): Eliminate.
1064         (fhandler_termios): Remove setting of last.
1065         (fhandler_base::~fhandler_termios): Ditto.
1066         * fhandler_console.cc (fhandler_console::open): Don't make decisions
1067         about opening close-on-exec handles here since it makes no sense for
1068         archetypes.
1069         (fhandler_console::init): Assume that input handle has already been
1070         opened.
1071         * fhandler_termios.cc (fhandler_termios::last): Delete.
1072         * path.h (path_conv::eq_worker): New function.  Move bulk of operator =
1073         here.
1074         (operator <<): New function.
1075         (operator =): Use eq_worker to perform old functionality.
1076
1077         * child_info.h (NPROCS): Move here from sigproc.cc.
1078         (child_info::nprocs): New field.  Not used yet.
1079         (child_info::children):: Ditto.
1080
1081 2011-10-21  Corinna Vinschen  <corinna@vinschen.de>
1082
1083         * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Check invalid
1084         success only on Samba shares.
1085         * mount.cc (fs_info::update): Drop has_buggy_basic_info flag for
1086         NcFsd.
1087         * syscalls.cc (unlink_nt): Fix typo in comment.
1088
1089 2011-10-21  Corinna Vinschen  <corinna@vinschen.de>
1090
1091         * globals.cc (ro_u_ncfsd): New R/O unicode string.
1092         * mount.cc (fs_info::update): Check for "NcFsd" FS.  Set flags and
1093         change comments accordingly.
1094         (fs_names): Add entry for NcFsd FS.
1095         * mount.h (enum fs_info_type): Add ncfsd.
1096         (class fs_info): Add ncfsd flag and accessor methods.
1097         * path.h (class path_conv): Add fs_is_ncfsd method.
1098         * syscalls.cc (unlink_nt): Experimentally try delete-on-close on NcFsd
1099         in STATUS_CANNOT_DELETE case.
1100
1101 2011-10-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
1102
1103         * fhandler.h (fhandler*::copyto): Free path_conv strings first.
1104         * path.h (cfree_and_null): Rename and expand from cfree_maybe.
1105         (path_conv &operator =): Call free_strings rather than freeing strings
1106         directly.
1107
1108 2011-10-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
1109
1110         Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.
1111         * devices.cc: Regenerate.
1112         * dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we
1113         opened.
1114         (build_fh_pc): Preserve any existing name.
1115         * fhandler.cc (fhandler_base::open_with_arch): Ditto.
1116         * fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the
1117         name to /dev/ptmx while preserving other pty master device information.
1118         * path.h (cfree_maybe): New macro.
1119         (path_conv::operator =): Free any allocated strings in target.
1120         (path_conv::free_strings): Delete unused function.
1121
1122         * sigproc.cc (proc_terminate): Remove previous accommodation for execed
1123         processes since it didn't have the desired effect.  Change comment to a
1124         FIXME.
1125
1126         * spawn.cc (chExeced): Mark NO_COPY.
1127         (exe_suffixes): Ditto.
1128
1129 2011-10-20  Corinna Vinschen  <corinna@vinschen.de>
1130
1131         * syscalls.cc (try_to_bin): Improve debug output.
1132         (check_dir_not_empty): Take additional path_conv argument.  Improve
1133         debug output.  Change syscall_printf to debug_printf.
1134         (unlink_nt): Improve debug output.  Change syscall_printf to
1135         debug_printf.
1136         (unlink): Change syscall_printf to debug_printf.
1137
1138         * cygthread.h: Fix copyright dates.
1139
1140 2011-10-18  Corinna Vinschen  <corinna@vinschen.de>
1141
1142         * path.cc: Extend two comments.  Mention the name RtlpCurDirRef
1143         for reference.
1144
1145 2011-10-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
1146
1147         * dcrt0.cc (dll_crt0_1): Copy argv before passing to main().
1148
1149 2011-10-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
1150
1151         * sigproc.cc (proc_terminate): Avoid setting ppid to 1 if we're execing.
1152
1153 2011-10-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
1154
1155         * cygerrno.h (__set_errno): Modify debugging output to make searching
1156         strace logs easier.
1157
1158         Throughout, change /dev/tty* to /dev/pty*.
1159         Throughout, add flags argument to fhandler_*::dup methods.
1160         * devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN.  Add
1161         /dev/ptymN devices for pty masters.
1162         * devices.cc: Regenerate.
1163         * devices.h (MAX_CONSOLES): Set to max number supported by devices.in.
1164         (fh_devices::FH_PTMX): Rename from FH_PTYM.
1165         (device::operator int): Return by reference.
1166         * dtable.cc (fh_alloc): Take pc as an argument rather than just the
1167         device.  This makes debugging easier since more information is
1168         available.  Actually implement handling for already-allocated pty
1169         master devices.  Make different decisions when generating fhandler for
1170         not-opened devices.  Add kludge to deal with opening /dev/tty.
1171         (cnew_no_ctor): New macro.
1172         (build_fh_pc): Make debugging output more verbose.  Use new clone()
1173         fhandler interface to duplicate archetypes.  Reset last term opened.
1174         (dtable::dup_worker): Use Use new clone() fhandler interface to
1175         duplicate archetypes.  Pass flags to child dup handler.
1176         (dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr.
1177         * fhandler.cc (fhandler_base::reset): Rename from operator =() and
1178         reduce functionality and sense of copy direction.
1179         (fhandler_base::open_with_arch): Use published interface to query
1180         io_handle().  Use new copyto() fhandler method to copy from/to found
1181         archetype.
1182         * fhandler.h: Throughout, delete size(), add copyout, clone, and
1183         fhandler_* (void *) methods.
1184         (fhandler_base::reset): Rename from operator =().
1185         (fhandler_termios::is_dev_tty): Delete.
1186         (fhandler_termios): change "protected" region to "private".
1187         (fhandler_termios::is_dev_tty): Delete.
1188         (fhandler_termios): Rearrange protected/public.
1189         (fhandler_termios::fhandler_termios): Remember last fhandler_termios
1190         "opened".
1191         (fhandler_termios::~fhandler_termios): Forget last fhandler_termios
1192         opened.
1193         (ioctl): Rename from ioctl_termios.  Take a void * argument.  Reflect
1194         argument change in pinfo::set_ctty.
1195         (fhandler_console::dup): Declare new function.  Set ctty here if
1196         appropriate.
1197         (fhandler_pty_master::from_master): Privatize.
1198         (fhandler_pty_master::to_master): Ditto.
1199         (fhandler_pty_master::dwProcessId): Ditto.
1200         (fhandler_pty_master::fhandler_pty_master): Add an `int' argument.
1201         (fhandler_pty_master::open_setup): Declare new function.
1202         (fhandler_pty_master::~fhandler_pty_master): Declare new method.
1203         (fhandler_nodevice): Remove commented out function declaration.
1204         * fhandler_console.cc: Use get_ttyp() instead of tc() throughout.
1205         (fhandler_console::dup): Define new function to set controlling ctty on
1206         dup, as appropriate.
1207         (fhandler_console::ioctl): Reflect ioctl_termios name change.
1208         (fhandler_console::setup): Rename from get_tty_stuff.
1209         (fhandler_console::open_setup): Reflect argument change in
1210         pinfo::set_ctty.
1211         (fhandler_console::fhandler_console): Set _tc here.
1212         * fhandler_termios.cc (handler_termios::ioctl): Rename.  Take a void *
1213         arg like other ioctl functions.
1214         * fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to
1215         potentially reset the controlling terminal.
1216         (fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios.
1217         (fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument.  Call
1218         setup() here so that we will know the unit number of this fhandler as
1219         soon as possible.  Set the unit as appropriate.
1220         (handler_pty_master::open): Move most stuff to constructor and
1221         open_setup.
1222         (handler_pty_slave::open_setup): Reflect argument change in
1223         pinfo::set_ctty.
1224         (handler_pty_master::open_setup): Define new function.
1225         (fhandler_pty_master::cleanup): Clear handles as a flag that the
1226         destructor does not have to do "close" operations.
1227         (fhandler_pty_master::close): Ditto.
1228         (fhandler_pty_master::~fhandler_pty_master): Define new method.
1229         (fhandler_pty_master::ioctl): Reflect name/arg change for
1230         ioctl_termios.
1231         (fhandler_pty_master::setup): Allocate tty here.  Rely on handles being
1232         returned from allocated test rather than opening them here.  Avoid
1233         setting _need_nl here since it is already zeroed in the constructor.
1234         Set up device information with DEV_TTYM_MAJOR.
1235         * path.h (path_conv &operator =): Take a const argument.
1236         (path_conv::dup): Ditto.
1237         (pathconv_arg::PC_OPEN): New enum.
1238         (pathconv_arg::PC_CTTY): Ditto.
1239         (path_types::PATH_CTTY): Ditto.
1240         (path_types::PATH_OPEN): Ditto.
1241         (path_conv::isopen): New method.
1242         (path_conv::isctty_capable): Ditto.
1243         * path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as
1244         appropriate.
1245         * pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle.
1246         * syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty
1247         on non-std* handles.
1248         * tty.cc (tty_list::allocate): Pass out handles for allocated tty.  use
1249         `not_allocated' to find unallocated ttys.  Avoid keeping the lock since
1250         the allocation of the tty should be sufficient to prevent multiple
1251         access.
1252         (tty::not_allocated): Clarify comment.  Rename.  Return handles when an
1253         unused tty is found.  Simply test for existing tty.
1254         (tty::exists): Rewrite to use `not_allocated'.
1255         * tty.h (NTTYS): Reset down to actual number supported by devices.in.
1256         (tty::not_allocated): Declare new function.
1257         (tty_list::allocate): Pass out read/write tty handles.  Zero them when
1258         not found.
1259         * fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX.
1260         * pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in.
1261         * pinfo.cc (pinfo::set_ctty): Ditto.  Just use tc() built into the
1262         passed-in fhandler_termios pointer.  Return true if ctty is assigned.
1263         * syscalls.cc (open): Call build_fh_pc with PC_OPEN flag.  Set PC_CTTY
1264         if appropriate.
1265         (stat_worker): Remove is_dev_tty () stuff.
1266
1267 2011-10-15  Corinna Vinschen  <corinna@vinschen.de>
1268
1269         * fhandler_process.cc (dos_drive_mappings::fixup_if_match): Convert
1270         native NT network paths into DOS UNC paths.
1271
1272 2011-10-15  Corinna Vinschen  <corinna@vinschen.de>
1273
1274         * sec_auth.cc (get_token_group_sidlist): Add CONSOLE LOGON SID on
1275         systems supporting it.  Never add SERVICE SID but keep code in for
1276         future reference.  Explain why.
1277         (get_priv_list): Add cygpsid pointer parameter.  Point it to the
1278         mandatory integrity SID which matches account and privileges.
1279         (create_token): Fetch mandatory integrity SID from call to
1280         get_priv_list.
1281         (lsaauth): Call get_priv_list with additional NULL pointer.  Change
1282         comment accordingly.
1283         * sec_helper.cc (well_known_console_logon_sid): New static SID.
1284         (cygpriv): Change to structure containing extra flag to store info
1285         about required integrity level.
1286         (privilege_luid): Accommodate changes to cygpriv.  Return integrity
1287         level in new high_integrity parameter.
1288         (privilege_name): Accommodate changes to cygpriv.
1289         (set_privilege): Drop trailing \n from debug output.
1290         (set_cygwin_privileges): Don't set SE_CREATE_GLOBAL_PRIVILEGE anymore
1291         since it's just not needed, but keep code in for future reference.
1292         Change comment accordingly.
1293         * security.h (well_known_console_logon_sid): Declare.
1294         (privilege_luid): Align declaration to above change.
1295         * wincap.h (wincaps::has_console_logon_sid): New element.
1296         * wincap.cc: Implement above element throughout.
1297
1298 2011-10-13  Corinna Vinschen  <corinna@vinschen.de>
1299
1300         * path.cc (find_fast_cwd_pointer): Allow 'push crit-sect-addr' instead
1301         of 'mov edi, crit-sect-addr; push edi' and set rcall accordingly.
1302
1303 2011-10-13  Corinna Vinschen  <corinna@vinschen.de>
1304
1305         * path.cc (copy_cwd_str): Move up in file to be accessible from
1306         class fcwd_access_t.
1307         (class fcwd_access_t): New class to consolidate and hide the details
1308         of the various FAST_CWD implementations.  Add implementation for
1309         Windows 8 Developer Preview.
1310         (fast_cwd_version): Make static private member of fcwd_access_t.
1311         (fast_cwd_ptr): Change base type to fcwd_access_t.
1312         (find_fast_cwd_pointer): Return fcwd_access_t**.
1313         (find_fast_cwd): Ditto.  Rip out all FAST_CWD implementations and use
1314         fcwd_access_t methods instead.
1315         (cwdstuff::override_win32_cwd): Ditto.
1316
1317 2011-10-12  Corinna Vinschen  <corinna@vinschen.de>
1318
1319         * fhandler_console.cc (fhandler_console::cursor_set): Disable forcing
1320         y to the current winBottom position.  Explain why.
1321
1322 2011-10-11  Christopher Faylor  <me.cygwin2011@cgf.cx>
1323
1324         * cygwin.din: Remove some _tc* exports.  Add tcgetsid().
1325         * dtable.cc (fh_alloc): Revert ill-advised setting of major/minor.  Use
1326         new is_dev_tty to remember that this device was opened as /dev/tty.
1327         * fhandler.cc (fhandler_base::fstat): Remove leftover debugging
1328         statement.
1329         (fhandler_base::tcgetsid): New function.
1330         * fhandler.h ((fhandler_base::tcgetsid): Declare new function.
1331         (fhandler_base::is_dev_tty): Ditto.
1332         (fhandler_termios): Rearrange protected/public.
1333         (fhandler_termios::fhandler_termios): Remember last fhandler_termios
1334         "opened".
1335         (fhandler_termios::~fhandler_termios): Forget last fhandler_termios
1336         opened.
1337         (fhandler_termios::opened_as_dev_tty): Declare new field.
1338         (fhandler_termios::is_dev_tty): Declare new function.
1339         (fhandler_termios::tcgetsid): Ditto.
1340         (fhandler_pty_common::use_archetype): Move here from subclass.
1341         (fhandler_pty_slave::use_archetype): Move up.
1342         (fhandler_pty_master::use_archetype): Ditto.
1343         * fhandler_console.cc (fhandler_console::ioctl): Rename second argument
1344         from `buf' to `arg' for consistency.  Call ioctl_termios for common
1345         fhandler_termios ioctl handling.
1346         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Call ioctl_termios for
1347         common fhandler_termios ioctl handling.
1348         (fhandler_pty_master::ioctl): Ditto.
1349         * fhandler_termios.cc (fhandler_termios::tcgetsid): Implement new
1350         function.
1351         (fhandler_termios::ioctl_termios): Ditto.  Implements TIOCSCTTY
1352         handling.
1353         * syscalls.cc (stat_worker): Set /dev/tty device info when appropriate.
1354         * termios.cc (tcgetpgrp): Avoid extraneous "isatty" check.
1355         (tcgetsid): Implement new function.
1356         * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 253.
1357         * include/sys/termios.h (TIOCSCTTY): Define.
1358
1359 2011-10-11  Christopher Faylor  <me.cygwin2011@cgf.cx>
1360
1361         * dtable.cc (fh_alloc): Don't parse /dev/tty if ctty is < 0.  Reset
1362         major/minor from the specific tty to those for /dev/tty.
1363
1364 2011-10-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
1365
1366         * syscalls.cc (open): Add temporary kludge to avoid assigning the
1367         controlling tty on open unless the open is for stdin/stdout/stderr.
1368         * tty.cc (tty_list::connect): Set ENXIO when can't find a tty.
1369
1370 2011-10-10  Corinna Vinschen  <corinna@vinschen.de>
1371
1372         * fhandler.h (fhandler_process::closedir): Declare.
1373         * fhandler_process.cc (fhandler_process::closedir): New function to
1374         avoid a SEGV in fhandler_proc::closedir.
1375
1376 2011-10-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
1377
1378         * fhandler_tty.cc (fhandler_pty_slave::open): Clarify debugging output.
1379         (fhandler_pty_slave::open): Change ENOENT to ENXIO when can't open a
1380         tty.
1381
1382 2011-10-07  Corinna Vinschen  <corinna@vinschen.de>
1383             Christopher Faylor  <me.cygwin2011@cgf.cx>
1384
1385         * fhandler.h (fhandler_console::tc_getpgid): New function.
1386         * spawn.cc (spawn_guts): Add logic to put pure-windows processes "in
1387         the background" when they are started that way.
1388
1389 2011-10-07  Corinna Vinschen  <corinna@vinschen.de>
1390
1391         * include/sys/cygwin.h (cygwin_getinfo_types): Define values
1392         additionally as preprocessor symbols.
1393
1394 2011-10-06  Corinna Vinschen  <corinna@vinschen.de>
1395
1396         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Send __SIGSETPGRP
1397         pseudo signal to process group instead of just calling
1398         init_console_handler.
1399         * sigproc.cc (wait_sig): Call init_console_handler here on __SIGSETPGRP
1400         signal.
1401         * sigproc.h (__SIGSETPGRP): Define.
1402
1403 2011-10-06  Christian Franke  <franke@computer.org>
1404
1405         * include/cygwin/wait.h: Use new __wait_status_to_int()
1406         macro to access status value in W*() status checks.
1407         Fix status description.
1408         * include/sys/wait.h: Allow `int' and `union wait' as
1409         wait status parameter.  Change __wait_status_to_int()
1410         macro and wait () prototypes accordingly.  Add inline
1411         functions for C++.  Remove extra `;'.
1412
1413 2011-10-05  Corinna Vinschen  <corinna@vinschen.de>
1414
1415         * external.cc (create_winenv): Rename from sync_winenv.  Take
1416         environment pointer as parameter and return pointer to corresponding
1417         win32 environment block if != NULL.  Otherwise just sync as before.
1418         (cygwin_internal): Add CW_CVT_ENV_TO_WINENV case.
1419         * include/cygwin/version.h: Bump API minor number.
1420         * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_CVT_ENV_TO_WINENV.
1421
1422 2011-10-04  Corinna Vinschen  <corinna@vinschen.de>
1423
1424         * net.cc (socketpair): Bind first socket to loopback only as well.
1425
1426 2011-09-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
1427
1428         * tty.cc (grantpt): Check for valid fd.
1429         (unlockpt): Ditto.
1430
1431 2011-09-02  Corinna Vinschen  <corinna@vinschen.de>
1432
1433         * net.cc (cygwin_getsockopt): Drop erroneous double conversion of error
1434         code returned by SOL_SOCKET/SO_ERROR.  Fix error handling.
1435
1436 2011-09-01  Corinna Vinschen  <corinna@vinschen.de>
1437
1438         * lc_msg.h: Regenerate.
1439
1440 2011-09-01  Corinna Vinschen  <corinna@vinschen.de>
1441
1442         * dlfcn.cc (gfpod_helper): Helper function to search DLL using
1443         a given DLL name.  Change default search path to allow /usr/bin.
1444         (get_full_path_of_dll): Find DLLs even if the caller used a ".so"
1445         suffix or a "lib" prefix for the DLL.
1446
1447 2011-08-31  Corinna Vinschen  <corinna@vinschen.de>
1448
1449         * flock.cc (inode_t::unlock_and_remove_if_unused): Rename from
1450         unlock_and_remove.
1451
1452 2011-08-29  Corinna Vinschen  <corinna@vinschen.de>
1453
1454         * flock.cc (LOCK_OBJ_NAME_LEN): Change to accommodate extra lf_ver
1455         field.
1456         (class lockf_t): Add lf_ver field.
1457         (lockf_t::lockf_t): Initialize lf_ver to 0.
1458         (class inode_t): Change i_wait to i_cnt.  Change comment to explain
1459         change in usage.
1460         (inode_t:use): Rename from wait.  Make private.
1461         (inode_t::unuse): Rename from unwait.  Make private.
1462         (inode_t::inuse): Rename from waiting.  Make private.
1463         (inode_t::notused): New public method to set use count to 0.
1464         (inode_t::unlock_and_remove): New method to unlock node and to delete
1465         it if it's unused in current process.
1466         (fhandler_base::del_my_locks): Drop global list lock.  Drop variable
1467         no_locks_left.  Simpify unlocking and removing node by just calling
1468         unlock_and_remove.
1469         (fixup_lockf_after_exec): Call notused method for each node.
1470         (inode_t::get): Call use method.  Lock node only if outside of list
1471         lock.
1472         (inode_t::get_all_locks_list): Accommodate additional lf_ver field
1473         when creating lockf_t structure from object name.
1474         (lockf_t::create_lock_obj_attr): Accommodate additional lf_ver field
1475         when creating object name from lockf_t structure.  Handle
1476         STATUS_OBJECT_NAME_COLLISION gracefully in F_POSIX case as well.
1477         Change comment accordingly.  Increment lf_ver field rather than high
1478         byte of lf_wid field.  Simplify comment.
1479         (fhandler_disk_file::lock): Always call unlock_and_remove rather than
1480         just UNLOCK on node.
1481         (lf_setlock): Move ret definition where it's used.  Drop unneeded
1482         tests for obj being not NULL.  Only check for deadlock condition if the
1483         lock we're trying to establish is a POSIX lock.  Revamp object
1484         collecting and wait code to cover all cases.  Don't return with EDEADLK
1485         if blocking process can't be opened for synchronization in F_POSIX case,
1486         rather just wait like in F_FLOCK case.  Change system_printf to
1487         debug_printf in that case.  Only run WaitForMultipleObjects with high
1488         priority.  Close obj and process handles prior to locking node.
1489
1490 2011-08-27  Corinna Vinschen  <corinna@vinschen.de>
1491
1492         * fhandler.cc (fhandler_base::open): Fix typo in comment.
1493         (fhandler_base::close): Move call to del_my_locks from here...
1494         * fhandler_disk_file.cc (fhandler_disk_file::open): ...to here.
1495         * flock.cc (struct lockfattr_t): New type.
1496         (lockf_t::close_lock_obj): New method, use throughout.
1497         (lockf_t::create_lock_obj_attr): New method.
1498         (lockf_t::create_lock_obj): Use create_lock_obj_attr method.  Handle
1499         STATUS_OBJECT_NAME_COLLISION in F_FLOCK case gracefully.  Add lengthy
1500         comments to explain why and how.
1501         (lockf_t::open_lock_obj): Use create_lock_obj_attr method.
1502         (lockf_t::del_lock_obj): Call NtSetEvent rather than SetEvent for
1503         symmetry.
1504         (fhandler_disk_file::lock): Define n only where it's used.  Call
1505         need_fork_fixup only if call was successful.  Handle EINTR and
1506         ECANCELED return values from lf_setlock.
1507         (lf_setlock): Drop WAIT_UNLOCKED and WAIT_PROC_EXITED.  Don't wait
1508         for event object handle count to become <= 1 in F_LOCK case.
1509         Simplify WFMO return value handling.  Don't handle signal and cancel
1510         events here; just return with appropriate error code instead.
1511         (lf_getblock): Ignore locks for which the handle can't be opened.
1512         Use IsEventSignalled.
1513         * ntdll.h (STATUS_INVALID_INFO_CLASS): Undef if defined elsewhere to
1514         make sure the definition is casted to NTSTATUS.
1515         (STATUS_INVALID_HANDLE): Define and ditto.
1516         (STATUS_OBJECT_NAME_COLLISION): Define.
1517         (NtSetEvent): Declare.
1518
1519 2011-08-25  Rafal Zwierz  <rzwierz@googlemail.com>
1520
1521         * cygthread.cc (cygthread::simplestub): Notify that the thread has
1522         detached also in freerange thread case.
1523
1524 2011-08-25  Corinna Vinschen  <corinna@vinschen.de>
1525
1526         * fhandler.cc (fhandler_base::open): Never open files with
1527         FILE_OVERWITE/FILE_OVERWRITE_IF.  Set file size to 0 explicitely if
1528         regular, existing file has been opened for writing with O_TRUNC flag
1529         set.  Explain why.
1530
1531 2011-08-24  Corinna Vinschen  <corinna@vinschen.de>
1532
1533         * thread.cc (pthread::pthread): Drop setting parent_tls.  Call
1534         sigprocmask to copy parent thread signal mask into new parent_sigmask
1535         member.
1536         (pthread::thread_init_wrapper): Copy _my_tls.sigmask from new
1537         parent_sigmask member.
1538         * thread.h (class pthread): Drop parent_tls.  Add parent_sigmask.
1539
1540 2011-08-24  Christopher Faylor  <me.cygwin2011@cgf.cx>
1541
1542         * thread.cc (pthread::exit): Create dummy tls structure to hold
1543         _main_tls contents if we've asked _main_tls to exit.
1544
1545 2011-08-23  Corinna Vinschen  <corinna@vinschen.de>
1546
1547         * poll.cc (poll): Don't return prematurely if invalid fds have been
1548         encountered.  Enforce timeout set to 0 in case of invalid fds.  Take
1549         number of invalid fds into account when returning.
1550
1551 2011-08-23  Corinna Vinschen  <corinna@vinschen.de>
1552
1553         * fhandler_socket.cc (fhandler_socket::send_internal): Fix setting
1554         nosignal flag.  Convert ECONNABORTED on connection-oriented socket
1555         to EPIPE, too.
1556
1557 2011-08-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
1558
1559         * dtable.cc (conv_start_chars): Remove unneeded section attribute.
1560
1561 2011-08-20  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1562
1563         * include/paths.h (_PATH_MAILDIR): Define.
1564         (_PATH_SHELLS): Define.
1565
1566 2011-08-20  Corinna Vinschen  <corinna@vinschen.de>
1567
1568         * fhandler_process.cc (format_process_maps): Define page protection
1569         shortcuts RO, X, and WC.  Use in creating access flag string.  Don't
1570         set type flag to 's' for copy-on-write pages, as on Linux.
1571
1572 2011-08-19  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1573
1574         * devices.h (fh_devices): Define DEV_MISC_MAJOR, DEV_MEM_MAJOR,
1575         DEV_SOUND_MAJOR.  Use throughout.
1576         * fhandler_proc.cc (proc_tab): Add /proc/devices and /proc/misc
1577         virtual files.
1578         (format_proc_devices): New function.
1579         (format_proc_misc): New function.
1580
1581 2011-08-19  Christopher Faylor  <me.cygwin2011@cgf.cx>
1582
1583         * dtable.cc: Mark some const variables as static.
1584         * environ.cc (conv_start_chars): Move to shared cygwin region and
1585         initialize at compile time.
1586         (match_first_char): New generic function for querying conv_start_chars.
1587         (posify_maybe): Rename from posify.
1588         (environ_init): Remove conv_envvars initialization.  Don't check
1589         conv_start_chars, just allow posify_maybe to make the decision.
1590         * fhandler_console.cc (__vt100_conv): Fix formatting.  Mark as const.
1591
1592 2011-08-19  Corinna Vinschen  <corinna@vinschen.de>
1593
1594         * fhandler_console.cc (fhandler_console::read): Recognize backspace key
1595         using the device independent key code, rather than the device dependent
1596         scan code.
1597
1598 2011-08-18  Christopher Faylor  <me.cygwin2011@cgf.cx>
1599
1600         * dcrt0.cc (dll_crt0_0): Remove unneeded __stdcall decoration.
1601         * init.cc: Reflect change to dll_crt0_0 in declaration.
1602
1603 2011-08-18  Corinna Vinschen  <corinna@vinschen.de>
1604
1605         * dtable.cc (dtable::get_debugger_info): Add missing braces.
1606         (dtable::stdio_init): Fix incorrect negation of not_open(2) condition.
1607
1608 2011-08-16  Pierre Humblet <Pierre.Humblet@ieee.org>
1609
1610         * net.cc (gethostby_helper): Remove DEBUGGING code from and
1611         streamline the second pass.
1612
1613 2011-08-16  Corinna Vinschen  <corinna@vinschen.de>
1614
1615         * dlfcn.cc (dlopen): Reimplement RTLD_NODELETE for Windows 2000 using
1616         internal datastructures.  Explain the code.
1617         * ntdll.h (struct _LDR_DATA_TABLE_ENTRY): Define.
1618         (struct _PEB_LDR_DATA): Define.
1619         (struct _PEB): Change PVOID LoaderData to PPEB_LDR_DATA Ldr.
1620
1621         * fhandler_process.cc (format_process_maps): Call NtQueryVirtualMemory
1622         with valid return length pointer.  Explain why.
1623
1624 2011-08-16  Corinna Vinschen  <corinna@vinschen.de>
1625
1626         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
1627
1628 2011-08-16  Corinna Vinschen  <corinna@vinschen.de>
1629
1630         * autoload.cc (GetModuleHandleExW): Define.
1631         * dlfcn.cc: Throughout mark exported symbols as extern "C".
1632         (dlopen): Unignore flags argument.  Define ret to NULL.  Fix typo in
1633         comment.  Support Glibc flags RTLD_NOLOAD and RTLD_NODELETE.
1634         * include/dlfcn.h:  Clean up comments.
1635         (RTLD_NODELETE): Define.
1636         (RTLD_NOLOAD): Define.
1637         (RTLD_DEEPBIND): Define.
1638
1639 2011-08-15  Corinna Vinschen  <corinna@vinschen.de>
1640
1641         * pipe.cc (pipe): Just call _pipe with O_BINARY mode.  Move code to
1642         generate normalized pathnames from here...
1643         (_pipe): ...to here.
1644
1645 2011-08-13  Corinna Vinschen  <corinna@vinschen.de>
1646
1647         * miscfuncs.cc (CreatePipeOverlapped): New function.
1648         (ReadPipeOverlapped): Ditto.
1649         (WritePipeOverlapped): Ditto.
1650         * miscfuncs.h: Declare new functions.
1651         * pinfo.cc (commune_process): Call WritePipeOverlapped instead of
1652         WriteFile.  Set timeout to 1 sec.
1653         (_pinfo::commune_request): Call ReadPipeOverlapped instead of ReadFile.
1654         Set timeout to 0.5 secs.
1655         * sigproc.cc (sig_send): Create pipe using CreatePipeOverlapped.
1656
1657 2011-08-12  Christopher Faylor  <me.cygwin2011@cgf.cx>
1658
1659         * miscfuncs.cc (create_pipe): Delete obsolete function.
1660         * miscfuncs.h (create_pipe): Delete define.
1661
1662         * pipe.c (fhandler_pipe::create_selectable): Delete obsolete comment.
1663
1664 2011-08-12  Corinna Vinschen  <corinna@vinschen.de>
1665
1666         * fhandler_proc.cc (fhandler_proc::closedir): Don't free, but delete
1667         instead.
1668
1669 2011-08-12  Corinna Vinschen  <corinna@vinschen.de>
1670
1671         * fhandler.h (fhandler_proc::opendir): Declare.
1672         (fhandler_proc::closedir): Declare.
1673         * fhandler_proc.cc (fhandler_proc::opendir): New method.  Fetch list
1674         of active processes here once to avoid potential duplicates and store
1675         in dir->__handle.
1676         (fhandler_proc::closedir): New method.  Free dir->__handle.
1677         (fhandler_proc::readdir): Convert pinfo into a reference to the winpids
1678         entry in dir->__handle.
1679
1680 2011-08-11  Corinna Vinschen  <corinna@vinschen.de>
1681
1682         * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Don't allow to
1683         access process info by using the Windows PID.
1684         * fhandler_process.cc (fhandler_process::fstat): Ditto.
1685         (fhandler_process::fill_filebuf): Ditto.
1686
1687 2011-08-11  Corinna Vinschen  <corinna@vinschen.de>
1688
1689         * (winpids::add): Make sure to store always a Windows PID in
1690         pidlist, even if pid is a Cygwin PID.
1691         (winpids::enum_processes): Fetch Cygwin processes from listing of
1692         shared cygwin object dir in the native NT namespace.  Only if winpid
1693         is true, fetch Windows processes using an additional call to
1694         NtQuerySystemInformation.
1695
1696 2011-08-10  Corinna Vinschen  <corinna@vinschen.de>
1697
1698         * fhandler_process.cc (format_process_status): Always print process name
1699         even for zombies.
1700         (get_mem_values): Fix loop fetching working set list to avoid out of
1701         memory conditions.  Return all mem values set to 0 for zombies.
1702         * ntdll.h (STATUS_PROCESS_IS_TERMINATING): Define.
1703
1704 2011-08-09  Corinna Vinschen  <corinna@vinschen.de>
1705
1706         * heap.cc (eval_initial_heap_size): New function fetching the heap
1707         size from the LoaderFlags field in the PE/COFF header.
1708         (heap_init): Call eval_initial_heap_size rather than
1709         cygwin_shared->heap_chunk_size to fetch the initial heap size.
1710         * shared.cc (shared_info::heap_chunk_size): Remove.
1711         * shared_info.h (class shared_info): Drop heap_chunk member.
1712         (CURR_SHARED_MAGIC): Update.
1713
1714 2011-08-09  Corinna Vinschen  <corinna@vinschen.de>
1715
1716         * ntdll.h (STATUS_NOT_FOUND): Define.
1717         * ntea.cc (read_ea): Return correct ENOTSUP rather than EOPNOTSUPP.
1718         Handle STATUS_INVALID_DEVICE_REQUEST and STATUS_NOT_FOUND.  Explain
1719         why.  Convert conditional to switch statement.
1720         (write_ea): Return correct ENOTSUP rather than EOPNOTSUPP.  Handle
1721         STATUS_INVALID_DEVICE_REQUEST.  Convert conditional to switch statement.
1722
1723 2011-08-07  Corinna Vinschen  <corinna@vinschen.de>
1724
1725         * resource.cc (getrlimit): Just return RLIM_INFINITY in a request for
1726         RLIMIT_AS.
1727
1728 2011-08-07  Corinna Vinschen  <corinna@vinschen.de>
1729
1730         * fhandler_process.cc (format_process_maps): Actually print info about
1731         the application heap of the printed process, not of the current process.
1732
1733 2011-08-04  Corinna Vinschen  <corinna@vinschen.de>
1734
1735         * net.cc (socketpair): Release sb0 if there's no space left for sb1.
1736
1737 2011-08-03  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1738
1739         * cygwin.din (clock_nanosleep): Export.
1740         * posix.sgml (std-notimpl): Move clock_nanosleep from here...
1741         (std-susv4): ... to here.
1742         (std-notes): Note limitations of clock_nanosleep.
1743         * signal.cc (clock_nanosleep): Renamed from nanosleep, adding clock_id
1744         and flags arguments and changing return values throughout.
1745         Improve checks for illegal rqtp values.  Add support for
1746         CLOCK_MONOTONIC and TIMER_ABSTIME.
1747         (nanosleep): Rewrite in terms of clock_nanosleep.
1748         (sleep): Ditto.
1749         (usleep): Ditto.
1750         * thread.cc: Mark clock_nanosleep in list of cancellation points.
1751         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
1752
1753 2011-08-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
1754
1755         * dll_init.cc: Use fabort in favor of api_fatal and fork_info->abort
1756         where appropriate throughout.
1757         (fabort): Define.
1758         (dll_list::topsort): Don't print sorting information.  Fix formatting.
1759         (dll_list::topsort_visit): Fix formatting.
1760         (dll_list::load_after_fork_impl): Perform comment fixups.
1761         * sigproc.cc (child_info_fork::abort): (for now?) Always print cause of
1762         fork failure.
1763         * include/sys/strace.h (strace_vprintf): Remove _STRACE_NOTALL when
1764         printing.  We really do want to see this.
1765
1766 2011-08-03  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1767
1768         * cygtls.h (struct _local_storage): Add cw_timer member.
1769         * cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer.
1770         (_cygtls::fixup_after_fork): Ditto.
1771         * tlsoffsets.h: Regenerate.
1772         * ntdll.h (enum _TIMER_INFORMATION_CLASS): Define.
1773         (struct _TIMER_BASIC_INFORMATION): Define.
1774         (NtQueryTimer): Declare function.
1775         * thread.h (cancelable_wait): Change timeout argument to
1776         PLARGE_INTEGER and provide NULL default.
1777         (fast_mutex::lock): Adjust accordingly.
1778         (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER
1779         and default to NULL.
1780         * thread.cc (cancelable_wait): Change timeout argument to
1781         PLARGE_INTEGER.  Initialize _cygtls.locals.cw_timer if needed.
1782         Use NT waitable timers for handling timeout.  Return remaining time
1783         to timeout argument if timeout was relative.
1784         (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER.
1785         Adjust to change in cancelable_wait.
1786         (pthread_mutex::lock): Adjust to change in cancelable_wait.
1787         (pthread_spinlock::lock): Ditto.
1788         (pthread::join): Ditto.
1789         (__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER.
1790         Adjust to changes in cancelable_wait and pthread_cond::wait.
1791         (pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait.
1792         (pthread_cond_wait): Ditto.
1793         (semaphore::_timedwait): Adjust to change in cancelable_wait.
1794         (semaphore::_wait): Ditto.
1795         * exceptions.cc (handle_sigsuspend): Ditto.
1796         * signal.cc (nanosleep): Ditto.
1797         * wait.cc (wait4): Ditto. Fix copyright dates.
1798         * times.cc (FACTOR, NSPERSEC): Move from here...
1799         * hires.h (FACTOR, NSPERSEC): ...to here.
1800
1801 2011-08-01  Corinna Vinschen  <corinna@vinschen.de>
1802
1803         * syscalls.cc (faccessat): Fix parens in flag expression when calling
1804         build_fh_name.
1805
1806         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Fix typo in
1807         comment.
1808         * fhandler_socket.cc (fhandler_socket::bind): Ditto.
1809         * path.cc (symlink_worker): Ditto.
1810
1811 2011-07-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1812
1813         * dll_init.cc (dll_list::load_after_fork_impl): Add a hint to an error
1814         message.
1815
1816 2011-07-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
1817
1818         * sigproc.cc (pending_signals::pending): Define new function.
1819         (sig_dispatch_pending): Avoid calling sig_send if there are no pending
1820         signals.
1821
1822 2011-07-31  Corinna Vinschen  <corinna@vinschen.de>
1823
1824         * fhandler.h (class fhandler_dev_mem): Remove dup method declaration.
1825         * fhandler_clipboard.cc (fhandler_dev_clipboard::dup): Accommodate the
1826         fact that the entire fhandler gets copied over to the child in
1827         operator =.
1828         * fhandler_floppy.cc (fhandler_dev_floppy::dup): Ditto.
1829         * fhandler_raw.cc (fhandler_dev_raw::dup): Ditto.
1830         * fhandler_serial.cc (fhandler_serial::dup): Ditto.
1831         * fhandler_socket.cc (fhandler_socket::dup): Ditto.
1832         * fhandler_virtual.cc (fhandler_virtual::dup): Ditto.
1833         * fhandler_mem.cc (fhandler_dev_mem::dup): Ditto.  Remove entirely.
1834
1835 2011-07-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1836
1837         * cygthread.cc (cygthread::async_create): Define new function.
1838         * cygthread.h (cygthread::create): Use correct regparm.
1839         (cygthread::standalone): Delete from class and from all constructors.
1840         (cygthread::cygthread): Use three only arguments for detached threads,
1841         (cygthread::async_create): Declare.
1842         and start the thread via QueueUserAPC/async_create.
1843         * dcrt0.cc (dll_crt0_0): Remove handling for
1844         wincap.has_buggy_thread_startup.
1845         (dll_crt0_1): Ditto.
1846         * wincap.cc: Ditto throughout.
1847         * wincap.h: Ditto.
1848
1849 2011-07-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
1850
1851         * fhandler.h (fhandler_base_overlapped::size): Declare/define size()
1852         function for consistency.
1853         (fhandler_termios::size): Ditto.
1854         (fhandler_pty_common::size): Ditto.
1855
1856 2011-07-30  Corinna Vinschen  <corinna@vinschen.de>
1857
1858         * fhandler_registry.cc (fhandler_registry::dup): Duplicate value_name.
1859
1860 2011-07-29  Corinna Vinschen  <corinna@vinschen.de>
1861
1862         Throughout change "WinSock" to "Winsock" in comments.
1863         * fhandler_socket.cc (fhandler_socket::sendmsg): Add missing call to
1864         get_inet_addr to convert AF_LOCAL to AF_INET sockets.
1865         * net.cc (cygwin_socket): Workaround UDP Winsock problem.  Add comment
1866         to explain why.
1867         * select.cc: Include winsock2.h rather than winsock.h.
1868
1869 2011-07-26  Corinna Vinschen  <corinna@vinschen.de>
1870
1871         * fhandler_disk_file.cc (__DIR_mounts::eval_ino): Create path_conv
1872         with PC_KEEP_HANDLE flag.
1873         * path.h (path_conv::operator =): Duplicate UNICODE path as well.
1874         * security.cc (check_file_access): Use path_conv handle if available.
1875         * syscalls.cc (access): Create fhandler with PC_KEEP_HANDLE flag set.
1876         (euidaccess): Ditto.
1877         (faccessat): Ditto.
1878
1879 2011-07-26  Corinna Vinschen  <corinna@vinschen.de>
1880
1881         * ntdll.h: Fix typo in comment.
1882         * path.cc: Ditto.
1883
1884 2011-07-25  Corinna Vinschen  <corinna@vinschen.de>
1885
1886         * fhandler_console.cc (fhandler_console::ioctl): Fetch console events
1887         using PeekConsoleInput and return only key down events in buf.
1888         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Always return EINVAL
1889         if PeekNamedPipe fails.
1890         (fhandler_pty_master::ioctl): Ditto.
1891
1892 2011-07-22  Corinna Vinschen  <corinna@vinschen.de>
1893
1894         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Drop FIONBIO case.
1895         Handle FIONREAD.
1896         (fhandler_pty_master::ioctl): Ditto.  Call fhandler_base::ioctl to
1897         decode default condition.
1898         * fhandler_console.cc (fhandler_console::ioctl): Handle FIONREAD.
1899
1900 2011-07-21  Christopher Faylor  <me.cygwin2011@cgf.cx>
1901             Corinna Vinschen  <corinna@vinschen.de>
1902
1903         * fhandler.cc: Add #include for asm/socket.h for dealing with FIONREAD.
1904         (fhandler_base::ioctl): Special-case errno for FIONREAD.
1905         * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Rename parameter for
1906         consistency.  Call fhandler_base::ioctl to decode default condition.
1907         * fhandler_serial.cc (fhandler_serial::ioctl): Ditto.
1908         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Call
1909         fhandler_base::ioctl to decode default condition.
1910         * fhandler_windows.cc (fhandler_windows::ioctl): Ditto.
1911
1912 2011-07-21  Corinna Vinschen  <corinna@vinschen.de>
1913
1914         * heap.cc (eval_start_address): Simplify test for large address
1915         awareness of executable, which works for 32 and 64 bit systems.
1916         Change comment accordingly.
1917
1918 2011-07-21  Corinna Vinschen  <corinna@vinschen.de>
1919
1920         * heap.cc (eval_start_address): New static function to evaluate the
1921         best start address for the application heap.
1922         (heap_init): Call eval_start_address to fetch the start value for
1923         start_address.  Move preceeding comment to eval_start_address.
1924
1925 2011-07-21  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1926
1927         * cygwin.din (pthread_condattr_getclock): Export.
1928         (pthread_condattr_setclock): Export.
1929         * posix.sgml (std-notimpl): Move pthread_condattr_getclock and
1930         pthread_condattr_setclock from here...
1931         (std-susv4): ... to here.
1932         * sysconf.cc (sca): Set _SC_CLOCK_SELECTION to _POSIX_CLOCK_SELECTION.
1933         * thread.cc: (pthread_condattr::pthread_condattr): Initialize clock_id.
1934         (pthread_cond::pthread_cond): Initialize clock_id.
1935         (pthread_cond_timedwait): Use clock_gettime() instead of gettimeofday()
1936         in order to support all allowed clocks.
1937         (pthread_condattr_getclock): New function.
1938         (pthread_condattr_setclock): New function.
1939         * thread.h (class pthread_condattr): Add clock_id member.
1940         (class pthread_cond): Ditto.
1941         * include/pthread.h: Remove obsolete comment.
1942         (pthread_condattr_getclock): Declare.
1943         (pthread_condattr_setclock): Declare.
1944         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
1945
1946 2011-07-18  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
1947
1948         * sysconf.cc (sca): Return -1 for _SC_THREAD_ROBUST_PRIO_INHERIT,
1949         _SC_THREAD_ROBUST_PRIO_PROTECT, and _SC_XOPEN_UUCP.
1950         (SC_MAX): Redefine accordingly.
1951         (csa): Return strings for _CS_POSIX_V7_THREADS_CFLAGS,
1952         _CS_POSIX_V7_THREADS_LDFLAGS, and _CS_V7_ENV.
1953         (CS_MAX): Redefine accordingly.
1954         * include/limits.h (LONG_BIT): Define.
1955         (WORD_BIT): Define.
1956
1957 2011-07-18  Corinna Vinschen  <corinna@vinschen.de>
1958
1959         * heap.cc (heap_init): Change type of largest_found to PVOID.  Start
1960         querying memory at 0x20000000.  Use largest_found pointer when trying
1961         to allocate largest free memory area found.
1962
1963 2011-07-14  Corinna Vinschen  <corinna@vinschen.de>
1964
1965         * fhandler_console.cc (fhandler_console::input_tcsetattr): Revert to
1966         setting ENABLE_PROCESSED_INPUT depending on ISIG and IGNBRK.
1967         (fhandler_console::tcgetattr): Set ISIG depending on
1968         ENABLE_PROCESSED_INPUT as well.
1969
1970 2011-07-13  Corinna Vinschen  <corinna@vinschen.de>
1971
1972         * fhandler_serial.cc (fhandler_serial::raw_read): Handle non-blocking
1973         case more thoroughly.
1974
1975 2011-07-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
1976
1977         * setup_handler (setup_handler): Change break to goto out, missed in
1978         2011-07-06 changes.
1979
1980 2011-07-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
1981
1982         * fhandler_tty.cc (fhandler_pty_slave::ioctl): Remove erroneous support
1983         for TIOCLINUX for pty.  Get rid of unneeded EINVAL handling in wake of
1984         tty removal.  Remove now-unneeded variable.
1985
1986 2011-07-10  Corinna Vinschen  <corinna@vinschen.de>
1987
1988         * include/netdb.h (gethostbyname2): Declare.
1989
1990 2011-07-09  Eric Blake  <eblake@redhat.com>
1991
1992         * signal.cc (handle_sigprocmask): Return error rather than setting
1993         errno, for pthread_sigmask.
1994         (sigprocmask): Adjust caller.
1995
1996 2011-07-07  Corinna Vinschen  <corinna@vinschen.de>
1997
1998         * miscfuncs.cc (yield): Drop thread priority only once.
1999
2000 2011-07-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
2001
2002         * exceptions.cc (_cygtls::interrupt_now): Back out previous change
2003         since it could theoretically cause a non-CTRL-C-able program if a
2004         program has suffered memory corruption.
2005         (setup_handler): Ditto.
2006
2007 2011-07-06  Corinna Vinschen  <corinna@vinschen.de>
2008
2009         * sched.c (sched_yield): Just call SwitchToThread because yield now
2010         potentially switches CPU.
2011
2012 2011-07-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
2013
2014         * exceptions.cc (_cygtls::interrupt_now): Don't check for spinning
2015         here.
2016         (setup_handler): Check for spinning here, assuming that it is
2017         transitory and should not affect the retry loop.
2018
2019 2011-07-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
2020
2021         * exceptions.cc (CALL_HANDLER_RETRY_INNER): Rename to reflect different
2022         functionality.
2023         (CALL_HANDLER_RETRY_OUTER): New define.
2024         (setup_handler): Add outer loop to signal handler to try harder to
2025         deliver the signal.
2026         * miscfuncs.cc (yield): Drop priority and use SleepEx() to force thread
2027         rescheduling rather than relying on SwitchToThread().
2028
2029 2011-07-06  Corinna Vinschen  <corinna@vinschen.de>
2030
2031         * sigproc.cc (wait_sig): Fix debug output.
2032
2033 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
2034
2035         * fhandler_console.cc (fhandler_console::input_tcsetattr): Make
2036         ENABLE_PROCESSED_INPUT flag only depending on value of IGNBRK.
2037         (fhandler_console::tcgetattr): Don't set ISIG depending on
2038         ENABLE_PROCESSED_INPUT, set IGNBRK instead.
2039
2040 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
2041
2042         * security.cc (get_file_sd): Fix comment.
2043
2044 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
2045
2046         * fhandler.cc (fhandler_base::open): Never create files with WRITE_DAC
2047         access.  Explain why.
2048         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Improve debug
2049         output.
2050
2051 2011-07-05  Corinna Vinschen  <corinna@vinschen.de>
2052
2053         * fhandler.cc (fhandler_base::open): Don't open file with WRITE_DAC
2054         access on remote filesystem.  Explain why.
2055         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
2056         directories.
2057         * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
2058         * path.cc (symlink_worker): Ditto for symlinks.
2059
2060 2011-07-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2061
2062         * environ.cc (tty_is_gone): Wrap warning at 80 characters.
2063
2064 2011-07-04  Corinna Vinschen  <corinna@vinschen.de>
2065
2066         Throughout, open console handles with sharing for reading and writing.
2067         * dcrt0.cc (insert_file): Open file with full sharing allowed.
2068         * hookapi.cc (find_first_notloaded_dll): Ditto.
2069         * spawn.cc (av::fixup): Ditto.
2070
2071 2011-07-04  Corinna Vinschen  <corinna@vinschen.de>
2072
2073         * dtable.cc (dtable::init_std_file_from_handle): Change test for console
2074         device in call to fh->init to avoid conhost crash on W7.
2075
2076 2011-07-04  Corinna Vinschen  <corinna@vinschen.de>
2077
2078         * environ.cc (environ_init): Reinstantiate on-the-fly CYGWIN variable
2079         test and call to parse_options if found.
2080
2081 2011-07-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2082
2083         * fhandler.cc (fhandler_base::open_with_arch): Call close_on_exec last
2084         to avoid setting close_on_exec for archetype.
2085         * fhandler_tty.cc (fhandler_pty_master::setup): Protect {from,to}_pty
2086         handles.  Use consistent naming in debug output.  Use inheritable
2087         handles and...
2088         (fhandler_pty_master::fixup_after_fork): ...avoid duplicating handles
2089         here.
2090         (fhandler_pty_slave::open): Don't set close_on_exec flag here.
2091
2092 2011-07-01  Christopher Faylor  <me.cygwin2011@cgf.cx>
2093
2094         * dtable.cc (cnew): Fix whitespace.
2095
2096 2011-07-01  Corinna Vinschen  <corinna@vinschen.de>
2097
2098         * include/sys/param.h (NGROUPS): Redefine as NGROUPS_MAX.
2099         (MAXHOSTNAMELEN): Redefine with same value as MAX_HOSTNAME_LEN.  Change
2100         comment.
2101         (MAXPATHLEN): Improve comment.
2102         (MAXSYMLINKS): Define and add comment.
2103
2104 2011-07-01  Corinna Vinschen  <corinna@vinschen.de>
2105
2106         * fhandler.cc (fhandler_base::open): Move NFS-specific code into the
2107         code block handling FH_FS stuff.
2108
2109 2011-06-30  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
2110
2111         * dtable.cc (fh_oom): Remove.
2112         (fh_calloc): Remove.
2113         (cnew): Redefine to handle NULL returns from cmalloc.
2114         (build_fh_name): Accommodate new definition of cnew.  Remove unneeded
2115         test for fh_oom.
2116         (fh_alloc): Ditto.
2117
2118 2011-06-30  Corinna Vinschen  <corinna@vinschen.de>
2119
2120         * fhandler_console.cc (fhandler_console::read): Add comment.
2121         (fhandler_console::input_tcsetattr): Don't set ENABLE_PROCESSED_INPUT
2122         if IGNBRK flag is set.
2123
2124 2011-06-30  Corinna Vinschen  <corinna@vinschen.de>
2125
2126         * dtable.cc (fh_oom): New static fhandler storage.
2127         (fh_calloc): New static function.  Add a comment to explain why this
2128         is needed.
2129         (cnew): Call fh_calloc as placement argument.
2130         (build_fh_name): Check return code from cnew against address of
2131         fh_oom to test for out of memory condition.
2132         (fh_alloc): Ditto.
2133         (build_fh_pc): Avoid a crash due to useing a NULL fhandler.
2134         * pipe.cc (fhandler_pipe::create): Check if build_fh_dev returned a
2135         valid pointer before using it.
2136
2137 2011-06-28  Corinna Vinschen  <corinna@vinschen.de>
2138
2139         * fhandler_process.cc (heap_info::fill_if_match): Rename info to
2140         note that this heap is a Windows heap.
2141         (format_process_maps): Print info about application heap.
2142
2143 2011-06-24  Corinna Vinschen  <corinna@vinschen.de>
2144
2145         * fhandler_console.cc (fhandler_console::read): Don't generate ^@ on
2146         Ctrl+Alt+Space.
2147
2148 2011-06-22  Corinna Vinschen  <corinna@vinschen.de>
2149
2150         * fhandler_tty.cc (fhandler_pty_master::setup): Create pty pipes
2151         non-inheritable.
2152
2153 2011-06-22  Corinna Vinschen  <corinna@vinschen.de>
2154
2155         * fhandler_tty.cc (fhandler_pty_master::setup): Fix crash in debug
2156         output.
2157
2158 2011-06-18  Corinna Vinschen  <corinna@vinschen.de>
2159
2160         * path.cc (normalize_win32_path): Skip all slashes after recognizing
2161         a ".." path component.  Add comment.
2162
2163 2011-06-17  Corinna Vinschen  <corinna@vinschen.de>
2164
2165         * fhandler.cc (fhandler_base::open): Drop local create_options variable.
2166         Use options member instead.
2167         * fhandler.h (class fhandler_base): Change type of access member to
2168         ACCESS_MASK.  Change get_access and set_access methods accordingly.
2169         Add options member.  Add get_options and set_options methods.
2170         (class fhandler_disk_file): Add prw_handle.
2171         (fhandler_disk_file::prw_open): Declare.
2172         (fhandler_disk_file::close): Declare.
2173         (fhandler_disk_file::dup): Declare.
2174         (fhandler_disk_file::fixup_after_fork): Declare.
2175         * fhandler_disk_file.cc (fhandler_disk_file::fhandler_disk_file):
2176         Initialize prw_handle to NULL.
2177         (fhandler_disk_file::close): Close prw_handle.
2178         (fhandler_disk_file::dup): New method.
2179         (fhandler_disk_file::fixup_after_fork): Set prw_handle to NULL since
2180         prw_handle is not inherited.
2181         (fhandler_disk_file::prw_open): New method.  Add long comment to
2182         explain current behaviour.
2183         (fhandler_disk_file::pread): Revert previous change.  Change to use
2184         prw_handle if possible.
2185         (fhandler_disk_file::pwrite): Change to use prw_handle if possible.
2186
2187 2011-06-17  Corinna Vinschen  <corinna@vinschen.de>
2188
2189         * dcrt0.cc (dll_crt0_1): Call strace.dll_info after call to pinfo_init.
2190         * strace.cc (strace::hello): Drop printing DLL information here since
2191         application info is not always available at this point.
2192         (strace::dll_info): New method to print DLL info.
2193         * include/sys/strace.h (strace::dll_info): Declare.
2194
2195 2011-06-17  Corinna Vinschen  <corinna@vinschen.de>
2196
2197         * dtable.cc (handle_to_fn): Accommodate name change of pty named pipes,
2198         otherwise ptys are not recognized.
2199
2200 2011-06-16  Christopher Faylor  <me.cygwin2011@cgf.cx>
2201
2202         * fhandler_console.cc (fhandler_console::set_unit): Set
2203         pc.file_attributes() to reflect existence.
2204         * fhandler.h (fhandler_pty_common::fhandler_pty_common): Ditto.
2205         * pinfo.cc (_pinfo::set_ctty): Output device numbers in hex.
2206
2207 2011-06-15  Christopher Faylor  <me.cygwin2011@cgf.cx>
2208
2209         * errno.cc (EIO): Lowercase "o" representative string.
2210
2211 2011-06-14  Christopher Faylor  <me.cygwin2011@cgf.cx>
2212
2213         * cygheap.h (init_cygheap::ctty_on_hold): Remove conditionalized
2214         variable.
2215         * dcrt0.cc (do_exit): Remove code which handled CYGWIN=tty style ttys.
2216         * devices.in: Remove "/dev/ttym".
2217         * dtable.cc: Rename tty to pty where appropriate throughout.
2218         (dtable::stdio_init): Use new t->is_console rather than using
2219         now-deleted hwnd element in tty structure.
2220         (dtable::init_std_file_from_handle): Remove code which handled
2221         CYGWIN=tty style ttys.
2222         (fh_alloc): Ditto.
2223         * fhandler.h: Rename tty to pty where appropriate.
2224         (fhandler_pty_common): Delete output_done_event, ioctl_request_event,
2225         ioctl_done_event.
2226         (fhandler_pty_master::setup): Delete argument.
2227         (fhandler_tty_master): Delete.
2228         (fhandler_union): Delete __tty_master.
2229         * fhandler_console.cc (use_tty): Delete.
2230         (fhandler_console::get_tty_stuff): Set is_console to true rather than
2231         calling sethwnd.
2232         (fhandler_console::send_winch_maybe): Remove CYGWIN=tty considerations.
2233         (fhandler_console::input_tcsetattr): Ditto.
2234         * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Use new
2235         t->is_console rather than using now-deleted hwnd element in tty
2236         structure.
2237         * fhandler_tty.cc: Rename tty to pty where appropriate throughout.
2238         (tty_master): Delete.
2239         (process_input): Ditto.
2240         (process_output): Ditto.
2241         (process_ioctl): Ditto.
2242         (fhandler_tty_master::*): Ditto.
2243         (fhandler_pty_master::process_slave_output): Remove CYGWIN=tty
2244         considerations.
2245         (fhandler_pty_slave::open): Ditto for *_done_event.
2246         (fhandler_pty_slave::write): Ditto.
2247         (fhandler_pty_slave::ioctl): Ditto.
2248         (fhandler_pty_slave::fch_open_handles): Ditto.
2249         (fhandler_pty_slave::fch_set_sd): Ditto.
2250         (fhandler_pty_slave::fch_close_handles): Ditto.
2251         (fhandler_pty_common::close): Ditto.
2252         (fhandler_pty_master::setup): Ditto.  Remove now-unneeded ispty
2253         parameter.
2254         (fhandler_pty_master::open): Reflect argument removal for
2255         tty::allocate.
2256         * select.cc: Rename tty to pty where appropriate throughout.
2257         * sigproc.cc (proc_subproc): Remove CYGWIN=tty considerations.
2258         * tty.cc (ttyslot): Accommodate CYGWIN=tty removal.
2259         (tty_list::init_session): Ditto.
2260         (tty_list::attach): Ditto.
2261         (tty::create_master): Delete.
2262         (tty_list::terminate): Ditto.
2263         (tty_list::allocate): Delete "with_console" parameter.  Remove
2264         CYGWIN=tty considerations.
2265         (tty::init): Set is_console = false.  Use 'false' for was_opened since
2266         it is a boolean.
2267         * tty.h (*_{DONE,REQUEST}_EVENT): Delete.
2268         (tty_min::is_console): Declare new field which replaces hwnd.
2269         (tty_min::gethwnd): Delete.
2270         (tty_min::sethwnd): Ditto.
2271         (tty_list::allocate): Delete parameter.
2272         (tty_list::terminate): Delete declaration.
2273         * include/sys/cygwin.h (PID_USETTY): Redefine to PID_UNUSED1 and change
2274         comment to reflect its availability.
2275
2276 2011-06-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
2277
2278         * fhandler_tty_slave.cc (fhandler_tty_slave::fhandler_tty_slave):
2279         Revert previous change since unit 0 is perfectly valid.
2280
2281 2011-06-12  Christopher Faylor  <me.cygwin2011@cgf.cx>
2282
2283         Rename FH_BAD to FH_NADA throughout.
2284         * devices.h (FH_ERROR): New value.
2285         (iscons_dev): Extend to detect all the console device types.
2286         * devices.in: Set aside storage for FH_ERROR.
2287         * dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to
2288         detect when device is a console.
2289         (fh_alloc): Pass device to console constructor.
2290         (build_fh_pc): Short circuit when we detect that the constructor saw an
2291         error.
2292         * fhandler.h (fhandler_console::fhandler_console): Accept fh_devices
2293         parameter.
2294         (get_tty_stuff): Change to void.
2295         * fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR
2296         on attempt to access anything other than the current console.
2297         (fhandler_console::get_tty_stuff): Change to void return.
2298         (fhandler_console::open): Return EPERM on FH_ERROR device type.
2299         (fhandler_console::fhandler_console): Set the device type appropriately
2300         before calling get_tty_stuff and rely on that function to reset it if
2301         necessary.
2302
2303 2011-06-10  Christopher Faylor  <me.cygwin2011@cgf.cx>
2304
2305         * environ.cc (create_upcaseenv): Delete.
2306         (ucenv): Don't honor create_upcaseenv.
2307         (environ_init): Remove early retrieval of CYGWIN environment variable.
2308         Change comment to reflect new behavior.
2309
2310 2011-06-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
2311
2312         * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
2313         (child_info::old_title): Delete.
2314         (child_info::~child_info_spawn): Remove recording of old_title.
2315         * dcrt0.cc (title_buf): Delete.
2316         (child_info_spawn::handle_spawn): Remove recording of old_title.
2317         (dll_crt0_1): Get rid of all title handling.
2318         (do_exit): Ditto.
2319         * environ.cc (known): Delete strip_title and title.
2320         * fhandler_console.cc (fhandler_console::write): Remove recording of
2321         old_title.
2322         * globals.cc (exit_states): Remove ES_TITLE.
2323         (display_title): Delete.
2324         (strip_title_path): Delete.
2325         (old_title): Delete.
2326         * spawn.cc (spawn_guts): Remove old_title accommodation.
2327
2328 2011-06-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
2329
2330         * environ.cc (envcache): Delete.
2331         (known): Remove envcache.
2332         (getwinenv): Don't honor envcache setting.
2333
2334 2011-06-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
2335
2336         * environ.c: Move code earlier to allow:
2337         (_addenv): Call parse_options() when CYGWIN environment variable is
2338         being changed.
2339         (parse_options): Change parameter to 'const'.
2340
2341 2011-06-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
2342
2343         * environ.cc (tty_is_gone): Add missing space to message.
2344
2345 2011-06-08  Christopher Faylor  <me.cygwin2011@cgf.cx>
2346
2347         * environ.cc (settings::set_process_state): Delete.
2348         (tty_is_gone): New function.
2349         (known): Change "tty" to call tty_is_gone().  Remove unneeded '&' from
2350         beginning of function address.
2351         (parse_options): Remove set_process_state handling.
2352         * shared_info.h (CURR_USER_MAGIC): Reset.
2353         (user_info::warned_notty): New member.
2354
2355 2011-06-07  Christopher Faylor  <me.cygwin2011@cgf.cx>
2356
2357         * fhandler_console.cc (fhandler_console::open_shared_console):
2358         Semi-revert to using fixed location for console stuff.
2359         * shared.cc (offsets): Ditto.  Comment.
2360         * shared_info (shared_locations): Re-add SH_SHARED_CONSOLE.
2361
2362 2011-06-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
2363
2364         * fhandler_disk_file.cc (fhandler_disk_file::pread): Reset windows file
2365         position pointer back to previous location after successful read.
2366
2367 2011-06-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
2368
2369         * fhandler_console.cc (fhandler_console::open_shared_console): Don't
2370         zero handle to open_shared since it is supposed to be an input.
2371         (enum_windows): Set handle input to open_shared to NULL since it does
2372         not represent any previously opened shared region.
2373         * shared.cc (open_shared): Tweak debugging output.
2374
2375 2011-06-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
2376
2377         * ntdll.h (FILE_PIPE_*): Define constants.
2378         * select.cc (pipe_data_available): Detect closing state.
2379
2380 2011-06-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
2381
2382         * pinfo.cc (_pinfo::set_ctty): Don't reset myself->{pgid,sid} if
2383         terminal has no pgid or sid settings.
2384
2385 2011-06-03  Christopher Faylor  <me.cygwin2011@cgf.cx>
2386
2387         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise
2388         SIGPIPE when writing.
2389
2390         * fhandler.h: Include "tty.h".
2391         (fhandler_termios::_tc): Rename from tc.
2392         (fhandler_termios::tc): New method.
2393         (fhandler_termios::tcinit): Remove an argument.
2394         (fhandler_termios::get_ttyp): Use method to retrieve value.
2395         (fhandler_console::console_state): Move here.
2396         (fhandler_console::dev_state): Delete.
2397         (fhandler_console::shared_console_info): Define.
2398         (fhandler_console::open_shared_console): Move this function under
2399         fhandler_console umbrella.
2400         (fhandler_console::tc): Define.  Return static value.
2401         (fhandler_console::focus_aware): Accommodate deletion of dev_state.
2402         (fhandler_console): Add tty_list::get_cttyp as a friend.
2403         * fhandler_console.cc (dev_state): Redefine as a pointer within
2404         shared_console_info and change dev-> to dev. throughout.
2405         (fhandler_console::shared_console_info): Move into fhandler_console.
2406         (fhandler_console::open_shared_console): Move into fhandler_console
2407         change argument to simple bool.
2408         (enum_windows): Accommodate changes to console_state and
2409         open_shared_console.
2410         (console_unit::console_unit): Ditto.
2411         (fhandler_console::get_tty_stuff): Accommodate change to dev_state.
2412         (tty_list::get_cttyp): Accommodate change to
2413         handler_console::shared_console_info.
2414         (fhandler_console::read): Accommodate change from tc to tc ().
2415         (fhandler_console::set_input_state): Ditto.
2416         (fhandler_console::open): Accommodate tcinit argument change and change
2417         from tc to tc().
2418         (fhandler_console::input_tcsetattr): Accomodate change from tc to tc().
2419         (fhandler_console::input_tcsetattr): Ditto.
2420         (fhandler_console::write_normal): Ditto.
2421         (fhandler_console::init): Ditto.
2422         (fhandler_console::igncr_enabled): Ditto.
2423         * fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument.
2424         Expect tc() to have been set up first.  Use tc() rather than tc.
2425         (fhandler_termios::tcsetpgrp): Accomodate change from tc to tc().
2426         (fhandler_termios::tcgetpgrp): Ditto.
2427         (fhandler_termios::bg_check): Ditto.
2428         (fhandler_termios::line_edit: Ditto.
2429         (fhandler_tty_master::set_winsize): Ditto.
2430         (fhandler_tty_slave::open): Ditto.
2431         (fhandler_tty_slave::init): Ditto.
2432         (fhandler_pty_master::write): Ditto.
2433         (fhandler_pty_master::setup): Ditto.  Accommodate change in arguments
2434         to tcinit.
2435         (fhandler_tty_slave::fch_open_handles): Set _tc directly.
2436         (tty_min::is_orphaned_process_group): Don't assume that parent pid
2437         exists.
2438         * pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were
2439         started by a non-Cygwin process but the tty exists.
2440         * shared_info.h (console_state): Delete from here.
2441         * tty.h: Make multiple inclusion safe.
2442
2443 2011-05-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
2444
2445         * exceptions.cc (ctrl_c_handler): Simplify test for no parent tty.
2446         * fhandler_console.cc (fhandler_console::get_tty_stuff): Return NULL if
2447         ctty is not tty/console.  Improve test for slave tty/pty device.
2448
2449 2011-05-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
2450
2451         * external.cc (fillout_pinfo): Don't truncate ctty if it's < 0.
2452
2453         * select.cc (pipe_data_available): Avoid printing debug info by default
2454         or suffer very large strace files.
2455
2456 2011-05-31  Christopher Faylor  <me.cygwin2011@cgf.cx>
2457
2458         * select.cc (pipe_data_available): New function - uses
2459         NtQueryInformationFile to return information about pipes.
2460         (peek_pipe): Rewrite to use pipe_data_available for both read and write
2461         tests.
2462
2463 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
2464
2465         * dtable.cc (dtable::select_write): Add missing argument to
2466         debug_printf.
2467
2468         * fhandler.cc (fhandler_base_overlapped::setup_overlapped): Explicitly
2469         set io_pending to false.
2470         (fhandler_base_overlapped::has_ongoing_io): Call GetOverlappedResult
2471         to force completion of I/O.
2472         (fhandler_base_overlapped::wait_overlapped): Rewrite to correctly deal
2473         with nonblocking reads and to make more race proof.
2474         (fhandler_base_overlapped::raw_write): Deal with new enum values.
2475         (fhandler_base_overlapped::raw_read): Ditto.  Don't deal with ongoing
2476         I/O here since it makes no sense in the read context.
2477         * fhandler.h (enum wait_return): Add overlapped_unknown,
2478         overlapped_nonblocking_no_data.
2479         * pipe.cc (pipe): Add debugging output.
2480
2481 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
2482
2483         * dll_init.cc (dll_list::append): Eliminate increment of unused tot
2484         variable.
2485         * dll_init.h (dll_list::tot): Delete.
2486         (dll_list::populate_all_deps): Delete undefined function.
2487
2488         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Move EPIPE
2489         handling under error condition.
2490
2491 2011-05-30  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
2492
2493         * dll_init.cc (reserve_upto): Remove.
2494         (release_upto): Ditto.
2495         (dll_list::reserve_space): New function to reserve space needed by
2496         DLL_LOAD dlls early in the fork process.
2497         (dll_list::load_after_fork): Rewrite to use recursion to
2498         track reservations it makes while trying to make dlls land where they
2499         belong.
2500         (dll_list::load_after_fork_impl): New function used by load_after_fork.
2501         (dll_list::alloc): Initialize image base field.
2502         * dll_init.h (dll_list::prefered_base): New field.
2503         (dll_list::reserve_space): Declare new function.
2504         (dll_list::load_after_fork): Declare new function.
2505         * fork.cc (frok::child): call dll_list::reserve_space early, so we can
2506         retry if it fails.
2507
2508 2011-05-30  Tor Perkins  <cygwin@noid.net>
2509
2510         * fhandler_termios.cc (fhandler_termios::bg_check): Do not return EIO
2511         when a process group has no leader as this is allowed and does not
2512         imply an orphaned process group.  Add a test for orphaned process
2513         groups.
2514         (tty_min::is_orphaned_process_group): Define new function.
2515         * tty.h (tty_min::is_orphaned_process_group): Define new function.
2516
2517 2011-05-30  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
2518
2519         * dll_init.cc (dll_list::find_by_modname): New function to search the
2520         dll list for a module name only (no path).
2521         (dll_list::alloc): Initialize newly-added members of struct dll.
2522         (dll_list::append): New function to factor out the append operation
2523         (used by dll_list::topsort).
2524         (dll_list::populate_deps): New function to identify dll dependencies.
2525         (dll_list::topsort): New function to sort the dll list topologically by
2526         dependencies.
2527         (dll_list::topsort_visit): New helper function for the above.
2528         * dll_init.h (dll::ndeps): New class member.
2529         (dll::deps): Ditto.
2530         (dll::modname): Ditto.
2531         (dll_list::find_by_modname): New function related to topsort.
2532         (dll_list::populate_all_deps): Ditto.
2533         (dll_list::populate_deps): Ditto.
2534         (dll_list::topsort): Ditto.
2535         (dll_list::topsort_visit): Ditto.
2536         (dll_list::append): Ditto.
2537         (pefile): New struct allowing simple introspection of dll images.
2538         * fork.cc (fork): Topologically sort the dll list before forking
2539
2540 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
2541
2542         * child_info.h (CURR_CHILD_INFO_MAGIC): Refresh.
2543         (child_info::refresh_cygheap): New function.
2544         * spawn.cc (spawn_guts): Call refresh_cygheap before creating a new
2545         process to ensure that cygheap_max is up-to-date.
2546         * fork.cc (frok::parent): Ditto.
2547
2548 2011-05-30  Christopher Faylor  <me.cygwin2011@cgf.cx>
2549
2550         * cygheap.cc (cygheap_dummy): Rename from cygheap_at_start.
2551         (cygheap): Accommodate name change to cygheap_dummy.
2552         (cygheap_init): Ditto.
2553         (cygheap_fixup_in_child): Simplify slightly.
2554         * fork.cc (fork): Add an advisory comment.
2555
2556 2011-05-29  Christopher Faylor  <me.cygwin2011@cgf.cx>
2557
2558         * fhandler.cc (fhandler_overlapped::wait_overlapped): Make sure that
2559         I/O is cancelled on signal.
2560
2561 2011-05-28  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
2562
2563         * dll_init.cc (dll_list::alloc): Initialize dll::image_size.
2564         (reserve_at): Don't reserve space needed by the target dll if the
2565         latter overlaps the free region to be blocked.
2566         (dll_list::load_after_fork): Use new version of reserve_at.
2567         * dll_init.h (dll::image_size): New member.
2568         (pefile): New struct.
2569
2570 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
2571             Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
2572
2573         * dll_init.c (dll_list::load_after_fork): Don't clear in_forkee here.
2574         * fork.cc (frok::errmsg): Rename from 'error'.
2575         (frok::error): New function.  Handle conditional printing of error
2576         messages.
2577         (frok::parent): Record hchild handle for use by error function.  Use
2578         throughout.  Use error function rather than setting error pointer
2579         directly.
2580         (fork): Clear is_forkee here.  Accommodate rename of 'error' to
2581         'errmsg'.
2582         * sigproc.cc (child_info::proc_retry): Detect EXITCODE_FORK_FAILED.
2583
2584 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
2585
2586         * fhandler.cc (handler_base_overlapped::wait_overlapped): Rework to
2587         attempt to properly set errno and bytes read for non-blocking case.
2588         Change to just rely on res to indicate error conditions.
2589
2590 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
2591
2592         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Don't set
2593         io_pending unless ReadFile has returned an error.  (this is a partial fix,
2594         accidentally checked in)
2595
2596 2011-05-28  Christopher Faylor  <me.cygwin2011@cgf.cx>
2597
2598         * autoload.cc: Call _api_fatal in asm.
2599         * child_info.h: Redefine CURR_CHILD_INFO_MAGIC.
2600         (child_info_fork::abort): Rename from handle_failure.  Change
2601         arguments.
2602         * cygtls.h (_local_storage::ttybuf): New field.
2603         * dcrt0.cc (vapi_fatal): Split api_fatal.  Add "in forked process" to
2604         message when appropriate.
2605         (api_fatal): Use vapi_fatal.
2606         * devices.h: Make multiple inclusion safe.
2607         (fh_devices): Add FH_CONS* stuff.  Reorder slightly.
2608         (device): Eliminate anonymous union.  Add more ways to access
2609         minor/major.
2610         (device::setunit): Accommodate no-longer-anonymous union.
2611         (device::is_fs): Ditto.
2612         (device::is_fs_special): Ditto.
2613         (device::major): New function.
2614         (device::minor): Ditto.
2615         (device::is_device): New function.
2616         (device::not_device): Ditto.
2617         (device::operator int): New operator.
2618         (device::operator fh_devices): Ditto.
2619         (device::operator bool): Ditto.
2620         (device::operator DWORD): Ditto.
2621         (device::operator =): Ditto.
2622         (isproc_dev): New function.
2623         (isprocsys_dev): Ditto.
2624         (iscons_dev): Ditto.
2625         (istty_slave_dev): Ditto.
2626         * devices.in: Add new "/dev/cons*" strings.  Accommodate
2627         no-longer-anonymous union throughout.
2628         (BRACK): Use more precise method for initialization.
2629         * devices.cc: Regenerate.
2630         * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty.
2631         (dtable::find_archetype): Use new DWORD operator in device to test
2632         archetypes.
2633         (dtable::init_std_file_from_handle): Use different method to initialize
2634         'dev'.  Adapt to different ctty handling and accommodate /dev/cons*.
2635         (fh_alloc): Accommodate no-longer-anonymous union.  Adapt to new
2636         /dev/cons*.
2637         (build_fh_pc): Make debugging output more useful.
2638         * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty.
2639         * external.cc (fillout_pinfo): Accommodate new cons* stuff.
2640         * fhandler.cc (fhandler_base::read): Eliminate is_slow() test.
2641         * fhandler.h (fhandler_base::*): Adapt to changes in device.h.
2642         (fhandler_*::is_slow): Delete.
2643         ( fhandler_proc::get_proc_fhandler): Return fh_devices type.
2644         * fhandler_console.cc (open_shared_console): New function.
2645         (console_unit): New class.
2646         (console_unit::console_unit): New constructor.
2647         (enum_windows): New function.  Declare as friend to console_unit.
2648         (fhandler_console::set_unit): New function.
2649         (fhandler_console::get_tty_stuff): Call set_unit to set the unit number
2650         and determine if initialization is needed.  Eliminate flags parameter.
2651         (tty_list::get_cttyp): Rename (sorta) from get_tty.  Return pointer to
2652         correct tty_min.
2653         (fhandler_console::open): Adapt to elimination of argument to
2654         get_tty_stuff.
2655         (fhandler_console::output_tcsetattr): Properly detect error condition.
2656         (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff()
2657         setting tc automatically.
2658         * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using
2659         fh_devices enum.
2660         (fhandler_proc::get_proc_fhandler): Return fh_devices.  Adapt to
2661         devices.h changes.
2662         * fhandler_process.cc: Adapt to devices.h changes.  Use FH_BAD rather
2663         than 0 throughout where using fh_devices enum.
2664         * fhandler_procnet.cc: Ditto.
2665         * fhandler_procsys.cc: Ditto.
2666         * fhandler_procsysvipc.cc: Ditto.
2667         * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto.
2668         * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname()
2669         rather than assuming that we can construct a tty.
2670         * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just
2671         return get_minor() of dev.
2672         (fhandler_pty_master::process_slave_output): Add slightly more
2673         debugging info.
2674         (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to
2675         unit.
2676         (fhandler_pty_master::open): Ditto.
2677         (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to
2678         represent a complete device.
2679         (fhandler_tty_master::init_console): Add debugging for failure path.
2680         (fhandler_pty_master::setup): Use get_unit() to retrieve unit number
2681         rather than relying on raw ntty.
2682         (fhandler_pty_master::setup): Ditto.
2683         * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices.
2684         * fork.cc: Remove obsolete vfork stuff.
2685         (frok::child): Don't assume that a ctty == 0 is valid.
2686         * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct
2687         changes.
2688         (mount_info::conv_to_win32_path): Ditto.
2689         * path.cc (path_conv::check): Retrive major/minor numbers via a method
2690         rather than accessing them directly from device.  Rely on dev operators
2691         to set/retrieve device information as required by device struct change.
2692         * path.h (isproc_dev): Move to devices.h.
2693         (isprocsys_dev): Ditto.
2694         (isvirtual_dev): Ditto.
2695         (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}):
2696         Use device methods to access/manipulate devices.
2697         * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid.  Use
2698         iscons_dev to determine if a device is a console.
2699         (_pinfo::_ctty): Use device::parse to generate tty/cons name.
2700         (_pinfo::set_ctty): Don't assume that ctty == 0 is valid.  Remove
2701         redundant info from debugging.
2702         * shared.cc (offsets): Remove console offset.
2703         * shared_info.h (shared_locations): Ditto.
2704         * syscalls.cc (umask): Use device methods to manipulate device
2705         information.
2706         (ctermid): Use device::parse to generate term device name.
2707         * tlsoffsets.h: Regenerate.
2708         * tty.cc (ttyslot): Return minor number of ctty since ctty now
2709         represents a full device.
2710         (tty::create_master): Set ctty to a complete device.
2711         (tty_list::attach): Rework to detect new /dev/cons* stuff.
2712         (tty_list::terminate): Adapt to changes to ctty.
2713         (tty_list::init): Adapt to change to setntty - pass in device major
2714         number.
2715         (tty::exists): Use get_unit() to retrive tty unit number.
2716         (tty::open_mutex): Ditto.
2717         (tty::open_inuse): Ditto.
2718         (tty::create_inuse): Ditto.
2719         (tty::get_event): Ditto.
2720         (tty_min::ttyname): Define new function.
2721         * tty.h (tty_min::ntty): Redefine as fh_devices.
2722         (tty::exists): Use get_unit() to retrive tty unit number.
2723         (tty::open_mutex): Ditto.
2724         (tty::open_inuse): Ditto.
2725         (tty::create_inuse): Ditto.
2726         (tty::get_event): Ditto.
2727         (tty_min::ttyname): Declare new function.
2728         (tty::getntty): Declare as const.
2729         (tty_list::operator []): Assure that only minor part of argument is
2730         used.
2731
2732         * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early
2733         issuing an explicit error message if necessary.
2734         * heap.cc (heap_init): Adapt to changes from fork->handle_failure to
2735         fork->abort.
2736         * pinfo.h (EXITCODE_FORK_FAILED): New enum.  (from Ryan Johnson)
2737         * sigproc.cc (child_info_fork::abort): Rename from handle_failure.
2738         Change arguments to allow passing in a printf-like message.
2739         * winsup.h (api_fatal): Delete macro definition.
2740         (api_fatal): Redefine from __api_fatal.
2741         (vapi_fatal): Declare new function.
2742         * include/sys/strace.h (strace_vprintf): Define new macro.
2743
2744         * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2745
2746 2011-05-27  Corinna Vinschen  <corinna@vinschen.de>
2747
2748         * shared.cc (offsets): Reorder so that console_state is lowest in
2749         memory.  Explain why.
2750         (open_shared): Accommodate reordering of offsets array.
2751         * shared_info.h (shared_locations): Reorder SH_SHARED_CONSOLE after
2752         SH_MYSELF.
2753
2754 2011-05-26  Corinna Vinschen  <corinna@vinschen.de>
2755
2756         * mount.h (MAX_MOUNTS): Raise to 64.
2757
2758 2011-05-25  Eric Blake  <eblake@redhat.com>
2759
2760         * cygtls.h (strerror_r_buf): New buffer.
2761         * errno.cc (strerror): Move guts...
2762         (_strerror_r): ...to new function demanded by newlib.
2763         (strerror_r): Don't clobber strerror buffer.
2764         (_user_strerror): Drop unused declaration.
2765         * tlsoffsets.h: Regenerate.
2766
2767 2011-05-25  Corinna Vinschen  <corinna@vinschen.de>
2768
2769         * init.cc (dll_entry): Reinstantiate wow64_test_stack_marker and
2770         previous stack tests.
2771
2772 2011-05-25  Corinna Vinschen  <corinna@vinschen.de>
2773
2774         * posix.sgml (std-notes): Add missing <para>.
2775
2776 2011-05-24  Corinna Vinschen  <corinna@vinschen.de>
2777
2778         * mount.cc (mount_info::conv_to_win32_path): Remove unused code.
2779         * mount.h (class mount_info): Remove sys_mount_table_counter member.
2780         * shared_info.h (class shared_info): Ditto.
2781         (CURR_SHARED_MAGIC): Update.
2782
2783 2011-05-24  Corinna Vinschen  <corinna@vinschen.de>
2784
2785         * pinfo.h (struct _pinfo): Reduce size of progname array slightly.
2786         Explain why.
2787
2788 2011-05-23  Eric Blake  <eblake@redhat.com>
2789
2790         * errno.cc (strerror): Print unknown errno as int.
2791         (__xpg_strerror_r): Likewise, and don't clobber strerror buffer.
2792         * cygtls.h (strerror_buf): Resize to allow '-'.
2793
2794 2011-05-23  Corinna Vinschen  <corinna@vinschen.de>
2795
2796         * fhandler_process.cc (thread_info::fill_if_match): Reformat.
2797         (format_process_maps): Ditto.  Fetch pointer to procinfo structure
2798         from mapped process.  Print info about global shared Cygwin regions.
2799
2800 2011-05-21  Corinna Vinschen  <corinna@vinschen.de>
2801
2802         * fhandler_process.cc (struct dos_drive_mappings): Use malloc/free
2803         rather than cmalloc/cfree.  Check return value from malloc before
2804         using it.
2805         (struct heap_info): Ditto.
2806         (struct thread_info): Ditto.  Rename from stack_info.  Rename members
2807         and local variables accordingly.
2808         (thread_info::thread_info): Store stack and TEB addresses.
2809         (thread_info::fill_if_match): Print "teb" if a TEB address has been
2810         found.  Special case for WOW64, explain why.
2811         (format_process_maps): Fetch PEB address.  Print MEM_RESERVE regions
2812         with equal signs to distinguish them from PAGE_NOACCESS regions.  Fix
2813         printing of 'p' and 's' to differ between MEM_PRIVATE and MEM_MAPPED
2814         pages, as on Linux.  Print 'g' instead of 'p for PAGE_GUARD pages.
2815         Print PEB and SharedUserData area if recognized.
2816
2817 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2818
2819         * miscfuncs.cc (CygwinCreateThread): Fix condition for adding the
2820         guardsize to the stacksize.  Fix accompanying comment.
2821
2822 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2823
2824         * miscfuncs.cc (CygwinCreateThread): Add accidentally missing comment.
2825
2826 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2827
2828         * fhandler_process.cc (struct heap_info): Change type of base and end
2829         members to char *.  Print "shared" rather than "share".
2830         (struct stack_info): New class to fetch process stack information.
2831         (format_process_maps): Initialize and check for stack information.
2832
2833 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2834
2835         * miscfuncs.cc (thread_wrapper): Remove statements added for debugging
2836         purposes.
2837
2838 2011-05-20  Corinna Vinschen  <corinna@vinschen.de>
2839
2840         * child_info.h (CURR_CHILD_INFO_MAGIC): Update.
2841         (class child_info_fork): Remove stacksize, add stackaddr and guardsize
2842         members.
2843         * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Partial rewrite
2844         to regenerate the stack exactly as in the parent.
2845         (child_info_fork::alloc_stack): Set stackaddr to 0, rather than
2846         stacksize.
2847         (dll_crt0_1): Check for stackaddr before changing the stack addresses
2848         in the TEB.
2849         * fork.cc (frok::child): Check for stackaddr here.
2850         (frok::parent): Set ch.stackaddr and ch.guardsize if not called from
2851         the main thread.
2852         * init.cc (dll_entry): Replace pointer to NT_TIB with pointer to TEB.
2853         Fix incorrectly changed address test before removing _my_tls.
2854         Set StackLimit to NULL on Windows 2000.  Explain why.
2855         * miscfuncs.cc (struct thread_wrapper_arg): Store stackbase rather
2856         than stacksize, store commitaddr, remove guardsize.  Store all pointers
2857         as char * for easier address arithmetic.
2858         (thread_wrapper): Rewrite to remove OS stack before calling thread
2859         function.  Add lots of comments to explain what we do.
2860         (CygwinCreateThread): Reserve our own stack in case we got no
2861         application stack.  Add comments.
2862         * ntdll.h (struct _TEB): Extend defintion up to DeallocationStack
2863         member.
2864         * thread.cc (pthread_attr::pthread_attr): Use "(size_t) -1"
2865         rather then 0xffffffff.
2866         * wincap.h (wincaps::has_stack_size_param_is_a_reservation): New
2867         element.
2868         * wincap.cc: Implement above element throughout.
2869
2870 2011-05-19  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2871
2872         * thread.cc: Mark psiginfo and psignal as available in list of
2873         optional cancellation points.
2874
2875 2011-05-19  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2876
2877         * cygwin.din (__fpurge): Export.
2878         * posix.sgml (std-solaris): Add __fpurge.
2879         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2880
2881 2011-05-18  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2882
2883         * posix.sgml (std-susv4): Remove chroot, futimes, hstrerror.
2884         (std-deprec): Add chroot.
2885         (std-bsd): Add futimes, hstrerror.
2886         (std-notimpl): Add clock_nanosleep, nexttoward, nexttowardf.
2887         Remove initstate, which is implemented and listed in std-susv4.
2888
2889 2011-05-17  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2890
2891         * cygwin.din (error): Export.
2892         (error_at_line): Export.
2893         (error_message_count): Export.
2894         (error_one_per_line): Export.
2895         (error_print_progname): Export.
2896         * errno.cc (error_message_count): Define.
2897         (error_one_per_line): Define.
2898         (error_print_progname): Define.
2899         (_verror): New static function.
2900         (error): New function.
2901         (error_at_line): New function.
2902         * posix.sgml (std-gnu): Add error, error_at_line.
2903         * include/error.h: New header.
2904         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2905
2906 2011-05-17  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
2907
2908         * cygwin.din (clock_getcpuclockid): Export.
2909         (pthread_getcpuclockid): Export.
2910         * hires.h (PID_TO_CLOCKID): New macro.
2911         (CLOCKID_TO_PID): New macro.
2912         (CLOCKID_IS_PROCESS): New macro.
2913         (THREADID_TO_CLOCKID): New macro.
2914         (CLOCKID_TO_THREADID): New macro.
2915         (CLOCKID_IS_THREAD): New macro.
2916         * ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadTimes.
2917         * posix.sgml (std-notimpl): Add clock_getcpuclockid and
2918         pthread_getcpuclockid from here...
2919         (std-susv4): ... to here.
2920         (std-notes): Remove limitations of clock_getres and clock_gettime.
2921         Note limitation of timer_create to CLOCK_REALTIME.
2922         * sysconf.cc (sca): Set _SC_CPUTIME to _POSIX_CPUTIME, and
2923         _SC_THREAD_CPUTIME to _POSIX_THREAD_CPUTIME.
2924         * thread.cc (pthread_getcpuclockid): New function.
2925         * timer.cc (timer_create): Set errno to ENOTSUP for CPU-time clocks.
2926         * times.cc (clock_gettime): Handle CLOCK_PROCESS_CPUTIME_ID and
2927         CLOCK_THREAD_CPUTIME_ID.
2928         (clock_getres): Ditto.
2929         (clock_settime): Set errno to EPERM for CPU-time clocks.
2930         (clock_getcpuclockid): New function.
2931         * include/pthread.h (pthread_getcpuclockid): Declare.
2932         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2933
2934 2011-05-17  Corinna Vinschen  <corinna@vinschen.de>
2935
2936         * miscfuncs.cc (thread_wrapper): Remove unused _cygtls record.
2937         * mmap.cc (is_mmapped_region): Avoid crash if no mmaps exist.
2938
2939 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2940
2941         * globals.cc (__getlogin_username): Remove.
2942         * uinfo.cc (getlogin_r): Fetch username from cygheap.
2943         (getlogin): Add static buffer username and fetch username from
2944         getlogin_r.
2945
2946 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2947
2948         * cygtls.h (struct _local_storage): Remove unused members rarg and
2949         _localtime_buf.  Remove username in favor of a global buffer.  Reorder
2950         slightly to keep the net.cc stuff together.
2951         * globals.cc (__getlogin_username): New global char buffer.
2952         * tlsoffsets.h: Regenerate.
2953         * uinfo.cc (getlogin): Copy username into __getlogin_username.
2954
2955 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2956
2957         * heap.cc (heap_init): Rewrite initial heap allocation to use addresses
2958         beyond 0x20000000.  Explain why and how.
2959         * shared.cc (shared_info::heap_slop_size): Remove.
2960         * shared_info.h (class shared_info): Remove heap_slop_inited and
2961         heap_slop members.  Remove heap_slop_size declaration.
2962         (CURR_SHARED_MAGIC): Update.
2963         * wincap.cc: Throughout, drop heapslop.
2964         * wincap.h (struct wincaps): Drop heapslop.
2965
2966 2011-05-16  Corinna Vinschen  <corinna@vinschen.de>
2967
2968         * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
2969         requested stack is application-provided within the user heap or an
2970         mmapped region.  If so, just use it.  Add comment to explain why.
2971         * miscfuncs.cc (thread_wrapper): If an application-provided stack
2972         has been given, implement cygtls area at the stackbase.  Fix comment.
2973         * mmap.cc (is_mmapped_region): New function.
2974         * winsup.h (is_mmapped_region): Declare.
2975
2976 2011-05-15  Corinna Vinschen  <corinna@vinschen.de>
2977
2978         * miscfuncs.cc (thread_wrapper): Add comments to assembler code.
2979
2980 2011-05-15  Corinna Vinschen  <corinna@vinschen.de>
2981
2982         * cygwin.din (pthread_attr_getguardsize): Export.
2983         (pthread_attr_setguardsize): Export.
2984         (pthread_attr_setstack): Export.
2985         (pthread_attr_setstackaddr): Export.
2986         * init.cc (dll_entry): Remove wow64_test_stack_marker.  Check for
2987         unusual stack address by testing stack addresses from current TEB.
2988         Check validity of _my_tls by testing if it's within the stack as
2989         given in current TEB.
2990         * miscfuncs.cc (struct thread_wrapper_arg): New structure used to
2991         push all required information to thread_wrapper function.
2992         (thread_wrapper): Wrapper function for actual thread function.
2993         If an application stack has been given, change %ebp and %esp so that
2994         the thread function runs on that stack.  If the thread has been created
2995         by CygwinCreateThread, set up the POSIX guard pages if necessary.
2996         (CygwinCreateThread): New function.
2997         * miscfuncs.h (CygwinCreateThread): Declare.
2998         * ntdll.h (struct _TEB): Define all members up to Peb.
2999         * posix.sgml (std-susv4): Move pthread_attr_getguardsize,
3000         pthread_attr_setguardsize and pthread_attr_setstack here.
3001         (std-deprec): Add pthread_attr_setstackaddr.
3002         * sysconf.cc (sca): Set _SC_THREAD_ATTR_STACKADDR to
3003         _POSIX_THREAD_ATTR_STACKADDR.
3004         * thread.cc (pthread::precreate): Copy pthread_attr stackaddr and
3005         guardsize members.
3006         (pthread::create): Call CygwinCreateThread.
3007         (pthread_attr::pthread_attr): Initialize guardsize.
3008         (pthread_attr_setstack): New function.
3009         (pthread_attr_setstackaddr): New function.
3010         (pthread_attr_setguardsize): New function.
3011         (pthread_attr_getguardsize): New function.
3012         (pthread_getattr_np): Copy attr.guardsize.
3013         * thread.h (pthread_attr): Add member guardsize.
3014         * include/pthread.h (pthread_attr_getguardsize): Declare.
3015         (pthread_attr_setguardsize): Declare.
3016         * include/cygwin/version.h: Bump API minor number.
3017
3018 2011-05-13  Corinna Vinschen  <corinna@vinschen.de>
3019
3020         * fhandler_process.cc (struct heap_info::heap): Convert base to
3021         uintptr_t.  Add heap_id, end, flags members.
3022         (heap_info::heap_vm_chunks): Rename from heaps.
3023         (heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation
3024         to get information of heap virtual memory blocks.  Store heap id and
3025         flags, as well as end address of each block.
3026         (heap_info::fill_if_match): Check incoming base address against full
3027         address range of heap chunks.  Convert flag values in extra heap
3028         information.
3029         (format_process_maps): Change order so that heap check is done before
3030         MEM_MAPPED check since there are shareable heaps.
3031         * ntdll.h (PDI_HEAP_BLOCKS): Define.
3032         (HEAP_FLAG_NOSERIALIZE): Define.
3033         (HEAP_FLAG_GROWABLE): Define.
3034         (HEAP_FLAG_EXCEPTIONS): Define.
3035         (HEAP_FLAG_NONDEFAULT): Define.
3036         (HEAP_FLAG_SHAREABLE): Define.
3037         (HEAP_FLAG_EXECUTABLE): Define.
3038         (HEAP_FLAG_DEBUGGED): Define.
3039         (struct _DEBUG_HEAP_ARRAY): Define.
3040         (struct _DEBUG_HEAP_BLOCK): Define.
3041
3042 2011-05-12  Corinna Vinschen  <corinna@vinschen.de>
3043
3044         Based on newlib patch to strptime by Peter Rosin <peda@lysator.liu.se>:
3045         * libc/time/strptime.c (is_leap_year): New static function.
3046         (first_day): Ditto.
3047         (__strptime): Fill in tm_yday when all of tm_year, tm_mon and tm_mday
3048         are updated. Fill in tm_mon, tm_mday and tm_wday when both of tm_year
3049         and tm_yday are updated.
3050
3051 2011-05-12  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3052
3053         * fhandler_proc.cc (format_proc_meminfo): Rewrite to use sysinfo().
3054         Support RAM and swap space larger than 4GB.
3055         Remove output elements not found with modern Linux kernels.
3056         (format_proc_swaps): Support paging files larger than 4GB.
3057
3058 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
3059
3060         * autoload.cc: Remove useless comment.
3061
3062 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
3063
3064         * autoload.cc (EnumProcessModules): Remove.
3065         * dlfcn.cc (dlopen): Make sure errno is set if an error occurs.
3066         (dlsym): Rewrite using RtlQueryProcessDebugInformation instead of
3067         EnumProcessModules.
3068         * ntdll.h (struct _DEBUG_MODULE_ARRAY): Define.
3069         (RtlCreateQueryDebugBuffer): Declare.
3070         (RtlDestroyQueryDebugBuffer): Declare.
3071         (RtlQueryProcessDebugInformation): Declare.
3072
3073 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
3074
3075         * autoload.cc (GetModuleFileNameExW): Remove.
3076         * autoload.cc (GetModuleInformation): Remove.
3077
3078 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
3079
3080         * autoload.cc (QueryWorkingSet): Remove.
3081
3082 2011-05-11  Ryan Johnson  <ryan.johnson@cs.utoronto.ca>
3083
3084         * fhandler_process.cc (format_process_maps): Rework to report
3085         all mapped address space in a process (committed or reserved),
3086         identifying the nature of the mapping (mapped file/image, heap,
3087         shared memory) when possible.
3088         (dos_drive_mappings): New helper classes.
3089         (heap_info): Ditto.
3090         * ntdll.h (struct _MEMORY_SECTION_NAME): Define.
3091
3092 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
3093
3094         * autoload.cc (GetProcessMemoryInfo): Remove.
3095         * resource.cc (fill_rusage): Call NtQueryInformationProcess rather than
3096         GetProcessMemoryInfo to drop a psapi dependency.
3097
3098 2011-05-11  Corinna Vinschen  <corinna@vinschen.de>
3099
3100         * fhandler_socket.cc (get_inet_addr): Rearrange for better readability.
3101         Make waiting loop interruptible and cancelable.  Check for SYSTEM DOS
3102         flag before reading the file.  Change return value to return 0 on
3103         success, SOCKET_ERROR on failure.
3104         (fhandler_socket::bind): Only set R/O DOS flag on filesystems not
3105         supporting ACLs.
3106         (fhandler_socket::connect): Accommodate changed return values from
3107         get_inet_addr.  Use SOCKET_ERROR instead of -1.
3108         (fhandler_socket::sendto): Accommodate changed return values from
3109         get_inet_addr.
3110         * syslog.cc (connect_syslogd): Ditto.
3111
3112 2011-05-10  Christian Franke  <franke@computer.org>
3113
3114         * security.cc (check_registry_access): Handle missing
3115         security descriptor of HKEY_PERFORMANCE_DATA.
3116
3117 2011-05-10  Corinna Vinschen  <corinna@vinschen.de>
3118
3119         * lc_msg.h: Regenerate.
3120
3121 2011-05-10  Corinna Vinschen  <corinna@vinschen.de>
3122
3123         * fhandler_proc.cc (format_proc_uptime): Don't call GetSystemInfo.
3124         Fetch CPU count from wincap.
3125         (format_proc_stat): Ditto.
3126         * globals.cc (system_info): Move to wincap.
3127         * heap.cc (heap_init): Fetch page size from wincap.
3128         * syscalls.cc (getpagesize): Fetch allocation granularity from wincap.
3129         (getsystempagesize): Fetch page size from wincap.
3130         * wincap.cc (wincap_2003): Default is_server to false.
3131         (wincapc::init): Call GetSystemInfo here.  Always set is_server value.
3132         * wincap.h (class wincapc): Add system_info as private member.
3133         (wincapc::cpu_count): New public method.
3134         (wincapc::page_size): Ditto.
3135         (wincapc::allocation_granularity): Ditto.
3136
3137 2011-05-10  Corinna Vinschen  <corinna@vinschen.de>
3138
3139         * environ.cc (set_chunksize): Remove.
3140         (parse_thing): Remove forkchunk entry.
3141         * fork.cc (child_copy): Drop handling external chunksize setting.
3142         * wincap.cc: Througout, drop chunksize.
3143         (wincapc::set_chunksize): Remove.
3144         * wincap.h (struct wincaps): Drop chunksize and declaration of
3145         set_chunksize.
3146
3147 2011-05-08  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3148
3149         * times.cc (settimeofday): Add EFAULT handler.
3150         Set errno to EINVAL if tv.tv_nsec is invalid, and to EPERM if
3151         SetSystemTime fails.  Return -1 in case of failure, all for
3152         compatibility with BSD and Linux.
3153         (clock_settime): New function.
3154         * cygwin.din (clock_settime): Export.
3155         * posix.sgml (std-susv4): Add clock_settime.
3156         Move clock_setres from here...
3157         (std-deprec): ... to here.
3158         (std-notes): Correct limitation of clock_setres to only CLOCK_REALTIME.
3159         Add limitation of clock_settime to only CLOCK_REALTIME.
3160         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3161
3162 2011-05-07  Corinna Vinschen  <corinna@vinschen.de>
3163
3164         * registry.cc (get_registry_hive_path): Change system_printf to
3165         debug_printf.
3166         (load_registry_hive): Ditto.
3167
3168 2011-05-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
3169
3170         * fhandler.h (fhandler_base::close_with_arch): Make non-virtual.
3171         (fhandler_base::open_fs): Move closer to it's close counterpart.
3172
3173 2011-05-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
3174
3175         * fhandler.cc (fhandler_base::dup): Avoid duping a handle when an
3176         fhandler has an archetype.
3177         * fhandler_console.cc (fhandler_console::invisible_console): Move to
3178         the top.
3179         (fhandler_console::set_close_on_exec): Don't set close-on-exec on
3180         handle since it's an archetype and you don't know how many things could
3181         be using it.
3182
3183 2011-05-06  Christopher Faylor  <me.cygwin2011@cgf.cx>
3184
3185         * fhandler.h (fhandler_dev_dsp): Cosmetic change.
3186
3187         * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Put back
3188         Sleep(10) for tty_master case.
3189
3190         * sigproc.cc (stopped_or_terminated): Don't consider a pid which has
3191         been reaped to be terminated.
3192
3193 2011-05-06  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3194
3195         * sysconf.cc (sysinfo): New function.
3196         * cygwin.din (sysinfo): Export.
3197         * posix.sgml (std-gnu): Add sysinfo.
3198         * include/sys/sysinfo.h (struct sysinfo): Define.
3199         (sysinfo): Declare.
3200         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3201
3202 2011-05-06  Corinna Vinschen  <corinna@vinschen.de>
3203
3204         * libc/minires-os-if.c (get_dns_info): Drop printing uninitialized
3205         value of dwRetVal in debug output.
3206
3207 2011-05-06  Corinna Vinschen  <corinna@vinschen.de>
3208
3209         * fhandler.h (fhandler_socket::read): Declare.
3210         (fhandler_socket::write): Declare.
3211         * fhandler_procsys.cc (fhandler_procsys::read): Add FIXME comment.
3212         (fhandler_procsys::write): Ditto.
3213         * fhandler_socket.cc (fhandler_socket::read): New method.
3214         (fhandler_socket::write): New method.
3215         * syscalls.cc: Rearrange order of read/write functions.
3216         (read): Call fhandler read method directly instead of just readv.
3217         (readv): Remove EINTR loop.  This is done in all affected fhandler's
3218         now.
3219         (write): Call fhandler write method directly instead of just writev.
3220         Fix debug output.
3221
3222 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
3223
3224         * cygheap.cc (cygheap::close_ctty): Close ctty via close_with_arch().
3225         * debug.cc (close_handle): Call debugger on failure.
3226         * devices.in (device::tty_to_real_device): Delete.
3227         * devices.h (device::tty_to_real_device): Ditto.
3228         * devices.cc: Regenerate.
3229         * dtable.cc: Delete old ifdef'ed vfork code.
3230         (dtable::release): Don't handle archetype here.
3231         (dtable::init_std_file_from_handle): Consolidate console tests.
3232         Generate major/minor for tty ASAP.  Fix incorrect setting of DEV_TTYS*
3233         for serial.
3234         (fh_alloc): New function derived from build_fh_pc.  Pass current tty
3235         when building tty.
3236         (build_pc_pc): Use fh_alloc to create.  Set name from fh->dev if
3237         appropriate.  Generate an archetype or point to one here.
3238         (dtable::dup_worker): Deal with archetypes.  Rely on = operator copying
3239         whole class rather than just fhandler_base.
3240         (dtable::fixup_after_exec): Call close_with_arch to handle closing of
3241         fhandlers with archetypes.
3242         * fhandler.cc (fhandler_base::operator =): Call memcpy with fhandler's
3243         size() rather than sizeof fhandler_base.
3244         (fhandler_base::open_with_arch): New function.  Handles opening of
3245         fhandler's with archetypes, dealing with usecounts, etc.
3246         (fhandler_base::close_with_arch): Ditto for close.
3247         * fhandler.h: Many changes for archetypes.
3248         (fhandler_base::set_name): Set both normalized path and regular path.
3249         (fhandler_base::open_with_arch): New function.
3250         (fhandler_base::open_setup): Ditto.
3251         (fhandler_base::use_archetype): Ditto.
3252         (fhandler_base::_archetype_usecount): Ditto.
3253         (fhandler_*::size): Ditto.
3254         (fhandler_dev_tape::open): Remove virtual decoration.
3255         (fhandler_console::use_archetype): New function.  Return true.
3256         (fhandler_console::open_setup): New function.
3257         (fhandler_console::dup): Delete.
3258         (fhandler_tty_slave::fhandler_tty_slave): Redeclare to take an
3259         argument.
3260         (fhandler_tty_slave::use_archetype): New function.  Return true.
3261         (fhandler_tty_slave::cleanup): New function.
3262         (fhandler_pty_master::use_archetype): New function.  Return true.
3263         (fhandler_pty_master::cleanup): New function.
3264         (fhandler_pty_master::is_tty_master): New function.  Return false.
3265         (fhandler_tty_master::is_tty_master): New function.  Return true.
3266         (fhandler_dev_dsp::fhandler_dev_dsp): New function.  Return true.
3267         (report_tty_counts): Only report on archetype's usecount if there is
3268         one.
3269         * fhandler_console.cc (fhandler_console::get_tty_stuff): Remove
3270         handling of setsid, set_ctty, set_flags, and manage_console_count.
3271         (fhandler_console::open_setup): New function.  Implement functionality
3272         removed from get_tty_stuff.
3273         (fhandler_console::dup): Delete.
3274         (fhandler_console::output_tcsetattr): Set errno on error.
3275         (fhandler_console::fhandler_console): Set device early.
3276         (fhandler_console::init): Use open_with_arch to open console handles.
3277         (fhandler_console::fixup_after_fork_exec): Nuke most of the stuff for
3278         dealing with console handles.
3279         * fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling.
3280         (fhandler_dev_dsp::write): Ditto.
3281         (fhandler_dev_dsp::read): Ditto.
3282         (fhandler_dev_dsp::close): Ditto.
3283         (fhandler_dev_dsp::dup): Ditto.
3284         (fhandler_dev_dsp::ioctl): Ditto.
3285         (fhandler_dev_dsp::fixup_after_fork): Ditto.
3286         (fhandler_dev_dsp::fixup_after_exec): Ditto.
3287         * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Add a
3288         little more debugging.
3289         (fhandler_tty_common::__release_output_mutex): Ditto.
3290         (fhandler_pty_master::process_slave_output): Ditto.  Don't do signal
3291         handling or pthread_cancel handling in the tty master thread.
3292         (process_output): Minor reorg.
3293         (fhandler_tty_slave::fhandler_tty_slave): Set device based on new ntty
3294         argument.
3295         (fhandler_tty_slave::open): Remove archetype handling.  Move some
3296         processing into open_setup().
3297         (fhandler_tty_slave::open_setup): New function.
3298         (fhandler_tty_slave::cleanup): New function.
3299         (fhandler_tty_slave::close): Remove archetype handling.  Move some
3300         processing into cleanup().
3301         (fhandler_tty_slave::init): Rename argument from f to h.  Open device
3302         using open_with_arch().  Remove archetype handling.
3303         (fhandler_pty_master::dup): Ditto.
3304         (fhandler_pty_master::open): Ditto.
3305         (fhandler_pty_master::close): Ditto.  Move some handling to cleanup().
3306         (fhandler_pty_master::cleanup): New function.
3307         (fhandler_tty_master::init_console): Give unique name to captive
3308         console fhandler.
3309         * pinfo.cc (_pinfo::set_ctty): Rename argument from arch to fh.
3310         Eliminate archetype assumption.
3311         * syscalls.cc (close_all_files): Use close_with_arch for closing.
3312         (open): Use open_with_arch() rather than open().
3313         (close): Use close_with_arch() rather than close().
3314
3315 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
3316
3317         * pinfo.h (class push_process_state): New class to push a process state
3318         flag temporarily into myself->process_state.
3319         * fhandler_console.cc (fhandler_console::read): Add push_process_state
3320         handler.
3321         (fhandler_console::write): Call bg_check from here.  Add
3322         push_process_state handler.
3323         * fhandler_tty.cc (fhandler_tty_slave::write): Ditto.
3324         (fhandler_tty_slave::read): Ditto.
3325         (fhandler_pty_master::write): Ditto.
3326         (fhandler_pty_master::read): Ditto.
3327         * syscalls.cc (readv): Remove bg_check call and setting process state.
3328         (writev): Ditto.
3329
3330 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
3331
3332         * syscalls.cc (readv): Add myfault handler.  Don't check repeatedly
3333         open state of file handler.  Streamline loop.
3334         (writev): Add myfault handler.
3335
3336 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
3337
3338         * fhandler.cc (fhandler_base_overlapped::raw_read): Rename from
3339         read_overlapped.
3340         (fhandler_base_overlapped::raw_e): Rename from write_overlapped.
3341         * fhandler.h (fhandler_*::raw_read): Add reparm decoration.
3342         (fhandler_*::raw_write): Ditto.
3343         (fhandler_base_overlapped::raw_read): Rename from read_overlapped.
3344         (fhandler_base_overlapped::raw_write): Rename from write_overlapped.
3345         (fhandler_pipe::raw_read): Delete.
3346         (fhandler_pipe::raw_write): Ditto.
3347         (fhandler_mailslot::raw_read): Ditto.
3348         * fhandler_fifo.cc (fhandler_fifo::raw_read): Reflect read_overlapped
3349         -> raw_read rename.
3350         (fhandler_fifo::raw_write): Ditto.
3351         * fhandler_mailslot.cc (fhandler_mailslot::raw_read): Delete.
3352         (fhandler_mailslot::raw_write): Reflect read_overlapped -> raw_read
3353         rename.
3354         * pipe.cc (fhandler_pipe::raw_read): Delete.
3355         (fhandler_pipe::raw_write): Ditto.
3356
3357 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
3358
3359         * fork.cc (fork): Clear PID_REAPED.
3360         * pinfo.cc (pinfo_init): Ditto.
3361         (pinfo::init): Check for PID_REAPED.
3362         * sigproc.cc (stopped_or_terminated): Ditto.
3363
3364 2011-05-05  Christopher Faylor  <me.cygwin2011@cgf.cx>
3365
3366         * pinfo.cc (_pinfo::exists): Check for PID_REAPED.
3367
3368 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
3369
3370         * fhandler_disk_file.cc (fhandler_disk_file::pread): Correctly return
3371         with errno set to EBADF if file open mode is incorrect.
3372         (fhandler_disk_file::pwrite): Ditto.
3373
3374 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
3375
3376         * fhandler.cc (is_at_eof): Drop static storage class.  Drop err
3377         parameter since we don't change the Win32 error here anymore.
3378         (fhandler_base::raw_read): Accommodate change to is_at_eof.
3379
3380         * fhandler_disk_file.cc (fhandler_disk_file::pread): In binary mode use
3381         direct call to NtReadFile, rather than lseek/read.
3382         (fhandler_disk_file::pwrite): In binary mode use direct call to
3383         NtWriteFile, rather than lseek/write.
3384
3385 2011-05-05  Corinna Vinschen  <corinna@vinschen.de>
3386
3387         * dcrt0.cc (dll_crt0_1): Reset locale to "C" even when dynamically
3388         loaded.
3389
3390 2011-05-05  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3391
3392         * posix.sgml (std-notimpl): Remove bsd_signal, setcontext, and
3393         swapcontext, marked obsolete in SUSv3 and not present in SUSv4.
3394
3395 2011-05-05  Christian Franke  <franke@computer.org>
3396
3397         * fhandler_registry.cc (fhandler_registry::exists): Fix regression
3398         in EACCES handling.
3399         (fhandler_registry::open): Fix "%val" case.
3400
3401 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
3402
3403         * signal.cc (_pinfo::kill): Return success on kill(0) only if pid
3404         exists or is in PID_EXITED state.  Report pid 0 when pid does not exist
3405         rather than pid -1.  Make debug output reflect actual function call.
3406         * sigproc.cc (stopped_or_terminated): Set process state to reaped when
3407         we've finished waiting for it.
3408         * include/sys/cygwin.h (PID_REAPED): New enum.
3409
3410 2011-05-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3411
3412         * cygwin.din (psiginfo): Export.
3413         (psignal): Export.
3414         (sys_siglist): Export.
3415         * posix.sgml (std-notimpl): Move psiginfo and psignal from here...
3416         (std-susv4): ... to here.
3417         (std-deprec): Add sys_siglist.
3418         * strsig.cc (sys_siglist): New array.
3419         (psiginfo): New function.
3420         * include/cygwin/signal.h (sys_siglist): Declare.
3421         (psiginfo): Declare.
3422         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3423
3424 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
3425
3426         * dll_list::detach (dll_list::detach): Avoid doing anything with detach
3427         during a failing fork.
3428
3429 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
3430
3431         * dll_init.cc (dll_global_dtors): Avoid calling destructors during
3432         failing fork().
3433
3434 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
3435
3436         * fhandler.h (class fhandler_base): Remove uninterruptible_io status
3437         flag.
3438         (fhandler_base::ready_for_read): Remove declaration.
3439         (fhandler_socket::ready_for_read): Ditto.
3440         (fhandler_pipe::ready_for_read): Ditto.
3441         (fhandler_tty_master::is_slow): Remove.
3442         * fhandler_console.cc (fhandler_console::open): Drop setting
3443         uninterruptible_io.
3444         * fhandler_serial.cc (fhandler_serial::open): Ditto.
3445         * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Ditto.
3446         (fhandler_tty_master::init_console): Ditto.
3447         * pipe.cc (fhandler_pipe::fhandler_pipe): Ditto.
3448         (fhandler_pipe::open): Ditto.
3449         (_pipe): Ditto.
3450         * select.cc (fhandler_pipe::ready_for_read): Remove.
3451         (fhandler_base::ready_for_read): Remove.
3452         * syscalls.cc (readv): Drop unneeded wait variable.  Remove entire test
3453         which might lead to calling ready_for_read.  Remove now unused label
3454         out.
3455
3456 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
3457
3458         * fhandler.h (class fhandler_mailslot): Move down in file and change
3459         parent class to fhandler_base_overlapped.  Remove declaration of
3460         method write.  Add declaraiotns for raw_read and raw_write.
3461         * fhandler_mailslot.cc (fhandler_mailslot::fhandler_mailslot): Call
3462         fhandler_base_overlapped constructor.
3463         (fhandler_mailslot::fstat): Call fhandler_base_overlapped::fstat.
3464         (fhandler_mailslot::open): Drop FILE_SYNCHRONOUS_IO_NONALERT flag from
3465         call to NtOpenFile.
3466         (fhandler_mailslot::raw_read): New method.
3467         (fhandler_mailslot::raw_write): Ditto.  Take over length algorithm from
3468         former write method.
3469         (fhandler_mailslot::write): Remove.
3470         (fhandler_mailslot::ioctl): Call fhandler_base_overlapped::ioctl.
3471
3472 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
3473
3474         * fhandler.h (fhandler_dev_tape::_lock): Add bool parameter.
3475         * fhandler_tape.cc (lock): Call _lock with false argument.
3476         (_lock): Take bool cancelable parameter.  Handle O_NONBLOCK.
3477         Make cancelable if cancelabe parameter is true.
3478         (fhandler_dev_tape::raw_read): Call _lock with true argument.
3479         (fhandler_dev_tape::raw_write): Ditto.
3480
3481 2011-05-04  Corinna Vinschen  <corinna@vinschen.de>
3482
3483         * fhandler_dsp.cc (fhandler_dev_dsp::Audio): Add fh member.
3484         (fhandler_dev_dsp::Audio_out::Audio_out): Take pointer to encapsulating
3485         fhandler_dev_dsp as parameter.
3486         (fhandler_dev_dsp::Audio_in::Audio_in): Ditto.
3487         (fhandler_dev_dsp::Audio::Audio): Take pointer to encapsulating
3488         fhandler_dev_dsp as parameter and store in fh.
3489         (fhandler_dev_dsp::Audio_out::write): Change return type to int and
3490         return number of bytes written.  Return -1 if waitforspace returns false
3491         and no bytes have been written so far.
3492         (fhandler_dev_dsp::Audio_out::waitforspace): Change return type to bool.
3493         Handle O_NONBLOCK.  Make waiting loop interruptible and cancelable.
3494         Return false in any of these cases, otherwise true.
3495         (fhandler_dev_dsp::Audio_in::read): Set returned nBytes to -1 if
3496         waitfordata returns false and nothing has been read so far.
3497         (fhandler_dev_dsp::Audio_in::waitfordata): Change return type to bool.
3498         Handle O_NONBLOCK.  Make waiting loop interruptible and cancelable.
3499         Return false in any of these cases, otherwise true.
3500         (fhandler_dev_dsp::write): Call Audio_out constructor with this as
3501         parameter.
3502         (fhandler_dev_dsp::read): Call Audio_in constructor with this as
3503         parameter.
3504
3505 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
3506
3507         * thread.h (pthread::static_cancel_self): Mark as noreturn.
3508         (pthread::cancel_self): Ditto.
3509         * thread.cc (pthread::cancel_self): Explicitly use pthread::exit to
3510         avoid a "function returns" error.
3511
3512 2011-05-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
3513
3514         * pinfo.h (pinfo::pinfo): Set procinfo to NULL to avoid potential
3515         cleanup of uninitialized garbage.  (Suggested by Ryan Johnson)
3516
3517 2011-05-03  Corinna Vinschen  <corinna@vinschen.de>
3518
3519         * select.cc (cygwin_select): Make degenerate case cancelable.
3520         (select_stuff::destroy): New inline method to delete memory taken
3521         by select_stuff.
3522         (select_stuff::~select_stuff): Call destroy.
3523         (select_stuff::wait): Add case to allow canceling select.
3524         * select.h (select_stuff::destroy): Declare.
3525         * thread.cc: Mark poll, pselect and poll as cancelable.
3526
3527 2011-05-03  Corinna Vinschen  <corinna@vinschen.de>
3528
3529         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Make
3530         cancelable.  Remove test for main thread, always add signal_arrived
3531         to waited objects.
3532
3533 2011-05-03  Corinna Vinschen  <corinna@vinschen.de>
3534
3535         * fhandler_tty.cc (fhandler_tty_slave::read): Set WFMO timeout to 0 for
3536         nonblocking case.  Drop useless waiter variable.  Rewrite wait for
3537         input_available_event to use a switch statement.  Handle timeout and
3538         failure more gracefully.  Make restartable and cancelable.  Rewrite
3539         wait for input_mutex to use WFMO and a switch statement.  Handle
3540         timeout and failure more gracefully.  Make restartable and cancelable.
3541
3542 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
3543
3544         * signal.cc (_pinfo::kill): Avoid referencing 'pid' after ESRCH.
3545
3546 2011-05-02  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3547
3548         * cygwin.din (pthread_attr_getstack): Export.
3549         (pthread_attr_getstackaddr): Export.
3550         (pthread_getattr_np): Export.
3551         * ntdll.h (enum _THREAD_INFORMATION_CLASS): Add ThreadBasicInformation.
3552         (struct _THREAD_BASIC_INFORMATION): Define.
3553         (NtQueryInformationThread): Declare.
3554         * posix.sgml (std-susv4): Add pthread_attr_getstack.
3555         (std-gnu): Add pthread_getattr_np.
3556         (std-deprec): Add pthread_attr_getstackaddr.
3557         (std-notimpl): Remove pthread_attr_[gs]etstackaddr, as they were
3558         removed from SUSv4.
3559         * thread.cc (pthread_attr::pthread_attr): Initialize stackaddr.
3560         (pthread_attr_getstack): New function.
3561         (pthread_attr_getstackaddr): New function.
3562         (pthread_attr_setstacksize): Return EINVAL if passed size less than
3563         PTHREAD_STACK_MIN, as required by POSIX.
3564         (pthread_getattr_np): New function.
3565         * thread.h (class pthread_attr): Add stackaddr member.
3566         * include/pthread.h (pthread_attr_getstack): Declare.
3567         (pthread_attr_getstackaddr): Declare unconditionally.
3568         (pthread_attr_setstack): Declare inside false conditional for reference.
3569         (pthread_getattr_np): Declare.
3570         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
3571
3572 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
3573
3574         * Makefile.in: Allow CFLAGS to be overridden from the environment.
3575
3576 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
3577
3578         * thread.cc (cancelable_wait): Remove test for main thread.
3579         * fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto.
3580
3581 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
3582
3583         * fhandler_tty.cc (andler_pty_master::process_slave_output): Make
3584         interruptible and cancelable.  Fix nonblocking case.
3585
3586 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
3587
3588         * fhandler_console.cc (fhandler_console::read): Make restartable and
3589         cancelable.
3590
3591 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
3592
3593         * strace.cc (strace::vprntf): Avoid closing unopened handle.
3594
3595 2011-05-02  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
3596
3597         * sysconf.cc (sca): Set _SC_SPIN_LOCKS to _POSIX_SPIN_LOCKS.
3598
3599 2011-05-02  Christopher Faylor  <me.cygwin2011@cgf.cx>
3600
3601         * dll_init.cc (dll_list::alloc): Reset 'p' in forked process.
3602
3603         * select.cc (select_stuff::wait): Move cleanup() closer to WFMO to
3604         minimize unavoidable (?) race.
3605
3606 2011-05-02  Corinna Vinschen  <corinna@vinschen.de>
3607
3608         * fhandler_serial.cc (fhandler_serial::raw_read): Add restartability
3609         after a signal.  Add cancelability.
3610         (fhandler_serial::raw_write): Wait for write to succeed if O_NONBLOCK
3611         is not set.  Add signal handling and cancelability.
3612
3613 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
3614
3615         * fhandler_windows.cc (fhandler_windows::read): Use
3616         pthread::get_cancel_event to fetch thread's cancel event.
3617         * flock.cc (lf_setlock): Ditto.
3618         * posix_ipc.cc (ipc_cond_timedwait): Ditto.
3619         * thread.cc (pthread::get_cancel_event): New static method.
3620         * thread.h (pthread::get_cancel_event): Declare.
3621
3622 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
3623
3624         * libc/minires-os-if.c (get_dns_info): Remove unnecessary test for
3625         existence of DnsQuery_A.
3626
3627 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
3628
3629         Throughout, use user32 UNICODE functions rather than ANSI functions.
3630         * autoload.cc: Convert all definitions for ANSI user32 functions to
3631         definitions for the corresponding UNICODE function.
3632         (SendMessageA): Remove.
3633         (SendNotifyMessageW): Define.
3634         * fhandler.h (fhandler_windows::is_slow): Remove.
3635         * fhandler_windows.cc (fhandler_windows::write): Use SendNotifyMessageW
3636         call rather than SendMessage to make function always return immediately.
3637         (fhandler_windows::read): Make function interruptible and a cancellation
3638         point.  Handle O_NONBLOCK.
3639         * select.cc (peek_serial): Don't wait for signal_arrived here.
3640         * window.cc (wininfo::winthread): Call CreateWindowExW directly rather
3641         than CreateWindow wrapper.
3642
3643 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
3644
3645         * net.cc (fdsock): Drop setting uninterruptible_io to true.
3646
3647 2011-05-01  Corinna Vinschen  <corinna@vinschen.de>
3648
3649         * fhandler.h (fhandler_socket::is_slow): Remove.
3650
3651 2011-04-30  Corinna Vinschen  <corinna@vinschen.de>
3652
3653         * fcntl.cc (fcntl64): Call pthread_testcancel.
3654         * fhandler_socket.cc (fhandler_socket::connect): Ditto.
3655         (fhandler_socket::accept4): Ditto.
3656         (fhandler_socket::recvfrom): Ditto.
3657         (fhandler_socket::recvmsg): Ditto.
3658         (fhandler_socket::sendto): Ditto.
3659         (fhandler_socket::sendmsg): Ditto.
3660         * flock.cc (lf_setlock): Allow to cancel thread running blocking
3661         file lock.  Try to make code more readable.
3662         (lockf): Call pthread_testcancel.
3663         * mmap.cc (msync): Ditto.
3664         * posix_ipc.cc (ipc_cond_timedwait): Call pthread::static_cancel_self
3665         rather than pthread_testcancel.
3666         * select.cc (cygwin_select): Call pthread_testcancel.
3667         * syscalls.cc (pread): Ditto.
3668         (pwrite): Ditto.
3669         (readv): Ditto.
3670         (writev): Ditto.
3671         (open): Ditto.
3672         (close): Ditto.
3673         (fsync): Ditto.
3674         * termios.cc (tcdrain): Ditto.
3675         * thread.cc: Align list of cancellation points with above changes.
3676         Mark not-implemented functions, too.
3677         (cancelable_wait): Don't set unused object indices to WAIT_FAILED
3678         since that could result in wrong behaviour.  Set them to the invalid
3679         value WAIT_TIMEOUT + 1 instead.
3680
3681 2011-04-30  Corinna Vinschen  <corinna@vinschen.de>
3682
3683         * thread.h (class pthread): Add bool member canceled.
3684         * thread.cc (pthread::pthread): Initialize canceled to false.
3685         (pthread::cancel): Set canceled before setting cancel_event.
3686         (pthread::testcancel): Check for canceled.  Only wait for cancel_event
3687         if canceled is true.  Explain why.
3688         (pthread::_fixup_after_fork): Set canceled to false.
3689
3690 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3691
3692         * errno.cc (errmap): Sort.  Map ERROR_EXE_MACHINE_TYPE_MISMATCH to
3693         ENOEXEC.
3694
3695 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3696
3697         * thread.cc: Update comment listing cancellation points per POSIX.
3698
3699 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3700
3701         * advapi32.cc: Add comment.
3702         (EqualSid): Remove.
3703         (CopySid): Remove.
3704         (AddAccessAllowedAce): Remove.
3705         (AddAccessDeniedAce): Remove.
3706         (MakeSelfRelativeSD): Remove.
3707         * flock.cc: Replace above functions throughout with their ntdll.dll
3708         equivalent.
3709         * sec_acl.cc: Ditto.
3710         * sec_auth.cc: Ditto.
3711         * sec_helper.cc: Ditto.
3712         * security.cc: Ditto.
3713         * security.h: Ditto.
3714         (RtlEqualSid): Declare.  Explain why.
3715         (RtlCopySid): Ditto.
3716
3717 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3718
3719         * advapi32.cc (AccessCheck): Remove.
3720         (PrivilegeCheck): Remove.
3721         (OpenThreadToken): Remove.
3722         * fhandler_tty.cc: Replace above functions throughout with their
3723         ntdll.dll equivalent.
3724         * security.cc: Ditto.
3725
3726 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3727
3728         * ntdll.h (IsEventSignalled): New inline function.
3729         * cygthread.cc (cygthread::terminate_thread): Use IsEventSignalled in
3730         place of WaitForSingleObject on event with 0 timeout.
3731         * fhandler.cc (fhandler_base_overlapped::has_ongoing_io): Ditto.
3732         * fhandler_fifo.cc (fhandler_fifo::open_nonserver): Ditto.
3733         (fhandler_fifo::wait): Ditto.
3734         * fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
3735         * select.cc (verify_tty_slave): Ditto.
3736         * thread.cc (pthread::testcancel): Ditto.
3737
3738 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3739
3740         * advapi32.cc (GetTokenInformation): Remove.
3741         (SetTokenInformation): Remove.
3742         * grp.cc: Replace above functions throughout with their ntdll.dll
3743         equivalent.
3744         * sec_auth.cc: Ditto.
3745         * syscalls.cc: Ditto.
3746         * uinfo.cc: Ditto.
3747
3748 2011-04-29  Corinna Vinschen  <corinna@vinschen.de>
3749
3750         * posix_ipc.cc (ipc_cond_timedwait): Only wait for pthread's
3751         cancel_event if thread's cancelability isn't disabled.
3752
3753 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3754
3755         * advapi32.cc (SetSecurityDescriptorDacl): Remove.
3756         (SetSecurityDescriptorGroup): Remove.
3757         (SetSecurityDescriptorOwner): Remove.
3758         * pinfo.cc: Replace above functions throughout with their ntdll.dll
3759         equivalent.
3760         * sec_acl.cc: Ditto.
3761         * sec_helper.cc: Ditto.
3762         * security.cc: Ditto.
3763
3764         * sec_helper.cc (__sec_user): Remove old comment.
3765
3766 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3767
3768         * posix_ipc.cc (ipc_cond_timedwait): Also wait for pthread's
3769         cancel_event, if any.  Call pthread_testcancel if cancel_event has been
3770         signalled.
3771
3772 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3773
3774         * posix_ipc.cc (ipc_cond_timedwait): Remove pthread_testcancel calls.
3775         (_mq_send): Add pthread_testcancel call at start of function.
3776         (_mq_receive): Ditto.
3777
3778 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3779
3780         * cygerrno.h (geterrno_from_nt_status): Declare.
3781         * errno.cc (geterrno_from_nt_status): Define.
3782         * flock.cc: Fix copyright dates.
3783         * ntdll.h (enum _TIMER_TYPE): Define.
3784         (PTIMER_APC_ROUTINE): Define.
3785         (NtCancelTimer): Declare.
3786         (NtCreateTimer): Declare.
3787         (NtSetTimer): Declare.
3788         * posix_ipc.cc (ipc_cond_timedwait): Rewrite to make interruptible and
3789         restartable.  Call pthread_testcancel in case of timeout to enable
3790         pthread_cancel on waiting thread.  Replace WFMO timeout with waiting
3791         for a waitable timer.  Explain why.  Replace single call to WFMO with
3792         two calls, one for the event, one for the mutex.  Don't lock mutex in
3793         case of error.
3794         (ipc_cond_signal): Make void function.
3795         (ipc_cond_close): Ditto.
3796         (_mq_send): Immediately return -1 in case of error from
3797         ipc_cond_timedwait.
3798         (_mq_receive): Ditto.
3799
3800 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3801
3802         * advapi32.cc (GetSecurityDescriptorDacl): Remove.
3803         (GetSecurityDescriptorGroup): Remove.
3804         (GetSecurityDescriptorOwner): Remove.
3805         * sec_acl.cc: Replace above functions throughout with their ntdll.dll
3806         equivalent.  Remove redundant debug output.
3807         * sec_auth.cc: Ditto.
3808         * security.cc: Ditto.
3809         * uinfo.cc: Ditto.
3810
3811 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3812
3813         * advapi32.cc (InitializeAcl): Remove.
3814         (AddAce): Remove.
3815         (FindFirstFreeAce): Remove.
3816         (GetAce): Remove.
3817         (InitializeSecurityDescriptor): Remove.
3818         (OpenProcessToken): Remove.
3819         * dcrt0.cc: Replace above functions throughout with their ntdll.dll
3820         equivalent.
3821         * fhandler_tty.cc: Ditto.
3822         * flock.cc: Ditto.
3823         * pinfo.cc: Ditto.  Drop unnecessary error handling.
3824         * sec_acl.cc: Ditto.
3825         * sec_auth.cc: Ditto.
3826         * sec_helper.cc: Ditto.
3827         * security.cc: Ditto.
3828
3829 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3830
3831         * advapi32.cc (InitializeSid): Remove.
3832         (EqualPrefixSid): Remove.
3833         (GetLengthSid): Remove.
3834         (GetSidSubAuthority): Remove.
3835         (GetSidSubAuthorityCount): Remove.
3836         (GetSidIdentifierAuthority): Remove.
3837         * fhandler_disk_file.cc: Replace above functions throughout with their
3838         ntdll.dll equivalent.
3839         * sec_auth.cc: Ditto.
3840         * sec_helper.cc: Ditto.
3841         * security.cc: Ditto.
3842
3843 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3844
3845         * advapi32.cc (AllocateLocallyUniqueId): Remove.
3846         * fhandler_disk_file.cc (fhandler_base::open_fs): Replace call to
3847         AllocateLocallyUniqueId with call to NtAllocateLocallyUniqueId;
3848         * posix_ipc.cc (mq_open): Ditto.  Drop error handling for that call.
3849         (sem_open): Ditto.
3850
3851 2011-04-28  Corinna Vinschen  <corinna@vinschen.de>
3852
3853         * autoload.cc (GetSecurityInfo): Remove.
3854         * ntdll.h (RtlConvertToAutoInheritSecurityObject): Declare.
3855         (RtlDeleteSecurityObject): Declare.
3856         (RtlGetControlSecurityDescriptor): Declare.
3857         (RtlLengthSecurityDescriptor): Declare.
3858         * security.cc (file_mapping): New global variable.
3859         (get_file_sd): Rewrite.  Clean up code.  Get rid of GetSecurityInfo
3860         call.
3861         (alloc_sd): Call RtlSetControlSecurityDescriptor to set
3862         SE_DACL_PROTECTED flag.
3863         (check_file_access): Remove mapping.  Use file_mapping instead.
3864         (check_registry_access): Rename mapping to reg_mapping.
3865         * wincap.cc: Througout, drop use_get_sec_info_on_dirs,
3866         * wincap.h (struct wincaps): Drop use_get_sec_info_on_dirs.
3867
3868 2011-04-24  Corinna Vinschen  <corinna@vinschen.de>
3869
3870         * include/fenv.h: Add missing _FENV_H_ define.
3871
3872 2011-04-23  Corinna Vinschen  <corinna@vinschen.de>
3873
3874         * registry.cc (reg_key::get_dword): Rename from get_int, use DWORD
3875         rather than int type.  Avoid compiler warning.
3876         (reg_key::set_dword): Rename from set_int, use DWORD rather than int
3877         type.  Change return type to NTSTATUS.
3878         (reg_key::get_string): Change return type to NTSTATUS.
3879         (reg_key::set_string): Ditto.
3880         * registry.h: Accommodate above changes.
3881         * environ.cc (regopt): Test return value of reg_key::get_string as
3882         NTSTATUS.
3883         * sched.cc (sched_rr_get_interval): Change local int vars to DWORD.
3884         Call reg_key::get_dword instead of reg_key::get_int.
3885         * shared.cc (init_installation_root): Test return value of
3886         reg_key::get_string as NTSTATUS.
3887         (shared_info::heap_slop_size): Call reg_key::get_dword rather than
3888         reg_key::get_int.
3889         (shared_info::heap_chunk_size): Ditto.
3890         * shared_info.h (CURR_SHARED_MAGIC): Update.
3891         (class shared_info): Change heap_chunk and heap_slop to DWORD  values.
3892
3893 2011-04-21  Corinna Vinschen  <corinna@vinschen.de>
3894
3895         * cygtls.cc (_cygtls::init_thread): Drop setting locals.process_logmask.
3896         * cygtls.cc (_cygtls::remove): Always free mallocated TLS storage on
3897         thread exit.  Drop freeing locals.process_ident.
3898         * cygtls.h (struct _local_storage): Remove syslog-related members.
3899         * syslog.cc (syslog_globals): New static storage for global syslog
3900         settings.  Use throughout instead of _my_tls.locals.
3901         (openlog): Set new syslog_globals.process_ident value more carefully.
3902         * tlsoffsets.h: Regenerate.
3903
3904 2011-04-21  Thomas Stalder <cygwinml@gmail.com>
3905
3906         * include/sys/poll.h: Include signal.h to get definition of sigset_t.
3907
3908 2011-04-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
3909
3910         * cygheap.cc (init_cygheap::close_ctty): Avoid closing console-cttys
3911         since they don't use archetypes and this will just result in double
3912         frees.
3913         * dll_init.cc (dll_list::protect): Define.
3914         (dll_list::alloc): Guard list access.
3915         (dll_list::detach): Ditto.
3916         * dll_init.h (dll_list::protect): Declare new muto.
3917         (dll_list::guard): Define/declare function to guard list access.
3918         * fhandler_termios.cc (fhandler_termios::sigflush): Avoid SEGV in
3919         pathological condition of get_ttyp() == NULL.
3920
3921 2011-04-20  Christopher Faylor  <me.cygwin2011@cgf.cx>
3922
3923         * select.cc (serial_cleanup): Make sure that device_specific_pipe is
3924         always deleted regardless of whether it has a unique thread associated
3925         with it
3926         (socket_cleanup): Ditto.
3927         (mailslot_cleanup): Ditto.
3928
3929 2011-04-20  Corinna Vinschen  <corinna@vinschen.de>
3930
3931         * devices.h: Renumber internal devices so that FH_PROCESS is part of
3932         the /proc family of virtual devices.
3933         (FH_PROC_MAX_MINOR): Define.
3934         * path.h (isproc_dev): Use FH_PROC_MAX_MINOR rather than FH_PROC.
3935
3936 2011-04-19  Peter Rosin  <peda@lysator.liu.se>
3937
3938         * select.cc (pipe_cleanup): Make sure that device_specific_pipe is
3939         always deleted regardless of whether it has a unique thread associated
3940         with it.
3941
3942 2011-04-19  Jon TURNEY  <jon.turney@dronecode.org.uk>
3943
3944         * thread.cc (semaphore::init): We cannot reliably infer anything from
3945         the existing contents of sem, so merely warn rather than return EBUSY
3946         if it looks like we are reinitialising a semaphore.
3947
3948 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3949
3950         * autoload.cc (GetConsoleWindow): Drop.
3951         (GetSystemWindowsDirectoryW): Drop.
3952         * fhandler_console.cc (beep): Call GetSystemWindowsDirectoryW instead of
3953         GetWindowsDirectoryW.
3954         * uinfo.cc (cygheap_user::env_systemroot): Call
3955         GetSystemWindowsDirectoryW and convert to multibyte on the fly.
3956         * winlean.h (GetWindowsDirectoryW): Redefine to something invalid.
3957         Explain why.
3958
3959 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3960
3961         * Makefile.in (DLL_IMPORTS): Drop advapi32.dll.
3962         * autoload.cc: Enable autoloading advapi32 functions.
3963         * environ.cc (regopt): Use wide char arguments in reg_key functions.
3964         * fhandler_console.cc (beep): Ditto.  Use WCHAR throughout.
3965         * registry.cc (reg_key): Rewrite reg_key class to use native NT registry
3966         functions.  Use WCHAR string parameters throughout.  Use PCWSTR rather
3967         than const WCHAR.  Drop multibyte char functionality.  Drop unused
3968         methods.
3969         (get_registry_hive_path): Use RtlQueryRegistryValues to fetch path from
3970         registry.
3971         (load_registry_hive): Drop useless check for user hive being available.
3972         Load hive using NtLoadKey.
3973         * registry.h: Accommodate above changes.
3974         * sched.cc (sched_rr_get_interval): Use wide char arguments in reg_key
3975         functions.
3976         * shared.cc (init_installation_root): Ditto.
3977         (shared_info::init_obcaseinsensitive): Use RtlQueryRegistryValues to
3978         fetch obcaseinsensitive value.
3979         (shared_info::heap_slop_size): Use wide char arguments in reg_key
3980         functions.
3981         (shared_info::heap_chunk_size): Ditto.
3982         * syscalls.cc (gethostid): Ditto.
3983         * winsup.h (__WIDE): Define.
3984         (_WIDE): Define.
3985         * libc/minires-os-if.c (get_registry_dns_items): Don't fetch values
3986         from registry.  Just extract them from given UNICODE_STRING parameter.
3987         (get_registry_dns): Fetch all registry values at once using
3988         RtlQueryRegistryValues.
3989
3990 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3991
3992         * net.cc (get_ipv4fromreg_ipcnt): Rearrange to fetch all registry
3993         values at once using RtlQueryRegistryValues.
3994         (get_ipv4fromreg): Ditto.
3995
3996 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
3997
3998         * fhandler_registry.cc (fhandler_registry::fstat): Use RegQueryInfoKeyW.
3999
4000 2011-04-19  Corinna Vinschen  <corinna@vinschen.de>
4001
4002         * fhandler_proc.cc (read_value): Remove definition.
4003         (print): Simplify.
4004         (format_proc_cpuinfo): Drop useless call to GetSystemInfo.  Rearrange
4005         to use Rtl registry functions.  Rename dwOldThreadAffinityMask to
4006         orig_affinity_mask.
4007
4008 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
4009
4010         * localtime.cc (tzload): Don't change global timezone information
4011         when called from gmtime or gmtime_r.
4012         (tzparse): Ditto.
4013
4014 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
4015
4016         * cygtls.cc (_cygtls::remove): Always close sockevt handle.
4017
4018 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
4019
4020         * cygwin.din (ppoll): Export.
4021         * poll.cc (ppoll): Implement.
4022         * posix.sgml (std-gnu): Add ppoll.
4023         * include/cygwin/version.h: Bump API minor number.
4024         * include/sys/poll.h (ppoll): Declare.
4025
4026 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
4027
4028         * fhandler_socket.cc (fhandler_socket::evaluate_events): Handle the
4029         FD_CLOSE event specially when called from accept.  Explain why.
4030         (fhandler_socket::shutdown): Fake success on not-connected socket and
4031         trigger socket event if the read side of a socket is affected.  Explain
4032         why.
4033         * poll.cc (poll): Check for saw_shutdown_read on sockets to generate
4034         POLLHUP as well.
4035
4036 2011-04-18  Corinna Vinschen  <corinna@vinschen.de>
4037
4038         * Fix various copyrights.
4039
4040 2011-04-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
4041
4042         * signal.cc (_pinfo::kill): Set this_process_state when process
4043         exists.
4044
4045 2011-04-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
4046
4047         * signal.cc (_pinfo::kill): Return 0 when attempting to test for
4048         existence of an existed process which has not yet been reaped.
4049
4050 2011-04-17  Christopher Faylor  <me.cygwin2011@cgf.cx>
4051
4052         * cygheap.h (init_cygheap::ctty): Use base class so that console can
4053         join in the fun.
4054         * dtable.cc (dtable::stdio_init): Remove special-case call to
4055         set_console_ctty ().
4056         * exceptions.cc (sigpacket::process): Conditionally flush terminal
4057         input on certain signals.
4058         * fhandler.h (fhandler_console::get_tty_stuff): Make non-static.
4059         (fhandler_termios::get_ttyp): Move here.
4060         (fhandler_termios::sigflush): Declare.
4061         (fhandler_tty_common::get_ttyp): Delete.
4062         * fhandler_console.cc (fhandler_console::get_tty_stuff): Pass this as
4063         "arch" argument.
4064         (set_console_ctty): Delete.
4065         (tty_list::get_tty): Just return pointer to shared console region,
4066         delaying get_tty_stuff until open().
4067         (fhandler_console::init): Treat NULL handle as signifying that console
4068         should be opened with O_NOCTTY flag.  Rename handle argument to the
4069         more common 'h'.
4070         * fhandler_termios.cc (fhandler_termios::sigflush): Define.
4071         * fhandler_tty.cc (handler_tty_master::init_console): Pass NULL as
4072         first argument to fhandler_console::init.
4073         * pinfo.cc (_pinfo::set_ctty): Change third parameter to
4074         fhandler_termios *.  Add extra debugging.
4075         * pinfo.h (_pinfo::set_ctty): Change third parameter to
4076         fhandler_termios *.
4077
4078         * exceptions.cc (handle_sigsuspend): Don't special-case non-main threads.
4079
4080 2011-04-15  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4081
4082         * thread.cc (pthread_setschedprio): New function.
4083         * include/pthread.h (pthread_setschedprio): Declare.
4084         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
4085         * cygwin.din (pthread_setschedprio): Export.
4086         * posix.sgml (std-notimpl) Move pthread_setschedprio from here...
4087         (std-susv4) ...to here.
4088
4089 2011-04-10  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4090
4091         * fhandler_proc.cc (proc_tab): Add /proc/swaps virtual file.
4092         (format_proc_swaps): New function.
4093
4094 2011-04-06  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4095
4096         * Makefile.in: Move srcdir definition before others which uses it.
4097
4098 2011-04-06  Jon TURNEY  <jon.turney@dronecode.org.uk>
4099
4100         * dll_init.cc (reserve_at, release_at): New functions.
4101         (load_after_fork): If the DLL was loaded higher than the required
4102         address, assume that it loaded at it's base address and also reserve
4103         memory there to force it to be relocated.
4104
4105 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4106
4107         * include/cygwin/types.h: Move #include <sys/sysmacros.h> to
4108         end of header so that it gets the dev_t typedef.
4109         * include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
4110         gnu_dev_makedev): Prototype and define as inline functions.
4111         (major, minor, makedev): Redefine in terms of gnu_dev_*.
4112
4113 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4114
4115         * include/cygwin/types.h: Move multiple inclusion guards to
4116         beginning and end of header.
4117
4118 2011-04-04  Christopher Faylor  <me.cygwin2011@cgf.cx>
4119
4120         * Makefile.in: Move Makefile.common include earlier to fix problems
4121         with relative ${srcdir} path which confuses make.
4122
4123 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
4124
4125         Drop NT4 support.
4126         * autoload.cc (DnsQuery_A): Fatal if not available.
4127         (DnsRecordListFree): Ditto.
4128         (DsGetDcNameW): Ditto.
4129         (NetGetAnyDCName): Remove.
4130         (NetGetDCName): Remove.
4131         (EnumProcessModules): Fatal if not available.
4132         (GetModuleFileNameExW): Ditto.
4133         (GetModuleInformation): Ditto.
4134         (GetProcessMemoryInfo): Ditto.
4135         (QueryWorkingSet): Ditto.
4136         (LsaRegisterLogonProcess): Ditto.
4137         * fenv.cc (_feinitialise): Drop supports_sse condition.
4138         * fhandler_disk_file.cc (path_conv::isgood_inode): Fix comment.
4139         (fhandler_base::fstat_by_name): Drop has_fileid_dirinfo condition.
4140         (fhandler_disk_file::opendir): Ditto.
4141         * fhandler_netdrive.cc (fhandler_netdrive::readdir): Fix comment.
4142         * fhandler_proc.cc (format_proc_partitions): Drop NT4-only code.
4143         * fhandler_process.cc (get_process_state): Ditto.
4144         * kernel32.cc (GetWindowsDirectoryW): Remove.
4145         (GetWindowsDirectoryA): Remove.
4146         * miscfuncs.cc (nice_to_winprio): Drop NT4-only code.
4147         * mount.cc (fs_info::update): Fix comments.
4148         * net.cc (get_2k_ifs): Drop NT4-only code.
4149         * sec_auth.cc (get_logon_server): Ditto.
4150         (lsaauth): Drop NT4-specific error handling.
4151         * security.cc (alloc_sd): Set SE_DACL_PROTECTED unconditionally.
4152         * select.cc (select_stuff::wait): Always use MWMO_INPUTAVAILABLE.
4153         (peek_windows): Drop NT4-only condition in call to PeekMessage.
4154         * syscalls.cc (gethostid): Remove NT4-only workaround.
4155         * wincap.cc: Througout, drop has_dacl_protect,
4156         has_broken_if_oper_status, has_process_io_counters,
4157         has_terminal_services, has_extended_priority_class, has_guid_volumes,
4158         has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse from
4159         wincaps.
4160         (wincap_nt4sp4): Remove.
4161         (wincap_minimal): Set to wincap_2000.
4162         (wincapc::init): Rely on availability of OSVERSIONINFOEX structure.
4163         Treat error from GetVersionEx as fatal.  Treat NT4 as fatal.
4164         * wincap.h (struct wincaps): Drop has_dacl_protect,
4165         has_broken_if_oper_status, has_process_io_counters,
4166         has_terminal_services, has_extended_priority_class, has_guid_volumes,
4167         has_fileid_dirinfo, has_mwmo_inputavailable and supports_sse flags
4168         and methods.
4169         * winlean.h (GetWindowsDirectoryW) Define as GetSystemWindowsDirectoryW.
4170         (GetWindowsDirectoryA): Define as GetSystemWindowsDirectoryA.
4171
4172 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
4173
4174         * dtable.cc (dtable::init_std_file_from_handle): Fix a comment to
4175         reflect the current state.
4176
4177 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4178
4179         * Makefile.in (fhandler_proc_CFLAGS): Define USERNAME, HOSTNAME,
4180         and GCC_VERSION.
4181         * fhandler_proc.cc (format_proc_version):  Add build machine and GCC
4182         version information as on Linux.
4183
4184 2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4185             Corinna Vinschen  <corinna@vinschen.de>
4186
4187         * devices.h (fh_devices): Define FH_PROC_MIN_MINOR.
4188         Reorder major-0 devices so that all /proc directories fall
4189         between FH_PROC and FH_PROC_MIN_MINOR.
4190         * path.h (isproc_dev): Redefine accordingly.
4191
4192 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
4193
4194         * cygserver_setpwd.h (setlsapwd): Add username parameter to declaration.
4195         * external.cc (cygwin_internal): In the CW_SET_PRIV_KEY case, fetch
4196         additional username parameter.
4197         * setlsapwd.cc (setlsapwd): Add username parameter.  Allow admin to
4198         set the hidden password for other users.
4199
4200 2011-04-04  Corinna Vinschen  <corinna@vinschen.de>
4201
4202         * sec_auth.cc (get_user_groups): Mark well-known groups as well-known.
4203         (get_user_local_groups): Ditto.
4204         (verify_token): Drop useless label.
4205         * sec_helper.cc (cygsid::get_sid): Check for well-known SID if
4206         well_known isn't set.
4207         * security.h (well_known_sid_type): New inline function.
4208
4209 2011-04-02  Corinna Vinschen  <corinna@vinschen.de>
4210
4211         * autoload.cc (FindFirstVolumeA): Remove.
4212         (FindNextVolumeA): Remove.
4213         (FindVolumeClose): Remove.
4214         (GetVolumeNameForVolumeMountPointA): Remove.
4215         * ntdll.h (NtFlushBuffersFile): Declare.
4216         * syscalls.cc (sync_worker): Rewrite using native NT functions.
4217         (sync): Ditto.
4218
4219 2011-04-02  Corinna Vinschen  <corinna@vinschen.de>
4220
4221         * fhandler_proc.cc (format_proc_partitions): Express length in WCHAR
4222         size.
4223
4224 2011-04-02  Corinna Vinschen  <corinna@vinschen.de>
4225
4226         * autoload.cc (GetExtendedTcpTable): Remove.
4227         (GetTcpTable): Remove.
4228         (CharNextExA): Remove.
4229         (FindWindowA): Remove.
4230         (ShowWindowAsync): Remove.
4231         * dcrt0.cc (disable_dep): Remove unused function.
4232         (dll_crt0_0): Drop comment babbling about TS & DEP.
4233         * fhandler_socket.cc (address_in_use): Remove unused function.
4234         * wincap.cc: Throughout, drop ts_has_dep_problem from wincaps.
4235         (wincapc::init): Drop code setting ts_has_dep_problem flag.
4236         * wincap.h (struct wincaps): Drop ts_has_dep_problem flags and method.
4237
4238 2011-04-01  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4239
4240         Implement /proc/sysvipc/*
4241         * devices.in (dev_procsysvipc_storage): Add.
4242         * devices.cc: Regenerate.
4243         * devices.h (fh_devices): Add FH_PROCSYSVIPC.
4244         * dtable.cc (build_fh_pc): Add case FH_PROCSYSVIPC.
4245         * fhandler.h (class fhandler_procsysvipc): Declare.
4246         (fhandler_union): Add __procsysvipc.
4247         * fhandler_proc.cc (proc_tab): Add sysvipc virt_directory.
4248         * fhandler_procsysvipc.cc: New file.
4249         * Makefile.in (DLL_OFILES): Add fhandler_procsysvipc.o.
4250         * path.h (isproc_dev): Add FH_PROCSYSVIPC to conditional.
4251
4252 2011-04-01  Corinna Vinschen  <corinna@vinschen.de>
4253
4254         * Makefile.in (DLL_OFILES): Add avapi32.o.
4255         * advapi32.cc: New file.
4256         * autoload.cc: Add block of remaining advapi32 functions used by
4257         Cygwin.  Keep commented out.  Explain why.
4258
4259 2011-04-01  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4260
4261         * fhandler_proc.cc (format_proc_loadavg): Add running/total
4262         processes as fourth component of output.
4263         * fhandler_process.cc (get_process_state): Make non-static.
4264         Add FIXME about generating an 'O' flag.
4265
4266 2011-04-01  Corinna Vinschen  <corinna@vinschen.de>
4267
4268         * fhandler_random.cc (fhandler_dev_random::crypt_gen_random):
4269         Use CryptAcquireContextW.
4270         * ntdll.h (STATUS_PROCEDURE_NOT_FOUND): Define.
4271         * sec_auth.cc (open_local_policy): Rename NTSTATUS variable ret to
4272         status.  Drop usage of LsaNtStatusToWinError.
4273         (verify_token): Call NtQuerySecurityObject instead of
4274         GetKernelObjectSecurity.
4275         (create_token): Rename NTSTATUS variable ret to status.  Rename ret2 to
4276         sub_status.  Drop usage of LsaNtStatusToWinError.  In case LsaLogonUser
4277         fails, report the sub_status as well.
4278
4279 2011-04-01  Corinna Vinschen  <corinna@vinschen.de>
4280
4281         * libc/strptime.c: Remove misleading comment.
4282
4283 2011-03-31  Corinna Vinschen  <corinna@vinschen.de>
4284
4285         * ntdll.h: Allow usage from plain C code.
4286         (FSCTL_PIPE_IMPERSONATE): Define.
4287         (enum _THREAD_INFORMATION_CLASS): Define.
4288         (RTL_QUERY_REGISTRY_xxx): Define.
4289         (RTL_REGISTRY_xxx): Define.
4290         (PRTL_QUERY_REGISTRY_ROUTINE): Define.
4291         (struct _RTL_QUERY_REGISTRY_TABLE): Define.
4292         (enum _KEY_VALUE_INFORMATION_CLASS): Define.
4293         (struct _KEY_VALUE_PARTIAL_INFORMATION): Define.
4294         (NtAccessCheck): Declare.
4295         (NtAllocateLocallyUniqueId): Declare.
4296         (NtCreateKey): Declare.
4297         (NtDuplicateToken): Declare.
4298         (NtLoadKey): Declare.
4299         (NtOpenKey): Declare.
4300         (NtOpenProcessToken): Declare.
4301         (NtOpenThreadToken): Declare.
4302         (NtPrivilegeCheck): Declare.
4303         (NtQueryInformationToken): Declare.
4304         (NtQueryValueKey): Declare.
4305         (NtSetInformationThread): Declare.
4306         (NtSetInformationToken): Declare.
4307         (NtSetValueKey): Declare.
4308         (RtlAbsoluteToSelfRelativeSD): Declare.
4309         (RtlAddAccessAllowedAce): Declare.
4310         (RtlAddAccessDeniedAce): Declare.
4311         (RtlAddAce): Declare.
4312         (RtlCheckRegistryKey): Declare.
4313         (RtlCopySid): Declare.
4314         (RtlCreateAcl): Declare.
4315         (RtlCreateRegistryKey): Declare.
4316         (RtlCreateSecurityDescriptor): Declare.
4317         (RtlEqualPrefixSid): Declare.
4318         (RtlEqualSid): Declare.
4319         (RtlFirstFreeAce): Declare.
4320         (RtlGetAce): Declare.
4321         (RtlGetDaclSecurityDescriptor): Declare.
4322         (RtlGetGroupSecurityDescriptor): Declare.
4323         (RtlGetOwnerSecurityDescriptor): Declare.
4324         (RtlIdentifierAuthoritySid): Declare.
4325         (RtlInitializeSid): Declare.
4326         (RtlLengthSid): Declare.
4327         (RtlQueryRegistryValues): Declare.
4328         (RtlSetControlSecurityDescriptor): Declare.
4329         (RtlSetDaclSecurityDescriptor): Declare.
4330         (RtlSetGroupSecurityDescriptor): Declare.
4331         (RtlSetOwnerSecurityDescriptor): Declare.
4332         (RtlSubAuthorityCountSid): Declare.
4333         (RtlSubAuthoritySid): Declare.
4334         (RtlWriteRegistryValue): Declare.
4335
4336 2011-03-31  Corinna Vinschen  <corinna@vinschen.de>
4337
4338         * uinfo.cc (cygheap_user::init): Don't call GetUserName.  Fetch username
4339         from Windows environment instead.  Explain why.
4340         (cygheap_user::env_domain): Use MAX_DOMAIN_NAME_LEN rather than DNLEN
4341         to specify the size of the domain name buffer.
4342
4343 2011-03-30  Corinna Vinschen  <corinna@vinschen.de>
4344
4345         * hires.h: Fix copyright.
4346         * times.cc: Ditto.
4347         (FACTOR): Add comment.
4348         (NSPERSEC): Ditto.
4349         (JITTER): New definition.  Comment.
4350         (systime_ns): Avoid gratuitous copying of the value returned by
4351         GetSystemTimeAsFileTime.
4352         (corelocaltime, localtime, gmtime): Remove very old, unused code block.
4353         (cygwin_tzset): Remove.
4354         (hires_ms::timeGetTime_ns): Add missing semicolon in comment.
4355         (hires_ms::nsecs): Redefine check for difference between internal
4356         timer value and system time.
4357
4358 2011-03-30  Corinna Vinschen  <corinna@vinschen.de>
4359
4360         * times.cc (hires_ms::resolution): Make sure resolution is never 0.
4361         (clock_setres): Ditto.
4362
4363 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4364
4365         * cygtls.h (struct _local_storage): Redefine process_ident as wchar_t
4366         pointer.
4367         * syslog.cc (CYGWIN_LOG_NAME): Convert to wide char constant.
4368         (openlog): Convert incoming ident string to wide char.  Fix formatting.
4369         (vsyslog): Print ident string as wide char string.  Convert message
4370         string to wide char and call UNICODE Win32 Event functions to make sure
4371         to use correct codeset.
4372         * tlsoffset.h: Regenerate.
4373
4374 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4375
4376         * fhandler_socket.cc (get_inet_addr): Make externally available.
4377         * autoload.cc (GetUdpTable): Define.
4378         * syslog.cc (connect_syslogd): Use get_inet_addr rather than _stat64
4379         to check for local socket file.  Create socket with type returned by
4380         get_inet_addr.  If connect on UDP socket works, test if there's
4381         really a listening peer, otherwise fall back to Windows event log.
4382         (try_connect_syslogd): Use syslogd_inited flag to check if syslogd
4383         is available.
4384
4385 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4386
4387         * uinfo.cc (cygheap_user::env_domain): Use LookupAccountSidW and
4388         convert user and domain to multibyte strings to make sure to use
4389         correct codeset.
4390
4391 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4392
4393         * autoload.cc (UuidCreate): Remove.
4394         (UuidCreateSequential): Remove.
4395         * passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler
4396         error with gcc 4.5.1.
4397         * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Ditto.
4398         * ntdll.h (NtAllocateUuids): Declare.
4399         * syscalls.cc (gethostid): Use NtAllocateUuids function rather than
4400         UuidCreateSequential/UuidCreate to get rid of rpcrt4 dependency.
4401
4402 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4403
4404         * cygwin.din (pthread_spin_destroy): Export.
4405         (pthread_spin_init): Export.
4406         (pthread_spin_lock): Export.
4407         (pthread_spin_trylock): Export.
4408         (pthread_spin_unlock): Export.
4409         * posix.sgml (std-susv4): Add pthread_spin_destroy, pthread_spin_init,
4410         pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock.
4411         (std-notimpl): Remove pthread_spin_[...].
4412         * pthread.cc (pthread_spin_init): New function.
4413         * thread.cc (pthread_spinlock::is_good_object): New function.
4414         (pthread_mutex::pthread_mutex): Rearrange initializers to accommodate
4415         protected data in pthread_mutex.
4416         (pthread_spinlock::pthread_spinlock): New constructor.
4417         (pthread_spinlock::lock): New method.
4418         (pthread_spinlock::unlock): New method.
4419         (pthread_spinlock::init): New method.
4420         (pthread_spin_lock): New function.
4421         (pthread_spin_trylock): New function.
4422         (pthread_spin_unlock): New function.
4423         (pthread_spin_destroy): New function.
4424         * thread.h (PTHREAD_SPINLOCK_MAGIC): Define.
4425         (class pthread_mutex): Change access level of members shared with
4426         derived classes to protected.
4427         (pthread_mutex::set_shared): New protected method.
4428         (class pthread_spinlock): New class, derived class of pthread_mutex.
4429         * include/pthread.h (pthread_spin_destroy): Declare.
4430         (pthread_spin_init): Declare.
4431         (pthread_spin_lock): Declare.
4432         (pthread_spin_trylock): Declare.
4433         (pthread_spin_unlock): Declare.
4434         * include/cygwin/types.h (pthread_spinlock_t): New typedef.
4435         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
4436
4437 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4438
4439         * net.cc (SIO_BASE_HANDLE): Define.
4440         (fdsock): If we got an LSP handle, try to create a copy of the base
4441         handle instead.  Change comment to explain.
4442
4443 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4444
4445         * include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 10.
4446
4447 2011-03-29  Corinna Vinschen  <corinna@vinschen.de>
4448
4449         * autoload.cc (winmm): Remove time functions.  Don't treat
4450         unloadable wave functions as fatal.
4451         * hires.h (hires_ms::timeGetTime_ns): New private method.
4452         (hires_ms::dmsecs): Call timeGetTime_ns here.
4453         * ntdll.h (struct _KSYSTEM_TIME): Define.
4454         (KUSER_SHARED_DATA): Redefine to allow access to InterruptTime.
4455         (SharedUserData): Define here.
4456         (NtQueryTimerResolution): Declare.
4457         (NtSetTimerResolution): Declare.
4458         * path.cc (SharedUserData): Move to ntdll.h.
4459         * times.cc (hires_ms::timeGetTime_ns): New private method.
4460         Use throughout instead of timeGetTime.  Document entire functionality
4461         of timeGetTime in case we need it.
4462         (hires_ms::resolution): Try a call to NtQueryTimerResolution
4463         to fetch current period.  Fall back to heuristic if that fails.
4464         Cast to DWORD in assignments to minperiod.
4465         (clock_setres): Align period to possible values per a call to
4466         NtQueryTimerResolution.  Explain why.  Replace calls to timeBeginPeriod
4467         and timeEndPeriod with underlying call to NtSetTimerResolution.  Use
4468         status code from NtSetTimerResolution to compute errno.
4469         Convert period to ULONGLONG and store 100ns value to simplify code.
4470
4471 2011-03-29  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4472             Corinna Vinschen  <corinna@vinschen.de>
4473
4474         * include/sys/xattr.h: New file.
4475
4476 2011-03-28  Jon TURNEY  <jon.turney@dronecode.org.uk>
4477
4478         * thread.cc (semaphore::init, destroy, close): Standards conformance
4479         fix.  On a failure, return -1 and set errno.
4480         * thread.h (semaphore::terminate): Save errno since semaphore::close()
4481         may now modify it.
4482
4483 2011-03-27  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4484
4485         * cygwin.din (strchrnul): Export.
4486         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
4487         * posix.sgml (std-gnu): Add strchrnul.
4488
4489 2011-03-27  Christopher Faylor  <me.cygwin2011@cgf.cx>
4490
4491         * dll_init.cc (dll::init): Accommodate ill-behaved dlls who don't fill
4492         out p.envptr.
4493
4494 2011-03-25  Corinna Vinschen  <corinna@vinschen.de>
4495
4496         * mmap.cc (mmap64): Add a cheat to let a certain autoconf test succeed
4497         on 64 bit systems.  Explain why.
4498
4499 2011-03-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
4500
4501         * wincap.cc (wincap_2003): Set use_dont_resolve_hack to true.
4502
4503 2011-03-23  Christopher Faylor  <me.cygwin2011@cgf.cx>
4504
4505         * autoload.cc (dll_load): Change error message to make it clear if a
4506         newer DLL is being run.
4507
4508 2011-03-20  Corinna Vinschen  <corinna@vinschen.de>
4509
4510         * fenv.cc (_feinitialise): Don't use SSE instructions on systems not
4511         supporting them.
4512         * wincap.h (wincaps::supports_sse): New element.
4513         * wincap.cc: Implement above element throughout.
4514
4515 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
4516
4517         * cygwin.sc: Raise default cygheap size to 2 Megs.
4518
4519 2011-03-18  Christopher Faylor  <me.cygwin2011@cgf.cx>
4520
4521         * fhandler.h (DEFAULT_PIPEBUFSIZE): Reset to 64K.
4522
4523 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
4524
4525         * mmap.cc (mmap_record::alloc_fh): Initialize name strings in fdev to
4526         empty strings or suffer a SEGV.  Drop second parameter in call to
4527         build_fh_dev.
4528
4529 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
4530
4531         * mmap.cc (class mmap_record): Pack 4 byte-aligned.  Convert member dev
4532         to plain int.
4533         (mmap_record::alloc_fh): Create temporary device from dev and use in
4534         call to build_fh_dev.
4535
4536 2011-03-18  Corinna Vinschen  <corinna@vinschen.de>
4537
4538         * mmap.cc (mmap_record::page_map): Define as variable array rather than
4539         as pointer.
4540         (mmap_record::alloc_page_map): Remove.
4541         (mmap_record::free_page_map): Remove.
4542         (mmap_record::init_page_map): New method.
4543         (mmap_record::add_record): Take mmap_record parameter by reference
4544         rather than by value.
4545         (mmap_record::map_pages): Fix comment.
4546         (mmap_list::add_record): Allocate space for mmap_record including the
4547         page_map in a single ccalloc call.  Call init_page_map afterwards.
4548         (mmap_list::del_record): Remove call to mmap_record::free_page_map.
4549
4550 2011-03-16  Corinna Vinschen  <corinna@vinschen.de>
4551
4552         * crt0.c (mainCRTStartup): Move call to _feinitialise from here...
4553         * dcrt0.cc (_dll_crt0): ...to here.
4554
4555 2011-03-16  Corinna Vinschen  <corinna@vinschen.de>
4556
4557         * winver.rc: Fix copyright dates.
4558
4559 2011-03-14  Corinna Vinschen  <corinna@vinschen.de>
4560
4561         * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Only use
4562         file id as inode number if it masters the isgood_inode check.
4563
4564 2011-03-13  Christopher Faylor  <me.cygwin2011@cgf.cx>
4565
4566         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove
4567         special treatment for ERROR_NO_SYSTEM_RESOURCES.  Cancel I/O and reset
4568         the overlapped handle on error.
4569         (fhandler_base_overlapped::write_overlapped): Limit writes to
4570         max_atomic_write bytes in blocking case.  Incorporate code from
4571         now-defunct write_overlapped_fallback.  Fix serious oversight where ptr
4572         was not advanced as buffer was written.
4573         (fhandler_base_overlapped::write_overlapped_fallback): Eliminate.
4574         * fhandler.h (fhandler_base_overlapped::write_overlapped_fallback):
4575         Ditto for declaration.
4576         (DEFAULT_PIPEBUFSIZE): Lower size to slightly less than documented
4577         worst-case atomic write size.
4578         (fhandler_overlapped::wait_return): Remove unused element.
4579
4580 2011-03-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
4581
4582         * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Handle
4583         overlapped_fallback error condition like other error conditions.  Set
4584         res carefully and specifically for each condition rather than resorting
4585         to a default.
4586         (fhandler_base_overlapped::write_overlapped): Preserve errno in
4587         overlapped_fallback condition.  Correct write_overlapped_fallback to
4588         avoid inappropriate looping.
4589         (fhandler_base_overlapped::write_overlapped_fallback): Add some more
4590         comments.
4591
4592 2011-03-09  Christopher Faylor  <me.cygwin2011@cgf.cx>
4593
4594         * fhandler.cc (fhandler_base_overlapped::write_overlapp): Oops!
4595         Accommodate change in arguments to wait_overlapped.
4596
4597 2011-03-09  Christopher Faylor  <me+cygwin@cgf.cx>
4598
4599         * errno.cc (errmap): Change mapping of NO_SYSTEM_RESOURCES to EFBIG.
4600         * fhandler.cc (MAX_OVERLAPPED_WRITE_LEN): New constant.
4601         (MIN_OVERLAPPED_WRITE_LEN): Ditto.
4602         (fhandler_base_overlapped::close): Accommodate change in arguments to
4603         wait_overlapped.
4604         (fhandler_base_overlapped::setup_overlapped): Add __stdcall and regparm
4605         modifiers.
4606         (fhandler_base_overlapped::destroy_overlapped): Ditto.
4607         (fhandler_base_overlapped::has_ongoing_io): Ditto.
4608         (fhandler_base_overlapped::wait_overlapped): Modify to return an enum
4609         returning various states.  Accept nonblocking parameter.
4610         (fhandler_base_overlapped::read_overlapped): Add __stdcall and regparm
4611         modifiers.  Rework to attempt to be smarter about reacting to states
4612         returned by wait_overlapped.
4613         (fhandler_base_overlapped::write_overlapped): Ditto.  Add fallback
4614         option for when wait_overlapped detects that smaller chunks must be
4615         written.
4616         (fhandler_base_overlapped::write_overlapped_fallback): Ditto.
4617         * fhandler.h (DEFAULT_PIPEBUFSIZE): Move definition here from pipe.cc.
4618         (fhandler_base::has_ongoing_io): Define with __stdcall and regparm
4619         modifiers.
4620         (fhandler_base_overlapped::wait_return): New enum.
4621         (fhandler_base_overlapped::max_atomic_write): New variable.
4622         (fhandler_base_overlapped:: wait_overlapped): Accommodate changes
4623         mentioned above to arguments and modifiers.
4624         (fhandler_base_overlapped::setup_overlapped): Ditto for modifiers.
4625         (fhandler_base_overlapped::read_overlapped): Ditto.
4626         (fhandler_base_overlapped::write_overlapped): Ditto.
4627         (fhandler_base_overlapped::destroy_overlapped): Ditto.
4628         (fhandler_base_overlapped::has_ongoing_io): Ditto.
4629         (fhandler_base_overlapped::fhandler_base_overlapped): Zero
4630         max_atomic_write.
4631         * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Set max_atomic_write
4632         to the size of the DEFAULT_PIPEBUFSIZE.
4633         (fhandler_fifo::wait): Accommodate change in arguments to
4634         wait_overlapped.
4635         * pipe.cc (fhandler_pipe::fhandler_pipe): Set max_atomic_write to the
4636         size of the DEFAULT_PIPEBUFSIZE.
4637         (fhandler_pipe::create_selectable): Allow minimum size of DEFAULT_PIPEBUFSIZE.
4638         (DEFAULT_PIPEBUFSIZE): Delete here, move to fhandler.h.
4639
4640 2011-03-08  Corinna Vinschen  <corinna@vinschen.de>
4641
4642         * security.cc: Fix copyright dates.
4643
4644 2011-03-08  Corinna Vinschen  <corinna@vinschen.de>
4645
4646         * fhandler.cc (fhandler_base::open): When creating a file on a
4647         filesystem supporting ACLs, create the file with WRITE_DAC access.
4648         Explain why.
4649         * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
4650         directories.
4651         * fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
4652         * path.cc (symlink_worker): Ditto for symlinks.
4653         * security.cc (get_file_sd): Always call GetSecurityInfo for directories
4654         on XP and Server 2003.  Improve comment to explain why.
4655         (set_file_attribute): Explicitely cast mode_t value to bool in call to
4656         get_file_sd.
4657         * wincap.h (wincaps::use_get_sec_info_on_dirs): New element.
4658         * wincap.cc: Implement above element throughout.
4659
4660 2011-03-04  Corinna Vinschen  <corinna@vinschen.de>
4661
4662         * fhandler_procsys.cc (fhandler_procsys::exists): Rewrite.
4663         (fhandler_procsys::fill_filebuf): Fill buffer with valid string even if
4664         reading the symlink fails.
4665
4666 2011-03-03  Corinna Vinschen  <corinna@vinschen.de>
4667
4668         * posix_ipc.cc (ipc_cond_timedwait): If ipc_mutex_unlock fails, return
4669         actual error number.
4670         (_mq_send): Break loop if ipc_cond_timedwait returns with error.
4671         (_mq_receive): Ditto.
4672
4673 2011-03-03  Corinna Vinschen  <corinna@vinschen.de>
4674
4675         * errno.cc (__xpg_strerror_r): Add accidentally missing condition.
4676
4677 2011-03-02  Corinna Vinschen  <corinna@vinschen.de>
4678
4679         * fhandler_procsys.cc (fhandler_procsys::open): Call worker exists
4680         method, rather than wrapper.
4681
4682 2011-03-01  Christopher Faylor  <me+cygwin@cgf.cx>
4683
4684         * autoload.cc (dll_load): Avoid in_forkee test since this apparently
4685         fails even when not forked.
4686
4687 2011-03-01  Christopher Faylor  <me+cygwin@cgf.cx>
4688
4689         * include/cygwin/version.h: Bump CYGWIN_VERSION_DLL_MINOR to 9.
4690
4691 2011-02-28  Christopher Faylor  <me+cygwin@cgf.cx>
4692
4693         * autoload.cc (dll_load): Only perform DONT_RESOLVE_DLL_REFERENCES hack
4694         on systems which need it.
4695         * wincap.cc (use_dont_resolve_hack): Set as appropriate.
4696         * wincap.h (use_dont_resolve_hack): Define.
4697
4698 2011-02-28  Christopher Faylor  <me+cygwin@cgf.cx>
4699
4700         * autoload.cc (dll_load): Make inline.  Clarify logic.
4701
4702 2011-02-27  Corinna Vinschen  <corinna@vinschen.de>
4703
4704         * autoload.cc (dll_load): Only call LoadLibraryExW with
4705         DONT_RESOLVE_DLL_REFERENCES if a normal LoadLibrary call failed with
4706         ERROR_INVALID_ADDRESS.
4707         (LsaRegisterLogonProcess): Align comment to previous change.
4708
4709 2011-02-26  Christopher Faylor  <me+cygwin@cgf.cx>
4710
4711         * autoload.cc: Use LoadDLLfuncEx3 for all winmm functions.  Accommodate
4712         changes to LoadDLLprime.
4713         (LoadDLLprime): Take an extra argument indicating whether this dll
4714         needs special handling on fork.  Place this information in the "handle"
4715         location.
4716         (LoadDLLfuncEx3): Eliminate "func" handling.  Pass new
4717         no_resolve_on_fork argument to LoadDLLprime.
4718         (dll_load): New function.
4719         (std_dll_init): Accommodate changes to dll_info::handle.  Use dll_load
4720         to load DLL in both cases where it is used.
4721
4722 2011-02-26  Corinna Vinschen  <corinna@vinschen.de>
4723
4724         * autoload.cc: Make autoloaded ntdll function non-optional.  Ditto for
4725         secur32 functions, except for LsaRegisterLogonProcess.  Change return
4726         value to ERROR_PROC_NOT_FOUND.  Explain why.
4727         * sec_auth.cc (lsaauth): Handle ERROR_PROC_NOT_FOUND from call to
4728         LsaRegisterLogonProcess when generating the errno value.
4729
4730 2011-02-22  Corinna Vinschen  <corinna@vinschen.de>
4731
4732         * dcrt0.cc: Fix copyright dates.
4733         * winsup.h: Ditto.
4734         * syscalls.cc (_read): Move EXPORT_ALIAS to its rightful place.
4735
4736 2011-02-21  Christopher Faylor  <me+cygwin@cgf.cx>
4737
4738         * cygwin.din: Mark __assert* and _abort as NOSIGFE.
4739
4740 2011-02-21  Corinna Vinschen  <corinna@vinschen.de>
4741
4742         * fhandler_socket (fhandler_socket::readv): Call recv_internal directly,
4743         rather than recvmsg.
4744         (fhandler_socket::writev): Call send_internal directly, rather than
4745         sendmsg.
4746         * net.cc (cygwin_recv): Call fhandler_socket::recvfrom directly, rather
4747         than cygwin_recvfrom.
4748         (cygwin_send): Call fhandler_socket::sendto directly, rather than
4749         cygwin_sendto.
4750
4751 2011-02-20  Christopher Faylor  <me+cygwin@cgf.cx>
4752
4753         * fhandler.cc (fhandler_base_overlapped::close): Finish any pending I/O
4754         before closing.
4755         (fhandler_base_overlapped::wait_overlapped): Defensively zero bytes
4756         read.  Add more info to debugging output.
4757
4758 2011-02-18  Christopher Faylor  <me+cygwin@cgf.cx>
4759
4760         * dcrt0.cc (dll_crt0_1): Add a CYGHEAP_DEBUG conditional for debugging
4761         which allocates a lot of space at startup.
4762
4763 2011-02-18  Corinna Vinschen  <corinna@vinschen.de>
4764
4765         * cygwin.sc: Set alignment of .cygheap section to 64K.
4766
4767 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4768
4769         * spawn.cc (spawn_guts): Only set PID_NOTCYGWIN in _P_OVERLAY mode.
4770         Drop flag if creating new process failed.
4771
4772 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4773
4774         * Throughout fix copyright dates.
4775
4776 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4777
4778         * devices.in: Throughout use slashes instead of backslashes in the
4779         native path of devices not backed by native NT devices.
4780         * devices.cc: Regenerate.
4781         * globals.cc (ro_u_pmem): Use correct case.
4782         (ro_u_globalroot): New R/O unicode string.
4783         * path.cc (path_conv::check): Fix incorrect handling of /proc/sys
4784         block devices if they are just visited due to a component check.
4785         (symlink_info::posixify): Fix typo in comment.
4786         (cygwin_conv_path): Use ro_u_globalroot instead of string constant.
4787         (fast_cwd_version): New shared variable to store FAST_CWD version
4788         used on the system.
4789         (find_fast_cwd_pointer): Rename from find_fast_cwd_pointers.  Don't
4790         set global fast_cwd_ptr pointer here.  Return pointer value instead.
4791         (find_fast_cwd): New function to set fast_cwd_ptr and fast_cwd_version.
4792         (cwdstuff::override_win32_cwd): Call find_fast_cwd from here.
4793         Check for fast_cwd_version to differ between old and new FAST_CWD
4794         structure.  Check old_cwd for NULL to avoid SEGV.  Don't set CWD if
4795         we have neitehr a valid fast_cwd_ptr, nor a valid CWD handle in the
4796         process parameter block.
4797         (cwdstuff::set): Create Win32 path taking /proc/sys paths into account.
4798         * spawn.cc (spawn_guts): Recode creating runpath.  Also take /proc/sys
4799         paths into account.  Drop special CWD handling when starting non-Cygwin
4800         processes.
4801
4802 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4803
4804         * fhandler_procsys.cc (fhandler_procsys::opendir): Avoid SEGV if
4805         opening object directory fails.
4806         * fhandler_virtual.cc (fhandler_virtual::opendir): Don't leak memory.
4807
4808 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4809
4810         * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Don't
4811         append slash if there is one already.
4812
4813 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4814
4815         Revert change from 2010-08-31:
4816         * path.cc (normalize_posix_path): Drop support for //./ and //?/
4817         prefixes.
4818         (path_conv::check): Ditto.
4819
4820 2011-02-15  Corinna Vinschen  <corinna@vinschen.de>
4821
4822         * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Use POSIX
4823         path to check for symlink.
4824
4825 2011-02-14  Corinna Vinschen  <corinna@vinschen.de>
4826
4827         * config/i386/profile.h: Sync with Mingw.
4828
4829 2011-02-13  Corinna Vinschen  <corinna@vinschen.de>
4830
4831         * path.cc (struct _FAST_CWD): Redefine to new layout used since patch
4832         for KB 2393802.  Adjust comments throughout.
4833         (struct _FAST_CWD_OLD): Rename former definition.
4834         (cwdstuff::override_win32_cwd): Check if the OS is using the old or the
4835         new FAST_CWD structure layout and handle accordingly.
4836
4837 2011-02-11  Christopher Faylor  <me+cygwin@cgf.cx>
4838
4839         * mkstatic: Make sure that we are not cd'ed to temporary directory on
4840         exit to avoid bogus warnings on directory cleanup.
4841         * speclib: Ditto.
4842         * mkimport: Ditto.
4843
4844 2011-02-11  Christopher Faylor  <me+cygwin@cgf.cx>
4845
4846         * cygwin.sc: Eliminate __cygheap_mid.
4847         * cygheap.cc: Ditto.
4848
4849 2011-02-11  Christopher Faylor  <me+cygwin@cgf.cx>
4850
4851         * cygheap.cc (_cygheap_mid): Drop unneeded section attribute.
4852         (cygheap_init): Just zero cygheap structure.
4853         * cygwin.sc: Keep 16 byte alignment but drop all other alignments
4854         related to cygheap.  Eliminate unused __cygheap_end1.
4855
4856 2011-02-11  Corinna Vinschen  <corinna@vinschen.de>
4857
4858         * cygwin.sc: Raise default cygheap size to 1 Meg.  Set alignment to
4859         standard 64K.
4860
4861 2011-02-11  Corinna Vinschen  <corinna@vinschen.de>
4862
4863         * include/endian.h: Move definitions of __BIG_ENDIAN, __LITTLE_ENDIAN,
4864         and __BYTE_ORDER into ...
4865         * include/bits/endian.h: New file.
4866         * include/arpa/nameser_compat.h: Include endian.h rather than defining
4867         BYTE_ORDER here.
4868         * include/asm/byteorder.h: Include bits/endian.h.  Drop definition of
4869         __LITTLE_ENDIAN.
4870         * include/netinet/ip.h: Include bits/endian.h.  Drop definitions of
4871         BIG_ENDIAN, LITTLE_ENDIAN, and BYTE_ORDER.  Use underscored variants
4872         of aforementioned constants.
4873         * include/netinet/tcp.h: Ditto.
4874         * include/sys/param.h: Drop disabled definitions of BIG_ENDIAN,
4875         LITTLE_ENDIAN, and BYTE_ORDER.
4876
4877         * include/netinet/ip.h: Reformat.  Define setsockopt IP_TOS options
4878         matching recent RFCs.  Tweak comments.
4879
4880 2011-02-10  Eric Blake  <eblake@redhat.com>
4881
4882         * errno.cc (includes): Avoid compilation failure if <string.h>
4883         settles on wrong strerror_r signature.
4884
4885         * errno.cc (__xpg_strerror_r): New function.
4886         (strerror_r): Update to copy newlib's fixes.
4887         (strerror): Set errno on failure.
4888         (_sys_errlist): Cause EINVAL failure for reserved values.
4889         * cygwin.din: Export new function.
4890         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Combine
4891         this into minor 236.
4892
4893 2011-02-09  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
4894
4895         * cygwin.din (pthread_yield): Export as alias to sched_yield.
4896         * include/pthread.h (pthread_yield): Declare.
4897         * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
4898         * posix.sgml (std-deprec): Add pthread_yield.
4899
4900 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
4901
4902         * cygheap.cc: Add some __stdcall decoration where appropriate.
4903         * lib/cygwin_crt0.c: __attribute -> __attribute__.
4904
4905 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
4906
4907         * hookapi.cc (hook_or_detect_cygwin): Prevent i from being considered
4908         uninitialized by gcc.
4909
4910 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
4911
4912         * exception.h: Remove DEBUG_EXCEPTION left over debugging ifdef.
4913
4914 2011-02-08  Christopher Faylor  <me+cygwin@cgf.cx>
4915
4916         * dll_init.cc: Fix typo in comment.
4917
4918 2011-02-07  Corinna Vinschen  <corinna@vinschen.de>
4919
4920         * configure.in: Remove AC_ALLOCA test and test for __builtin_memset.
4921         * configure: Regenerate.
4922
4923 2011-02-07  Corinna Vinschen  <corinna@vinschen.de>
4924
4925         * fhandler_console.cc (fhandler_console::write_normal): Remove
4926         erroneous premature return after collecting truncated multibyte
4927         sequence in trunc_buf.  Rather fall through to printing routine.
4928         Fix return value to take trunc_buf content into account.  Improve
4929         comments.
4930
4931 2011-02-05  Christopher Faylor  <me+cygwin@cgf.cx>
4932
4933         * autoload.cc (wsock_init): Properly define WSAStartup function pointer
4934         to avoid stack damage.
4935
4936 2011-02-02  Corinna Vinschen  <corinna@vinschen.de>
4937
4938         * libc/bsdlib.cc: Include err.h.
4939
4940 2011-02-02  Eric Blake  <eblake@redhat.com>
4941
4942         * include/err.h: Fix loss of semicolons in previous patch.
4943
4944 2011-02-02  Corinna Vinschen  <corinna@vinschen.de>
4945
4946         * include/err.h (err): Add noreturn attribute.
4947         (errx): Ditto.
4948         (verr): Ditto.
4949         (verrx): Ditto.
4950
4951 2011-02-02  Corinna Vinschen  <corinna@vinschen.de>
4952
4953         * path.cc (conv_path_list): Remove enclosing quotes and trailing
4954         backslashes from Win32 environment path lists.
4955
4956 2011-02-01  Christian Franke  <franke@computer.org>
4957
4958         * fhandler.cc (fhandler_base::fsync): Ignore ERROR_INVALID_FUNCTION
4959         error from FlushFileBuffers().
4960
4961 2011-01-31  Corinna Vinschen  <corinna@vinschen.de>
4962
4963         * syscalls.cc (utmp_data): Fix potential buffer overflow.
4964
4965 2011-01-31  Corinna Vinschen  <corinna@vinschen.de>
4966
4967         * fhandler_socket.cc (address_in_use): Improve comment readability.
4968
4969 2011-01-30  Corinna Vinschen  <corinna@vinschen.de>
4970
4971         * fhandler_socket.cc (address_in_use): Disable.  Add comment.
4972         (fhandler_socket::bind): Change comment to explain setting the
4973         SO_EXCLUSIVEADDRUSE socket option.  Remove code which checks for
4974         address in use.
4975         * net.cc (cygwin_setsockopt): Never set SO_REUSEADDR option.  Improve
4976         comment to compensate for the deleted comment in fhandler_socket::bind.
4977         * wincap.cc: Throughout, drop has_enhanced_socket_security from wincaps.
4978         * wincap.h (struct wincaps): Drop has_enhanced_socket_security flags
4979         and method.
4980
4981 2011-01-28 Peter Foley <jpfoley2@verizon.net>
4982
4983         * configure.in: Define LIBSERVER regardless of cross_host.
4984         * configure: Regenerate.
4985
4986 2011-01-28  Corinna Vinschen  <corinna@vinschen.de>
4987
4988         * fhandler_socket.cc (fhandler_socket::wait_for_events): Call
4989         pthread_testcancel in case of timeout to enable pthread_cancel
4990         on waiting thread.
4991
4992 2011-01-27  Corinna Vinschen  <corinna@vinschen.de>
4993
4994         * include/features.h (__STDC_ISO_10646__): Move to newlib's
4995         sys/features.h.
4996
4997 2011-01-26  Corinna Vinschen  <corinna@vinschen.de>
4998
4999         * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Fix
5000         computation of st_blocks.
5001         (fhandler_base::fstat_helper): Fix formatting.
5002
5003 2011-01-24  Corinna Vinschen  <corinna@vinschen.de>
5004
5005         * include/features.h (__STDC_ISO_10646__): Define.  Add comment.
5006
5007 2011-01-21  Corinna Vinschen  <corinna@vinschen.de>
5008
5009         * syscalls.cc (rename): Fix permission problem with symlinks on NFS.
5010         Rework how NtOpenFile gets called to make it more readable.  Change
5011         comment.
5012
5013 2011-01-20  Corinna Vinschen  <corinna@vinschen.de>
5014
5015         * exec.cc: Include pinfo.h.
5016         * winf.h: Move definitions of _P_PATH_TYPE_EXEC and _P_MODE from here...
5017         * pinfo.h: ...to here.
5018         (_P_PATH_TYPE_EXEC): Redefine to be bigger than _P_SYSTEM.
5019         (_P_MODE): Redefine so as not to mask out _P_SYSTEM.
5020         * spawn.cc (spawnlp): Add _P_PATH_TYPE_EXEC flag in call to spawnve.
5021         (spawnlpe): Ditto.
5022         (spawnvp): Ditto.
5023
5024 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
5025
5026         * spawn.cc (av::fixup): Reenable #! handling for all exec functions.
5027         Return ENOEXEC in !p_type_exec case only for unrecognized files.
5028         Fix comment formatting.
5029
5030 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
5031
5032         * exec.cc (execlp): Add missing _P_PATH_TYPE_EXEC flag in call to
5033         spawnve.
5034
5035 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
5036
5037         * exec.cc: Rearrange functions in alphabetical order.
5038         (_execve): Drop temporary define and drop export alias.
5039         (execl): Call spawnve.
5040         (execle): New function.
5041         (execlp): New function.
5042         (execv): Call spawnve.
5043         (execve): Drop converting NULL envp to emtpy envp.
5044         (execvp): Call spawnve.
5045         (execvpe): Drop converting NULL envp to emtpy envp.  Call spawnve.
5046         (fexecve): Call spawnve.
5047         * spawn.cc (spawnve): Convert NULL envp to emtpy envp.  Remove outdated
5048         comment.
5049         (spawnlp): Call spawnve.
5050         (spawnlpe): Ditto.
5051         (spawnvp): Ditto.
5052         (spawnvpe): Fix formatting.
5053
5054 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
5055
5056         * exec.cc (strccpy): Move function from here...
5057         * strfuncs.cc (strccpy): ...to here.
5058         * string.h (strccpy): Declare.
5059         * winsup.h (strccpy): Drop declaration.
5060
5061 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
5062
5063         * errno.cc (errmap): Add error codes for invalid binaries.
5064         * exec.cc (execvp): Call spawnve with _P_PATH_TYPE_EXEC flag
5065         from here.
5066         (execvpe): Ditto.
5067         * spawn.cc (spawn_guts): Filter _P_PATH_TYPE_EXEC from mode and
5068         store in p_type_exec.  Call av::fixup with addtional p_type_exec
5069         argument.
5070         (spawnve): Check for filtered mode.
5071         (spawnvpe): Add _P_PATH_TYPE_EXEC flag when calling spawnve.
5072         (av::fixup): Accept additional bool parameter p_type_exec.  Only check
5073         for script if p_type_exec is true.
5074         * winf.h (_P_PATH_TYPE_EXEC): Define.
5075         (_P_MODE): Define.
5076         (av::fixup): Declare with additional bool parameter.
5077
5078 2011-01-17  Corinna Vinschen  <corinna@vinschen.de>
5079
5080         * fhandler_proc.cc (format_proc_partitions): Fix compiler warning.
5081
5082 2011-01-17  Corinna Vinschen  <corinna@vinschen.de>
5083
5084         * path.cc (path_conv::check): Don't follow reparse point symlinks if
5085         PC_SYM_NOFOLLOW_REP flag is set.
5086         (cygwin_conv_path): Set PC_SYM_NOFOLLOW_REP flag when converting from
5087         POSIX to Win32.
5088         * path.h (enum pathconv_arg): Define PC_SYM_NOFOLLOW_REP flag.
5089
5090 2011-01-17  Corinna Vinschen  <corinna@vinschen.de>
5091
5092         * fhandler_proc.cc (proc_tab_cmp): Fix typo in comment.
5093         (fhandler_proc::fill_filebuf): Handle return value of 0 from format
5094         function as error.
5095         (format_proc_stat): Set errno when returning 0 size.
5096         (format_proc_partitions): Rewrite method to fetch partition info.
5097
5098 2011-01-13  Corinna Vinschen  <corinna@vinschen.de>
5099
5100         * fhandler_disk_file.cc (fhandler_base::fstat_helper): Always set
5101         st_size of directories to 0.  Explain why.
5102
5103 2011-01-12  Corinna Vinschen  <corinna@vinschen.de>
5104
5105         * posix.sgml: Add madvise to BSD list.
5106
5107 2011-01-12  Corinna Vinschen  <corinna@vinschen.de>
5108
5109         * cygwin.din (madvise): Export posix_madvise as madvise.
5110         * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR.
5111         * include/sys/mman.h: Define madvise constants, keep Linux-specific
5112         constants undefined.
5113         (madvise): Declare.
5114
5115 2011-01-12  Corinna Vinschen  <corinna@vinschen.de>
5116
5117         * fhandler.h (struct part_t): New type.
5118         (class fhandler_dev_floppy): Convert partitions to part_t pointer.
5119         Add lock_partition method.
5120         * fhandler_floppy.cc (fhandler_dev_floppy::lock_partition): New method
5121         to implement ondemand partition locking.
5122         (fhandler_dev_floppy::write_file): Call lock_partition from here if
5123         writing failed due to a potential write restriction on a disk
5124         partition.
5125         (fhandler_dev_floppy::open): Don't lock partitions here.
5126         (fhandler_dev_floppy::close): Keep track of partition handle reference
5127         count.  Close handles and remove partitions pointer ony if count is 0.
5128         (fhandler_dev_floppy::dup): Just copy partitions pointer and increment
5129         reference count.
5130
5131 2011-01-11  Corinna Vinschen  <corinna@vinschen.de>
5132
5133         * fhandler.h (MAX_PARTITIONS): New definition.
5134         (class fhandler_dev_floppy): Add partitions array member.  Add close
5135         method.
5136         * fhandler_floppy.cc (fhandler_dev_floppy::fhandler_dev_floppy): Zero
5137         out partitions array.
5138         (fhandler_dev_floppy::open): Fix "entire disk" condition for call to
5139         DeviceIoControl (FSCTL_ALLOW_EXTENDED_DASD_IO).
5140         When opening disks for writing, call DeviceIoControl (FSCTL_LOCK_VOLUME)
5141         on all affected disk partitions starting with Vista.
5142         (fhandler_dev_floppy::close): New method.
5143         (fhandler_dev_floppy::dup): Duplicate handles in partitions, if any.
5144         * wincap.h (wincaps::has_restricted_raw_disk_access): New element.
5145         * wincap.cc: Implement above element throughout.
5146
5147 2011-01-11  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>
5148
5149         * termios.cc (cfgetospeed, cfgetispeed): Constify argument per POSIX.
5150         * include/sys/termios.h (cfgetospeed, cfgetispeed): Declare functions.
5151         Move macros after declarations and make conditional on !__cplusplus.
5152
5153 2011-01-11  Corinna Vinschen  <corinna@vinschen.de>
5154
5155         * cygtls.cc (_cygtls::init_thread): Call _REENT_INIT_PTR.  Drop setting
5156         current locale and calling srand48.
5157
5158 2011-01-02  Christopher Faylor  <me+cygwin@cgf.cx>
5159
5160         * ChangeLog-2010: Create from ChangeLog.
5161         * ChangeLog: Start fresh.