OSDN Git Service

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