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