OSDN Git Service

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