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