OSDN Git Service

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