1 2003-01-03 Christopher Faylor <cgf@redhat.com>
3 * dtable.h (dtable::in_vfork_cleanup): New function. True if vfork
5 * dtable.cc (dtable::vfork_parent_restore): Remove assertion.
6 * pipe.cc (fhandler_pipe::close): Don't close read_state during
7 fork_fixup since it wasn't inherited.
9 2003-01-01 Christopher Faylor <cgf@redhat.com>
11 * passwd.cc (getpwuid_r32): Revert previous change.
13 2003-01-01 Christopher Faylor <cgf@redhat.com>
15 * sysconf.cc (sysconf): Return arbitrary values for
16 _SC_GETGR_R_SIZE_MAX, _SC_LOGIN_NAME_MAX, _SC_GETPW_R_SIZE_MAX.
18 * passwd.cc (getpwuid_r32): Add uid/gid fields to size check
21 2002-12-30 Christopher Faylor <cgf@redhat.com>
23 * exceptions.cc (events_init): Display name of mutex on failure.
25 2002-12-30 Christopher Faylor <cgf@redhat.com>
27 * windows.cc (setitimer): Return ENOSYS on invalid argument.
29 2002-12-28 Christopher Faylor <cgf@redhat.com>
31 * fhandler_termios.cc (fhandler_termios::line_edit): Perform echo
32 before input is accepted or suffer a "race".
34 2002-12-27 Christopher Faylor <cgf@redhat.com>
36 * fhandler.h (fhandler_tty_master::set_winsize): Declare new function.
37 * fhandler_console.cc (fhandler_console::send_winch_maybe): If
38 appropriate, call tty master function to handle screen size change.
39 * fhandler_tty.cc (fhandler_tty_master::set_winsize): New function.
40 (fhandler_tty_master::init): Call set_winsize to set initial screen
43 2002-12-26 Christopher Faylor <cgf@redhat.com>
45 * fhandler_tty.cc (fhandler_tty_master::init): Set initial size of tty
46 to that of console in which tty is operating.
47 (process_input): Semi-revert previous change. Need to just use current
48 terminfo settings since this function is running in a thread, blocked
49 when the terminfo changes.
51 2002-12-26 Christopher Faylor <cgf@redhat.com>
53 * fhandler.h (fhandler_termios::line_edit): Replace third argument with
54 passed-in termios struct.
55 * fhandler_console.cc (fhandler_console::read): Prior to loop, make a
56 copy of current termios for passing to line_edit prior so that all
57 characters are processed consistently.
58 * fhandler_tty.cc (fhandler_pty_master::write): Ditto.
59 (process_input): Make a copy of curent termios prior to read for use in
61 * fhandler_termios.cc (fhandler_termios::line_edit): Replace third
62 parameter with passed-in termios struct and use it throughout rather
63 than the data from the current fhandler_termios class.
65 2002-12-25 Christopher Faylor <cgf@redhat.com>
67 * include/cygwin/version.h: Bump DLL minor number.
69 2002-12-25 Christopher Faylor <cgf@redhat.com>
71 * exceptions.cc (events_init): Initialize critical section to control
73 (signal_exit): Enter critical section early to avoid exit races with
75 * dcrt0.cc (do_exit): Use exit_lock critical section to avoid races.
77 2002-12-25 Christopher Faylor <cgf@redhat.com>
79 * cygthread.cc (cygthread::detach): Set errno with set_sig_errno so
80 that EINTR is properly restored after signal.
82 2002-12-21 Christopher Faylor <cgf@redhat.com>
84 * Makefile.in: Default fhandler objects to -fomit-frame-pointer.
85 Eliminate redundant CFLAGS settings.
87 2002-12-20 Christopher Faylor <cgf@redhat.com>
89 * fhandler.h (line_edit_status): Reorganize so that tests for error
90 condition can be < or >.
91 * fhandler_tty.cc (fhandler_pty_master::write): Don't return after
94 * fhandler_termios.cc (fhandler_termios::line_edit): Trivial change to
95 use built-in bool types.
97 2002-12-19 Pierre Humblet <pierre.humblet@ieee.org>
99 * localtime.cc (tzsetwall): Set lcl_is_set and lcl_TZname
100 in the Cygwin specific part of the routine.
102 2002-12-19 Pierre Humblet <pierre.humblet@ieee.org>
104 * fhandler.cc (fhandler_base::open): Use "flags" rather than "mode"
105 in Win9X directory code.
107 2002-12-19 Steve Osborn <bub@io.com>
109 * fhandler.h (line_edit_status): Add a new element.
110 * fhandler_termios.cc (fhandler_termios::line_edit): After
111 accept_input, handle both potential error condition and pipe full
113 * fhandler_tty.cc (fhandler_pty_master::accept_input): Return -1 on
115 (fhandler_pty_master::write): Handle pipe full condition.
117 2002-12-16 Steve Osborn <bub@io.com>
118 Christopher Faylor <cgf@redhat.com>
120 * fhandler_termios.cc (fhandler_termios::line_edit): Return
121 line_edit_error and remove last char from readahead buffer if
122 accept_input() fails.
123 * fhandler_tty.cc (fhandler_pty_master::accept_input): Return 0 and
124 restore readahead buffer when tty slave pipe is full.
126 2002-12-16 Christopher Faylor <cgf@redhat.com>
128 * pinfo.cc (_pinfo::cmdline): Allocate sufficient space for myself
131 2002-12-14 Steve Osborn <bub@io.com>
133 * fhandler_termios.cc (fhandler_termios::line_edit): Call
134 accept_input() in character processing loop. Set return value
135 independently of input_done.
137 2002-12-14 Christopher Faylor <cgf@redhat.com>
139 * fhandler.cc (fhandler_base::read): Signal event, if necessary, and
140 raw_read hasn't done so.
142 2002-12-14 Christopher Faylor <cgf@redhat.com>
144 * fhandler.cc (fhandler_base::raw_read): Reset priorities to minimize
145 window where thread termination may cause data loss.
146 (fhandler_base::read): Always return at end of function. Just set len
147 to copied_chars when len is zero. Return immediately after raw_read if
148 len <= 0. Remove in_len setting and just check end instead. Fix CRLF
149 handling at end of buffer.
151 2002-12-14 Corinna Vinschen <corinna@vinschen.de>
153 * dcrt0.cc (dll_crt0_1): Call well known SID initializer function.
154 * security.h (cygsid::init): Declare new static method.
155 * sec_helper.cc (cygsid::init): New method for initializing well
158 2002-12-14 Pierre Humblet <pierre.humblet@ieee.org>
160 * security.h: Declare well_known_creator_group_sid.
161 * sec_helper.cc: Define and initialize well_known_creator_group_sid.
163 2002-12-14 Corinna Vinschen <corinna@vinschen.de>
165 * netdb.cc: Remove strtok_r comment.
167 2002-12-14 Pierre Humblet <pierre.humblet@ieee.org>
169 * security.cc (get_user_local_groups): Use LookupAccountSid to find the
170 local equivalent of BUILTIN.
172 2002-12-14 Christopher Faylor <cgf@redhat.com>
174 * pipe.cc (make_pipe): Set fork fixup flag for read pipe.
176 2002-12-14 Christopher Faylor <cgf@redhat.com>
178 * winbase.h: Turn on inline versions of Interlocked* by default.
180 2002-12-14 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
182 * winbase.h: Fixup inline asm functions. Add ilockcmpexch.
184 2002-12-13 Christopher Faylor <cgf@redhat.com>
186 Throughout, change fhandler_*::read and fhandler_*::raw_read to void
187 functions whose second arguments are both the length and the return
189 * fhandler.cc (fhandler_base::read): Rework slightly to use second
190 argument as input/output. Tweak CRLF stuff.
191 (fhandler_base::readv): Accommodate fhandler_*::read changes.
192 * cygthread.h (cygthread::detach): Declare as taking optional handle
194 (cygthread::detach): When given a handle argument, wait for the handle
195 to be signalled before waiting for thread to detach. Return true when
198 2002-12-12 Corinna Vinschen <corinna@vinschen.de>
200 * Makefile.in: Add MINGW_LDFLAGS when linking cygrun.exe.
202 2002-12-10 Christopher Faylor <cgf@redhat.com>
204 * cygthread.h (cygthread::stack_ptr): New element.
205 (cygthread::detach): Accept a "wait_for_signal" argument.
206 (cygthread::terminate_thread): New function.
207 * cygthread.cc (cygthread::stub): Set stack pointer argument.
208 (cygthread::terminate_thread): New function. Forcibly terminate
210 (cygthread::detach): Optionally wait for signals and kill thread when
212 * exceptions.cc (signal_exit): Set signal_arrived prior to exiting to
213 wake up anything blocking on signals.
214 * fhandler.h (fhandler_base::set_r_no_interrupt): Change to accept bool
216 (fhandler_pipe::ready_for_read): Declare.
217 * pipe.cc (pipeargs): New structure.
218 (read_pipe): New thread stub wrapper for normal pipe read.
219 (fhandler_pipe::read): Modify to call reader in a cygthread,
220 terminating on signal, as appropriate.
221 * select.cc (fhandler_pipe::ready_for_read): Define new function.
223 2002-12-10 Corinna Vinschen <corinna@vinschen.de>
225 * net.cc (free_protoent_ptr): Add missing free() for base structure.
226 (free_servent_pt): Ditto.
227 (free_hostent_pt): Ditto.
229 2002-12-10 Craig McGeachie <slapdau@yahoo.com.au>
231 * netdb.cc (parse_alias_list): Change strtok calls to strtok_r.
232 (parse_services_line): Ditto.
233 (parse_protocol_line): Ditto.
235 2002-12-10 Pierre Humblet <pierre.humblet@ieee.org>
237 * pwdgrp.h (pwdgrp_check::pwdgrp_state): Replace by
238 pwdgrp_check::isinitializing ().
239 (pwdgrp_check::isinitializing): Create.
240 * passwd.cc (grab_int): Change type to unsigned, use strtoul and set
241 the pointer content to 0 if the field is invalid.
242 (parse_pwd): Move validity test after getting pw_gid.
243 (read_etc_passwd): Replace "passwd_state <= " by
244 passwd_state::isinitializing ().
245 (internal_getpwuid): Ditto.
246 (internal_getpwnam): Ditto.
249 * grp.cc (parse_grp): Use strtoul for gr_gid and verify the validity.
250 (read_etc_group): Replace "group_state <= " by
251 group_state::isinitializing ().
252 (internal_getgrgid): Ditto.
254 (internal_getgrent): Ditto.
256 2002-12-10 Pierre Humblet <pierre.humblet@ieee.org>
258 * security.h: Move declarations of internal_getgrent,
259 internal_getpwsid and internal_getgrsid to pwdgrp.h.
260 * pwdgrp.h: Declare internal_getpwsid, internal_getpwnam,
261 internal_getpwuid, internal_getgrsid, internal_getgrgid,
262 internal_getgrnam, internal_getgrent and internal_getgroups.
263 Delete "emulated" from enum pwdgrp_state.
264 (pwdgrp_check::isuninitialized): Create.
265 (pwdgrp_check::pwdgrp_state): Change state to initializing
266 rather than to uninitialized.
267 (pwdgrp_read::gets): Remove trailing CRs.
268 * passwd.cc (grab_string): Don't look for NLs.
270 (parse_pwd): Don't look for CRs. Return 0 if entry is too short.
271 (search_for): Delete.
272 (read_etc_passwd): Simplify tests to actually read the file.
273 Set state to loaded before making internal_getpwXX calls.
274 Replace search_for calls by equivalent internal_pwgetXX calls.
275 (internal_getpwsid): Use passwd_state.isuninitialized to decide
276 to call read_etc_passwd.
277 (internal_getpwuid): Create.
278 (internal_getpwnam): Create.
279 (getpwuid32): Simply call internal_getpwuid.
280 (getpwuid_r32): Call internal_getpwuid.
281 (getpwnam): Simply call internal_getpwnam.
282 (getpwnam_r): Call internal_getpwnam.
283 * grp.cc (parse_grp): Don't look for CRs. Adjust blank space.
284 (add_grp_line): Adjust blank space.
285 (class group_lock): Ditto.
286 (read_etc_group): Simplify tests to actually read the file.
287 Set state to loaded before making internal_getgrXX calls.
288 Replace getgrXX calls by equivalent internal calls.
289 (internal_getgrsid): Use group_state.isuninitialized to decide
290 to call read_etc_group.
291 (internal_getgrgid): Create.
292 (internal_getgrnam): Create.
293 (getgroups32): Simply call internal_getgrgid.
294 (getgrnam32): Simply call internal_getgrnam.
295 (internal_getgrent): Call group_state.isuninitialized.
296 (internal_getgroups): Create from the former getgroups32, using
297 two of the four arguments. Set gid to myself->gid and username
298 to cygheap->user.name ().
299 (getgroups32): Simply call internal_getgroup.
300 (getgroups): Call internal_getgroup instead of getgroups32.
301 (setgroups32): Call internal versions of get{pw,gr}XX.
302 * sec_helper.cc: Include pwdgrp.h.
303 (is_grp_member): Call internal versions of get{pw,gr}XX.
304 * security.cc: Include pwdgrp.h.
305 (alloc_sd): Call internal versions of get{pw,gr}XX.
306 * syscalls.cc: Include pwdgrp.h.
307 (seteuid32): Call internal versions of get{pw,gr}XX.
309 * uinfo.cc: Include pwdgrp.h.
310 (internal_getlogin): Call internal versions of get{pw,gr}XX.
311 (cygheap_user::ontherange): Ditto.
312 * sec_acl.cc: Include pwdgrp.h.
313 (setacl): Call internal versions of get{pw,gr}XX.
314 (acl_access): Ditto and simplify logic.
315 (aclfromtext): Ditto.
317 2002-12-09 2002-12-02 Egor Duda <deo@logos-m.ru>
319 * lib/pseudo-reloc.c: New file.
320 * lib/_cygwin_crt0_common.cc: Perform pseudo-relocs during
321 initialization of cygwin binary (.exe or .dll).
323 2002-12-06 Christopher Faylor <cgf@redhat.com>
325 * cygwin.din: Reflect name change from strtodf to strtof. Export
327 * include/cygwin/version.h: Bump API minor number.
329 2002-12-04 Steve Osborn <bub@io.com>
331 * fhandler.h (fhandler_termios::line_edit): Change return from an int
332 to an enum to allow the function to return an error.
333 * fhandler_console.cc (fhandler_console::read): Update the line_edit
334 call to use the new enum.
335 * fhandler_termios.cc (fhandler_termios::line_edit): Change return from
336 an int to an enum to allow the function to return an error. Put
337 put_readahead call before doecho for future patch.
338 * fhandler_tty.cc (fhandler_pty_master::write): Change to call
339 line_edit one character at a time, and stop if an error occurs.
341 2002-12-04 Craig McGeachie <slapdau@yahoo.com.au>
343 * netdb.cc: New file.
344 * Makeile.in (DLL_OFILES): Add reference to the new netdb.cc file.
345 * cygwin.din : Add new aliased exports for service and protocol
346 enumerations in netdb.cc.
348 2002-12-04 Thomas Pfaff <tpfaff@gmx.net>
350 * cxx.cc: New file. Implement new, new[], delete and delete[]
351 operators and __cxa_pure_virtual if compiled by gcc >=3.
352 * Makefile.in (DLL_OFILES): Add cxx.o.
353 Remove libstdc++.a from cygwin1.dll link step.
355 2002-11-29 Steve Osborn <bub@io.com>
357 * fhandler_tty.cc (fhandler_pty_master::accept_input): Move
358 read_retval assignment to prevent race condition. Remove read_retval
359 from return statement.
361 2002-11-29 Christopher Faylor <cgf@redhat.com>
363 * pinfo.h (winpids::set): Renamed from init.
364 (winpids::init): New declaration.
365 (winpids::cs): Ditto.
366 (winpids::winpids): Use set rather than init.
367 * external.cc (fillout_pinfo): Ditto.
368 * dcrt0.cc (dll_crt0_1): Call winpids::init.
369 * pinfo.cc (winpids::set): Renamed from init. Wrap calls in critical
371 (winpids::init): New function.
372 (winpids::cs): Define.
374 2002-11-28 Christopher Faylor <cgf@redhat.com>
376 * sigproc.cc (sig_dispatch_pending): Remove assertion.
378 2002-11-27 Christopher Faylor <cgf@redhat.com>
380 * include/cygwin/version.h: Bump DLL minor number.
382 2002-11-27 Mikael Ylikoski <my@post.utfors.se>
384 * fhandler_socket.cc (fhandler_socket::sendto): Fix potential
385 unitialized value return.
387 2002-11-27 Christopher Faylor <cgf@redhat.com>
389 * cygwin.din: Export pthread_getsequence_np.
390 * include/cygwin/version.h: Bump API minor version.
392 2002-11-26 Jason Tishler <jason@tishler.net>
394 * cygwin.din: Export nl_langinfo().
395 * include/cygwin/version.h: Bump API minor version.
397 2002-11-26 Christopher Faylor <cgf@redhat.com>
399 * fhandler_tty.cc (fhandler_pty_master::accept_input): Just use a
400 normal Sleep or suffer amazing pauses when other tty apps are running.
401 (fhandler_pty_master::process_slave_output): Ditto.
403 2002-11-25 Pierre Humblet <pierre.humblet@ieee.org>
405 * passwd.cc (read_etc_passwd): Never add an entry when starting
406 on Win95/98/ME if a default entry is present.
407 * uinfo.cc (internal_getlogin): Look for the default uid if needed.
408 Always call user.set_name ().
410 2002-11-25 Corinna Vinschen <corinna@vinschen.de>
412 * sec_acl.cc (getacl): Set errno to ENOSPC if command is GETACL and
413 nentries is less than the number of entries in the file's ACL.
415 2002-11-24 Corinna Vinschen <corinna@vinschen.de>
417 * sec_acl.cc: Fix some formatting. Only set and check `other' bits in
418 a_perm throughout. Use ILLEGAL_GID id for all entries having no id.
419 (setacl): Fix inheritance condition.
420 (getacl): Set all permission bits in CLASS_OBJ and DEF_CLASS_OBJ
421 entries. Remove DENY bits before returning to calling function.
422 (acltomode): Fix usage of searchace(). If available, use CLASS_OBJ
423 to mask GROUP_OBJ permissions.
424 (aclfrommode): Fix usage of searchace(). If available, set CLASS_OBJ
425 permissions to same value as GROUP_OBJ permissions.
427 2002-11-24 Pierre Humblet <pierre.humblet@ieee.org>
429 * sec_acl.cc (getace): Fix the behavior when allow and
430 deny entries are present in arbitrary order.
431 (getacl): Report the actual number of entries when
432 aclbufp is NULL, even if nentries is zero. Fix the mask
433 reporting, handle the case where the owner and group sids
434 are equal and streamline the code.
435 (acl_worker): Take allow_ntsec into account.
437 2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
439 * dcrt0.cc (dll_crt0_1): Add call to pthread::initMainThread to
440 initialize mainthread when it is safe to call new.
441 * init.cc (dll_entry): Change call to store reents in tls key.
442 * thread.cc (_reent_clib) : Change call to get reents from tls
444 (_reent_winsup): Ditto.
445 (MTinterface::Init): Key handling changed. Remove initialization
447 (MTinterface::fixup_after_fork): Reinitialize mainthread object
448 after fork. Reset threadount to 1.
449 (pthread::initMainThread): Create mainthread object dynamically.
450 and initialize with valid handles.
451 (pthread::self): Remove calls to create thread objects.
452 (pthread::setTlsSelfPointer): Change call to store thread self
454 (pthread::getTlsSelfPointer): New static method.
455 (pthread::exit): Remove setTlsSelfPointer call.
456 (pthread::initCurrentThread): New method.
457 (pthread::thread_init_wrapper): Change call to store thread self
459 (pthread::join): Check for a valid joiner.
460 (pthreadNull::pthreadNull): Mark Null object as detached.
461 (pthreadNull::exit): Terminate thread via ExitThread.
462 * thread.h (pthread::initMainThread): Change parameter in function
464 (pthread::getTlsSelfPointer): New static method.
465 (pthread::initCurrentThread): New method.
466 (MTinterface::reent_key): Remove.
467 (MTinterface::thread_self_dwTlsIndex): Ditto..
468 (MTinterface::indexallocated): Ditto.
469 (MTinterface::mainthread): Ditto.
470 (MTinterface::reent_key): New member.
471 (MTinterface::thread_self_key): Ditto.
472 (MTinterface::MTinterface): Initialize all members.
474 2002-11-23 Christopher Faylor <cgf@redhat.com>
476 * wait.cc (wait4): Force pending signal delivery before waiting for
479 2002-11-23 Christopher Faylor <cgf@redhat.com>
481 * include/cygwin/version.h: Bump DLL minor number.
483 2002-11-22 Christopher Faylor <cgf@redhat.com>
485 * exceptions.cc (handle_sigsuspend): Force pending signal delivery
486 before waiting for signals to happen.
487 * signal.cc (sleep): Force pending signal delivery before sleeping.
489 (signal): Force pending signal delivery before manipulating signal
491 (sigprocmask): Ditto.
492 (kill_worker): Ditto.
495 * syscalls.cc (readv): Force pending signal delivery before I/O.
498 * net.cc: Ditto, throughout.
499 * sigproc.cc (sig_dispatch_pending): Deliver any pending signals prior
502 * tty.cc (tty::make_pipes): Increase pipe buffer size.
504 2002-11-22 Christopher Faylor <cgf@redhat.com>
506 * include/cygwin/version.h: Fix comment.
508 2002-11-21 Igor Pechtchanski <pechtcha@cs.nyu.edu>
510 * external.cc (cygwin_internal): Fix va_arg references.
512 2002-11-21 Christopher Faylor <cgf@redhat.com>
514 * exceptions.cc (sigthread::get_winapi_lock): Just do standard 'give up
516 (setup_handler): Revamp YA to attempt to deliver signal multiple times
517 on failure rather than punting to wait_sig.
518 * miscfuncs.cc (low_priority_sleep): Accept INFINITE sleep to mean
519 "don't reset the priority after setting it to idle". Return previous
521 * winsup.h (SLEEP_0_STAY_LOW): Define.
522 (low_priority_sleep): Return an int.
523 * sigproc.h: Define WAIT_SIG_PRIORITY here.
524 * sigproc.cc: Remove WAIT_SIG_PRIORITY definition.
526 2002-11-20 Pierre Humblet <pierre.humblet@ieee.org>
528 * security.h: Declare internal_getpwsid and internal_getgrsid.
529 Undeclare internal_getpwent. Define DEFAULT_UID_NT. Change
531 * passwd.cc (internal_getpwsid): New function.
532 (internal_getpwent): Suppress.
533 (read_etc_passwd): Make static. Rewrite the code for the completion
534 line. Set curr_lines to 0.
535 (parse_pwd): Change type to static int. Return 0 for short lines.
536 (add_pwd_line): Pay attention to the value of parse_pwd.
537 (search_for): Do not look for nor return the DEFAULT_UID.
538 * grp.cc (read_etc_group): Make static. Free gr_mem and set
539 curr_lines to 0. Always call add_pwd_line. Rewrite the code for the
541 (internal_getgrsid): New function.
542 (parse_grp): If grp.gr_mem is empty, set it to &null_ptr.
543 Never NULL gr_passwd.
544 (getgrgid32): Only return the default if ntsec is off and the gid is
546 * sec_helper.cc (cygsid::get_id): Use getpwsid and getgrsid.
547 (cygsid_getfrompw): Clean up last line.
548 (cygsid_getfromgr): Ditto.
549 (is_grp_member): Use getpwuid32 and getgrgid32.
550 * uinfo.cc (internal_getlogin): Set DEFAULT_GID at start.
551 Use getpwsid. Move the read of /etc/group after the second access
552 to /etc/passwd. Change some debug_printf.
554 2002-11-20 Steven O'Brien <steven.obrien2@ntlworld.com>
556 * poll.cc (poll): ...but set POLLIN instead.
558 2002-11-20 Pierre Humblet <pierre.humblet@ieee.org>
560 * security.cc (get_attribute_from_acl): Always test "anti",
561 just in case an access_denied ACE follows an access_allowed.
562 Handle the case owner_sid == group_sid, with a FIXME.
563 Remove unnecessary tests for non-NULL PSIDs.
564 (alloc_sd): Use existing owner and group sids if {ug}id == -1.
565 Handle case where owner_sid == group_sid.
566 Do not call is_grp_member. Try to preserve canonical ACE order.
567 Remove unnecessary tests for non-NULL PSIDs. Reorganize
569 (get_initgroups_sidlist): Put well_known_system_sid on left
571 (add_access_denied_ace): Only call GetAce if inherit != 0.
572 (add_access_allowed_ace): Ditto. Use appropriate sizeof.
573 * syscalls.cc (chown_worker): Pass {ug}id equal to -1 to
574 alloc_sd, which removes the need to obtain old_{ug}id.
575 (chmod): Remove call to get_file_attribute (), simply pass
576 {ug}id equal to -1 to alloc_sd.
578 2002-11-20 Corinna Vinschen <corinna@vinschen.de>
580 * poll.cc (poll): Don't set POLLERR if a listening socket has a
581 pending connect. Don't use errno value from call to
582 fhandler_socket::recvfrom().
584 2002-11-19 Christopher Faylor <cgf@redhat.com>
586 * net.cc: Sprinkle sigframes throughout.
588 2002-11-16 Christopher Faylor <cgf@redhat.com>
590 * tty.cc (tty::make_pipes): Make pipe buffer larger.
592 2002-11-15 Pierre Humblet <pierre.humblet@ieee.org>
594 * grp.cc (getgroups32): Protect against closing cygheap->user.token.
596 2002-11-15 Christopher Faylor <cgf@redhat.com>
598 * include/cygwin/version.h: Bump API_MINOR to accommodate below
601 002-11-14 Sergey Okhapkin <sos@prospect.com.ru>
603 * cygwin.din (siginterrupt): New export.
604 * signal.cc (siginterrupt): New.
606 2002-11-15 Sergey Okhapkin <sos@prospect.com.ru>
608 * select.cc (peek_serial): Don't call PurgeComm() to avoid characters
611 2002-11-14 Christopher Faylor <cgf@redhat.com>
613 * exceptions.cc (setup_handler): Add debugging output. Set thread
614 priority to idle if pending signals to allow other threads to get into
616 * miscfuncs.cc (sys_mbstowcs): Save current thread in variable to avoid
618 * wait.cc (wait_sig): Reset thread priority each time through loop
619 since the priority may have been set down to deal with pending signals.
621 2002-11-14 Christopher Faylor <cgf@redhat.com>
623 * fhandler_serial.cc (fhandler_serial::tcgetattr): Don't take any
624 special action when vmin_ == 0.
626 2002-11-14 Corinna Vinschen <corinna@vinschen.de>
628 * grp.cc (getgroups32): Revert previous patch. Use impersonation
629 token if process is in impersonated state.
630 * sec_helper.cc (is_grp_member): Rewrite. Call getgroups32 only
631 for current user. Scan passwd and group info otherwise.
633 2002-11-14 Christopher Faylor <cgf@redhat.com>
635 * fhandler_console.cc (fhandler_console::write): Allow characters >=
636 0177 to be displayed in the title bar.
638 2002-11-14 Corinna Vinschen <corinna@vinschen.de>
640 * grp.cc (getgroups32): Don't use access token of current user when
641 retrieving group info for another user.
643 2002-11-13 Christopher Faylor <cgf@redhat.com>
645 * dll_init.cc (dll_list::detach): Eliminate reliance on passed in dll
646 address. Infer from module of caller instead.
647 (cygwin_detach_dll): Ignore dll_index argument.
648 * dll_init.h (dll_list::detach): Reflect argument change above.
650 2002-11-13 Christopher Faylor <cgf@redhat.com>
652 * ioctl.cc (ioctl): Always print ioctl results, even when it's a tty.
654 2002-11-13 Christopher Faylor <cgf@redhat.com>
656 * winsup.h (low_priority_sleep): Declare.
658 2002-11-13 Christopher Faylor <cgf@redhat.com>
660 * miscfuncs.cc (low_priority_sleep): New function. Use throughout
661 where code is supposed to be giving up time slice.
663 * fhandler_console.cc (fhandler_console::read): Switch button 2/3
664 output escape sequences to be consistent with xterm.
666 2002-11-12 Pierre Humblet <pierre.humblet@ieee.org>
668 * syscalls.cc (chmod): Simplify conditional.
669 * sec_helper (cygsid::getfromstr): Reorganize to remove
670 calls to strcpy and strtok_r.
671 (cygsid::getfromgr): Change type to __uid32_t instead of int.
672 Keep only the allow_ntsec branch. Never call LookupAccountSid
673 which calls PDCs, simply return -1 in case of failure.
674 Use cygsid == instead of calling EqualSid and remove test
676 * security.h: Declare cygsid::getfromgr as __uid32_t.
678 2002-11-10 Corinna Vinschen <corinna@vinschen.de>
680 * net.cc: Run indent.
682 2002-11-10 Alexander Gottwald <Alexander.Gottwald@s1999.tu-chemnitz.de>
684 * autoload.cc (GetIfEntry): Add symbol.
685 * net.cc (get_2k_ifconf): Get the interface entries with the GetIfEntry
686 call intead of the GetIfTable call. Clean-up multiple IP address naming.
688 2002-11-09 Sergey Okhapkin <sos@prospect.com.ru>
690 * fhandler.h (class fhandler_pipe): New ioctl() method.
691 * pipe.cc (fhandler_pipe::ioctl): New.
693 2002-11-07 Christopher Faylor <cgf@redhat.com>
695 * fhandler_serial.cc (fhandler_serial::ioctl): Fix typo.
697 2002-11-07 Christopher January <chris@atomice.net>
699 * include/cygwin/fs.h: New file.
700 * include/cygwin/hdreg.h: New file.
701 * fhandler_floppy.cc (fhandler_floppy::ioctl): Add implementation for
702 HDIO_GETGEO, BLKGETSIZE, BLKGETSIZE64, BLKRRPART and BLKSSZGET ioctls.
704 2002-11-07 Gilles Courcoux <Gilles.Courcoux@col.bsf.alcatel.fr>
706 * fhandler_socket.cc (fhandler_socket::ioctl): Return correct flags
707 for loopback interface when name is given on input instead of address.
709 2002-11-07 Jason Tishler <jason@tishler.net>
711 * cygwin.din: Export fseeko() and ftello().
712 * include/cygwin/version.h: Bump API minor version.
714 2002-11-06 Christopher Faylor <cgf@redhat.com>
716 * fhandler_console.cc (keytable[]): Revert previous change. It would
717 break too many things.
719 2002-11-06 Christopher Faylor <cgf@redhat.com>
721 * fhandler_console.cc (keytable[]): Redefine F1 - F5 to something a
722 little more sensical.
724 2002-11-06 Sergey Okhapkin <sos@prospect.com.ru>
726 * syscalls.cc (getutid): Use UT_IDLEN where appropriate.
728 2002-11-06 Christopher Faylor <cgf@redhat.com>
730 * include/cygwin/version.h: Bump API minor number for below export.
732 2002-11-06 Sergey Okhapkin <sos@prospect.com.ru>
734 * cygwin.din (pututline): New exported function.
735 * syscalls.cc (login): Use pututiline().
736 (setutent): Open utmp as read/write.
737 (endutent): Check if utmp file is open.
738 (utmpname): call endutent() to close current utmp file.
739 (getutid): Enable all cases, use strncmp() to compare ut_id fields.
741 * tty.cc (create_tty_master): Set ut_pid to current pid.
743 2002-11-05 Christopher Faylor <cgf@redhat.com>
745 * fhandler_serial.cc (fhandler_serial::ioctl): Don't try to figure out
746 if OS has the capability to retrieve RTS/CTS. Just set default values
747 if DeviceIoControl fails. (suggested by Sergey Okhapkin)
749 2002-11-05 Sergey Okhapkin <sos@prospect.com.ru>
751 * fhandler_serial.cc (fhandler_serial::raw_read): Use correct type for
753 (fhandler_serial::ioctl): Set errno if the ClearCommError fails.
754 (fhandler_serial::tcsetattr): Use correct value for vmin_.
755 (fhandler_serial::tcgetattr): Ditto.
757 2002-11-05 Thomas Pfaff <tpfaff@gmx.net>
759 * fhandler_socket.cc (fhandler_socket::recvmsg): Call if from == NULL
760 WSARecvFrom with fromlen = NULL.
762 2002-11-04 Christopher Faylor <cgf@redhat.com>
764 * pinfo.cc (_pinfo::commune_send): Fix thinko in previous checkin.
766 2002-11-04 Christopher Faylor <cgf@redhat.com>
768 * pinfo.cc (_pinfo::commune_send): Set priority low when sleeping,
769 waiting for commune completion so that we don't spin waiting for lower
772 2002-11-04 Christopher Faylor <cgf@redhat.com>
774 * sigproc.cc (WAIT_SIG_PRIORITY): Bump to THREAD_PRIORITY_TIME_CRITICAL.
776 2002-11-04 Christopher Faylor <cgf@redhat.com>
778 * pinfo.cc (_pinfo::commune_send): Initialize buffer or suffer random
781 2002-11-04 Christopher Faylor <cgf@redhat.com>
783 * fhandler_process.cc (fhandler_process::fill_filebuf): Deal with error
784 condition from cmdline retrieval.
786 2002-11-04 Christopher Faylor <cgf@redhat.com>
788 * sigproc.cc (WAIT_SIG_PRIORITY): Bump to highest priority.
790 2002-11-04 Christopher Faylor <cgf@redhat.com>
792 * include/cygwin/version.h: Bump DLL minor number.
794 2002-11-03 Christopher Faylor <cgf@redhat.com>
796 * fhandler_serial.cc (fhandler_serial::ioctl): Reformat. Set errno
797 appropriately. Exit from the bottom. Correctly deal with third
798 argument for TCFLSH. (Suggested by Sergey Okhapkin)
800 2003-11-03 Sergey Okhapkin <sos@prospect.com.ru>
802 * fhandler_tty.cc (fhandler_tty_slave::ioctl): Do nothing if the new
803 window size is equal to the old one. Send SIGWINCH if slave connected
805 (fhandler_pty_master::ioctl): Do nothing if the new window size is
806 equal to the old one.
808 2002-10-31 Pierre Humblet <pierre.humblet@ieee.org>
810 * fhandler.cc (fhandler_base::open): Verify pc isn't NULL.
812 2002-10-30 Christopher Faylor <cgf@redhat.com>
814 * include/cygwin/version.h: Bump DLL minor number.
816 2002-10-30 Christopher Faylor <cgf@redhat.com>
818 * external.cc (cygwin_internal): Implement CW_CMDLINE.
819 * pinfo.h (SIGCOMMUNE): New signal type.
820 (commune_result): New structure for commune functions.
821 (picom): New enum for commune functions.
822 (_pinfo::hello_pid): New. Pid who's communicating with me.
823 (_pinfo::tothem): New. Handle of communicating pipe.
824 (_pinfo::fromthem): Ditto.
825 (_pinfo::commune_recv): Declare.
826 (_pinfo::commune_send): Declare.
827 (_pinfo::alive): Declare.
828 (_pinfo::cmdline): Declare.
829 (_pinfo::lock): Declare.
830 * pinfo.cc (set_myself): Initialize new _pinfo lock.
831 (_pinfo::alive): Define. Determines if process still exists.
832 (_pinfo::commune_recv): Define. Receive info from another cooperating process.
833 (_pinfo::commune_send): Define. Send info to another cooperating process.
834 (_pinfo::cmdline): Define. Determine command line of a given process.
835 * include/sys/cygwin.h (CW_CMDLINE): Define.
837 *sigproc.cc (talktome): Communicate with any processes who want to talk
839 (wait_sig): Honor __SIGCOMMUNE.
841 * fhandler.cc (fhandler_virtual::fixup_after_exec): Declare.
842 * fhandler_proc.cc: Use malloc/free/realloc throughout rather than
843 cmalloc since buffers don't need to be propagated to subprocesses.
844 * fhandler_registry.cc: Ditto.
845 * fhandler_virtual.cc: Ditto.
846 (fhandler_virtual::fixup_after_exec): Define.
847 * fhandler_process.cc: Ditto for malloc/free/realloc.
848 (process_listin): Add "cmdline".
849 (fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE.
851 * miscfuncs.cc (isalpha_array): New array populated with xor values for
852 alpha characters to switch from one case to another.
853 * string.h (cygwin_strcasematch): New asm implementation of case match.
854 * string.h (cygwin_nstrcasematch): New asm implementation of counted
857 2002-10-24 Pierre Humblet <pierre.humblet@ieee.org>
859 * pwdgrp.h (pwdgrp_read::open): Compare fh to INVALID_HANDLE_VALUE.
861 2002-10-22 Christopher Faylor <cgf@redhat.com>
863 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Nevermind.
864 Revert everything to previous state wrt ntsec and exec bits.
866 2002-10-22 Christopher Faylor <cgf@redhat.com>
868 * shared.cc (shared_info::initialize): Use correct value for version
870 * include/cygwin/version.h (CYGWIN_VERSION_MAGIC): Use all of a DWORD
871 for magic calculation.
873 2002-10-22 Christopher Faylor <cgf@redhat.com>
875 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Oops. Only
876 do the executable thing for #! scripts since .exe files wouldn't be
877 executable in ntsec case regardless.
879 2002-10-22 Christopher Faylor <cgf@redhat.com>
881 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always
882 consider .exe files and '#!' shell scripts to be executable.
884 2002-10-22 Christopher Faylor <cgf@redhat.com>
886 * cygthread.cc (cygthread::exiting): New variable.
887 (cygthread::initialized): Delete.
888 (cygthread::stub): Use exiting variable to determine when to exit.
889 (cygthread::runner): Delete.
890 (cygthread_protect): New variable.
891 (cygthread::init): Don't start runner thread. Initialize muto for list
893 (cygthread::freerange): Return pointer to cygthread.
894 (cygthread::operator new): Change logic to start threads on an
896 (cygthread::detach): Don't zero id.
897 (cygthread::terminate): Don't kill any executing threads. Just set
899 * cygthread.h (cygthread): Reflect above changes.
900 * dcrt0.cc (dll_crt0_1): Move cygthread initialization later.
902 * fork.cc (fork_child): Do fdtab fixup after dll fixup or (apparently)
903 winsock may allocate memory in dll load address.
905 2002-10-22 Pierre Humblet <pierre.humblet@ieee.org>
907 * sec_helper.cc (cygsid::get_id): If the sid matches a sid stored in
908 cygheap->user, return the uid or gid from myself.
909 * security.cc (alloc_sd): If gid == myself->gid, return the group sid
910 from cygheap->user. Remove the test for uid == original_uid, which is
913 2002-10-22 Christopher Faylor <cgf@redhat.com>
915 * cygheap.cc (cygheap_fixup_in_child): Use user_heap element in
917 (init_cheap): Ditto for declaration.
918 * fork.cc (fork_parent): Use user_heap element in cygheap.
919 * heap.h (inheap): Ditto.
920 * heap.cc (sbrk): Ditto.
921 (heap_init): Ditto. Reorganize to shrink heap chunk as required and
922 record new value in cygheap.
923 * dcrt0.cc (dll_crt0_1): More "move the cygthread init" games.
924 * shared.cc (open_shared): Rework memory protection to properly deal
925 with relocated shared segment.
926 (shared_info::heap_chunk_size): Rename element to 'heap_chunk'.
927 * shared_info.h (shared_info): Ditto for declaration.
928 * strace.cc (strace::hello): Report on heap chunk size from cygheap
931 2002-10-20 Christopher Faylor <cgf@redhat.com>
933 Change _function() to function() throughout.
934 * cygwin.din: Remove last vestiges (?) of newlib wrappers.
936 2002-10-20 Christopher Faylor <cgf@redhat.com>
938 * cygthread.cc (cygthread::detach): Always wait for event or suffer an
939 apparently inavoidable race.
940 * dcrt0.cc (dll_crt0_1): Allocate threads after stack has been
942 * debub.cc (lock_debug): Don't acquire lock on exit.
943 * fork.cc (fork_child): Recreate mmaps before doing anything else since
944 Windows has a habit of using blocks of memory in the child that could
945 previously have been occupied by shared memory in the parent.
946 * mmap.cc (fhandler_disk_file::fixup_mmap_after_fork): Issue error here
947 and provide some details about what went wrong.
948 (fixup_mmaps_after_fork): Remove error message.
949 * shared.cc (open_shared): Move warning message so that more detail is
951 * sigproc.cc (sigproc_init): Initialize sync_proc_subproc to avoid a
953 (sigproc_terminate): Specifically wait for process thread to terminate.
955 2002-10-20 Christopher Faylor <cgf@redhat.com>
957 * cygthread.cc (cygthread::stub): Fix typo.
958 (cygthread::terminate): Don't zero thread handle prior to using it.
960 2002-10-20 Christopher Faylor <cgf@redhat.com>
962 * sigproc.cc (wait_sig): Remove obsolete sigchld logic.
964 2002-10-20 Christopher Faylor <cgf@redhat.com>
966 Rename _kill() to kill() throughout. Rename _raise() to raise()
967 throughout. Rename _pid() to pid() throughout.
968 * Makefile.in: Compile some objects with -fomit-frame-pointer.
969 * cygwin.din: Reverse aliasing for _kill.
970 * syscalls.cc (_getpid_r): New function, implemented for newlib
973 * shared.cc (open_shared): Remove reserving of memory since previous
974 change eliminate the need for this hack.
976 2002-10-19 Christopher Faylor <cgf@redhat.com>
978 * fork.cc (fork_child): Move pinfo fixup later to attempt some minor
979 gains from concurrency with cythread::init.
981 2002-10-18 Christopher Faylor <cgf@redhat.com>
983 * dcrt0.cc (dll_crt0_1): Initialize cygwin threads here only when not
985 * fork.cc (fork_child): Initialize cygwin thread later in process to
986 avoid allocating memory for thread stacks.
987 * shared.cc (open_shared): Issue warning if NT and shared segment is
990 2002-10-18 Christopher Faylor <cgf@redhat.com>
992 * cygthread.cc: Bump number of cygthreads up to accommodate
993 applications which use ttys.
995 2002-10-18 Christopher Faylor <cgf@redhat.com>
997 * fork.cc (fork_child): Move mmap initialization.
998 * shared.cc (shared_info::heap_chunk_size): Store info as megabytes.
999 Search HKEY_LOCAL_MACHINE as well as HKEY_CURRENT_USER.
1000 * shared_info.h (shared_info::initial_heap_size): Change element name
1001 to reflect new functionality.
1002 * strace.cc (strace::hello): Report on initial heap size.
1004 2002-10-18 Thomas Pfaff <tpfaff@gmx.net>
1006 * thread.cc (verifyable_object_isvalid): Test for a valid object
1007 pointer before testing for static ptr.
1009 2002-10-17 Christopher Faylor <cgf@redhat.com>
1011 * dtable.cc (dtable::init_std_file_from_handle): Force "devices" to
1012 always be in binary mode. Temporary fix until ssh is rebuilt?
1014 2002-10-17 Christopher Faylor <cgf@redhat.com>
1016 * dtable.cc (dtable::set_file_pointers_for_exec): New function.
1017 * dtable.h (dtable::set_file_pointers_for_exec): Declare new function.
1018 * spawn.cc (spawn_guts): Call dtable::set_file_pointers_for_exec to set
1019 pointers to EOF when execing non-cygwin applications.
1021 2002-10-17 Robert Collins <rbtcollins@hotmail.com>
1023 * thread.h (pthread_mutex::isGoodInitializerOrBadObject): Declare.
1024 * thread.cc (pthread_mutex::isGoodInitializerOrBadObject): Implement.
1025 (pthread_mutex::init): Use isGoodInitializerOrBadObject to avoid
1026 unneeded SEGV's during debugging.
1028 2002-10-17 Thomas Pfaff <tpfaff@gmx.net>
1030 * thread.cc (verifyable_object_isvalid): Test for static object first.
1032 2002-10-16 Christopher Faylor <cgf@redhat.com>
1034 * fhandler_tty.cc (fhandler_tty_slave::read): Attempt #527 to properly
1035 implement VMIN/VTIME.
1037 2002-10-15 Christopher Faylor <cgf@redhat.com>
1039 * shared.cc (open_shared): Revert to "old" method for shared memory
1040 location if !wincap.needs_memory_protection.
1041 * wincap.cc: Implement needs_memory_protection throughout.
1044 2002-10-15 Christopher Faylor <cgf@redhat.com>
1046 * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
1047 (child_info_fork::mount_table): Remove.
1048 (child_info_fork::myself_addr): Remove.
1049 * fork.cc (fork_child): Don't set either of the above.
1050 * dcrt0.cc (dll_crt0_1): Call memory_init as early as possible.
1051 * fhandler_console.cc (console_state): Move to shared_info.h.
1052 (fhandler_console::get_tty_stuff): Reflect open_shared arg change.
1053 * pinfo.cc (myself_addr): Remove definition.
1054 (pinfo::init): Get myself address from open_shared.
1055 * pinfo.h (myself_addr): Remove declaration.
1056 * shared.cc (open_shared): Rework so that known shared memory locations
1057 are protected. Take shared memory type as fifth argument.
1058 (memory_init): Reflect open_shared arg change.
1059 * shared_info.h (shared_locations): New enum.
1060 (console_state): Move here.
1061 (open_shared): Reflect open_shared arg change in declaration.
1063 2002-10-14 Christopher Faylor <cgf@redhat.com>
1065 * child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
1066 (child_info_fork::heaptop): Remove obsolete element.
1067 (child_info_fork::heabbase): Ditto.
1068 (child_info_fork::heapptr): Ditto.
1069 (child_info_fork::mount_table): New element.
1070 (child_info_fork::myself_addr): Ditto.
1071 * dcrt0.cc (dll_crt0_1): Set mount_table and myself_addr when forking.
1072 (initial_env): Add newline to "sleeping" message.
1073 * dll_init.cc (reserve_upto): Accommodate cygwin heap when freeing
1074 memory. Make debugging output a little more descriptive.
1075 * fork.cc (fork_parent): Save mount_table and myself_addr.
1076 * pinfo.cc (myself_addr): New variable.
1077 (set_myself): Pass PID_MYSELF flag to init.
1078 (pinfo::init): Honor PID_MYSELF. Save address where myself shared
1079 memory resides in myself_addr, for fork.
1080 * pinfo.h (myself_addr): Declare.
1081 * shared.cc (memory_init): On fork, use previously saved address for
1082 location of mount table.
1083 * include/sys/cygwin.h (PID_MYSELF): New value.
1085 * dtable.cc (dtable::stdio_init): Don't pass access type to
1086 init_std_file_from_handle. It's always the same.
1087 (dtable::init_std_file_from_handle): Remove access type argument.
1089 * dtable.h (dtable::init_std_file_from_handle): Ditto for declaration.
1091 * exceptions.cc (try_to_debug): Don't try to debug if already being
1094 * fhandler_console.cc (shared_console_info_save): New variable.
1095 (fhandler_console::get_tty_stuff): Save address of shared console stuff
1098 2002-10-13 Christopher Faylor <cgf@redhat.com>
1100 * cygthread.cc (cygthread::stub): Reintroduce clearing of __name but do
1101 it before SetEvent to eliminate a race.
1102 (cygthread::terminate): Accumulate list of threads to check for
1103 termination and call WaitForMultipleObjects on list rather than waiting
1104 for each thread individually.
1105 * sigproc.cc (subproc_init): Zap hwait_subproc thread handle since it
1108 2002-10-13 Christopher Faylor <cgf@redhat.com>
1110 * spawn.cc (spawn_guts): Fix so that cygthread::terminate is *really*
1111 called only for exec.
1113 2002-10-13 Christopher Faylor <cgf@redhat.com>
1115 * cygthread.cc (cygthread::stub): Don't zero __name here. That
1118 2002-10-13 Christopher Faylor <cgf@redhat.com>
1120 * include/cygwin/version.h: Bump DLL minor number.
1122 2002-10-13 Christopher Faylor <cgf@redhat.com>
1124 * cygthread.cc (cygthread::stub): Don't create event for long-running
1125 threads. Initialize thread_sync event here which is used to Suspend
1126 using an event rather than relying on SuspendThread/ResumeThread.
1127 (cygthread::init): Save handle to runner thread for future termination.
1128 (cygthread::cygthread): Only resume thread when it is actually
1129 suspended. Otherwise signal thread completion event.
1130 (cygthread::terminate): Forcibly terminate runner thread and any helper
1131 threads. Call DisableThreadLibrary calls if execing.
1132 * cygthread.h (cygthread::thread_sync): Declare.
1133 * dcrt0.cc (do_exit): Eliminate calls to obsolete window_terminate and
1135 * exceptions.cc (events_terminate): Don't bother closing title_mutex
1136 since it is going away anyway.
1137 * pinfo.cc (_pinfo::exit): Call cygthread::terminate to ensure that
1138 threads are shut down before process exit or otherwise strange races
1140 * shared.cc (shared_terminate): Eliminate.
1141 * shared.h (shared_terminate): Eliminate declaration.
1142 * winsup.h (window_terminate): Eliminate declaration.
1143 * spawn.cc (spawn_guts): Call cygthread::terminate early in process if
1144 execing. Call DisableThreadLibrary calls if execing.
1145 * window.cc (Winmain): Call ExitThread to force exit.
1146 (window_terminate): Eliminate.
1148 * dcrt0.cc (do_exit): Track exit state more closely.
1150 2002-10-10 Christopher Faylor <cgf@redhat.com>
1152 * window.cc (gethwnd): Use SetThreadPriority method.
1154 2002-10-10 Christopher Faylor <cgf@redhat.com>
1156 * Makefile.in (new-cygwin1.dll): Reorganize library order.
1158 * dcrt0.cc (do_exit): Move thread stuff after vfork stuff or threads
1159 are terminated during vfork.
1160 * sigproc.cc (proc_terminate): Grab proc lock prior to signalling
1161 subproc thread exit to avoid an extra "wait-for-thread-to-exit".
1163 2002-10-09 Christopher Faylor <cgf@redhat.com>
1165 * cygthread.cc (cygthread::stub): Don't create an event for "cygself"
1166 threads. Assume that they exit via an ExitThread call.
1167 * cygthread.h (cygthread::SetThreadPriority): New function.
1168 (cygthread::zap_h): New function.
1169 * dcrt0.cc (do_exit): Move cygthread::terminate earlier and establish
1171 * fhandler.h (fhandler_tty_master::output_thread): Delete.
1172 * fhandler_tty.cc (fhandler_tty_master::init): Set priority for threads
1173 via method. Zap handles when done. Don't treat process_output
1175 (process_output): Call ExitThread directly.
1176 (fhandler_tty_master::fixup_after_fork): Don't worry about
1178 (fhandler_tty_master::fixup_after_exec): Ditto.
1179 * sigproc.cc (proc_terminate): Don't detach from hwait_subproc. Just
1181 (sigproc_init): Close thread handle after initialization.
1182 (wait_sig): Use GetCurrentThread() as SetThreadPriority call rather
1183 than *event* handle. Call ExitThread directly on termination.
1184 (wait_subproc): Call ExitThread directly on termination.
1185 * tty.cc (tty_list::terminate): Don't attempt to detach from
1188 2002-10-08 Christopher Faylor <cgf@redhat.com>
1190 * cygheap.cc (dup_now): Make fatal error a little more informative.
1191 (cygheap_setup_for_child): Detect when default size of shared region is
1192 less than the current size and allocate that much.
1193 (_cbrk): Just return NULL on inability to allocate.
1195 * cygheap.h (CYGHEAPSIZE): Change size to reflect newer, tinier
1197 * spawn.cc (av::error): New element, reflects potential errno from cmalloc.
1198 (av::~av): Don't free NULL pointers.
1199 (av::replace0_maybe): Detect out-of-memory conditions.
1200 (av::dup_maybe): Ditto.
1201 (av::dup_all): Ditto.
1202 (av::unshift): Ditto.
1203 (spawn_guts): Set errno and return if argv creation ran into problems.
1205 * fhandler.h (fhandler_union): Change member names to something safer.
1207 * fhandler_console.cc (fhandler_console::get_tty_stuff): Always set
1208 fhandler_console::dev_state regardless of whether shared region is
1211 * cygthread.cc (cygthread::runner): Use ExitThread rather than return
1212 (planning for future).
1214 2002-10-08 Christopher Faylor <cgf@redhat.com>
1216 * fhandler.h (dev_console): New class.
1217 (fhandler_console::dev_state): New class element.
1218 (fhandler_console::mouse_aware): Use dev_state element.
1219 (fhandler_console::get_tty_stuff): Declare new function.
1220 * fhandler_console.cc: Use dev_state fhandler_console element,
1222 (fhandler_console::get_tty_stuff): Move to fhandler_console class.
1223 Incorporate dev_console information. Move constructor stuff here.
1225 2002-10-07 Christopher Faylor <cgf@redhat.com>
1227 * dtable.cc (dtable::init_std_file_from_handle): Try to mimic standard
1228 open behavior with files redirected from stdin/stdout/stderr, i.e.,
1229 fmode settings take precedence over mount settings.
1231 2002-10-07 Christopher Faylor <cgf@redhat.com>
1233 * dtable.cc (unknown_file): New variable.
1234 (dtable::init_std_file_from_handle): Don't set binmode if we couldn't
1235 determine the actual file name on stdin/stdout/stderr.
1236 (handle_to_fn): Return unknown_file when can't determine filename.
1238 2002-10-07 Christopher Faylor <cgf@redhat.com>
1240 * dcrt0.cc (do_exit): Call DisableThreadLibraryCalls since we don't
1241 need to track thread detaches.
1242 * init.cc (dll_entry): Reorganize slightly. Fix api_fatal message.
1244 2002-10-05 Christopher Faylor <cgf@redhat.com>
1246 * cygthread.cc (cygthread::stub): Very minor cleanup.
1247 (cygthread::stub): Report overflows in cygwin thread pool when
1248 DEBUGGING is on and special environment variable is not set.
1249 (cygthread::terminate): Set event only when event actually exists.
1250 * exceptions.cc (signal_exit): Set priority of main thread to low
1251 before setting current thread to high.
1253 2002-10-01 Robert Collins <rbtcollins@hotmail.com>
1255 * thread.cc (pthread_key::keys): Copy on fork. Add a comment explaining
1257 (pthreadNull::_instance): Copy on fork. Absolutely no state exists
1260 2002-09-30 Conrad Scott <conrad.scott@dsl.pipex.com>
1262 * cygserver_transport_pipes.cc (transport_layer_pipes::accept):
1263 Remove trailing \n from debug_printf.
1265 2002-09-30 Christopher Faylor <cgf@redhat.com>
1267 * thread.cc (pthread_mutex::initMutex): Remove \n from api_fatal.
1269 2002-09-30 Christopher Faylor <cgf@redhat.com>
1271 * thread.cc (pthread::precreate): Use explicit "no inherit" option when
1273 (pthread_mutex::nativeMutex::init): Ditto.
1275 2002-09-30 Christopher Faylor <cgf@redhat.com>
1277 * thread.cc (pthread_key::keys): Do not copy on fork.
1278 (pthread_mutex::mutexInitializationLock): Ditto.
1279 (pthreadNull::_instance): Ditto.
1281 2002-09-30 Christopher Faylor <cgf@redhat.com>
1283 * exceptions.cc (unused_sig_wrapper): Still need additional level of
1284 indirection when setting errno.
1286 2002-09-30 Robert Collins <rbtcollins@hotmail.com>
1288 * thread.cc (pthread_mutex::initMutex): Use the wrapper init call.
1289 (pthread_mutex::nativeMutex::init): Implement.
1290 (pthread_mutex::nativeMutex::lock): Ditto.
1291 (pthread_mutex::nativeMutex::unlock): Ditto.
1292 (pthread_mutex::init): Use the wrapper lock and unlockcalls.
1293 * thread.h (pthread_mutex): Move mutexInitializationLock into a
1294 nativeMutex wrapper class.
1296 2002-09-30 Christopher Faylor <cgf@redhat.com>
1298 Remove \n from calls to strace class printfs throughout.
1300 2002-09-30 Christopher Faylor <cgf@redhat.com>
1302 * exceptions.cc (unused_sig_wrapper): Accommodate newer compilers.
1304 2002-09-29 Christopher Faylor <cgf@redhat.com>
1306 * security.cc (allow_ntsec): Default to zero.
1307 * environ.cc (environ_init): Set allow_ntsec to TRUE by default,
1308 assuming OS allows it.
1310 2002-09-29 Christopher Faylor <cgf@redhat.com>
1312 * environ.cc (environ_init): Avoid a compiler warning.
1313 * path.cc (path_conv::check): Ditto.
1314 * path.h (path_conv::operator int): Ditto.
1315 * regex/engine.c: Ditto throughout.
1316 * regex/regcomp.c: Ditto throughout.
1317 * regex/regexec.c: Ditto throughout.
1319 2002-09-29 Christopher Faylor <cgf@redhat.com>
1321 * thread.cc: Use "%E" in *_printf throughout rather than calling
1322 GetLastError. GNUify comments.
1323 (__pthread_mutex_lock): Don't return error on EBUSY since that just
1324 means that the mutex has already been initialized.
1326 2002-09-30 Robert Collins <rbtcollins@hotmail.com>
1328 * pthread.cc (pthread_mutex_init): Use new pthread_mutex::init.
1329 * thread.cc: Change __pthread_mutex_init to pthread_mutex::init
1331 (MTinterface::Init): Initialise pthread_mutex support.
1332 (pthread_mutex::mutexInitializationLock): Instantiate.
1333 (pthread_mutex::initMutex): New method.
1334 (__pthread_cond_dowait): Don't dereference untrusted pointers.
1335 Use the new pthread_mutex::init method.
1336 (__pthread_condattr_init): Don't dereference untrusted pointers.
1337 (__pthread_mutex_init): Rename to pthread_mutex::init.
1338 Lock and release mutexInitializationLock to prevent races on
1339 mutex initialisation.
1340 * thread.h (pthread_mutex::initMutex): New method, initialise
1341 pthread_mutex supporting state on process initialisation.
1342 (pthread_mutex::init): Initialise a single mutex.
1343 (pthread_mutex::mutexInitializationLock): A win32 mutex for
1344 syncronising pthread mutex initialisation.
1345 (__pthread_mutex_init): Remove this.
1347 2002-09-28 Christopher Faylor <cgf@redhat.com>
1349 * thread.h (verifyable_object:~verifyable_object): Make virtual.
1351 2002-09-28 Christopher Faylor <cgf@redhat.com>
1353 * cygthread.h (cygthread::terminate): Declare new function.
1354 (cygthread::initialized): Change to 'int'.
1355 * cygthread.cc (cygthread::stub): Exit thread if initialized < 0.
1356 (cygthread::new): Ditto.
1357 (cygthread::runner): Ditto. Set initialized using xor to preserve
1359 (cygthread::terminate): New function.
1360 * dcrt0.cc (do_exit): Call cygthread::terminate.
1362 2002-09-27 Robert Collins <rbtcollins@hotmail.com>
1364 * thread.cc (pthread_key::run_destructor): Run_destructor is not
1365 const as it needs to set the key value.
1366 * thread.h (pthread_key::run_destructor): Ditto.
1368 2002-09-27 Robert Collins <rbtcollins@hotmail.com>
1370 * thread.cc (pthread_key::run_destructor): Follow opengroup algorithm.
1371 I.e. only run the destructor NON-NULL key values, and reset the key
1372 to NULL before running the destructor. Reported by Thomas Pfaff.
1374 2002-09-25 Christopher Faylor <cgf@redhat.com>
1376 * cygrun.c (main): Fix setting of CYGWIN environment variable.
1378 * Makefile.in: Remove linking of unnecessary libraries.
1380 2002-09-24 Christopher January <chris@atomice.net>
1382 * fhandler_proc.cc (format_process_stat): make ctty a real device
1384 (format_process_status): use effective uid/gid as real and saved
1387 2002-09-24 Corinna Vinschen <corinna@vinschen.de>
1389 * errno.cc (errmap): Map ERROR_INVALID_ADDRESS to new errno code
1391 (_sys_errlist): Add entries for EILSEQ and EOVERFLOW.
1393 * mmap.cc (map_map): Set errno in case of error.
1394 (mmap64): Remove setting errno explicitely to ENOMEM.
1396 2002-09-24 Corinna Vinschen <corinna@vinschen.de>
1398 * mmap.cc (map_map): Add debug output.
1399 (mmap64): Evaluate gran_len correctly even if offset isn't 0.
1401 2002-09-22 Christopher Faylor <cgf@redhat.com>
1403 More GNUify non-GNU formatted functions calls throughout.
1405 2002-09-22 Christopher Faylor <cgf@redhat.com>
1407 * Makefile.in (DLL_O_FILES): Restore formatting.
1409 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1411 GNUify non-GNU formatted functions calls throughout.
1413 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1415 * cygserver_shm.cc (with_strerr): Remove macro.
1416 (server_shmmgr::segment_t::~segment_t): Remove calls to with_strerr.
1417 (server_shmmgr::segment_t::attach): Ditto.
1418 (server_shmmgr::new_segment): Ditto.
1419 * shm.cc (with_strerr): Remove macro.
1420 (client_shmmgr::shmdt): Remove calls to with_strerr.
1421 (client_shmmgr::attach): Ditto.
1423 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1425 * include/sys/ipc.h: Move to "include/cygwin/ipc.h".
1426 * include/sys/msg.h: Move to "include/cygwin/msg.h".
1427 * include/sys/sem.h: Move to "include/cygwin/sem.h".
1428 * include/sys/shm.h: Move to "include/cygwin/shm.h".
1429 * include/cygwin/ipc.h: New file.
1430 * include/cygwin/msg.h: Ditto.
1431 * include/cygwin/sem.h: Ditto.
1432 * include/cygwin/shm.h: Ditto.
1433 * cygserver_shm.h: Update includes.
1437 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1439 * safe_memory.h (safe_delete): Make a templated function.
1440 * cygserver.cc (~server_request): Update use of safe_delete.
1442 * cygserver_client.cc (client_request::handle_request): Ditto.
1443 (client_request::make_request): Ditto.
1444 * cygserver_process.cc (~process_cleanup): Ditto.
1445 (process::remove): Ditto.
1446 (process::cleanup): Ditto.
1447 (process_cache::process): Ditto.
1448 * cygserver_shm.cc (server_shmmgr::segment_t::detach): Ditto.
1449 (server_shmmgr::delete_segment): Ditto.
1450 * shm.cc (client_shmmgr::shmdt): Ditto.
1451 * threaded_queue.cc (~threaded_queue): Ditto.
1452 (threaded_queue::worker_loop): Ditto.
1454 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1456 * safe_memory.h: Replace #include <new> with an explicit
1457 definition of the placement new operator.
1458 (safe_delete): Remove unnecessary ## operator.
1460 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1462 * cygserver_shm.cc (class server_shmmgr): Remove `cleanup_t'
1464 (cleanup_t::cleanup_t): Use the segment's shmid as the key rather
1465 than the segment pointer itself.
1466 (cleanup_t::segptr): Remove method.
1467 (cleanup_t::shmid): New method.
1468 (cleanup_t::cleanup): Update for new key value.
1469 (server_shmmgr::find (segment_t *)): Remove method.
1470 * include/cygwin/cygserver_process.h (cleanup_routine::key): Make
1473 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1475 * include/cygwin/cygserver_process.h
1476 (cleanup_routine::_key): New field.
1477 (cleanup_routine::cleanup_routine): Initialise new field with new
1479 (cleanup_routine::operator==): New method.
1480 (cleanup_routine::key): New method.
1481 (cleanup_routine::cleanup): Make argument non-const.
1482 (process::is_active): New method.
1483 (process::remove): Ditto.
1484 (process::check_exit_code): Rename method.
1485 * cygserver_process.cc (process::add): Reorganize code.
1486 (process::remove): New method.
1487 (process::check_exit_code): Rename method.
1488 (process::cleanup): Use new `process::is_active' method.
1489 (process_cache::process): Ditto.
1490 (process_cache::sync_wait_array): Ditto.
1491 (process_cache::check_and_remove_process): Ditto.
1492 * cygserver_shm.cc (server_shmmgr): Make `cleanup_t' a friend.
1493 (segment_t::detach): Make argument non-const. Remove cleanup
1494 object from client if appropriate.
1495 (cleanup_t::_segptr): Remove field.
1496 (cleanup_t::cleanup_t): Initialise parent explicitly. Remove
1498 (cleanup_t::segptr): New method.
1499 (cleanup_t::cleanup): Add error checking and reporting.
1500 (server_shmmgr::shmdt): Make argument non-const.
1501 (server_shmmgr::find (segment_t *)): New method.
1503 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1505 * cygserver.cc (client_request_shutdown::client_request_shutdown):
1506 Comment out verbose tracing statement.
1507 * cygserver_client.cc
1508 (client_request_get_version::client_request_get_version): Ditto.
1509 (client_request_attach_tty::client_request_attach_tty): Ditto.
1510 * cygserver_shm.cc (client_request_shm::client_request_shm):
1513 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1515 * cygserver_transport_pipes.cc (transport_layer_pipes::listen):
1516 Set `_is_listening_endpoint' appropriately.
1518 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1520 * include/cygwin/cygserver_transport.h
1521 (transport_layer_base::listen): Change return type.
1522 (transport_layer_base::connect): Ditto.
1523 * include/cygwin/cygserver_transport_pipes.h
1524 (transport_layer_pipes::listen): Change return type.
1525 (transport_layer_pipes::connect): Ditto.
1526 (transport_layer_pipes::_sec_none_nih): Remove unused field.
1527 (transport_layer_pipes::_is_listening_endpoint): New field.
1528 * cygserver_transport_pipes.cc: Synchronize with sockets code.
1529 (transport_layer_pipes::transport_layer_pipes): Initialise new
1530 field. Separate out asserts.
1531 (transport_layer_pipes::listen): Change return type. Add asserts.
1532 (transport_layer_pipes::accept): Add asserts.
1533 (transport_layer_pipes::read): Change conditional to an assert.
1535 (transport_layer_pipes::write): Ditto.
1536 (transport_layer_pipes::connect): Change return type. Change
1537 conditional to an assert. Add asserts. Rationalize error code
1539 (transport_layer_pipes::impersonate_client): Add asserts.
1540 * include/cygwin/cygserver_transport_sockets.h
1541 (transport_layer_sockets::listen): Change return type.
1542 (transport_layer_sockets::connect): Ditto.
1543 (transport_layer_sockets::_addr): Change type of field.
1544 (transport_layer_sockets::_addr_len): Ditto.
1545 (transport_layer_sockets::_is_accepted_endpoint): New field.
1546 (transport_layer_sockets::_is_listening_endpoint): Ditto.
1547 * cygserver_transport_sockets.cc
1548 (MAX_CONNECT_RETRY): New constant.
1549 (transport_layer_sockets::transport_layer_sockets): Initialise new
1550 fields. Only initialise the socket address where necessary.
1551 (transport_layer_sockets::listen): Change return type. Rewrite.
1552 (transport_layer_sockets::accept): Add asserts. Add tracing
1553 statements. Use a local variable to hold the accepted address.
1554 (transport_layer_sockets::close): Add tracing statements. Unlink
1555 the UNIX domain socket file as appropriate. Close the socket
1557 (transport_layer_sockets::read): Rewrite method.
1558 (transport_layer_sockets::write): Ditto.
1559 (transport_layer_sockets::connect): Change return type. Rewrite.
1560 * cygserver.cc (server_submission_loop::request_loop): Run the
1561 listening thread at high priority with special handling for
1563 (main): Print the request error code rather than errno in shutdown
1564 request code. Install signal handlers with sigaction(2) to avoid
1565 setting SA_RESTART. Check value of the listen method call, now it
1567 * cygserver_client.cc (client_request::make_request): Check new
1568 return value on connect method call.
1570 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1572 * include/cygwin/cygserver_transport_pipes.h
1573 (cygserver_transport_pipes::_sd): Rename field.
1574 (cygserver_transport_pipes::_sec_none_nih): Ditto.
1575 (cygserver_transport_pipes::_sec_all_nih): Ditto.
1576 (cygserver_transport_pipes::_pipe_name): Ditto.
1577 (cygserver_transport_pipes::_hPipe): Ditto.
1578 (cygserver_transport_pipes::_is_accepted_endpoint): Ditto.
1579 * cygserver_transport_pipes.cc
1580 (transport_layer_pipes::transport_layer_pipes): Rename fields.
1581 (transport_layer_pipes::init_security): Ditto.
1582 (transport_layer_pipes::listen): Ditto.
1583 (transport_layer_pipes::accept): Ditto.
1584 (transport_layer_pipes::close): Ditto.
1585 (transport_layer_pipes::read): Ditto.
1586 (transport_layer_pipes::write): Ditto.
1587 (transport_layer_pipes::connect): Ditto.
1588 (transport_layer_pipes::impersonate_client): Ditto.
1589 (transport_layer_pipes::revert_to_self): Ditto.
1590 * include/cygwin/cygserver_transport_sockets.h
1591 (cygserver_transport_sockets::_fd): Rename field.
1592 (cygserver_transport_sockets::_addr): Ditto.
1593 (cygserver_transport_sockets::_addr_len): Ditto.
1594 * cygserver_transport_sockets.cc
1595 (transport_layer_sockets::transport_layer_sockets): Rename fields.
1596 (transport_layer_sockets::listen): Ditto.
1597 (transport_layer_sockets::accept): Ditto.
1598 (transport_layer_sockets::close): Ditto.
1599 (transport_layer_sockets::read): Ditto.
1600 (transport_layer_sockets::write): Ditto.
1601 (transport_layer_sockets::connect): Ditto.
1603 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1605 * cygserver_shm.cc (with_strerr): Fix use of %p format.
1606 * shm.cc (client_shmmgr::shmat): Ditto.
1607 (client_shmmgr::shmctl): Ditto.
1608 (client_shmmgr::shmdt): Ditto.
1609 (client_shmmgr::attach): Ditto.
1611 2002-09-22 Christopher Faylor <cgf@redhat.com>
1613 * woutsup.h (system_printf): Remove extraneous semicolon from macro
1616 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1618 * cygserver_transport_pipes.cc
1619 (transport_layer_pipes::connect): Use ProtectHandle in DLL code.
1620 (transport_layer_pipes::close): Use ForceCloseHandle in DLL code.
1622 2002-09-22 Nicholas Wourms <nwourms@netscape.com>
1624 * threaded_queue.h (class queue_submission_loop): Correct friend
1625 declaration for GCC 3.1.1.
1626 * include/cygwin/cygserver_process.h (class process): Ditto.
1627 (class process_cache): Ditto.
1629 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1631 * cygserver_shm.cc (server_shmmgr::shmdt): Only call
1632 delete_segment if the segment exists [sic].
1634 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1636 * safe_memory.h: Include <new> rather than <new.h> for gcc 3.
1638 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1640 * safe_memory.h: New file extracted from "woutsup.h".
1641 * woutsup.h: Move the "safe" new/delete macros into the new
1642 "safe_memory.h" header file and include that here.
1643 * cygserver_client.cc: Explicitly include "safe_memory.h" for
1645 (client_request::make_request): Use the "safe" new/delete macros
1646 unconditionally, i.e. use them on the client side as well as on
1648 * cygserver_transport.cc: Explicitly include "safe_memory.h" for
1650 (create_server_transport): Use the "safe" new/delete macros
1651 unconditionally, i.e. use them on the client side as well as on
1653 * shm.cc: Include "safe_memory.h".
1654 (client_shmmgr::instance): Use the "safe" new/delete macros.
1655 (client_shmmgr::shmdt): Ditto.
1656 (client_shmmgr::new_segment): Ditto.
1658 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1660 * cygserver_process (process::process): Add the client's cygpid
1661 and winpid to all tracing statements as appropriate.
1662 (process::exit_code): Ditto.
1663 (process_cache::check_and_remove_process): Ditto.
1664 * cygserver_shm.cc (server_shmmgr::shmat): Ditto.
1665 (server_shmmgr::shmdt): Ditto.
1666 (server_shmmgr::shmctl): Add a process object argument and remove
1667 the explicit cygpid argument. Add the client's cygpid and winpid
1668 to all tracing statements as appropriate.
1669 (server_shmmgr::shmget): Ditto.
1670 (client_request_shm::serve): Update for the new signature of the
1671 shmctl and shmget methods.
1673 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1675 * cygserver.cc (client_request_shutdown::serve): Don't set the
1676 shutdown flag directly, but send a SIGINT, as the signal handler
1677 sets the flag and the signal breaks the pause(2) in the main loop.
1678 (print_usage): Add new options.
1679 (main): Add new --cleanup-threads and --request-threads options to
1680 set the number of threads used by the daemon. Use pause(2) rather
1681 the win32 Sleep in the main loop.
1682 * shm.cc (shmat): Add sigframe.
1687 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1689 * cygserver_shm.cc: Automatically detach processes from any
1690 segments they are attached to at exit.
1691 (class server_shmmgr::attach_t): New class.
1692 (server_shmmgr::segment_t::IS_DELETED): Rename and make private.
1693 (server_shmmgr::segment_t::_sequence): Make private.
1694 (server_shmmgr::segment_t::_flg): Ditto.
1695 (server_shmmgr::segment_t::_hFileMap): Ditto.
1696 (server_shmmgr::segment_t::_attach_head): New private field.
1697 (server_shmmgr::segment_t::segment_t): Initialise new fields.
1699 (server_shmmgr::segment_t::~segment_t): New method.
1700 (server_shmmgr::segment_t::is_deleted): Ditto.
1701 (server_shmmgr::segment_t::is_pending_delete): Ditto.
1702 (server_shmmgr::segment_t::mark_deleted): Ditto.
1703 (server_shmmgr::segment_t::attach): Ditto.
1704 (server_shmmgr::segment_t::detach): Ditto.
1705 (server_shmmgr::segment_t::find): Ditto.
1706 (class server_shmmgr::cleanup_t): New class.
1707 (server_shmmgr::_shm_atts): New private field.
1708 (server_shmmgr::shmat): Add a process object argument to replace
1709 the removed process_cache, cygpid and winpid arguments. Remove
1710 the process_cache manipulations. Move body of code to the
1711 segment_t::attach method. Increment _shm_atts when required.
1712 Update tracing statements.
1713 (server_shmmgr::shmdt): Add a process object argument to replace
1714 the removed cygpid argument. Move body of code to the
1715 segment_t::detach method. Decrement _shm_atts when required.
1716 Update tracing statements.
1717 (server_shmmgr::shmget): Use the new segment_t::is_deleted method.
1718 (server_shmmgr::server_shmmgr): Initialise the new _shm_atts
1720 (server_shmmgr::delete_segment): Remove the CloseHandle code, as
1721 this is now done in the segment_t destructor.
1722 (client_request_shm::serve): Look up the client's process object
1723 and pass to the server_shmmgr::shmat and server_shmmgr::shmdt
1724 methods rather than passing the cache, winpid and cygpid.
1725 * cygserver_process.h: Add a cygpid to the process object to make
1726 it more useful and then pass process objects rather than winpids
1728 (cleanup_routine::cleanup): Change argument to be a pointer to a
1730 (class process): Re-order fields for no discernible reason.
1731 (process::_cygpid): New field.
1732 (process::process): Add a cygpid argument.
1733 (process::winpid): New method.
1734 (process::cygpid): Ditto.
1735 (process::add): Make public, as it always should have been.
1736 (process_cache::process): Add a cygpid argument.
1737 * cygserver_process.cc (process::process): Add a cygpid argument
1738 and use it to initialise the `_cygpid' field. Re-order
1739 initialisers to match new field order.
1740 (process::cleanup): Pass `this' rather than just the winpid to
1741 cleanup_routine::cleanup.
1742 (process_cache::process): Add a cygpid argument and pass it to the
1743 process object constructor.
1744 * include/sys/shm.h (shmatt_t): Make unsigned as per SUSv3.
1745 (shm_info::shm_atts): New field.
1747 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1749 * cygserver_shm.cc (class server_shmmgr::segment_t): Add `_'
1750 prefix to the names of all fields.
1752 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1754 * msg.cc: New file of stub functions, no functionality.
1756 * shm.cc (client_shmmgr::shmctl): Add support for an out shm_info
1757 buffer for the SHM_INFO command.
1758 (client_shmmgr::shmget): Use %X to print keys.
1759 * include/sys/ipc.h: Comment all fields and values.
1760 (IPC_PRIVATE): Change to be non-negative.
1761 * include/sys/msg.h: New file with SUSv3 and ipcs(8) interfaces.
1762 * include/sys/sem.h: Ditto.
1763 * include/sys/shm.h: Comment all fields and values.
1764 (struct shm_info): New struct.
1765 * cygserver_shm.h (client_request_shm::shminfo): Rename.
1766 (client_request_shm::shm_info): New method.
1767 (client_request_shm::_parameters.out.hFileMap): Move into union.
1768 (client_request_shm::_parameters.out.shminfo): Rename.
1769 (client_request_shm::_parameters.out.shm_info): New field.
1770 * cygserver_shm.cc (server_shmmgr::_shm_ids): Rename.
1771 (server_shmmgr::_shm_tot): New field.
1772 (server_shmmgr::shmctl): Rename `out_shminfo' argument. Add
1773 `out_shm_info' argument. Fill in the `out_shm_info' argument in
1774 the SHM_INFO command.
1775 (server_shmmgr::shmget): Check `shmflg' against the mode of
1776 existing segments as per Stevens 1990, p. 123.
1777 (server_shmmgr::server_shmmgr): Initialise the new `_shm_tot'
1779 (server_shmmgr::new_segment): Set ENOMEM if CreateFileMapping
1780 fails. Pass `size' to new_segment.
1781 (server_shmmgr::new_segment): Add size argument and use it to
1782 check against and update the new `_shm_tot' field.
1783 (server_shmmgr::delete_segment): Update the new `_shm_tot' field.
1784 * Makefile.in (DLL_OFILES): Add new DLL object files.
1786 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1788 * cygserver_transport_pipes.cc: The main change is to make the
1789 client try harder to connect to the server if it's previously
1790 connected, and so has good grounds for believing that the server
1792 (MAX_WAIT_NAMED_PIPE_RETRY): Change to be an enumerator.
1793 (WAIT_NAMED_PIPE_TIMEOUT): Ditto.
1794 (transport_layer_pipes::accept): Use interlocked operators on
1796 (transport_layer_pipes::close): Rearrange so that FlushFileBuffers
1797 and DisconnectNamedPipe are only called for accepted endpoints.
1798 Use interlocked operators on `pipe_instance'.
1799 (transport_layer_pipes::read): Use set_errno where required.
1800 (transport_layer_pipes::write): Ditto.
1801 (transport_layer_pipes::connect): Add local static variable
1802 `assume_cygserver'. Set it if a connection is made to cygserver,
1803 clear it if a connection is not made even after retrying. If set,
1804 ignore all errors from CreateFile and retry the connection. Catch
1805 the situation where WaitNamedPipe fails to wait [sic] and add a
1806 `Sleep (0)' so that the server gets a chance to run.
1808 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1810 * dcrt0.cc: Only check for cygserver if and when required.
1811 (dll_crt0_1): Remove call to `cygserver_init ()'.
1812 * fhandler_tty.cc (fhandler_tty_slave::open): Change the cygserver
1813 logic to allow for the fact that `cygserver_init ()' may not yet
1815 (fhandler_tty_slave::cygserver_attach_tty): Tweak the cygserver
1816 request logic to conform to the practice elsewhere in the code.
1817 * tty.cc (tty::common_init): Add an explicit call to
1818 `cygserver_init ()' if it hasn't already been called.
1819 * include/cygwin/cygserver.h (CYGSERVER_UNAVAIL): Rename from
1821 (client_request_get_version::check_version): Make available in
1822 cygserver as well the DLL.
1823 (check_cygserver_available): Ditto. Remove `check_version_too'
1825 (cygserver_init): Ditto. And likewise.
1826 * cygserver_client.cc (client_request_get_version::check_version):
1827 Make available in cygserver as well the DLL.
1828 (client_request::make_request): This may now be called without
1829 `cygserver_init ()' having been called first. Detect this and
1830 call it as required. Add tracing.
1831 (check_cygserver_available): Make available in cygserver as well
1832 the DLL. Remove `check_version_too' argument and always check the
1833 version information. And since this is called from within
1834 `cygserver_init ()', force `cygserver_running' before calling
1835 `client_request::make_request ()'.
1836 (cygserver_init): Make available in cygserver as well the DLL.
1837 Remove `check_version_too' argument.
1839 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1841 * cygserver_shm.cc: Implement the ipcs(8) interfaces, IPC_INFO,
1842 SHM_STAT and SHM_INFO.
1843 (server_shmmgr::segment_t::sequence): New static field.
1844 (server_shmmgr::segment_t::key): Remove field, use the new
1845 ds.shm_perm.key field instead.
1846 (server_shmmgr::segment_t::shmid): Remove field.
1847 (server_shmmgr::segment_t::intid): New field.
1848 (server_shmmgr::segment_t::segment_t): Use the `key' argument to
1849 initialise `ds.shm_perm.key'. Change from using `shmid' to
1851 (server_shmmgr::_shmseg_cnt): Renamed from `_shmid_cnt'.
1852 (server_shmmgr::_intid_max): Renamed from `_shmid_max.
1853 (server_shmmgr::shmat): Move the out arguments to the start of the
1854 argument list. Rename the `pid' argument as `cygpid'. Add
1855 tracing. Pass an intid to `find ()', not a shmid.
1856 (server_shmmgr::shmctl): Add separate out arguments. Rename the
1857 `pid' argument as `cygpid'. Add support for the ipcs(8)
1858 interfaces. Add tracing. Pass an intid to `find ()', not a
1860 (server_shmmgr::shmdt): Rename the `pid' argument as `cygpid'.
1861 Add tracing. Pass an intid to `find ()', not a shmid.
1862 (server_shmmgr::shmget): Add a separate out arguments. Rename the
1863 `pid' argument as `cygpid'. Add tracing.
1864 (server_shmmgr::server_shmmgr): Update for new field names.
1865 (server_shmmgr::find_by_key): Update for the new `ds.shm_perm.key'
1867 (server_shmmgr::find): Update to use the new `segment_t::intid'
1869 (server_shmmgr::new_segment): Rename the `pid' argument as
1870 `cygpid'. Check that the requested size is within bounds. Handle
1871 new error result from `new_segment (key, HANDLE)'.
1872 (server_shmmgr::new_segment): Work with intids, not shmids. Check
1873 that the new intid is within bounds. Update for new field names.
1874 (server_shmmgr::delete_segment): Pass an intid to `find ()', not a
1875 shmid. Update for new field names.
1876 (client_request_shm::serve): Check that the incoming message
1877 length is the size of the `_parameters.in' struct, not of the
1878 whole in/out parameter union. Likewise, set the outgoing message
1879 length to the size of the `_parameters.out' struct. Update for
1880 the new server_shmmgr interfaces.
1881 * include/sys/ipc.h (ipc_perm::key): New field.
1882 * include/sys/shm.h (SHM_INFO): New constant.
1883 * cygserver_ipc.h (IPCMNI): New constant.
1884 (ipc_int2ext): Add `sequence' argument and munge this into the
1886 (ipc_ext2int_subsys): Unmunge the sequence number from the
1888 (ipc_ext2int): Ditto.
1889 (ipc_inc_id): Remove.
1890 (ipc_dec_id): Remove.
1891 * cygserver_shm.h (SHMMAX): New constant.
1896 (client_request_shm::_parameters): Re-arrange as a union of two
1897 separate structs, one for in arguments, the other for out.
1898 (client_request_shm::shmid): Update for the new parameter layout.
1899 (client_request_shm::ds): Ditto.
1900 (client_request_shm::info): New method.
1901 * shm.cc (client_shmmgr::_shmat_cnt): New static field.
1902 (client_shmmgr::shmat): Add locking. Add tracing.
1903 (client_shmmgr::shmctl): Update for ipcs(8) commands. Add
1904 tracing. Add more argument checking.
1905 (client_shmmgr::shmdt): Add locking. Add tracing. Update the new
1907 (client_shmmgr::shmget): Add tracing.
1908 (client_shmmgr::fixup_shms_after_fork): Add tracing. Add
1909 consistency checking.
1910 (client_shmmgr::attach): Add more tracing.
1911 (client_shmmgr::new_segment): Update the new `_shmat_cnt' field.
1912 (client_request_shm::client_request_shm): Update for the new
1913 parameter layout. Set the outgoing message length to the size of
1914 the `_parameters.in' struct, not of the whole in/out parameter
1917 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1919 * shm.cc: Remove the use of a static client_shmmgr object.
1920 (client_shmmgr::_instance): New static variable.
1921 (client_shmmgr::instance): Allocate a new shmmgr on the heap,
1922 rather than using a local static object.
1924 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1926 * cygserver_transport.cc (create_server_transport): Fix
1927 cut-and-paste error.
1929 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1931 * cygserver_client.cc (client_request::handle_request): Don't
1932 bother with the client request activity marker when compiled with
1935 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1937 * cygserver_transport_pipes.cc
1938 (MAX_WAIT_NAMED_PIPE_RETRY): New constant.
1939 (WAIT_NAMED_PIPE_TIMEOUT): Ditto.
1940 (transport_layer_pipes::close): The `pipe' field is now either
1941 NULL or a valid handle, and it should never have the value
1942 `INVALID_HANDLE_VALUE'.
1943 (transport_layer_pipes::read): Ditto.
1944 (transport_layer_pipes::write): Ditto.
1945 (transport_layer_pipes::connect): Ditto.
1946 (transport_layer_pipes::impersonate_client): Ditto.
1947 (transport_layer_pipes::connect): Ditto. New, but still bogus,
1950 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1952 * cygserver_shm.cc (server_shmmgr::server_shmmgr): All fields have
1953 to be initialized now that the singleton is no longer static.
1955 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1957 * cygserver_shm.cc (server_shmmgr::_instance): New static field.
1958 (server_shmmgr::_instance_once): Ditto.
1959 (server_shmmgr::initialise_instance): New static method.
1960 (server_shmmgr::instance): Use a pthread_once_t rather than
1961 relying on a local static variable.
1963 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1965 * woutsup.h: Remove all uses of the C++ new and delete operators
1966 throughout cygserver until they are fully thread-safe.
1967 (safe_new0): New macro to replace the C++ new operator.
1969 (safe_delete): New macro to replace the C++ delete operator.
1970 * cygserver_client.cc (client_request::handle_request): Replace
1971 all uses of the C++ new and delete operators with the new macros
1973 (client_request::make_request): Ditto.
1974 * cygserver_process.cc (~process_cleanup): Ditto.
1975 (process::cleanup): Ditto.
1976 (process_cache::process): Ditto.
1977 (process_cache::check_and_remove_process): Ditto.
1978 * cygserver_shm.cc (server_shmmgr::new_segment): Ditto.
1979 (server_shmmgr::delete_segment): Ditto.
1980 * cygserver_transport.cc (create_server_transport): Ditto.
1981 * cygserver_transport_pipes.cc
1982 (transport_layer_pipes::accept): Ditto.
1983 * cygserver_transport_sockets.cc
1984 (transport_layer_sockets::accept): Ditto.
1985 * threaded_queue.cc (~threaded_queue): Ditto.
1986 (threaded_queue::worker_loop): Ditto.
1987 (threaded_queue::stop): Replace sleep(3) with win32 Sleep.
1988 * cygserver.cc (~server_request): Replace all uses of the C++ new
1989 and delete operators with the new macros from "woutsup.h".
1990 (server_submission_loop::request_loop): Ditto.
1991 (main): Ditto. Replace sleep(3) with win32 Sleep. Replace
1992 iostreams with FILEs.
1993 (print_usage): Replace iostreams with FILEs.
1994 (print_version): Ditto.
1996 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
1998 * cygserver_transport_sockets.cc
1999 (transport_layer_sockets::accept): Rename local variable
2000 `accept_fd' to avoid shadowing the `fd' field.
2002 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2004 * cygwin_ipc.h: Moved (back) to "include/sys/ipc.h".
2005 * cygwin_shm.h: Moved (back) to "include/sys/shm.h".
2006 * include/sys/ipc.h: New file.
2007 * include/sys/shm.h: New file.
2008 * cygserver_shm.h: Update for new header file locations.
2011 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2013 * cygserver_client.cc (client_request::make_request): Comment out
2014 a verbose tracing statement.
2015 * cygserver_process.cc (process_cache::sync_wait_array): Fix
2017 * include/cygwin/cygserver.h (class client_request): Remove excess
2018 use of `class' qualifier in declarations.
2019 (class client_request_get_version): Ditto.
2020 (class client_request_shutdown): Ditto.
2021 (class client_request_attach_tty): Ditto.
2023 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2025 * cygserver_ipc.h: New file.
2026 * cygserver_shm.h: Re-written from scratch.
2027 * cygserver_shm.cc: Ditto.
2030 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2032 * threaded_queue.h (class queue_request): Re-write.
2033 (threaded_queue_thread_function): Remove.
2034 (class queue_process_param): Remove.
2035 (class threaded_queue): Re-write.
2036 (class queue_submission_loop): New version of the old
2037 `queue_process_param' class.
2038 (TInterlockedExchangePointer): New templated function.
2039 (TInterlockedCompareExchangePointer): Ditto.
2040 * threaded_queue.cc (worker_function): Remove.
2041 (class threaded_queue): Re-write.
2042 (class queue_process_param): Remove.
2043 (class queue_submission_loop): New version of the old
2044 `queue_process_param' class.
2045 * include/cygwin/cygserver_process.h (process_cleanup): Re-write.
2046 (class process_process_param): Remove.
2047 (class cleanup_routine): Re-write.
2048 (class process): Re-write.
2049 (class process_cache): Re-write.
2050 * cygserver_process.cc (process_cleanup): Re-write.
2051 (class process_process_param): Remove.
2052 (class cleanup_routine): Re-write.
2053 (class process): Re-write.
2054 (class process_cache): Re-write.
2055 * cygserver.cc (request_count): Remove unused variable.
2056 (class server_request): Move methods inline.
2057 (class server_process_param): Remove.
2058 (class server_request_queue): Remove.
2059 (request_queue): Move into `main ()' and change type to
2061 (request_loop): Remove.
2062 (class server_submission_loop): New version of the old
2063 `server_process_param' class.
2064 (shutdown_server): New variable.
2065 (client_request_shutdown::serve): Set `shutdown_server' to trigger
2067 (handle_signal): Ditto.
2068 (main): Install signal handler for SIGINT rather than SIGQUIT.
2069 Use new interfaces for the `request_queue' and the `cache'.
2070 Create a `server_submission_loop' and add to the `request_queue'.
2071 Add check for the `shutdown_server' variable to the main loop.
2072 * cygserver_shm.cc (client_request_shm::serve): Release the
2073 process object after use.
2075 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2077 * cygserver_client.cc (client_request::handle_request): Correct
2079 * cygserver_transport_pipes.cc: Remove local definition of
2080 FILE_FLAG_FIRST_PIPE_INSTANCE constant.
2081 * cygwin_ipc.h: Update copyright notice.
2082 * cygwin_shm.h: Ditto.
2083 * woutsup.h: Add definition of _WIN32_WINNT.
2085 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2087 * cygserver_client (client_request::make_request): Replace my
2088 inappropriate use of set_errno () with error_code () throughout.
2090 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2092 * include/cygwin/cygserver.h: Add forward declarations of class
2093 transport_layer_base and class process_cache to reduce
2094 dependencies between header files.
2095 * include/cygwin/cygserver_process.h: Add include of
2097 * cygserver.cc: Remove unnecessary cygserver header files.
2098 * cygserver_client.cc: Ditto.
2099 * cygserver_process.cc: Ditto.
2100 * cygserver_shm.cc: Ditto.
2101 * cygserver_shm.h: Ditto.
2102 * cygserver_transport_pipes.cc: Ditto.
2104 * fhandler_tty.cc: Ditto.
2107 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2109 * cygserver_shm.h: Replace <sys/shm.h> with "cygwin_shm.h" after
2111 * cygwin_ipc.h: Update with changes to include/sys/ipc.h lost in
2113 * cygwin_shm.h: Ditto.
2115 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2117 * cygserver.cc: The tests for a duplicate server instance are now
2118 the responsibility of the transport layer.
2119 (request_loop): Use new `recoverable' flag in call to
2120 `cygserver_transport::accept ()' and shutdown on an unrecoverable
2122 (main): Never call `cygserver_init ()'. Fake `cygserver_running'
2123 just for sending a shutdown request.
2124 * cygserver_client.cc (client_request::send): Comment out
2125 message-size tracing statements as verbose.
2126 (client_request::handle): Ditto.
2127 (client_request_get_version::check_version): #ifdef as DLL-only.
2128 (check_cygserver_available): Ditto.
2129 (cygserver_init): Ditto.
2130 * include/cygwin/cygserver.h
2131 (client_request_get_version::check_version): #ifdef as DLL-only.
2132 (check_cygserver_available): Ditto.
2133 (cygserver_init): Ditto.
2134 * include/cygwin/cygserver_transport.h
2135 (transport_layer_base::impersonate_client): #ifdef as
2137 (transport_layer_base::revert_to_self): Ditto.
2138 (transport_layer_base::listen): Ditto.
2139 (transport_layer_base::accept): Ditto. Add a `recoverable' out
2140 flag for error handling.
2141 * include/cygwin/cygserver_transport_sockets.h: Ditto.
2142 * include/cygwin/cygserver_transport_pipes.h: Ditto.
2143 (transport_layer_pipes): Change type of the `pipe_name' field.
2144 Remove the `inited' field, as unnecessary. Add new
2145 `is_accepted_endpoint' field.
2146 * include/cygwin/cygserver_transport.cc
2147 (transport_layer_base::impersonate_client): #ifdef as
2149 (transport_layer_base::revert_to_self): Ditto.
2150 * include/cygwin/cygserver_transport_sockets.cc
2151 (transport_layer_sockets::listen): #ifdef as cygserver-only.
2152 (transport_layer_sockets::accept): #ifdef as cygserver-only.
2153 Analyse any errno from `accept ()' and set `recoverable' as
2155 * cygserver_transport_pipes.cc: Add local #define of
2156 `FILE_FLAG_FIRST_PIPE_INSTANCE'.
2157 (pipe_instance_lock_once): New variable.
2158 (pipe_instance_lock): Ditto.
2159 (pipe_instance): Ditto.
2160 (initialise_pipe_instance_lock): New function.
2161 (transport_layer_pipes::transport_layer_pipes): Change
2162 initialization of `pipe_name'. Initialize `is_accepted_endpoint'
2163 as appropriate. Remove use of `inited'.
2164 (transport_layer_pipes::impersonate_client): #ifdef as
2166 (transport_layer_pipes::revert_to_self): Ditto.
2167 (transport_layer_pipes::listen): Ditto.
2168 (transport_layer_pipes::accept): Ditto. Keep track of how often
2169 many named pipes have been created, in the `pipe_instance'
2170 variable, and pass the `FILE_FLAG_FIRST_PIPE_INSTANCE' flag on the
2171 open of the first instance. Analyse the error code from
2172 `CreateNamedPipe ()' and set the `recoverable' flag as
2174 (transport_layer_pipes::close): Update the `pipe_instance' count.
2176 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2178 * woutsup.h (cygserver_running): Add declaration.
2179 (api_fatal): Eliminate.
2180 * include/cygwin/cygserver.h
2181 (client_request_get_version::check_version): Change return type to
2183 (check_cygserver_available): New function.
2184 (cygserver_init): Add check_version_too argument.
2185 * cygserver_client.cc (allow_daemon): Make a bool.
2186 (client_request_get_version::make_request): See errno on error.
2187 Remove special case for CYGSERVER_REQUEST_GET_VERSION; this is now
2188 handled in cygserver_init().
2189 (client_request_get_version::check_version): Use syscall_printf()
2190 instead of api_fatal(). Return true if cygserver version is
2192 (check_cygserver_available): New function; code moved here from
2194 (cygserver_init): Move some code into check_cygserver_available().
2195 * cygserver.cc (__set_errno): Copy from debug.cc so that
2196 set_errno() can be used when __OUTSIDE_CYGWIN__.
2197 (main): Call cygserver_init() to set up cygserver_running and add
2198 checks against this to (try and) prevent multiple copies of
2199 cygserver running simultaneously. Remember to delete all
2200 transport connections so that (one day) the transport classes can
2201 tidy up on cygserver shutdown.
2203 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2205 * cygserver.cc (main): Adjust tracing output for a cleaner display
2206 when compiled without --enable-debugging.
2207 * threaded_queue.cc (threaded_queue::cleanup): Ditto.
2208 (queue_process_param::stop): Ditto.
2209 * include/cygwin/cygserver.h
2210 (client_request::make_request): Make non-virtual.
2211 (client_request::send): Make virtual and protected, not private.
2212 (client_request_attach_tty::send): New virtual method.
2213 * cygserver_client.cc: Use the `msglen()' accessor rather than
2214 `_header.msglen' throughout.
2215 (client_request_attach_tty::send): New method.
2216 (client_request::make_request): Remove the explicit close of
2217 `transport' as it is closed on deletion.
2219 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2221 * include/cygwin/cygserver.h: Change the client_request classes to
2222 give greater encapsulation and to allow variable length requests
2224 (enum cygserver_request_code): Now client_request::request_code_t.
2225 (class request_header): Now client_request::header_t. Make a
2226 union of the request_code and the error_code. The `cb' field,
2227 which was the buffer length, is now the `size_t msglen' field.
2228 (struct request_get_version): Now
2229 client_request_get_version::request_get_version.
2230 (struct request_shutdown): Remove unused type.
2231 (struct request_attach_tty): Now
2232 client_request_attach_tty::request_attach_tty.
2233 (client_request::_buf): Make field const.
2234 (client_request::_buflen): New const private field.
2235 (client_request::request_code): New accessor.
2236 (client_request::error_code): Ditto.
2237 (client_request::msglen): Ditto.
2238 (client_request::handle_request): New static method.
2239 (client_request::make_request): New virtual method.
2240 (client_request::handle): New method.
2241 (client_request::send): Make private.
2242 (client_request_get_version::check_version): New method.
2243 (client_request_get_version::serve): Make private.
2244 (client_request_get_version::version): Ditto.
2245 (client_request_shutdown::serve): Ditto.
2246 (client_request_attach_tty::req): Ditto.
2247 (client_request_attach_tty::serve): Ditto.
2248 (client_request_attach_tty::from_master): Make method const.
2249 (client_request_attach_tty::from_master): Ditto.
2250 * cygserver_client.cc
2251 (client_request_get_version::client_request_get_version): Track
2252 changes to the client_request classes.
2253 (client_request_attach_tty::client_request_attach_tty): Ditto.
2254 (client_request_get_version::check_version): New method to
2255 encapsulate code from cygserver_init().
2256 (client_request_shutdown::client_request_shutdown): Move into
2258 (client_request::send): Track changes to the client_request
2259 classes. Add more error checking.
2260 (client_request::handle_request): New static method containing the
2261 first half of the old server_request::process() code.
2262 (client_request::make_request): New method to replace the old
2263 cygserver_request() function.
2264 (client_request::handle): New method containing the second half of
2265 the old server_request::process() code.
2266 (cygserver_init): Track changes to the client_request classes. In
2267 particular, some code moved into the
2268 client_request_get_version::check_version() method.
2269 * cygserver.cc (client_request_attach_tty::serve): Track changes
2270 to the client_request classes. In particular, only return a reply
2271 body if some handles are successfully duplicated for the client.
2273 (client_request_get_version::serve): Track changes to the
2274 client_request classes.
2275 (client_request_shutdown::serve): Ditto.
2276 (class client_request_invalid): Dead, and so young too.
2277 (server_request::request_buffer): Remove unnecessary field.
2278 (client_request_shutdown::client_request_shutdown): Moved here
2279 from "cygserver_client.cc".
2280 (server_request::process): Implementation moved into the new
2281 client_request::handle_request() and client_request::handle()
2283 * cygserver_shm.h (class client_request_shm): Put client- and
2284 server-specific interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__
2286 (client_request_shm::serve): Make private.
2288 (client_request_shm::client_request_shm): Track changes to the
2289 client_request classes.
2290 (client_request_shm::serve): Ditto
2291 * shm.cc (client_request_shm::client_request_shm): Ditto. Use
2292 alloc_sd() rather than set_security_attribute() to get access to
2293 the SECURITY_DESCRIPTOR length, so that we can use it to set the
2294 request body length.
2295 (shmat): Track changes to the client_request classes. In
2296 particular, allocate client_request objects on the stack rather
2297 than on the heap, and use the client_request::make_request()
2298 method rather than the old cygserver_request() function.
2302 * fhandler_tty.cc (fhandler_tty_slave::cygserver_attach_tty): Ditto.
2304 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2306 * include/cygwin/cygserver_transport.h
2307 (cygserver_transport::read): Change buffer type to void *.
2308 (cygserver_transport::write): Ditto.
2309 * include/cygwin/cygserver_transport_sockets.h
2310 (cygserver_transport_sockets::read): Ditto.
2311 (cygserver_transport_sockets::write): Ditto.
2312 * include/cygwin/cygserver_transport_pipes.h
2313 (cygserver_transport_pipes::read): Ditto.
2314 (cygserver_transport_pipes::write): Ditto.
2315 * cygserver_transport_sockets.cc
2316 (cygserver_transport_sockets::read): Ditto.
2317 (cygserver_transport_sockets::write): Ditto.
2318 * cygserver_transport_pipes.cc
2319 (cygserver_transport_pipes::read): Ditto. Set errno on error, to
2320 match behaviour of cygserver_transport_sockets class.
2321 (cygserver_transport_pipes::write): Ditto.
2323 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2325 * cygserver.cc (version): New static variable.
2326 (server_request_queue::add_connection): Remove my gratuitous use
2328 (setup_privileges): Declare static.
2329 (handle_signal): Ditto.
2330 (longopts): Make a local variable of main().
2332 (print_usage): New function.
2333 (print_version): Ditto (tip of the hat to Joshua Daniel Franklin
2334 for inspiration here).
2335 (main): More argument checking. Add --help and --version options.
2337 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2339 * include/cygwin/cygserver.h (client_request::serve): Make pure
2341 * cygserver.cc (client_request::serve): Remove definition of pure
2343 (class client_request_invalid): New class.
2344 (server_request::process): Use new client_request_invalid
2345 class. And remove goto's.
2347 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2349 * cygserver.cc (class server_request): Add virtual destructor.
2350 (server_request_queue::addConnection): New method to replace bad
2351 virtual add() method.
2352 (request_loop): Replace call to queue->add() with call to
2353 queue->addConnection().
2354 (server_request::server_request): Use field initialization.
2355 (server_request::~server_request): New virtual destructor.
2356 (server_request::process): Remove close and delete of
2357 transport_layer_base object. It is deleted by the server_request's
2358 own destructor and closed by its own destructor.
2359 * include/cygwin/cygserver.h
2360 (client_request::operator request_header): Remove unused method.
2361 * cygserver_client.cc: Ditto.
2362 * include/cygwin/cygserver_process.h
2363 (class cleanup_routine): Add virtual destructor.
2364 (cleanup_routine::cleanup): Make pure virtual.
2365 (class process_cache): Make destructor non-virtual.
2366 (process_cache::add): Ditto.
2367 * cygserver_process.cc
2368 (cleanup_routine::~cleanup_routine): New virtual destructor.
2369 * include/cygwin/cygserver_transport.h
2370 (class transport_layer_base): Add virtual destructor.
2371 * cygserver_transport.cc
2372 (transport_layer_base::~transport_layer_base): New virtual
2374 * include/cygwin/cygserver_transport_pipes.h
2375 (class transport_layer_pipes): Add virtual destructor.
2376 * cygserver_transport_pipes.cc
2377 (transport_layer_pipes::~transport_layer_pipes): New virtual
2379 (transport_layer_pipes::close): Null out handle after closing.
2380 * include/cygwin/cygserver_transport_sockets.h
2381 (class transport_layer_sockets): Add virtual destructor.
2382 * cygserver_transport_sockets.cc
2383 (transport_layer_sockets::~transport_layer_sockets): New virtual
2385 (transport_layer_sockets::close): Null out fd after closing.
2386 * threaded_queue.h (class queue_request): Add virtual destructor.
2387 (queue_request::process): Make pure virtual.
2388 * threaded_queue.cc (~queue_request): New virtual destructor.
2389 (queue_request::process): Remove definition of pure virtual
2392 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2394 * include/cygwin/cygserver.h (client_request::send): Make
2396 (class client_request_attach_tty): Put client- and server-specific
2397 interfaces inside #ifdef/#ifndef __INSIDE_CYGWIN__ guards.
2398 * cygserver_client.cc: Ditto.
2399 (cygserver_init): Fix error handling.
2401 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2403 * cygserver.cc: Throughout the code, check and correct level of
2404 the XXX_printf() functions used. Comment out several of the
2405 debug_printf() calls with "// verbose:". Reformat and correct
2406 typos of some of the XXX_printf() formats.
2407 * cygserver_process.cc: Ditto.
2408 * cygserver_shm.cc: Ditto.
2409 * cygserver_transport_pipes.cc: Ditto.
2410 * cygserver_transport_sockets.cc: Ditto.
2411 * shm.cc (hi_ulong): New function to allow printing of a 64-bit
2412 key with current small_printf implementation.
2414 (client_request_shm::client_request_shm): Use hi_ulong() and
2415 lo_ulong() in call to debug_printf().
2417 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2419 * cygserver_shm.cc: Remove #define __INSIDE_CYGWIN__ from around
2420 <sys/shm.h> as it no longer contains any internal code.
2422 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2424 * include/sys/ipc.h (IPC_PRIVATE): Add cast to key_t.
2425 (IPC_INFO): New flag for ipcs(8).
2426 (IPC_RMID IPC_SET IPC_STAT): Renumber.
2427 * include/sys/shm.h (SHM_RDONLY SHM_RND): Renumber with distinct
2429 (class _shmattach): Internal type moved to "cygserver_shm.h".
2430 (class shmnode): Ditto.
2431 (class shmid_ds): Ditto.
2432 (struct shmid_ds): Add spare fields.
2433 (struct shminfo): New type for IPC_INFO interface.
2434 * cygserver_shm.h: Remove obsolete #if 0 ... #endif block.
2435 (class shm_cleanup): Remove unused class.
2436 (struct _shmattach): Internal type moved from <sys/shm.h>.
2437 (struct shmnode): Ditto.
2438 (struct int_shmid_ds): Ditto. Renamed to avoid name clash with
2439 public interface struct shmid_ds. Use the shmid_bs structure as a
2441 * cygserver_shm.cc: Remove obsolete #if 0 ... #endif block.
2442 (client_request_shm::serve): Update for redefinition of
2443 int_shmid_ds structure.
2444 * shm.cc (build_inprocess_shmds): Ditto.
2445 (fixup_shms_after_fork): Ditto.
2447 (shmget): Ditto. Remove obsolete #if 0 ... #endif code.
2449 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2451 * include/cygwin/cygserver_transport.h
2452 (transport_layer_base::transport_layer_base): Remove since it is
2454 (transport_layer_base::listen): Make a pure virtual method.
2455 (transport_layer_base::accept): Ditto.
2456 (transport_layer_base::close): Ditto.
2457 (transport_layer_base::read): Ditto.
2458 (transport_layer_base::write): Ditto.
2459 (transport_layer_base::connect): Ditto.
2460 * cygserver_transport.cc
2461 (transport_layer_base::transport_layer_base): Remove since it is
2463 (transport_layer_base::listen): Remove since it is now a pure
2465 (transport_layer_base::accept): Ditto.
2466 (transport_layer_base::close): Ditto.
2467 (transport_layer_base::read): Ditto.
2468 (transport_layer_base::write): Ditto.
2469 (transport_layer_base::connect): Ditto.
2471 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2473 * cygserver.cc (check_and_dup_handle): Only use security code if
2474 running on NT, i.e. if wincap.has_security().
2475 (client_request_attach_tty::serve): Add check for has_security().
2476 * cygserver_process.cc (process_cache::process): Use DWORD winpid
2477 throughout to avoid win32 vs. cygwin pid confusion.
2478 (process::process): Ditto.
2479 * cygserver_shm.cc (client_request_shm::serve): Only use security
2480 code if running on NT, i.e. if wincap.has_security().
2481 * cygserver_shm.h (client_request_shm::parameters.in): Replace the
2482 ambiguous pid field with cygpid and winpid fields.
2483 (client_request_shm::client_request_shm): Reduce to only two
2484 client-side constructors: one for SHM_CREATE, another for all the
2486 * shm.cc (client_request_shm::client_request_shm):
2487 Ditto. Initialize cygpid and winpid fields here. On NT initialize
2488 sd_buf here using set_security_attribute() to make use of the euid
2490 (shmat): Use new client_request_shm constructor.
2493 (shmget): Ditto. Remove security code, now performed in the
2494 relevant client_request_shm constructor.
2495 * include/cygwin/cygserver_process.h: (class cleanup_routine):
2496 Change winpid type to DWORD.
2497 (class process): Ditto.
2499 2002-09-22 Conrad Scott <conrad.scott@dsl.pipex.com>
2501 * woutsup.h: New file.
2502 * cygserver.cc: Use "woutsup.h" and new XXX_printf macros.
2503 (getfunc): New function, copied verbatim from "strace.cc".
2504 (__cygserver__printf): New function.
2505 * cygserver_client.cc: Use "woutsup.h" and new XXX_printf macros.
2506 * cygserver_process.cc: Ditto.
2507 * cygserver_shm.cc: Ditto.
2508 * cygserver_transport.cc: Ditto.
2509 * cygserver_transport_pipes.cc: Ditto.
2510 * cygserver_transport_sockets.cc: Ditto.
2511 * threaded_queue.cc: Ditto.
2512 * shm.cc: Remove trailing \n from XXX_printf format strings.
2513 * Makefile.in: Remove special __OUTSIDE_CYGWIN__ case for
2516 2002-09-21 Christopher Faylor <cgf@redhat.com>
2518 * init.cc (dll_entry): Temporarily disable thread detach code.
2520 2002-09-21 Christopher Faylor <cgf@redhat.com>
2522 * fhandler.cc (fhandler_base::dup): Don't set handle on failure.
2523 Caller has already taken care of that.
2524 * fhandler_console.cc (fhandler_console::open): Initialize handles to
2526 (fhandler_console::close): Ditto.
2528 2002-09-21 Christopher Faylor <cgf@redhat.com>
2530 GNUify non-GNU formatted functions calls throughout.
2532 2002-09-21 Conrad Scott <conrad.scott@dsl.pipex.com>
2534 * cygwin_ipc.h: Move to "include/cygwin/ipc.h".
2535 * cygwin_shm.h: Move to "include/cygwin/shm.h".
2536 * include/cygwin/ipc.h: New file.
2537 * include/cygwin/shm.h: New file.
2538 * ipc.c:c Update <cygwin/ipc.h> include.
2539 * cygserver_shm.cc: Update <cygwin/shm.h> include.
2542 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
2544 * pthread.cc: Use class::call for converted pthread and semaphore
2546 * thread.cc: Convert various __pthread_call and __sem_call to
2547 pthread::call and sem::call throughout.
2548 * pthread.h (__pthread_cancel): Convert to pthread::cancel.
2549 (__pthread_join): Convert to pthread::join.
2550 (__pthread_detach): Convert to pthread::detach.
2551 (__pthread_create): Convert to pthread::create.
2552 (__pthread_once): Convert to pthread::once.
2553 (__pthread_atfork): Convert to pthread::atfork.
2554 (__pthread_suspend): Convert to pthread::suspend.
2555 (__pthread_continue): Convert to pthread::resume.
2556 (__sem_init): Convert to semaphore::init.
2557 (__sem_destroy): Convert to semaphore::destroy.
2558 (__sem_wait): Convert to semaphore::wait.
2559 (__sem_trywait): Convert to semaphore::trywait.
2560 (__sem_post): Convert to semaphore::post.
2562 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
2564 * thread.cc: Finish the removal of the separate pthread_key
2566 Remove all pthread_key_destructor and pthread_key_destructor_list
2567 references throughout.
2568 (pthread::exit): Call the new pthread_key interface to activate
2570 (pthread_key::keys): Change into a list.
2571 (pthread_key::saveAKey): New method, used via forEach.
2572 (pthread_key::restoreAKey): Ditto.
2573 (pthread_key::destroyAKey): Ditto.
2574 (pthread_key::fixup_before_fork): Use the List::forEach functionality.
2575 (pthread_key::fixup_after_fork): Ditto.
2576 (pthread_key::runAllDestructors): New method implementation.
2577 (pthread_key::pthread_key): Use List::Insert rather than custom list
2579 (pthread_key::~pthread_key): Use List::Remove for the same reason.
2580 * thread.h: Remove all pthread_key_destructor and
2581 pthread_key_destructor_list references throughout.
2582 (List): Move the interface above pthread_key in the header.
2583 Use atomic operations during insert and delete.
2584 (List::forEach): A generic interface for doing something on each node.
2585 (pthread_key::runAllDestructors): New method, run all destructors.
2586 (pthread_key::fork_buf): Make private.
2587 (pthread_key::run_destructor): Ditto.
2588 (pthread_key::saveAKey): New method for clearer source.
2589 (pthread_key::restoreAKey): Ditto.
2590 (pthread_key::destroyAKey): Ditto.
2591 (MTinterface::destructors): Remove.
2593 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
2595 * thread.cc: Partial refactoring of pthread_key destructor
2596 handling. Loosely based on Thomas Pfaff's work.
2597 (pthread_key_destructor_list::Insert): Remove.
2598 (pthread_key_destructor_list::Pop): Remove.
2599 (pthread_key_destructor_list::IterateNull): Call the key's
2600 run_destructor method.
2601 (pthread_key::pthread_key): Initialize new member.
2602 (pthread_key::get): Mark as const for correctness.
2603 (pthread_key::run_destructor): Implement.
2604 * thread.h (pthread_key::get): Mark as const for correctness.
2605 (pthread_key::run_destructor): Declare.
2606 (List): New template class that implements a generic list.
2607 (pthread_key_destructor_list): Inherit from List, and remove
2608 now duplicate functions.
2610 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
2612 * thread.cc: Change verifyable_object_isvalid calls with
2613 PTHREAD_CONDATTR_MAGIC, PTHREAD_MUTEXATTR_MAGIC, PTHREAD_COND_MAGIC,
2614 SEM_MAGIC to objecttype::isGoodObject() calls throughout.
2615 (pthread_condattr::isGoodObject): Implement.
2616 (pthread_mutex::isGoodInitializer): Implement.
2617 (pthread_mutex::isGoodInitializerOrObject): Minor bugfix in the
2618 check for verifyable_object_isvalid result.
2619 (pthread_mutexattr::isGoodObject): Implement.
2620 (pthread_cond::isGoodObject): Ditto.
2621 (pthread_cond::isGoodInitializer): Ditto.
2622 (pthread_cond::isGoodInitializerOrObject): Ditto.
2623 (semaphore::isGoodObject): Ditto.
2624 * thread.h (pthread_mutex::isGoodInitializer): Declare.
2625 (pthread_condattr::isGoodObject): Ditto.
2626 (pthread_cond::isGoodObject): Const correctness.
2627 (pthread_cond::isGoodInitializer): Declare.
2628 (pthread_cond::isGoodInitializerOrObject): Ditto.
2629 (semaphore::isGoodObject): Const correctness.
2631 2002-09-21 Robert Collins <rbtcollins@hotmail.com>
2633 * thread.cc: Change verifyable_object_isvalid calls with
2634 PTHREAD_MUTEX_MAGIC and PTHREAD_KEY_MAGIC and PTHREAD_ATTR_MAGIC to
2635 ::isGoodObject() calls throughout.
2636 (MTinterface::Init): Remove dead code.
2637 (pthread_attr::isGoodObject): Implement.
2638 (pthread_key::isGoodObject): Implement.
2639 (pthread_mutex::isGoodObject): Implement.
2640 (pthread_mutex::isGoodInitializerOrObject): Implement.
2641 (pthread::isGoodObject): Update signature.
2642 * thread.h (pthread_key::isGoodObject): Declare.
2643 (pthread_attr::isGoodObject): Ditto.
2644 (pthread_mutex::isGoodObject): Ditto.
2645 (pthread_mutex::isGoodInitializerOrObject): Ditto.
2646 (pthread::isGoodObject): Change to a const parameter for const
2648 (pthread_mutexattr::isGoodObject): Declare.
2649 (pthread_condattr::isGoodObject): Ditto.
2650 (pthread_cond::isGoodObject): Ditto.
2651 (semaphore::isGoodObject): Ditto.
2653 2002-09-19 Christopher Faylor <cgf@redhat.com>
2655 Cleanup calls to CreateFile throughout.
2656 * dcrt0.cc (__api_fatal): Correctly check for failing return from CreateFile.
2657 * assert.cc (__assert): Don't check return value from CreateFile for NULL.
2658 * fhandler_console.cc (set_console_state_for_spawn): Ditto.
2659 * fork.cc (fork_parent): Ditto.
2661 2002-09-18 Christopher Faylor <cgf@redhat.com>
2663 * cygthread.cc (cygthread::initialized): Avoid copying on fork or some
2664 threads may not end up in the pool.
2665 (cygthread::new): Avoid race when checking for initialized. Add
2668 2002-09-18 Pierre Humblet <pierre.humblet@ieee.org>
2670 * fhandler.cc (fhandler_base::raw_read): Add case for
2671 ERROR_INVALID_HANDLE due to Win95 directories.
2672 (fhandler_base::open): Handle errors due to Win95 directories.
2673 (fhandler_base::close): Add get_nohandle () test.
2674 (fhandler_base::set_close_on_exec): Ditto.
2675 (fhandler_base::fork_fixup): Ditto.
2676 (fhandler_base::lock): Change error code to Posix EINVAL.
2677 (fhandler_base::dup): If get_nohandle (), set new value to
2678 INVALID_HANDLE_VALUE instead of NULL.
2679 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name
2680 if get_nohandle (). Remove extraneous element from strpbrk.
2681 (fhandler_disk_file::open): Remove test for Win95 directory.
2683 * fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle ().
2684 * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
2685 * fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
2686 (fhandler_dev_zero::close): Delete.
2687 * fhandler.h (class fhandler_dev_zero): Ditto.
2689 2002-09-17 Robert Collins <rbtcollins@hotmail.com>
2691 * thread.cc (pthread_key::set): Preserve GetLastError(). Reported
2694 2002-09-17 Robert Collins <rbtcollins@hotmail.com>
2696 This work inspires by Thomas Pfaff's pthread_fork patch (1).
2697 * fork.cc (fork_child): Remove MTinterface fixup call, it's
2698 adsorbed by pthread::atforkchild.
2699 Rename __pthread_atforkchild to pthread::atforkchild to give
2700 access to private members.
2701 (fork_parent): Rename __pthread_atforkparent to
2702 pthread::atforkparent to give it access to private members.
2703 Ditto for __pthread_atforkprepare.
2704 * thread.cc: Fix some formatting problems throughout.
2705 (MTinterface::fixup_before_fork): Implement.
2706 (MTinterface::fixup_after_fork): Fix pthread_keys.
2707 (pthread_key::keys): Implement.
2708 (pthread_key::fixup_before_fork): Ditto.
2709 (pthread_key::fixup_after_fork): Ditto.
2710 (pthread_key::pthread_key): Add to pthread_key::keys.
2711 (pthread_key::~pthread_key): Remove from pthread_key::keys.
2712 (pthread_key::saveKeyToBuffer): Implement.
2713 (pthread_key::recreateKeyFromBuffer): Ditto.
2714 (pthread::atforkprepare): Prepare all MT classes for fork.
2715 (pthread::atforkchild): And fix them up afterwards.
2716 * thread.h (pthread_key): Buffer the key value during
2718 List the keys needing to be fixed up in a linked list with
2719 head pthread_key::keys.
2720 (pthread): Move atfork cygwin internal calls into the class.
2721 (MTInterface): Provide a fixup_before_fork for objecst that
2723 (__pthread_atforkprepare): Remove.
2724 (__pthread_atforkparent): Remove.
2725 (__pthread_atforkchild): Remove.
2727 2002-09-16 Christopher Faylor <cgf@redhat.com>
2729 * init.cc: Cleanup slightly and remove obsolete code.
2731 2002-09-11 Robert Collins <rbtcollins@hotmail.com>
2733 * init.cc (dll_entry): On thread detach, if the thread hasn't
2735 * pthread.cc (pthread_getsequence_np): Remove the
2736 __pthread_getsequence_np wrapper. This requires errno.h.
2737 * thread.cc (pthread::self): Instantiate a new pthread object
2738 when called and none exists. return a NULL object if instantiation
2740 (pthread::precreate): Factor out common code.
2741 (pthread::postcreate): Ditto.
2742 (pthread::create): Ditto.
2743 (pthread::exit): Remove the TLS value when we exit to prevent
2745 (MTinterface::Init): Bugfix - don't mark the TLS index as created
2746 if one was not allocated.
2747 Apply Extract Method to move pthread specific initialisation into
2749 (pthread::initMainThread): Extracted method from MTinterface::Init.
2750 (pthread::setTlsSelfPointer): Extracted method from various pthread
2751 calls, to make reading those functions easier.
2752 (pthread::setThreadIdtoCurrent): Ditto.
2753 (pthread::cancel_self): Bring into the .cc file, it's only used
2755 (pthread::getThreadId): Ditto.
2756 (pthread::thread_init_wrapper): Apply Extract Method to the TLS
2758 (pthread::isGoodObject): Extracted method from various pthread
2759 wrapper calls, for clarity of reading.
2760 (pthread::getsequence_np): Converted from __pthread_getsquence_np.
2761 (__pthread_create): Apply Extract Method to the object validation.
2762 (__pthread_cancel): Ditto.
2763 (__pthread_join): Ditto.
2764 (__pthread_detach): Ditto.
2765 (__pthread_suspend): Ditto.
2766 (__pthread_continue): Ditto.
2767 (__pthread_getschedparam): Ditto.
2768 (__pthread_getsequence_np): Remove.
2769 (__pthread_setschedparam): Apply Extract Method to the object
2771 (pthreadNull::getNullpthread): New method, return the pthreadNull
2773 (pthreadNull::pthreadNull): Private constructor to prevent accidental
2775 (pthreadNull::~pthreadNull): Prevent compile warnings.
2776 (pthreadNull::create): Override pthread behaviour.
2777 (pthreadNull::exit): Ditto.
2778 (pthreadNull::cancel): Ditto.
2779 (pthreadNull::testcancel): Ditto.
2780 (pthreadNull::setcancelstate): Ditto.
2781 (pthreadNull::setcanceltype): Ditto.
2782 (pthreadNull::push_cleanup_handler): Ditto.
2783 (pthreadNull::pop_cleanup_handler): Ditto.
2784 (pthreadNull::getsequence_np): Ditto.
2785 (pthreadNull::_instance): Ditto.
2786 * thread.h (pthread): Declare pre- and post-create.
2787 Move GetThreadId to private scope and rename to getThreadId.
2788 Move setThreadIdtoCurrent to private scope.
2789 Make create virtual.
2790 Make ~pthread virtual.
2791 Declare initMainThread.
2792 Declare isGoodObject.
2794 Make cancel virtual.
2795 Make testcancel virtual.
2796 Make setcancelstate virtual.
2797 Make setcanceltype virtual.
2798 Make push_cleanup_handler virtual.
2799 Make pop_cleanup_handler virtual.
2800 Declare getsequence_np.
2801 Declare setTlsSelfPointer.
2802 (pthreadNull): New null object class for pthread.
2803 (__pthread_getsequence_np): Remove.
2805 2002-09-13 Corinna Vinschen <corinna@vinschen.de>
2807 * syscalls.cc (seteuid32): Treat ILLEGAL_UID invalid.
2808 (setegid32): Treat ILLEGAL_GID invalid.
2810 2002-09-10 Pierre Humblet <pierre.humblet@ieee.org>
2812 * grp.cc (initgroups): Call groups::clear_supp to free the
2813 supplementary group sids that may have been set by setgroups.
2814 * security.cc (cygsidlist::free_sids): Also zero the class members.
2815 * security.h (groups::clear_supp): New.
2816 Rename cygsidlist_unknown to cygsidlist_empty.
2818 2002-09-08 Christopher Faylor <cgf@redhat.com>
2820 * fhandler_tty.cc (fhandler_tty_slave::open): Don't protect
2821 input/output handles since they are not properly manipulated later.
2822 * tty.cc (tty::make_pipes): Ditto.
2824 2002-09-06 Christopher Faylor <cgf@redhat.com>
2826 * winsup.h (_WIN32_WINNT): Protect.
2828 2002-09-06 Christopher Faylor <cgf@redhat.com>
2830 * winsup.h (_WIN32_WINNT): Define.
2832 2002-09-03 Corinna Vinschen <corinna@vinschen.de>
2834 * Makefile.in (DLL_OFILES): Drop shortcut.o.
2835 * path.cc: Move all shortcut functions from shortcut.c to here.
2836 (check_shortcut): Implement without using COM interface.
2837 * path.h: Move definition of SHORTCUT_HDR_SIZE to here.
2838 * shortcut.c: Remove.
2839 * shortcut.h: Ditto.
2841 2002-09-03 Conrad Scott <conrad.scott@dsl.pipex.com>
2843 * fhandler.h (fhandler_socket::read): Remove method.
2844 (fhandler_socket::write): Ditto.
2845 (fhandler_socket::readv): New method.
2846 (fhandler_socket::writev): Ditto.
2847 (fhandler_socket::recvmsg): Add new optional argument.
2848 (fhandler_socket::sendmsg): Ditto.
2849 * fhandler.cc (fhandler_socket::read): Remove method.
2850 (fhandler_socket::write): Ditto.
2851 (fhandler_socket::readv): New method.
2852 (fhandler_socket::writev): Ditto.
2853 (fhandler_socket::recvmsg): Use win32's scatter/gather IO where
2855 (fhandler_socket::sendmsg): Ditto.
2856 * net.cc (cygwin_recvmsg): Check the msghdr's iovec fields.
2857 (cygwin_sendmsg): Ditto. Add omitted sigframe.
2859 2002-09-02 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
2861 * cygwin.din: Revert exporting new wchar functions.
2862 * include/cygwin/version.h: Change comment for API minor 62.
2864 2002-09-02 Christopher Faylor <cgf@redhat.com>
2866 * dcrt0.cc (dll_crt0_1): Remove getpagesize() call.
2867 * shared.cc (memory_init): Move it here.
2869 2002-08-31 Christopher January <chris@atomice.net>
2871 * fhandler_proc.cc: Add <sys/param.h> include.
2872 (format_proc_uptime): Use KernelTime and UserTime only as they include
2874 (format_proc_stat): KernelTime includes IdleTime, so subtract IdleTime
2875 from KernelTime. Make number of 'jiffies' per second same as HZ define.
2876 * fhandler_process.cc: Add <sys/param.h> include.
2877 (format_process_stat): Make number of 'jiffies' per second same as
2878 HZ define. Use KernelTime and UserTime only to calculate start_time.
2880 2002-08-30 Christopher Faylor <cgf@redhat.com>
2882 (inspired by a patch from Egor Duda)
2883 * select.cc (fhandler_tty_slave::ready_for_read): Remove.
2884 * fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration.
2885 * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Set "don't
2886 need ready for read" flag.
2887 (fhandler_tty_slave::read): Don't do anything special with vtime when
2890 2002-08-30 Egor Duda <deo@logos-m.ru>
2892 * autoload.cc (GetConsoleWindow): Correct parameter count.
2894 2002-08-30 Christopher January <chris@atomice.net>
2895 Christopher Faylor <cgf@redhat.com>
2897 * tty.cc (tty_list::allocate_tty): Use GetConsoleWindow, if available.
2898 Call FindWindow in a loop.
2899 * autoload.cc (GetConsoleWindow): Export
2901 2002-08-30 Christopher Faylor <cgf@redhat.com>
2903 * miscfuncs.cc (check_iovec_for_read): Don't check buffer when zero
2905 (check_iovec_for_write): Ditto.
2907 2002-08-27 Conrad Scott <conrad.scott@dsl.pipex.com>
2909 * fhandler.h (fhandler_base::readv): New method.
2910 (fhandler_base::writev): Ditto.
2911 * fhandler.cc (fhandler_base::readv): New method.
2912 (fhandler_base::writev): Ditto.
2913 * syscalls.cc (_read): Delegate to readv(2).
2914 (_write): Ditto, mutatis mutandi.
2915 (readv): Rewrite, based on the old _read code, to use the new
2916 fhandler_base::readv method. Improve access mode handling and ensure
2917 all calls reach the final strace statement.
2918 (writev): Ditto, mutatis mutandi.
2919 * include/sys/uio.h (struct iovec): Change field types to match SUSv3.
2920 * winsup.h (check_iovec_for_read): New function.
2921 (check_iovec_for_write): Ditto.
2922 * miscfuncs.cc (check_iovec_for_read): Ditto.
2923 (check_iovec_for_write): Ditto.
2925 2002-08-30 Corinna Vinschen <corinna@vinschen.de>
2927 * cygwin.din: Add more prototypes for new wchar functions in newlib.
2929 2002-08-30 Corinna Vinschen <corinna@vinschen.de>
2931 * cygwin.din: Add prototypes for new wchar functions in newlib.
2932 * include/cygwin/version.h: Bump API minor number.
2934 2002-08-29 Boris Schaeling <boriss@web.de>
2935 Corinna Vinschen <corinna@vinschen.de>
2937 * poll.cc (poll): Peek sockets ready for read to see if there's
2940 2002-08-28 Christopher Faylor <cgf@redhat.com>
2942 * cygthread.cc (hthreads): Remove unneeded global.
2943 (cygthread::simplestub): New static member function.
2944 (cygthread::runner): Don't set hthreads.
2945 (cygthread::freerange): New member function.
2946 (cygthread::operator new): Call freerange if all cygwin slots are used
2948 (cygthread::exit_thread): Don't mess with event if freerange thread.
2949 (cygthread::detach): Ditto.
2950 * cygthread.h (class cygthread): Declare new member functions and
2953 2002-08-28 Christopher Faylor <cgf@redhat.com>
2955 * malloc.cc: Protect some definitions to avoid a compile time warning.
2957 2002-08-27 Nicholas Wourms <nwourms@netscape.net>
2959 * cygwin.din: Export getc_unlocked, getchar_unlocked,
2960 putc_unlocked, putchar_unlocked functions.
2961 * include/cygwin/version.h: Bump api minor.
2963 2002-08-28 Corinna Vinschen <corinna@vinschen.de>
2965 * fhandler_socket.cc (fhandler_socket::recvfrom): Eliminate flags
2966 not understood by WinSock.
2967 (fhandler_socket::sendto): Ditto. If WinSock sendto() returns
2968 WSAESHUTDOWN, change errno to EPIPE and raise SIGPIPE if MSG_NOSIGNAL
2970 * include/cygwin/socket.h: Define MSG_WINMASK and MSG_NOSIGNAL.
2971 * include/cygwin/version.h: Bump API minor number.
2973 2002-08-28 Corinna Vinschen <corinna@vinschen.de>
2975 * poll.cc (poll): Eliminate erroneous POLLERR conditional.
2977 2002-08-26 Conrad Scott <conrad.scott@dsl.pipex.com>
2979 * fhandler_socket.cc (fhandler_socket::check_peer_secret_event):
2981 (fhandler_socket::connect): Remove sigframe.
2982 (fhandler_socket::accept): Ditto.
2983 (fhandler_socket::getsockname): Ditto.
2984 (fhandler_socket::getpeername): Ditto.
2985 (fhandler_socket::recvfrom): Ditto.
2986 (fhandler_socket::recvmsg): Ditto.
2987 (fhandler_socket::sendto): Ditto.
2988 (fhandler_socket::sendmsg): Ditto.
2989 (fhandler_socket::close): Ditto.
2990 (fhandler_socket::ioctl): Ditto.
2991 * ioctl.cc (ioctl): Add sigframe.
2992 * net.cc (cygwin_sendto): Ditto.
2993 (cygwin_recvfrom): Ditto.
2994 (cygwin_recvfrom): Ditto.
2995 (cygwin_connect): Ditto.
2996 (cygwin_shutdown): Ditto.
2997 (cygwin_getpeername): Ditto.
2998 (cygwin_accept): Ditto. Improve strace message.
2999 (cygwin_getsockname): Ditto. Ditto.
3000 (cygwin_recvmsg): Ditto. Ditto.
3001 (cygwin_sendmsg): Fix strace message.
3003 2002-08-27 Christopher Faylor <cgf@redhat.com>
3005 * child_info.h: Add _PROC_WHOOPS enum value.
3006 (CURR_CHILD_INFO_MAGIC): Update.
3007 (child_info::magic): Make 'long'.
3008 * cygheap.h: Export _cygheap_start.
3009 * cygheap.cc: Don't declare _cygheap_start.
3010 * cygmagic: Use cksum to produce checksums. Append 'U' to end of
3012 * dcrt0.cc (initial_env): Calculate sleep ms before reusing buffer.
3013 (_dll_crt0): Detect cygheap mismatch as indicative of different cygwin
3014 version. Set child_proc_info to NULL when _PROC_WHOOPS.
3015 (multiple_cygwin_problem): If child_info specific problem, then set
3016 child_proc_info type to _PROC_WHOOPS.
3017 * shared_info.h (CURR_MOUNT_MAGIC): Update.
3018 (CURR_SHARED_MAGIC): Ditto.
3020 2002-08-25 Conrad Scott <conrad.scott@dsl.pipex.com>
3022 * fhandler.h (fhandler_socket::recvfrom): Fix prototype.
3023 (fhandler_socket::sendto): Ditto.
3024 * fhandler_socket.cc (fhandler_socket::recvfrom): Ditto.
3025 (fhandler_socket::sendto): Ditto.
3026 * include/sys/socket.h (recv): Fix prototype.
3030 * net.cc (cygwin_sendto): Ditto. Improve strace message
3031 (cygwin_recvfrom): Ditto. Ditto.
3032 (cygwin_setsockopt): Improve strace message.
3033 (cygwin_getsockopt): Ditto.
3034 (cygwin_connect): Ditto.
3035 (cygwin_accept): Ditto.
3036 (cygwin_bind): Ditto.
3037 (cygwin_getsockname): Ditto.
3038 (cygwin_getpeername): Ditto.
3039 (cygwin_recv): Fix prototype.
3040 (cygwin_send): Ditto.
3041 (cygwin_recvmsg): Improve strace message.
3042 (cygwin_sendmsg): Ditto.
3044 2002-08-25 Pierre Humblet <Pierre.Humblet@ieee.org>
3046 * sec_acl.cc (getacl): Check ace_sid == well_known_world_sid
3047 before owner_sid and group_sid so that well_known_world_sid
3048 means "other" even when owner_sid and/or group_sid are Everyone.
3049 * security.cc (get_attribute_from_acl): Created from code common
3050 to get_nt_attribute() and get_nt_object_attribute(), with same
3051 reordering as in getacl() above.
3052 (get_nt_attribute): Call get_attribute_from_acl().
3053 (get_nt_object_attribute): Ditto.
3055 2002-08-26 Christopher Faylor <cgf@redhat.com>
3057 * Makefile.in (cygrunk.exe): Make a -mno-cygwin program.
3058 * cygrun.c (main): Export CYGWIN=ntsec unless otherwise set.
3060 * shared.cc (shared_name): Only add build date to shared name when
3063 2002-08-24 Christopher Faylor <cgf@redhat.com>
3065 * Makefile.in (DLL_IMPORTS): Move libuuid.a and libshell32.a to list
3066 rather than referring to them via -l. Add DLL imports last in link
3067 line for new-cygwin.dll and cygrun.exe.
3069 2002-08-19 Christopher Faylor <cgf@redhat.com>
3071 * pinfo.h (pinfo::remember): Arrange for destructor call if
3072 proc_subproc returns error.
3073 * sigproc.cc (zombies): Store 1 + total zombies since proc_subproc uses
3076 2002-08-19 Corinna Vinschen <corinna@vinschen.de>
3078 * pwdgrp.h (pwdgrp_read::pwdgrp_read): Remove.
3079 (pwdgrp_read::~pwdgrp_read): Ditto.
3080 (pwdgrp_read::open): Reset fh to NULL instead of INVALID_HANDLE_VALUE.
3081 (pwdgrp_read::close): Ditto.
3083 2002-08-19 Christopher Faylor <cgf@redhat.com>
3085 * fhandler.h (fhandler_console::send_winch_maybe): New method.
3086 * fhandler_console.cc (set_console_state_for_spawn): Remove if 0'ed
3088 (fhandler_console::send_winch_maybe): Define new method.
3089 (fhandler_console::read): Use send_winch_maybe where appropriate.
3090 (fhandler_console::init): Just call all tcsetattr rather than
3092 * select.cc (peek_console): Reorganize so that send_winch_maybe is
3093 called for everything but keyboard input.
3095 2002-08-18 Christopher Faylor <cgf@redhat.com>
3097 * perthread.h (vfork_save): Add ctty, sid, pgid, exitval fields.
3098 (vfork_save::restore_pid): New method.
3099 (vfork_save::restore_exit): New method.
3100 * fork.cc (vfork): Save ctty, sid, pgid and restore them when returning
3101 to "parent". Use exitval field if exiting but never created a new
3103 * syscalls.cc (setsid): Detect when in "vfork" and force an actual fork
3104 so that pid will be allocated (UGLY!).
3105 (getsid): New function.
3106 * dcrt0.cc (do_exit): Use vfork_save::restore_exit method for returning
3108 * spawn.cc (spawnve): Use vfork_save::{restore_pid,restore_exit}
3109 methods for returning from vfork.
3110 * cygwin.din: Export getsid.
3111 * include/cygwin/version.h: Bump api minor number.
3113 * malloc.cc: #ifdef sYSTRIm for when MORECORE_CANNOT_TRIM is true.
3115 2002-08-18 Christopher Faylor <cgf@redhat.com>
3117 * cygmalloc.h (MORECORE_CANNOT_TRIM): Define.
3119 2002-08-18 Christopher Faylor <cgf@redhat.com>
3121 * sigproc.cc (sigCONT): Define.
3122 * sigproc.h (sigCONT): Declare.
3123 (wait_sig): Create sigCONT event here.
3124 * exceptions.cc (sig_handle_tty_stop): Wait for sigCONT event rather
3125 than stopping thread.
3126 (sig_handle): Set sigCONT event as appropriate on SIGCONT rather than
3127 calling ResumeThread.
3129 2002-08-17 Christopher Faylor <cgf@redhat.com>
3131 * malloc.cc: Update to 2.7.2.
3132 * malloc_wrapper.cc (malloc_init): Call user level mallocs to determine
3133 if the malloc routines have been overridden.
3135 2002-08-16 Christopher Faylor <cgf@redhat.com>
3137 * winsup.h: Remove malloc_*lock functions.
3139 2002-08-16 Christopher Faylor <cgf@redhat.com>
3141 * Makefile.in: Add support for new malloc.o and renamed
3142 malloc_wrapper.o. Use -fomit-frame-pointer for malloc.o compilation.
3143 * malloc_wrapper.cc: New file. Rename from malloc.cc. Add support for
3144 more malloc functions. Eliminate export_* calls. Just use straight
3145 malloc names. Remove unused argument from malloc lock functions.
3146 * cygwin.din: Just export straight malloc names. Add malloc_stats,
3147 malloc_trim, malloc_usable_size, mallopt, memalign, valloc.
3148 * dcrt0.cc (__cygwin_user): Eliminate export_* malloc entries.
3149 * fork.cc (fork_parent): Remove unused argument from malloc_lock
3151 * malloc.cc: New file. Doug Lea's malloc v2.7.1.
3152 * cygmalloc.h: New file.
3153 * include/cygwin/version.h: Bump API_MINOR.
3155 * sync.h (muto::acquire): Use appropriate number for regparm attribute.
3156 (muto::reset): Ditto.
3157 (muto::release): Ditto.
3159 2002-08-16 Pavel Tsekov <ptsekov@gmx.net>
3161 * exceptions.cc (interrupt_setup): Ensure that the previous signal mask
3164 2002-08-15 Thomas Pfaff <tpfaff@gmx.net>
3166 * dcrt0.cc: Modify define for CYGWIN_GUARD.
3167 (alloc_stack_hard_way): Just use CYGWIN_GUARD in VirtualAlloc call.
3169 2002-08-11 Conrad Scott <conrad.scott@dsl.pipex.com>
3171 * fhandler.h (fhandler_socket::recv): Remove method.
3172 (fhandler_socket::send): Ditto.
3173 * fhandler_socket.cc (fhandler_socket::recv): Ditto.
3174 (fhandler_socket::send): Ditto.
3175 (fhandler_socket::read): Delegate to fhandler_socket::recvfrom.
3176 (fhandler_socket::write): Delegate to fhandler_socket::sendto.
3177 (fhandler_socket::sendto): Check for null `to' address.
3178 * net.cc (cygwin_sendto): Check for zero request length.
3179 (cygwin_recvfrom): Ditto. Fix signature, use void *buf.
3180 (cygwin_recv): Delegate to cygwin_recvfrom.
3181 (cygwin_send): Delegate to cygwin_sendto.
3183 2002-08-11 Christopher Faylor <cgf@redhat.com>
3185 * cygthread.cc (cygthread::cygthread): Close another race.
3187 2002-08-11 Christopher Faylor <cgf@redhat.com>
3189 * assert.cc (__assert): Call debugger on assertion failure if
3191 * dcrt0.cc (dll_crt0_1): Just wait for signal thread to go live rather
3192 than going through the overhead of invoking it.
3193 * fork.cc (fork_child): Ditto.
3194 * exceptions.cc (signal_fixup_after_fork): Call sigproc_init here.
3195 * sigproc.cc (proc_can_be_signalled): Assume that the signal thread is
3197 (sig_dispatch): Ditto.
3199 (wait_for_sigthread): Rename from "wait_for_me". Assume that
3200 wait_sig_inited has been set and that this function is only called from
3202 * sigproc.h (wait_for_sigthread): Declare new function.
3204 2002-08-08 Christopher Faylor <cgf@redhat.com>
3206 * environ.cc (parse_options): Remember the "no" part of any options for
3209 2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com>
3211 * winsup.h (__check_null_invalid_struct): Make ptr argument non-const.
3212 (__check_null_invalid_struct_errno): Ditto.
3213 * miscfuncs.cc (__check_null_invalid_struct): Ditto.
3214 (__check_null_invalid_struct_errno): Ditto.
3215 (__check_invalid_read_ptr_errno): Remove superfluous cast.
3216 * net.cc (get): Set appropriate errno if fd is not a socket.
3217 (cygwin_sendto): Fix parameter checking.
3218 (cygwin_recvfrom): Ditto.
3219 (cygwin_setsockopt): Ditto.
3220 (cygwin_getsockopt): Ditto.
3221 (cygwin_connect): Ditto.
3222 (cygwin_gethostbyaddr): Ditto.
3223 (cygwin_accept): Ditto.
3224 (cygwin_bind): Ditto.
3225 (cygwin_getsockname): Ditto.
3226 (cygwin_listen): Ditto.
3227 (cygwin_getpeername): Ditto.
3228 (cygwin_send): Ditto.
3229 (cygwin_shutdown): Ditto. Move sigframe to fhandler_socket.
3230 (cygwin_recvmsg): Fix parameter checking. Add tracing.
3231 (cygwin_sendmsg): Ditto.
3232 * fhandler_socket.cc (fhandler_socket::shutdown): Add sigframe.
3233 * resource.cc (setrlimit): Fix parameter checking.
3235 2002-08-08 Joe Buehler <jbuehler@hekimian.com
3237 * sec_helper.cc (sec_acl): remove extraneous arg to debug_printf.
3239 2002-08-07 Conrad Scott <conrad.scott@dsl.pipex.com>
3241 * fhandler_socket.cc (fhandler_socket::accept): Fix FIONBIO call.
3243 2002-08-06 Christopher Faylor <cgf@redhat.com>
3245 * cygheap.cc (_csbrk): Avoid !cygheap considerations.
3246 (cygheap_init): Deal with unintialized cygheap issues here.
3247 (cheap_init): Move cygheap_max setting here.
3249 2002-08-06 Christopher Faylor <cgf@redhat.com>
3250 Conrad Scott <conrad.scott@dsl.pipex.com
3252 * cygheap.cc (_csbrk): Allocate some slop initially. Don't erroneously
3253 add sbrk amount to returned value in initial case.
3255 2002-08-06 Christopher Faylor <cgf@redhat.com>
3257 * spawn.cc (spawn_guts): Don't set mount_h here.
3258 * sigproc.cc (init_child_info): Set it here instead.
3259 * shared.cc (cygwin_mount_h): Make NO_COPY.
3261 2002-08-06 Christopher Faylor <cgf@redhat.com>
3263 * cygthread.cc (cygthread::stub): Accept flag to pass info structure to
3265 (cygthread::operator new): Add defensive debugging output.
3266 (cygthread::cygthread): Add debugging output. Set name after thread
3267 has been awakened to avoid a race.
3268 (cygthread::exit_thread): Use handle operator rather than using ev
3270 (cygthread::exit_thread): Reorganize to provide debugging. Set __name
3272 * cygthread.h (cygself): Define.
3273 * fhandler_tty.cc (fhandler_tty_master::init): Use cygself as argument
3274 so that invoked thread can access its own info.
3275 (process_output): Derive cygthread info of thread from thread argument.
3276 * sigproc.cc (sigproc_init): Use cygself as argument so that invoked
3277 thread can access its own info.
3278 (wait_sig): Derive cygthread info of thread from thread argument.
3280 2002-08-06 Conrad Scott <conrad.scott@dsl.pipex.com>
3282 * debug.h (handle_list::allocated): Remove field.
3283 * debug.cc (newh): Don't malloc extra entries.
3284 (add_handle): Downgrade strace message level.
3285 (delete_handle): Remove case for `allocated' entries.
3287 2002-08-05 Christopher Faylor <cgf@redhat.com>
3289 * cygthread.cc (cygthread::stub): Change event creation to manual
3290 reset. Set __name after calling SetEvent to prevent races.
3291 (cygthread::detach): Always reset event here to prevent races.
3293 2002-08-03 Conrad Scott <conrad.scott@dsl.pipex.com>
3295 * debug.h (WaitForMultipleObjects): Correct typo.
3297 2002-08-01 Pierre Humblet <Pierre.Humblet@ieee.org>
3299 * security.cc (verify_token): Do not reject a token just because
3300 the supplementary group list is missing Everyone or a groupsid
3301 equal to usersid, or because the primary group is not in the token,
3302 as long as it is equal to the usersid.
3303 * syscalls.cc (seteuid32): Use common code for all successful returns.
3304 * grp.cc (getgroups32): Never includes Everyone in the output.
3306 2002-08-01 Christopher Faylor <cgf@redhat.com>
3308 * cygthread.cc (cygthread::exit_thread): Define new method.
3309 * cygthread.h (cygthread::exit_thread): Declare new method.
3310 * fhandler.h (fhandler_tty_master::hThread): Delete.
3311 (fhandler_tty_master::output_thread): Define.
3312 * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Adjust
3314 (fhandler_tty_master::init): Use cygthread rather than handle.
3315 (process_output): Use cygthread method to exit.
3316 (fhandler_tty_master::fixup_after_fork): Set output_thread to NULL
3318 (fhandler_tty_master::fixup_after_exec): Set output_thread to NULL
3320 * tty.cc (tty_list::terminate): Detach from output_thread using
3323 2002-08-01 Christopher Faylor <cgf@redhat.com>
3325 * syscalls.cc (_link): Revert previous change and just always
3326 dereference the oldpath.
3328 2002-08-01 Christopher Faylor <cgf@redhat.com>
3330 * syscalls.cc (link): Properly deal with a link to a symlink.
3332 2002-08-01 Christopher Faylor <cgf@redhat.com>
3334 * cygthread.cc: Remove cruft.
3336 2002-08-01 Christopher Faylor <cgf@redhat.com>
3338 * Makefile.in (DLL_OFILES): Add cygthread.o.
3339 * dcrt0.cc (dll_crt0_1): Eliminate various thread initialization
3340 functions in favor of new cygthread class.
3341 * debug.cc: Remove thread manipulation functions.
3343 * external.cc (cygwin_internal): Use cygthread method for determining
3344 thread name. Remove capability for setting thread name.
3345 * fhandler_console.cc (fhandler_console::read): Use cygthread method
3346 rather than iscygthread function.
3347 * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Use
3348 cygthread methods to create threads.
3349 (fhandler_tty_common::__acquire_output_mutex): Use cygthread method to
3350 retrieve thread name.
3351 * select.cc (pipeinf): Use cygthread pointer rather than handle.
3352 (start_thread_pipe): Ditto.
3353 (pipe_cleanup): Ditto.
3355 (start_thread_serial): Ditto.
3356 (serial_cleanup): Ditto.
3358 (start_thread_socket): Ditto.
3359 (socket_cleanup): Ditto.
3360 * sigproc.cc (hwait_sig): Ditto.
3361 (hwait_subproc): Ditto.
3362 (proc_terminate): Ditto.
3363 (sigproc_terminate): Ditto.
3364 (sigproc_init): Initialize cygthread hwait_sig pointer.
3365 (subproc_init): Initialize cygthread hwait_subproc pointer.
3366 (wait_sig): Rely on cygthread HANDLE operator.
3367 * strace.cc (strace::vsprntf): Use cygthread::name rather than threadname.
3368 * window.cc (gethwnd): Use cygthread method to initialize thread.
3370 2002-07-31 Conrad Scott <conrad.scott@dsl.pipex.com>
3372 * fhandler.h (fhandler_base::get_r_no_interrupt): Make non-virtual.
3373 * net.cc (fdsock): Call set_r_no_interrupt.
3375 2002-07-30 Christopher Faylor <cgf@redhat.com>
3377 * syscalls.cc (_read): Clarify debugging output.
3379 2002-07-30 Christopher Faylor <cgf@redhat.com>
3381 * fhandler.h (fhandler_base::get_r_no_interrupt): Make virtual.
3383 2002-07-30 Christopher Faylor <cgf@redhat.com>
3385 * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Incorporate .
3386 and .. processing here.
3387 (fhandler_cygdrive::readdir): Assume . and .. are already in pdrive.
3388 (fhandler_cygdrive::seekdir): Ditto.
3390 2002-07-29 Christopher Faylor <cgf@redhat.com>
3392 * dcrt0.cc (dll_crt0_1): Move debug_fixup_after_fork_exec.
3393 * cygheap.cc (cygheap_fixup_in_child): Call debug_fixup_after_fork_exec
3394 immediately after cygheap has been set up.
3396 2002-07-29 Corinna Vinschen <corinna@vinschen.de>
3398 * security.cc: Change some formatting.
3399 * include/cygwin/version.h: Bump API minor version.
3401 2002-07-28 Pierre Humblet <Pierre.Humblet@ieee.org>
3403 * cygheap.h (class cygheap_user): Add member groups.
3404 * security.h (class cygsidlist): Add members type and maxcount, methods
3405 position, addfromgr, alloc_sids and free_sids and operator+= (const
3406 PSID psid). Modify contains () to call position () and optimize add ()
3408 (class user_groups): Create. Update declarations of verify_token and
3410 * security.cc (cygsidlist::alloc_sids): New.
3411 (cygsidlist::free_sids): New.
3412 (get_token_group_sidlist): Create from get_group_sidlist.
3413 (get_initgroups_sidlist): Create from get_group_sidlist.
3414 (get_group_sidlist): Suppress.
3415 (get_setgroups_sidlist): Create.
3416 (verify_token): Modify arguments. Add setgroups case.
3417 (create_token): Modify arguments. Call get_initgroups_sidlist and
3418 get_setgroups_sidlist as needed. Set SE_GROUP_LOGON_ID from auth_pos
3419 outside of the loop. Rename the various group sid lists consistently.
3420 * syscalls.cc (seteuid32): Modify to use cygheap->user.groups.
3421 (setegid32): Call cygheap->user.groups.update_pgrp.
3422 * grp.cc (setgroups): Create.
3423 (setgroups32): Create.
3424 * uinfo.cc (internal_getlogin): Initialize and update
3426 * cygwin.din: Add setgroups and setgroups32.
3428 2002-07-28 Christopher Faylor <cgf@redhat.com>
3430 * fhandler_console.cc (fhandler_console::read): Use appropriate
3432 * select.cc (peek_console): Ditto.
3433 * fhandler_termios.cc (fhandler_termios::bg_check): Send "stopped"
3434 signal to entire process group as dictated by SUSv3.
3435 * termios.cc (tcsetattr): Detect when stopped signal sent and force a
3436 stop before setting anything.
3438 2002-07-26 Christopher Faylor <cgf@redhat.com>
3440 * include/cygwin/version.h: Bump API version to indicate that ntsec is
3443 2002-07-26 Conrad Scott <conrad.scott@dsl.pipex.com>
3445 * fhandler_registry.cc (fhandler_registry::close): Return any error
3446 result to the caller.
3447 * syscalls.cc (_close): Return result of fhandler::close to the caller.
3449 2002-07-25 Christopher Faylor <cgf@redhat.com>
3451 * security.cc (allow_ntsec): Default to on.
3452 (allow_smbntsec): Default to off.
3454 2002-07-24 David MacMahon <davidm@smartsc.com>
3456 * times.cc (to_time_t): Always round time_t down to nearest second.
3458 2002-07-25 Egor Duda <deo@logos-m.ru>
3460 * Makefile.in: Check if API version is updated when exports are
3461 changed and stop if not so.
3463 2002-07-24 Egor Duda <deo@logos-m.ru>
3465 * include/cygwin/version.h: Bump minor API version.
3467 2002-07-24 Corinna Vinschen <corinna@vinschen.de>
3469 * fhandler_serial.cc: Change 'must_init_serial_line capability'
3470 to 'supports_reading_modem_output_lines' throughout (negated meaning).
3474 2002-07-23 Nicholas Wourms <nwourms@netscape.net>
3476 * cygwin.din (fcloseall): Add symbol for export.
3477 (fcloseall_r): Ditto.
3479 2002-07-24 Christopher Faylor <cgf@redhat.com>
3481 * path.cc (path_conv::check): Always set fileattr when component == 0.
3482 (readlink): Use path_conv method rather than field.
3483 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto,
3485 * path.h (path_conv): Make fileattr private.
3486 * exceptions.cc (try_to_debug): Default to idle priority when looping.
3488 2002-07-23 Corinna Vinschen <corinna@vinschen.de>
3490 * fhandler_serial.cc: Use must_init_serial_line capability throughout.
3491 * wincap.cc: Set flag must_init_serial_line appropriately.
3492 * wincap.h: Add flag must_init_serial_line.
3494 2002-07-23 Corinna Vinschen <corinna@vinschen.de>
3496 * security.cc (get_group_sidlist): Create group list from /etc files
3497 even if DC is available but access fails.
3499 2002-07-22 Christopher Faylor <cgf@redhat.com>
3501 * fhandler_serial.cc: Fix formatting problems introduced by below
3504 2002-07-22 Jacek Trzcinski <jacek@certum.pl>
3506 * fhandler.h (class fhandler_serial): Add new members of the class -
3507 rts,dtr and method ioctl(). Variables rts and dtr important for Win 9x
3509 * fhandler_serial.cc (fhandler_serial::open): Add initial setting of
3510 dtr and rts. Important for Win 9x only.
3511 (fhandler_serial::ioctl): New function. Implements commands TIOCMGET,
3512 TIOCMSET and TIOCINQ.
3513 (fhandler_serial::tcflush): Fix found error.
3514 (fhandler_serial::tcsetattr): Add settings of rts and dtr. Important
3516 * termios.h: Add new defines as a support for ioctl() function on
3519 2002-07-20 Christopher Faylor <cgf@redhat.com>
3521 * autoload.cc (LoadDLLprime): Add jmp call to allow streamlining of
3523 (doit): Avoid use of cx register. Just change one word to avoid races.
3525 2002-07-18 Pierre Humblet <pierre.humblet@ieee.org>
3527 * security.cc (get_unix_group_sidlist): Create.
3528 (get_supplementary_group_sidlist): Evolve into get_unix_group_sidlist.
3529 (get_user_local_groups): Add check for duplicates.
3530 (get_user_primary_group): Suppress.
3531 (get_group_sidlist): Silently ignore PDC unavailability.
3532 Call get_unix_group_sidlist() before get_user_local_groups().
3533 Remove call to get_supplementary_group_sidlist(). Never call
3534 get_user_primary_group() as the passwd group is always included.
3535 Add well_known_authenticated_users_sid in only one statement.
3537 2002-07-19 Christopher Faylor <cgf@redhat.com>
3539 * fhandler_serial.cc (fhandler_serial::tcflush): Fix typo.
3541 2002-07-15 Corinna Vinschen <corinna@vinschen.de>
3543 * security.cc (get_group_sidlist): Fix formatting.
3545 2002-07-14 Christopher Faylor <cgf@redhat.com>
3547 * dcrt0.cc (initial_env): Force path and CYGWIN_DEBUG contents to lower
3549 * exceptions.cc (error_start_init): Use the name derived from
3550 GetModuleName rather than myself->progname.
3552 2002-07-14 Christopher Faylor <cgf@redhat.com>
3554 * dcrt0.cc (dll_crt0_1): Move debug_init call back to here. Avoid a
3556 * shared.cc (memory_init): Remove debug_init call.
3557 * debug.h (handle_list): Change "clexec" to "inherited".
3558 * debug.cc: Remove a spurious declaration.
3559 (setclexec): Conditionalize away since it is currently unused.
3560 (add_handle): Use inherited field rather than clexec.
3561 (debug_fixup_after_fork_exec): Ditto. Move debugging output to
3563 (delete_handle): Add debugging output.
3564 * fhandler.cc (fhandler_base::set_inheritance): Don't bother setting
3565 inheritance in debugging table since the handle was never protected
3567 (fhandler_base::fork_fixup): Ditto.
3569 * exceptions.cc (debugger_command): Revert.
3571 2002-07-14 Conrad Scott <conrad.scott@dsl.pipex.com>
3573 * debug.cc (clexec): Add missing `hl = hl->next'.
3575 2002-07-14 Christopher Faylor <cgf@redhat.com>
3577 * Makefile.in (cygrun.exe): Add a -lcygwin on the end.
3579 2002-07-14 Christopher Faylor <cgf@redhat.com>
3581 * Makefile.in (cygserver.exe): Add -lstdc++.
3582 (cygrun.exe): Move -lgcc last.
3584 2002-07-13 Christopher Faylor <cgf@redhat.com>
3586 * dcrt0.cc (dll_crt0_1): Delay closing of some handles until cygheap
3588 (break_here): New function, for debugging.
3589 (initial_env): Add program name to "Sleeping" message. Implement new
3590 "CYGWIN_DEBUG" environment variable option.
3591 * exceptions.cc (debugger_command): Add argument to dumper call.
3592 * strace.cc (strace::hello): Use winpid if cygwin pid is unavailable.
3593 (strace::vsprntf): Ditto.
3595 2002-07-13 Christopher Faylor <cgf@redhat.com>
3597 * debug.h (handle_list): Move here from debug.cc. Add "inherit" flag
3599 * cygheap.cc (init_cheap): Move cygheap_max calculation to _csbrk.
3600 (_csbrk): Reorganize to not assume first allocation is <= 1 page.
3601 (cygheap_setup_for_child): Mark protected handle as inheritable.
3602 * cygheap.h (cygheap_debug): New struct.
3603 (init_cygheap): Add new structure when debugging.
3604 * dcrt0.cc (dll_crt0_1): Remove call to debug_init. Close ppid_handle
3605 here, if appropriate. Don't protect subproc_ready, since it is already
3606 protected in the parent. Call memory_init prior to ProtectHandle to
3607 ensure that cygheap is set up. Call debug_fixup_after_fork_exec when
3609 (_dll_crt0): Don't close ppid_handle here.
3610 * debug.cc: Use cygheap debug structure rather than static elements
3612 (add_handle): Don't issue a warning if attempt to protect handle in
3613 exactly the same way from exactly the same place. Add pid info to
3614 warning output. Accept additional argument controlling whether handle
3615 is to be inherited. Add pid to stored information.
3616 (debug_fixup_after_fork_exec): Renamed from debug_fixup_after_fork.
3617 Reorganize to avoid erroneously skipping handles.
3618 (mark_closed): Add pid info to warning output.
3619 (setclexec): Rename from setclexec_pid.
3620 * fhandler.cc (fhandler_base::get_default_fmode): Minor reorg.
3621 (fhandler_base::fstat): Add debugging output.
3622 (fhandler_base::set_inheritance): Call setclexec rather than
3624 (fhandler_base::fork_fixup): Ditto.
3625 * fhandler_console.cc (get_tty_stuff): Mark protected handle as
3627 * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
3628 * tty.cc (tty::make_pipes): Ditto.
3629 (tty::common_init): Ditto.
3630 * fork.cc (fork_parent): Ditto.
3631 (fork_child): Close protected handles with correct name. Remove
3632 debug_fixup_after_fork call.
3633 * fhandler_socket.cc (fhandler_socket::create_secret_event): Mark
3634 protected handle as inheritable/non-inheritable, as appropriate.
3635 * shared.cc (memory_init): Mark protected handle as inheritable.
3636 Call debug_init here.
3637 * sigproc.cc (wait_sig): Close protected handle with correct name.
3638 * spawn.cc (spawn_guts): Rename spr to subproc_ready and mark it as
3641 * exceptions.cc (debugger_command): Try to run dumper.exe, if found.
3643 * syscalls.cc (fstat64): Don't follow symlinks for path_conv lookup
3644 since path is already resolved.
3646 2002-07-12 Christopher Faylor <cgf@redhat.com>
3648 * cygwin.din: Change erroneous entries.
3650 2002-07-11 Pavel Tsekov <ptsekov@gmx.net>
3652 * fhandler_disk_file.cc (fhandler_disk_file::open): Don't
3653 move the file pointer to the end of file if O_APPEND is
3654 specified in the open flags.
3656 2002-07-09 Christopher Faylor <cgf@redhat.com>
3658 * debug.cc: Avoid explicit zeroing of globals.
3659 (lock_debug): Make locker a static member. Avoid unlocking when
3660 already unlocked (from Conrad Scott).
3661 (debug_init): Initialize lock_debug::locker here.
3662 * fork.cc (fork_child): Fix up fdtab earlier to avoid some (but not
3663 all) confusion with close-on-exec craziness.
3665 2002-07-05 Corinna Vinschen <corinna@vinschen.de>
3667 * fhandler.h (fhandler_socket::is_unconnected): Constify.
3668 (fhandler_socket::is_connect_pending): Ditto.
3669 (fhandler_socket::is_connected): Ditto.
3670 (fhandler_socket::set_connect_state): New method.
3671 (struct select_record): Add member `except_on_write'.
3672 (select_record::select_record): Initialize all bool values to `false'.
3673 * fhandler_socket.cc: Use set_connect_state() method throughout.
3674 (fhandler_socket::connect): Set state always to connected if connection
3676 * net.cc (cygwin_getsockopt): Revert erroneous previous patch.
3677 * select.cc (set_bits): Check for `except_on_write'. Set fd in
3678 write_fds if set. Set connect state to connected if fd has been
3679 returned by WINSOCK_SELECT.
3680 (peek_socket): Check for `except_on_write'.
3681 (start_thread_socket): Ditto.
3682 (fhandler_socket::select_write): Don't set `write_ready' if connect
3683 is pending. Set `except_on_write' if connect is pending.
3685 2002-07-05 Christopher Faylor <cgf@redhat.com>
3687 * ntdll.h (_SYSTEM_PROCESSOR_TIMES): Force eight byte alignment.
3688 (_SYSTEM_TIME_OF_DAY_INFORMATION): Ditto.
3690 * path.cc (suffix_scan::has): Reorganize to eliminate double scanning
3691 for for .exe (in the typical case).
3693 2002-07-05 Corinna Vinschen <corinna@vinschen.de>
3695 * fhandler.h (UNCONNECTED): New define.
3696 (CONNECT_PENDING): Ditto.
3698 (class fhandler_socket): Add member `had_connect_or_listen'.
3699 Add member functions `is_unconnected', `is_connect_pending' and
3701 * fhandler_socket.cc (fhandler_socket::connect): Set member
3702 `had_connect_or_listen' according to return code of WinSock
3704 (fhandler_socket::listen): Ditto.
3705 * net.cc (cygwin_getsockopt): Modify SO_ERROR return value in
3706 case of socket with pending connect().
3707 * select.cc (peek_socket): Only add socket to matching fd_set
3708 if it's not "ready". Call WINSOCK_SELECT only if at least one
3709 socket is in one of the fd_sets.
3710 (start_thread_socket): Only add socket to matching fd_set
3711 if it's not "ready".
3712 (fhandler_socket::select_write): Set write_ready to true also
3713 if socket isn't connected or listening.
3715 2002-07-04 Corinna Vinschen <corinna@vinschen.de>
3717 * fhandler_socket.cc (fhandler_socket::set_sun_path): Don't free
3718 memory here. Allow NULL parameter.
3720 2002-07-04 Corinna Vinschen <corinna@vinschen.de>
3722 * fhandler_socket.cc (fhandler_socket::dup): Add missing copy operation
3725 2002-07-03 Christopher Faylor <cgf@redhat.com>
3727 * include/cygwin/version.h: Bump DLL minor number.
3729 2002-07-03 Christopher Faylor <cgf@redhat.com>
3731 * include/sys/statfs.h: New header file.
3733 2002-07-03 Christopher Faylor <cgf@redhat.com>
3735 * dtable.cc (cygwin_attach_handle_to_fd): Default to implicit bin mode
3737 * fhandler.cc (fhandler_base::init): Make bin argument a guarantee
3738 rather than a suggestion.
3739 * path.cc (path_conv::check): Load flag returned from
3740 cygwin_conv_to_win32_path into path_flags.
3742 2002-07-03 Conrad Scott <conrad.scott@dsl.pipex.com>
3744 * tty.cc (tty::common_init): Reverse logic of cygserver check in
3745 call to SetKernelObjectSecurity.
3747 2002-07-03 Thomas Pfaff <tpfaff@gmx.net>
3749 * autoload.cc (WSAEventSelect): Define new autoload function.
3750 (WSAEnumNetworkEvents): Ditto.
3751 * fhandler_socket.cc (fhandler_socket::accept): If socket is
3752 in blocking mode wait for incoming connection and signal.
3754 2002-07-02 Christopher Faylor <cgf@redhat.com>
3756 * cygheap.cc (init_cheap): Rearrange error message.
3757 (cygheap_fixup_in_child): Ditto.
3758 * dtable.cc: Remove if 0'ed code.
3759 * fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode.
3760 * sec_helper.cc (cygsid::get_id): Use system_printf for error message.
3761 * tty.cc (tty::common_init): Ditto.
3763 2002-07-02 Christopher Faylor <cgf@redhat.com>
3765 * net.cc (cygwin_getpeername): Defend against NULL pointer dereference.
3767 2002-07-02 Egor Duda <deo@logos-m.ru>
3769 * include/cygwin/version.h: Bump API minor version.
3771 2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
3773 * security.cc (get_logon_server): Interpret a zero length
3774 domain as the local domain.
3775 (get_group_sidlist): Add authenticated users SID to SYSTEM's group
3776 list instead of SYSTEM itself.
3777 (verify_token): Accept the primary group sid if it equals
3780 2002-07-02 Corinna Vinschen <corinna@vinschen.de>
3782 * cygwin.din (__fpclassifyd): Add symbol.
3783 (__fpclassifyf): Ditto.
3784 (__signbitd): Ditto.
3785 (__signbitf): Ditto.
3787 2002-07-02 Corinna Vinschen <corinna@vinschen.de>
3789 * security.h (DONT_INHERIT): Eliminate definition.
3790 (INHERIT_ALL): Ditto.
3791 (INHERIT_ONLY): Ditto.
3792 * sec_acl.cc: Use appropriate defines from accctrl.h instead of the
3794 * security.cc: Ditto.
3796 2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
3798 * syscalls.c (seteuid32): Return immediately if the program is not
3799 impersonated and both uid and gid are original.
3800 (setegid32): Return immediately if the new gid is the current egid.
3802 2002-07-01 Christopher Faylor <cgf@redhat.com>
3804 * syscalls.cc (seteuid32): Fix incorrect placement of Pierre's patch
3807 2002-07-01 Christopher Faylor <cgf@redhat.com>
3809 * syscalls.cc (seteuid32): Fix incorrect use of system_printf.
3811 2002-07-02 Christopher January <chris@atomice.net>
3813 * autoload.cc (GetSecurityInfo): Define new autoload function.
3814 (RegQueryInfoKeyA): Ditto.
3815 * fhandler.h (fhandler_virtual::fill_filebuf): Change return type to
3817 (fhandler_proc::fill_filebuf): Ditto.
3818 (fhandler_registry::fill_filebuf): Ditto.
3819 (fhandler_process::fill_filebuf): Ditto.
3820 (fhandler_registry::value_name): Add new member.
3821 (fhandler_registry::close): Add new method.
3822 (fhandler_process::p): Remove member.
3823 * fhandler_proc.cc (fhandler_proc::open): Add set_nohandle after
3824 calling superclass method. Check return value of fill_filebuf.
3825 (fhandler_proc::fill_filebuf): Change return type to bool. Add return
3827 * fhandler_process.cc (fhandler_process::open): Add set_nohandle after
3828 calling superclass method. Remove references to p. Check return value
3830 (fhandler_process::fill_filebuf): Change return type to bool. Don't
3831 use dereference operator on p. Add return statement.
3832 (fhandler_process::format_process_stat): Fix typo.
3833 * fhandler_registry.cc: Add static open_key declaration.
3834 (fhandler_registry::exists): Assume path is already normalised. Try
3835 opening the path as a key in its own right first, before reverting to
3836 enumerating subkeys and values of the parent key.
3837 (fhandler_registry::fstat): Add additional code to return more relevant
3838 information about the registry key/value.
3839 (fhandler_registry::readdir): Explicitly set desired access when
3840 opening registry key. Remove output of buf from debug_printf format
3842 (fhandler_registry::open): Use set_io_handle to store registry key
3843 handle. Set value_name member. Move code to read a value from the
3844 registry to fill_filebuf. Add call to fill_filebuf.
3845 (fhandler_registry::close): New method.
3846 (fhandler_registry::fill_filebuf): Change return type to bool. Add
3847 code to read a value from registry.
3848 (fhandler_registry::open_key): Make function static. Use KEY_READ as
3849 desired access unless this is the last path component. Check the
3850 return value of RegOpenKeyEx for an error instead of hKey.
3851 * fhandler_virtual.cc (fhandler_virtual::lseek): Check the return value
3853 (fhandler_virtual::open): Remove call to set_nohandle.
3854 (fhandler_virtual::fill_filebuf): Change return type to bool. Add
3856 * security.cc (get_nt_object_attribute): New function.
3857 (get_object_attribute): New function.
3858 * security.h (get_object_attribute): New function declaration.
3860 2002-07-01 Pierre Humblet <pierre.humblet@ieee.org>
3862 * syscalls.c (seteuid32): Do not return an error when the token cannot
3863 be created only because of a problem with the gid.
3865 2002-07-01 Christopher Faylor <cgf@redhat.com>
3867 * fhandler_clipboard.c (fhandler_dev_clipboard::open): Force text mode.
3868 * fhandler_console.cc (fhandler_console::open): *Really* force binary
3869 mode rather than make it optional.
3870 * fhandler_proc.cc (fhandler_proc::open): Ditto.
3871 * fhandler_process.cc (fhandler_process::open): Ditto.
3872 * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
3873 * fhandler_raw.cc (fhandler_dev_raw::open): Ditto.
3874 * fhandler_registry.cc (fhandler_registry::open): Ditto.
3875 * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
3876 * fhandler_virtual.cc (fhandler_virtual::open): Ditto.
3877 * fhandler_windows.cc (fhandler_windows::open): Ditto.
3878 * fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
3879 * net.cc (fdsock): Ditto.
3880 * path.cc (set_flags): Add more debugging.
3882 2002-07-01 Christopher Faylor <cgf@redhat.com>
3884 * debug.cc (threads): Avoid initialization.
3885 * uinfo.cc (cygheap_user::ontherange): (from Corinna Vinschen) Actually
3886 make below changes work.
3888 2002-07-01 Christopher Faylor <cgf@redhat.com>
3890 * uinfo.cc (cygheap_user::ontherange): Make cygwin root the last resort
3891 for HOMEPATH/HOMEDRIVE for consistency with HOME.
3893 2002-07-01 Corinna Vinschen <corinna@vinschen.de>
3895 * shared.cc (sec_none): Move to sec_helper.cc.
3896 (sec_none_nih): Ditto.
3898 (sec_all_nih): Ditto.
3899 (get_null_sd): Ditto.
3901 (__sec_user): Ditto.
3902 * sec_helper.cc (sec_none): Move from shared.cc to here.
3903 (sec_none_nih): Ditto.
3905 (sec_all_nih): Ditto.
3906 (get_null_sd): Ditto.
3908 (__sec_user): Ditto.
3910 2002-06-30 Christopher Faylor <cgf@redhat.com>
3912 * uinfo.cc (cygheap_user::ontherange): Potentially set HOME from
3913 existing homepath and homedrive cygheap_user fields (not currently used
3914 yet). Set HOME to / if no other alternative.
3915 (cygheap_user::test_uid): Simplify.
3917 2002-06-30 Christopher Faylor <cgf@redhat.com>
3919 * environ.cc (parse_options): Use setenv to potentially replace CYGWIN
3920 value on export. Fixes broken behavior since November 2000 changes.
3921 (regopt): Return indication of whether or not something has been parsed
3923 (environ_init): Only attempt to export CYGWIN variable when values were
3924 set from the registry. It is exported automatically otherwise.
3926 2002-06-30 Christopher Faylor <cgf@redhat.com>
3928 * fhandler.h (fhandler_process::pid): New field.
3929 (fhandler_process::fstat): Remove unneeded array. Set pid element.
3930 (fhandler_process::open): Ditto.
3931 (fhandler_process::fill_filebuf): Handle case where 'p' field is NULL.
3933 2002-06-30 Christopher Faylor <cgf@redhat.com>
3935 * fhandler.h (fhandler_process::p): New field.
3936 (fhandler_process:fill_filebuf): Revert to same definition as virtual
3938 (fhandler_process::open): Fill out p field rather than passing as an
3940 (fhandler_process::fill_filebuf): Use p pointer rather than argument.
3942 2002-06-29 Pierre Humblet <pierre.humblet@ieee.org>
3944 * security.cc (extract_nt_dom_user): Check for all buffer overflows.
3945 Call LookupAccountSid after trying to get domain & user from passwd.
3946 (get_group_sidlist): Obtain the domain and user by calling
3947 extract_nt_dom_user instead of LookupAccountSid.
3949 2002-06-29 Christopher Faylor <cgf@redhat.com>
3951 * uinfo.cc (cygheap_user::test_uid): Use standard issetuid test.
3953 2002-06-29 Christopher Faylor <cgf@redhat.com>
3955 * autoload.cc (NetGetDCName): Change to make this an optional load
3957 * cygheap.h (cygheap_user::logsrv): Return NULL when operation fails.
3958 (cygheap_user::winname): Ditto.
3959 (cygheap_user::domain): Ditto.
3960 * uinfo.cc (cygheap_user::env_logsrv): Save results in temp variable.
3961 (cygheap_user::env_userprofile): Ditto.
3963 2002-06-29 Christopher Faylor <cgf@redhat.com>
3965 * environ.cc (spenv::retrieve): Detect return of env_dontadd from
3966 cygheap_user methods.
3967 (build_env): Avoid incrementing environment pointer if not actually
3968 adding to the environment. That could result in garbage in the
3969 environment table. Be more defensive when reallocing envblock.
3971 2002-06-29 Christopher Faylor <cgf@redhat.com>
3973 * uinfo.cc (cygheap_user::test_uid): Return NULL or further tests are
3975 (cygheap_user::env_domain): Recalculate if name is missing.
3977 2002-06-29 Christopher Faylor <cgf@redhat.com>
3979 * environ.cc (spenv::from_cygheap): Still need to take setuid into
3982 2002-06-28 Christopher Faylor <cgf@redhat.com>
3984 * uinfo.cc (cygheap_user::env_logsrv): Return "almost_null" in case
3985 where no domain or username is "SYSTEM".
3987 2002-06-28 Christopher Faylor <cgf@redhat.com>
3989 * cygheap.h (cygheap_user): Reorg to accommodate environment caching.
3990 (cygheap_user::logsrv): New method.
3991 (cygheap_user::winname): Ditto.
3992 (cygheap_user::domain): Ditto.
3993 (cygheap_user::test_uid): Ditto.
3994 * cygheap.cc (cygheap_user::set_name): Reflect name "pwinname" name
3996 * environ.cc (getwinenveq): New function.
3997 (penv::from_cygheap): penv::from_cygheap): Change arguments.
3998 (spenv::retrieve): Ditto for call. Use getwinenveq to retrieve info
3999 from environment. Always return value from cygwin environment, if it
4001 * environ.h (getwinenveq): Declare.
4002 * uinfo.cc (cygheap_user::ontherange): Use logsrv() rather than
4004 (cygheap_user::test_uid): Define new method.
4005 (cygheap_user::env_logsrv): Accept environment arguments. Use test_uid
4007 (cygheap_user::env_domain): Ditto.
4008 (cygheap_user::env_userprofile): Ditto.
4009 (cygheap_user::env_homepath): Ditto.
4010 (cygheap_user::env_homedrive): Ditto.
4011 (cygheap_user::env_name): Ditto.
4013 2002-06-27 Christopher Faylor <cgf@redhat.com>
4015 * cygheap.cc (cfree_and_set): New function.
4016 (cygheap_user::set_name): Use cfree_and_set to reset members.
4017 * cygheap.h (cygheap_user): Delete static members.
4018 (cygheap_user::puserprof): New member.
4019 (cfree_and_set): Declare.
4020 * dcrt0.cc (almost_null): Define.
4021 * environ.cc (env_dontadd): Redefine as "almost_null".
4022 * winsup.h (almost_null): Declare.
4023 * syscalls.cc (cfree_and_set): Remove unused variable.
4024 * uinfo.cc (cygheap_user::homepath_env_buf): Eliminate.
4025 (cygheap_user::homedrive_env_buf): Ditto.
4026 (cygheap_user::userprofile_env_buf): Ditto.
4027 (cygheap_user::ontherange): YA change to try to preserve existing
4028 HOMEPATH and HOMEDRIVE. Return almost_null values when variables
4029 should not actually exist.
4030 (cygheap_user::env_logsrv): Ditto.
4031 (cygheap_user::env_domain): Ditto.
4032 (cygheap_user::env_userprofile): Ditto.
4034 2002-06-27 Corinna Vinschen <corinna@vinschen.de>
4036 * dcrt0.cc (dll_crt0_1): Let __progname point to the applications
4037 basename. Move eliminating ".exe" suffix from argv[0] so that it
4038 always also affects __progname.
4040 2002-06-27 Thomas Pfaff <tpfaff@gmx.net>
4042 * thread.cc (pthread::create): Add trace printf to get CreateThread
4045 2002-06-27 Corinna Vinschen <corinna@vinschen.de>
4047 * mmap.cc (list::match): Check using pagesize aligned size.
4049 2002-06-26 Christopher Faylor <cgf@redhat.com>
4051 * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Force
4052 FindFirstFile on first file of directory when asking for x:\ .
4054 2002-06-26 Christopher Faylor <cgf@redhat.com>
4056 * cygheap.cc (cygheap_user::set_name): Correct thinko in below change.
4058 2002-06-26 Christopher Faylor <cgf@redhat.com>
4060 * cygheap.cc (cygheap_user::set_name): Avoid clearing things when just
4061 setting name to itself or during first time initialization.
4063 * environ.cc (check_case_init): Make case insensitive.
4065 2002-06-26 Corinna Vinschen <corinna@vinschen.de>
4067 * fhandler.h (fhandler_socket::bind): Add method definition.
4068 (fhandler_socket::connect): Ditto.
4069 (fhandler_socket::listen): Ditto.
4070 (fhandler_socket::accept): Ditto.
4071 (fhandler_socket::getsockname): Ditto.
4072 (fhandler_socket::getpeername): Ditto.
4073 (fhandler_socket::recvfrom): Ditto.
4074 (fhandler_socket::recvmsg): Ditto.
4075 (fhandler_socket::sendto): Ditto.
4076 (fhandler_socket::sendmsg): Ditto.
4077 (fhandler_socket::shutdown): Ditto.
4078 * fhandler_socket.cc (get_inet_addr): Move here from net.cc.
4079 (fhandler_socket::bind): New method.
4080 (fhandler_socket::connect): Ditto.
4081 (fhandler_socket::listen): Ditto.
4082 (fhandler_socket::accept): Ditto.
4083 (fhandler_socket::getsockname): Ditto.
4084 (fhandler_socket::getpeername): Ditto.
4085 (fhandler_socket::recvfrom): Ditto.
4086 (fhandler_socket::recvmsg): Ditto.
4087 (fhandler_socket::sendto): Ditto.
4088 (fhandler_socket::sendmsg): Ditto.
4089 (fhandler_socket::shutdown): Ditto.
4090 * net.cc: Various formatting cleanups throughout.
4091 (get_inet_addr): Move to fhandler_socket.cc.
4092 (cygwin_bind): Move base functionality to appropriate fhandler_socket
4094 (cygwin_connect): Ditto.
4095 (cygwin_listen): Ditto.
4096 (cygwin_accept): Ditto.
4097 (cygwin_getsockname): Ditto.
4098 (cygwin_getpeername): Ditto.
4099 (cygwin_recvfrom): Ditto.
4100 (cygwin_recvmsg): Ditto.
4101 (cygwin_sendto): Ditto.
4102 (cygwin_sendmsg): Ditto.
4103 (cygwin_shutdown): Ditto.
4105 2002-06-26 Corinna Vinschen <corinna@vinschen.de>
4107 * pwdgrp.h (pwdgrp_read::~pwdgrp_read): Avoid compiler warning.
4109 2002-06-26 Christopher Faylor <cgf@redhat.com>
4111 * dcrt0.cc (_dcrt0): Be more defensive when reserved block is used and
4112 it's not cygwin info.
4114 2002-06-26 Christopher Faylor <cgf@redhat.com>
4116 * autoload (noload): Avoid clobbering bx register.
4118 * environ.cc (codepage_init): Use case insensitive match.
4120 * fhandler_console.cc (cp_get_internal): Delete.
4121 (con_to_str): Use get_cp to derive code page.
4122 (str_to_con): Ditto.
4123 * miscfuncs.cc (get_cp): New function.
4124 (sys_wcstombs): New function. Converted from macro.
4125 (sys_mbstowcs): Ditto.
4126 * winsup.h: Reflect above changes.
4128 2002-06-26 Christopher Faylor <cgf@redhat.com>
4130 * winsup.h: Minor cleanup.
4131 * path.h (path_conv::[]): New operator.
4132 * syscalls.cc (_link): Use path_conv operators rather than methods,
4133 where appropriate. Minor white space cleanup.
4135 2002-06-26 Christopher Faylor <cgf@redhat.com>
4137 * include/cygwin/version.h: Bump DLL minor number.
4139 2002-06-25 Thomas Pfaff <tpfaff@gmx.net>
4141 * include/pthread.h (PTHREAD_CANCELED): Define a reasonable value.
4142 * pthread.cc (pthread_exit): Call method instead of function.
4143 (pthread_setcancelstate): Ditto.
4144 (pthread_setcanceltype): Ditto.
4145 (pthread_testcancel): Ditto.
4146 * thread.h (pthread::cancel_event): New member.
4147 (__pthread_cancel_self): New prototype.
4148 (pthread::exit): New Method.
4149 (pthread::cancel): Ditto.
4150 (pthread::testcancel): Ditto.
4151 (pthread::cancel_self): Ditto.
4152 (pthread::static_cancel_self): Ditto.
4153 (pthread::setcancelstate): Ditto.
4154 (pthread::setcanceltype): Ditto.
4155 (__pthread_cancel): Give c++ linkage.
4156 (__pthread_exit): Remove.
4157 (__pthread_setcancelstate): Ditto.
4158 (__pthread_setcanceltype): Ditto.
4159 (__pthread_testcancel): Ditto.
4160 * thread.cc (pthread::pthread): Inititialize cancel_event.
4161 (pthread::~pthread): Close cancel_event if needed.
4162 (pthread::create): Create cancel_event.
4163 (pthread::exit): New method. Replacement for __pthread_exit.
4164 (pthread::cancel): New method.
4165 (pthread::testcancel): Ditto.
4166 (pthread::static_cancel_self); New static method.
4167 (pthread::setcancelstate): New method. Replacement for
4168 __pthread_setcancelstate.
4169 (pthread::setcanceltype): New method. Replacement for
4170 __pthread_setcanceltype.
4171 (pthread::pop_cleanup_handler): Add lock for async cancel safe
4173 (pthread::thread_init_wrapper): Change __pthread_exit to
4175 (__pthread_cancel): Call method thread->cancel().
4176 (__pthread_exit): Remove.
4177 (__pthread_setcancelstate): Ditto.
4178 (__pthread_setcanceltype): Ditto.
4179 (__pthread_testcancel): Ditto.
4181 2002-06-25 Christopher Faylor <cgf@redhat.com>
4183 * dcrt0.cc (sm): Make NO_COPY.
4185 2002-06-25 Corinna Vinschen <corinna@vinschen.de>
4187 * syscalls.cc (chown): Convert uid to 32 bit.
4191 2002-06-24 Christopher Faylor <cgf@redhat.com>
4193 * dtable.cc (dtable::find_unused_handle): Avoid coercion.
4195 2002-06-24 Christopher Faylor <cgf@redhat.com>
4197 * dtable.cc (fhandler_base::dup2): Cleanup. Ensure that lock is turned
4198 off in error condition.
4200 2002-06-24 Corinna Vinschen <corinna@vinschen.de>
4202 * uinfo.cc (internal_getlogin): Set myself->uid and myself->gid instead
4203 of user.real_uid and user.real_gid.
4204 (uinfo_init): Evaluate orig_uid and real_uid from myself->uid. Ditto
4207 2002-06-23 Pierre Humblet <pierre.humblet@ieee.org>
4209 * security.cc (get_group_sidlist): Add pw argument and use pw->pw_name
4210 in call to get_supplementary_group_sidlist.
4211 (create_token): Add pw argument and use it in call to
4213 * security.h: Add pw argument in declaration of create_token.
4214 * syscalls.cc (seteuid32): Add pw argument in call to create_token.
4216 2002-06-23 Conrad Scott <conrad.scott@dsl.pipex.com>
4218 * fhandler.cc (fhandler_base::fstat): Set S_IFIFO for pipes.
4219 * fhandler_socket.cc (fhandler_socket.cc::fstat): Set S_IFSOCK.
4221 2002-06-23 Christopher Faylor <cgf@redhat.com>
4223 * lib/_cygwin_S_IEXEC.cc: Remove obsolete file.
4225 2002-06-23 Christopher Faylor <cgf@redhat.com>
4227 Use cygwin_{shm,ipc}.h instead of /sys/{shm,ipc}.h throughout.
4228 * sys/ipc.h: Remove.
4229 * sys/shm.h: Remove.
4230 * cygwin_ipc.h: New file.
4231 * cygwin_shm.h: New file.
4233 2002-06-23 Christopher Faylor <cgf@redhat.com>
4235 * cygwin.sc: Add recent changes from ld sources.
4237 2002-06-23 Conrad Scott <conrad.scott@dsl.pipex.com>
4239 * winsup.h: Move #ifdef EXPCGF code into "winbase.h".
4240 * winbase.h: #ifdef EXPCGF code moved here from "winsup.h".
4242 2002-06-12 Thomas Pfaff <tpfaff@gmx.net>
4244 * thread.h (pthread::cleanup_stack): Rename cleanup_handlers to
4246 * thread.cc (pthread::pthread): Ditto.
4247 (pthread::create): Fix mutex verification.
4248 (pthread::push_cleanup_handler): Renam cleanup_handlers to
4249 cleanup_stack. Remvoe Mutex calls, use InterlockedExchangePointer
4251 (pthread::pop_cleanup_handler): Rename cleanup_handlers to
4253 (pthread::pop_all_cleanup_handlers): Ditto.
4254 (__pthread_once): Check state first and return if already done.
4255 (__pthread_join): Revert DEADLOCK test to __pthread_equal call.
4256 (__pthread_detach): Unlock mutex before deletion.
4258 2002-06-21 Christopher Faylor <cgf@redhat.com>
4260 * Makefile.in (cygrun.exe): Move -lgcc where it will do some good.
4262 2002-06-21 Corinna Vinschen <corinna@vinschen.de>
4264 * syscalls.cc (stat64_to_stat32): Correctly evaluate st_rdev.
4265 (fstat64): Set st_rdev to same value as st_dev.
4266 (stat_worker): Ditto.
4268 2002-06-21 Corinna Vinschen <corinna@vinschen.de>
4270 * security.cc (alloc_sd): Carefully check owner_sid again after trying
4273 2002-06-21 Corinna Vinschen <corinna@vinschen.de>
4275 * security.cc (alloc_sd): Remove unnecessary retrieval of owner name.
4276 Check uid for current user first and use SIDs from cygheap if so.
4277 Set errno to EINVAL if user SID isn't retrievable. Just print user SID
4279 Don't bail out if group SID isn't retrievable. Change debug output
4282 2002-06-21 Christopher Faylor <cgf@redhat.com>
4284 * errno.cc: Change text description for EBADF throughout.
4286 2002-06-20 Pierre Humblet <pierre.humblet@ieee.org>
4288 * uinfo.cc (cygheap_user::ontherange): Use env_name for NetUserGetInfo.
4289 (cygheap_user::env_logsrv): Verify env_domain is valid.
4290 * environ.cc: Include child_info.h and keep spenvs[] sorted.
4291 (environ_init): Check child_proc_info instead of myself->ppid_handle.
4293 2002-06-19 Christopher Faylor <cgf@redhat.com>
4295 * fhandler.cc (fhandler_base::set_flags): Change priority of "linked
4296 in" default binmode setting so that it has priority over optional
4299 2002-06-19 Christopher Faylor <cgf@redhat.com>
4301 Use hMainProc where appropriate, throughout.
4302 * environ.cc (spenv::retrieve): Add debugging statements.
4304 * pinfo.cc (set_myself): Don't call strace.hello if already stracing.
4305 * strace.cc (strace): Move NO_COPY keyword so that it will actually
4308 2002-06-19 Corinna Vinschen <corinna@vinschen.de>
4310 * uinfo.cc (cygheap_user::ontherange): Call NetUserGetInfo() only with
4311 non-NULL logserver parameter.
4313 2002-06-16 Christopher Faylor <cgf@redhat.com>
4315 * cygheap.h (cygheap_user::issetuid): New method.
4316 * dtable.cc (dtable::vfork_child_dup): Use new method to determine if
4317 we are in "setuid mode."
4318 * fork.cc (fork_parent): Ditto.
4319 * spawn.cc (spawn_guts): Ditto.
4320 * syscalls.cc (seteuid32): Ditto.
4322 * environ.cc (spenv::retrieve): (Suggested by Pierre Humblet) Do
4323 potential recalculation of cygheap_user stuff when in setuid mode.
4324 Return special value when environment variable should be calculated but
4326 (build_env): Don't add retrieved value to dstp if it is 'dont_add'.
4328 2002-06-16 Christopher Faylor <cgf@redhat.com>
4330 Changes suggested by Pierre Humblet.
4331 * environ.cc (NL): New macro.
4332 (conv_envvars): Use NL macro to fill in name and namelen.
4333 (spenv::namelen): New field.
4334 (spenvs): Use NL to fill in name and namelen.
4335 (spenv::retrieve): Eliminate length argument. Instead, use namelen
4337 (build_env): Don't calculate length of initial FOO= part of
4338 environment. Accommodate spenv::retrive argument change.
4340 2002-06-16 Christopher Faylor <cgf@redhat.com>
4342 * cygheap.h (cygheap_user::winname): New field.
4343 * cygheap.cc (cygheap_user::set_name): Clear winname when name changes.
4344 * uinfo.cc (cygheap_user::env_logsrv): Avoid calculating server when
4345 Windows user == SYSTEM.
4346 (cygheap_user::env_domain): Set winname here too.
4347 (cygheap_user::env_userprofile): Eliminate superfluous tests.
4348 (cygheap_user::env_name): Seed winname by calling env_domain().
4350 2002-06-12 Pierre Humblet <pierre.humblet@ieee.org>
4352 * spawn.cc (spawn_guts): Revert removal of ciresrv.moreinfo->uid =
4355 2002-06-15 Christopher Faylor <cgf@redhat.com>
4357 * child_info.h (child_proc_info): Declare as base class.
4358 (spawn_info): Declare as alias of child_proc_info to aid debugging.
4360 * cygheap.cc (cygheap_fixup_in_child): Use child_proc_info global
4361 rather than parameter.
4362 * cygheap.h (cygheap_fixup_in_child): Reflect above change in
4364 * dcrt0.cc (_dll_crt0): Move 'si' definition here. Assign
4366 (dll_crt0_1): Accommodate cygheap_fixup_in_child and *_info changes.
4367 * environ.cc (spenv::retrieve): Make regparm.
4368 * environ.h (environ_init): Ditto.
4369 (win_env::add_cache): Ditto.
4372 * fork.cc (sync_with_parent): Use fork_info global.
4373 (fork_child): Ditto.
4375 2002-06-14 Christopher Faylor <cgf@redhat.com>
4377 * uinfo.cc (cygheap_user::ontherange): Don't set HOMEDRIVE or HOMEPATH
4378 unless one or the other is specified.
4380 2002-06-14 Christopher Faylor <cgf@redhat.com>
4382 * cygheap.h (cygheap_user::userprofile_env_buf): New static member.
4383 * environ.cc (build_env): Add debugging statement.
4384 (spenvs): Switch functions for USERDOMAIN and USERNAME.
4385 * spawn.cc (spawn_guts): Move environment initialization prior to
4386 cygheap_setup_for_child or environment info will never be copied to
4389 2002-06-14 Christopher Faylor <cgf@redhat.com>
4391 * cygheap.h (cygheap_user): Add static members to hold home{drive,path}
4393 * uinfo.cc (cygheap_user::ontherange): Use static class members for
4394 local HOME* storage.
4396 2002-06-14 Christopher Faylor <cgf@redhat.com>
4398 * cygheap.cc (cygheap_user::set_logsrv): Remove.
4399 (cygheap_user::set_domain): Ditto.
4400 * cygheap.h (cygheap_user::set_logsrv): Remove declaration.
4401 (cygheap_user::set_domain): Ditto.
4402 (cygheap_user::env_domain): Declare new method.
4403 (cygheap_user::env_name): Ditto.
4404 * environ.cc (spenvs): Add two environment variables.
4405 * spawn.cc (spawn_guts): Call build_env after RevertToSelf. Always set
4407 (cygheap_user::ontherange): Recalculate homedrive/homepath if they are
4408 empty. Use env_logsrv to get logon server.
4409 (cygheap_user::env_logsrv): Calculate server name here rather than
4410 relying on it having been previously calculated.
4411 (cygheap_user::env_domain): Ditto for domain name.
4412 (cygheap-user::env_name): New method.
4414 2002-06-12 Pierre Humblet <pierre.humblet@ieee.org>
4416 * syscalls.cc (seteuid32): Do not get or set the environment. Do not
4417 call LookupAccountSid nor internal_getlogin. Set cygheap->user name
4418 and sid from the passwd entry.
4419 * uinfo.cc (uinfo_init): Only call internal_getlogin when starting from
4420 a non Cygwin process and use the values returned in user.
4421 (internal_getlogin): Simplify to case where starting from a non Cygwin
4422 process. Store return values in user and return void. Do not set the
4423 Windows default environment.
4424 * dcrt0.cc (dll_crt0_1): Call uinfo_init only when needed. Do not set
4425 myself->uid nor reset user.sid.
4426 * spawn.cc (spawn_guts): Get the sid from cygheap->user. Always
4427 RevertToSelf(). Don't set uid in impersonated case.
4428 * cygheap.cc (cygheap_user::set_sid): Do not set orig_sig.
4429 (cygheap_user::set_orig_sid): New.
4430 * cygheap.h: Declare cygheap_user::set_sid.
4431 * winsup.h: Add argument to uinfo_init().
4433 2002-06-14 Corinna Vinschen <corinna@vinschen.de>
4435 * environ.cc (build_env): If realloc moves envblock, move s with it.
4437 2002-06-13 Nicholas S. Wourms <nwourms@netscape.net>
4439 * winver.rc: Add more words to copyright.
4441 2002-06-13 Corinna Vinschen <corinna@vinschen.de>
4443 * cygheap.cc (cygheap_user::set_name): Revert previous change.
4444 * environ.cc (spenv::retrieve): Check return value of call to
4445 cygheap->user.*from_cygheap().
4447 2002-06-13 Corinna Vinschen <corinna@vinschen.de>
4449 * cygheap.cc (cygheap_user::set_name): Remove setting homedrive and
4451 (cygheap_user::set_logsrv): Fix free'ing of plogsrv.
4452 * cygheap.h (cygheap_user::cygheap_user): Initialize homedrive and
4455 2002-06-13 Christopher Faylor <cgf@redhat.com>
4457 * security.cc (get_logon_server): Use strcasematch rather than
4460 2002-06-12 Christopher Faylor <cgf@redhat.com>
4462 * path.cc (chdir): Minor cleanup.
4464 2002-06-12 Christopher Faylor <cgf@redhat.com>
4466 * environ.cc (build_env): Correctly fill out windows environment block
4467 with win32 paths rather than posix paths.
4469 2002-06-12 Christopher Faylor <cgf@redhat.com>
4471 * cygheap.cc (cygheap_user::set_name): Set homedrive and homepath to
4472 NULL on user name change.
4473 (cygheap_user::set_logsrv): Allocate enough space for leading \\ so
4474 that we can put this in the environment, if needed.
4475 * cygheap.h (homebodies): New enum.
4476 (cygheap_user::homedrive): New field.
4477 (cygheap_user::homepath): Ditto.
4478 (cygheap_user::env_logsrv): New method.
4479 (cygheap_user::env_homepath): New method.
4480 (cygheap_user::env_homedrive): New method.
4481 (cygheap_user::env_userprofile): New method.
4482 (cygheap_user::ontherange): New method.
4483 * environ.cc (envsize): Eliminate debugging argument.
4484 (environ_init): Assume that envc counts number of elments not total
4487 (spenvs): New array, rename from forced_winenv_vars, using spenv.
4488 (spenv::retrieve): New method.
4489 (build_env): Rename from 'winenv' -- one stop shopping for building new
4490 environment blocks for both windows and "unix".
4491 * environ.h (build_env: Declare.
4492 (winenv): Delete declaration.
4494 * spawn.cc (spawn_guts): Use build_env to build windows and cygwin
4496 * uinfo.cc (internal_getlogin): Eliminate environment manipulation.
4497 Default to info from GetUserName if it exists. Move HOMEPATH and
4498 HOMEDRIVE stuff elsewhere. Move HOME setting elsewhere. Only set HOME
4499 environment variable in processes that are not parented by a cygwin
4501 (cygheap_user::ontherange): Define new method.
4502 (cygheap_user::env_logsrv): Ditto.
4503 (cygheap_user::env_homepath): Ditto.
4504 (cygheap_user::env_homedrive): Ditto.
4505 (cygheap_user::env_userprofile): Ditto.
4507 2002-06-11 Christopher Faylor <cgf@redhat.com>
4509 * spawn.cc (spawn_guts): More hToken removal cleanup.
4511 2002-06-09 Pierre Humblet <pierre.humblet@ieee.org>
4513 * spawn.cc (spawn_guts): Define sec_attribs and call sec_user_nih()
4516 2002-06-10 Christopher Faylor <cgf@redhat.com>
4518 * Makefile.in: Ensure that -MD gets added to CFLAGS regardless of
4519 CFLAGS command-line setting.
4521 * cygwin.din: Export sexec* functions as function which returns ENOSYS
4522 (i.e., sexec* is deprecated).
4523 * dtable.cc (dtable::vfork_child_dup): Ensure that impersonation is
4524 restored even on failure.
4525 * exec.cc: Throughout, remove references to sexec* and _spawnve.
4526 * pinfo.h: Remove _spawnve declaration.
4527 * spawn.cc: Rename _spawnve to spawnve and use throughout.
4528 (spawn_guts): Eliminate hToken argument and processing of same. Just
4529 perform special actions if impersonating.
4530 (spawnve): Rename from _spawnve.
4532 2002-06-10 Christopher Faylor <cgf@redhat.com>
4534 * include/sys/strace.h (strace): Avoid use of constructor.
4536 2002-06-10 Christopher Faylor <cgf@redhat.com>
4538 * dcrt0.cc (dll_crt0_1): Initialize wincap and check for sanity before
4539 running global ctors.
4540 * wincap.h (wincap): Eliminate constructor. Default is to zero memory,
4542 * wincap.cc (wincap): Copy this on fork to avoid initialization in
4545 2002-06-10 Corinna Vinschen <corinna@vinschen.de>
4547 * fhandler.h (fhandler_socket::fixup_after_fork): Revert patch from
4549 * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Ditto.
4550 (fhandler_socket::dup): Ditto.
4551 * net.cc (fdsock): Make sockets explicitely noninheritable on NT.
4553 2002-06-09 Christopher Faylor <cgf@redhat.com>
4555 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly
4556 set number of links for directory, if appropriate.
4558 2002-06-10 Robert Collins <rbtcollins@hotmail.com>
4560 * thread.cc: Variation of a patch from Thomas Pffaf.
4561 (__pthread_detach): Cleanup thread object if the thread has terminated.
4562 (__pthread_join): Change order of error checks, and lock against
4563 join/detach/exit races.
4564 (__pthread_exit): Lock object against join/detach/exit races.
4565 (pthread::thread_init_wrapper): Ditto.
4566 (thread_init_wrapper): Rename to pthread::thread_init_wrapper.
4567 (pthread::create): Check that the mutex initialized correctly.
4568 (pthread::push_cleanup_handler): Lock against potential cancellation
4569 race. NB: this may not be required if pthread_cleanup_push is non-
4571 * thread.h (pthread::mutex): New member.
4572 (thread_init_wrapper): Rename to pthread::thread_init_wrapper.
4573 (pthread::thread_init_wrapper_: New static member.
4575 2002-06-10 Robert Collins <rbtcollins@hotmail.com>
4577 * cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop.
4578 * pthread.cc: Change __pthread_self to pthread::self() thruoghout.
4579 (_pthread_cleanup_push): New function.
4580 (_pthread_cleanup_pop): Ditto.
4581 * thread.cc: Thanks to Thomas Pfaff for the pthread cleanup_push,_pop
4582 patch, this work is derived from that.
4583 Change __pthread_self to pthread::self() thruoghout.
4584 (__pthread_self): Rename to pthread::self.
4585 (pthread::self): New method.
4586 (pthread::pthread): Initialize new member.
4587 (pthread::push_cleanup_handler): New method.
4588 (pthread::pop_cleanup_handler): New method.
4589 (pthread::pop_all_cleanup_handlers): New method.
4590 (__pthread_exit): Pop all cleanup handlers.
4591 * thread.h (pthread::push_cleanup_handler): Declare.
4592 (pthread::pop_cleanup_handler): Ditto.
4593 (pthread::pop_all_cleanup_handlers): Ditto.
4594 (pthread::self): New static method.
4595 (__pthread_exit): Give C++ linkage.
4596 (__pthread_join): Ditto.
4597 (__pthread_detach): Ditto.
4598 (__pthread_self): Remove.
4600 2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
4602 * include/pthread.h (__pthread_cleanup_handler): New structure.
4603 (pthread_cleanup_push): Rewritten.
4604 (pthread_cleanup_pop): Ditto.
4605 (_pthread_cleanup_push): New prototype.
4606 (_pthread_cleanup_pop): Ditto.
4608 2002-04-24 Thomas Pfaff <tpfaff@gmx.net>
4610 * thread.cc (thread_init_wrapper): Check if thread is already joined.
4611 (__pthread_join): Set joiner first.
4612 (__pthread_detach): Ditto.
4614 2002-06-10 Robert Collins <rbtcollins@hotmail.com>
4616 * cygserver_transport.cc (create_server_transport): Finish the split
4617 out of sockets code from transport_layer_base. Thanks to Nicholas
4618 Wourms and Conrad Scott for catching this.
4620 2002-06-08 Christopher Faylor <cgf@redhat.com>
4622 * pinfo.cc (pinfo_dummy): Initialize to correct size.
4624 2002-06-08 Christopher Faylor <cgf@redhat.com>
4626 * path.cc: Change MOUNT_AUTO to MOUNT_CYGDRIVE throughout.
4627 * shared_info.h (CURR_MOUNT_MAGIC): Update.
4629 2002-06-08 Christopher Faylor <cgf@redhat.com>
4631 * external.cc (cygwin_internal): Make v1 mount table access invalid.
4632 * path.cc (mount_info::init): Remove had_to_create_mount_areas initialization.
4633 (mount_info::from_registry): Remove v1 table import.
4634 (mount_info::read_v1_mounts): Eliminate.
4635 (mount_info::import_v1_mounts): Ditto.
4636 * shared_info.h (mount_info): Ditto for both of above.
4637 * sys/mount.h (MOUNT_DEVFS): New enum.
4638 (MOUNT_PROC): Ditto.
4640 2002-06-08 Christopher Faylor <cgf@redhat.com>
4642 * include/wchar.h: Define __need_size_t.
4644 2002-06-07 Christopher Faylor <cgf@redhat.com>
4646 * fhandler_socket.cc (fhandler_socket::fstat): Don't assume that socket
4647 is unix-domain socket.
4649 2002-06-07 Christopher Faylor <cgf@redhat.com>
4651 * times.cc (hires_ms::prime): Set init flag.
4653 2002-06-07 Conrad Scott <conrad.scott@dsl.pipex.com>
4655 * times.cc (hires_ms::prime): Adjust epoch of initime_us from 1601 to
4658 2002-06-06 Christopher Faylor <cgf@redhat.com>
4660 * autoload.cc (timeGetDevCaps): Define new autoload function.
4661 (timeGetTime): Ditto.
4662 (timeBeginPeriod): Ditto.
4663 (timeEndPeriod): Ditto.
4664 * hires.h (hires_base): New class. Rename from hires.
4665 (hires_us): New class.
4666 (hires_ms): New class.
4667 * strace.cc (strace::microseconds): Use hires_us class.
4668 * times.cc (gettimeofday): Use hires-ms class.
4669 (hires_us::prime): Rename from hires::prime.
4670 (hires_us::usecs): Rename from hires:usecs.
4671 (hires_ms::prime): New method.
4672 (hires_ms::usecs): New method.
4673 (hires_ms::~hires_ms): New destructor.
4675 2002-06-06 Christopher Faylor <cgf@redhat.com>
4677 * autoload.cc (noload): Correctly save argument count register.
4679 2002-06-05 Conrad Scott <conrad.scott@dsl.pipex.com>
4681 * fhandler.cc (fhandler_base::fstat): Initialise tv_nsec member of
4682 st_atim, st_mtim, and st_ctim fields.
4683 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Ditto.
4684 * fhandler_process.cc (fhandler_process::fstat): Ditto.
4685 * glob.c (stat32_to_STAT): Copy across the whole st_atim, st_mtime, and
4687 * syscalls.cc (stat64_to_stat32): Ditto.
4688 * times.cc (to_timestruc_t): New function.
4689 (time_as_timestruc_t): New function.
4690 * winsup.h: Add to_timestruc_t and time_as_timestruc_t functions.
4691 * include/cygwin/stat.h: Replace time_t with timestruc_t throughout for
4692 all file times, removing the st_spare1, st_spare2, and st_spare3 fields
4693 in the process. Add macros to access tv_sec fields by old names.
4694 * include/cygwin/types.h: Typedef timespec_t and timestruc_t as struct
4697 2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
4699 * sec_helper.cc (lookup_name): Suppress.
4700 * security.cc (alloc_sd): Remove logsrv argument.
4701 Remove two calls to lookup_name.
4702 (set_security_attribute): Remove logsrv argument.
4703 Remove logsrv argument in call to alloc_sd.
4704 (set_nt_attribute): Remove logsrv argument.
4705 Remove logsrv argument in call to set_security_attribute.
4706 (set_file_attribute): Remove logsrv argument.
4707 Remove logsrv argument in call to set_nt_attribute.
4708 (set_file_attribute): Remove logsrv argument.
4709 Remove logsrv argument in call to set_file_attribute.
4710 * syscalls.cc (chown_worker): Remove logserver argument in
4711 call to set_file_attribute.
4713 * shm.cc (shmget): Remove logsrv argument in call to alloc_sd.
4714 * uinfo.cc (internal_getlogin): Replace calls to
4715 lookup_name by call to LookupAccountName.
4716 * security.h: Remove logsrv in declarations of set_file_attribute
4717 and alloc_sd. Remove declaration of lookup_name.
4719 2002-06-05 Christopher Faylor <cgf@redhat.com>
4721 * child_info.h (CHILD_INFO_MAGIC): Oops. Revert previous change. gcc
4724 2002-06-05 Christopher Faylor <cgf@redhat.com>
4726 * child_info.h (CHILD_INFO_MAGIC): Update.
4728 2002-06-05 Christopher Faylor <cgf@redhat.com>
4730 * strace.cc (strace::hello): Set inited, when appropriate.
4732 2002-06-05 Christopher Faylor <cgf@redhat.com>
4734 * cygwin.din: Eliminate some newlib wrappers.
4735 * path.cc (get_devn): Only consider first 99 potential com devices.
4736 (get_device_number): Ditto.
4737 * times.cc (_times): Eliminate.
4738 (_times): Rename from times().
4740 2002-06-05 Christopher Faylor <cgf@redhat.com>
4742 * dir.cc (rmdir): Streamline. Detect attempts to remove directories
4743 from "read-only" virtual devices. (Suggested by Pavel Tsekov)
4744 * syscalls.cc (unlink): Detect attempts to remove directories from
4745 "read-only" virtual devices. (From Pavel Tsekov)
4747 2002-06-05 Christopher Faylor <cgf@redhat.com>
4749 * dtable.cc (handle_to_fn): Check error return value from NtQueryObject
4750 first before seeing if name buffer is NULL.
4752 * grp.cc (read_etc_group): Fix gcc warning regarding snprintf format.
4753 * passwd.cc (read_etc_passwd): Ditto.
4755 2002-04-18 Thomas Pfaff <tpfaff@gmx.net>
4757 * thread.h (pthread::joiner): New member.
4758 * thread.cc (pthread::pthread): Initialize joiner to NULL
4759 (pthread::create): Increment of thread counter moved from
4760 __pthread_create to this location.
4761 (__pthread_create): Increment thread counter removed.
4762 (thread_init_wrapper): Set joiner to self when thread was created
4764 (__pthread_exit): delete thread when it is detached and not
4766 (__pthread_join): Check for deadlock and delete thread when it has
4768 (__pthread_detach): Set joiner to self when thread state
4769 changed to detached.
4771 2002-06-05 Corinna Vinschen <corinna@vinschen.de>
4773 * grp.cc (read_etc_group): When emulating nonexisting group file on
4774 NT systems, read primary group SID from process token. Use that info
4775 to create correct group entry. On error or on 9x systems fallback
4776 to emulating Administrators group as before.
4777 * passwd.cc (read_etc_passwd): When emulating nonexisting passwd file
4778 on NT systems, read user and primary group SID from process token.
4779 Use that info to create correct passwd entry. On error or on 9x
4780 systems fallback to emulating user with Administrator user id and
4781 Administrators group as before.
4783 2002-06-05 Corinna Vinschen <corinna@vinschen.de>
4785 * grp.cc (etc_group): Removed.
4786 (parse_grp): Make line parameter nonconst. Don't copy data into new
4787 allocated memory. Check for CR instead of LF to accomodate new
4789 (add_grp_line): Make line parameter nonconst.
4790 (read_etc_group): Rearrange using new pwdgrp_read class.
4791 * passwd.cc (parse_pwd): Don't copy data into new allocated memory.
4792 Check for CR instead of LF to accomodate new read method.
4793 (read_etc_passwd): Rearrange using new pwdgrp_read class.
4794 * pwdgrp.h (pwdgrp_check::set_last_modified): Use different
4796 (class pwdgrp_read): New class for opening and reading passwd and
4799 2002-06-04 Christopher Faylor <cgf@redhat.com>
4801 * dtable.cc (handle_to_fn): Attempt to handle "raw" accesses to remote
4803 * path.cc (mount_info::conv_to_win32_path): Set flags to binary when
4804 mount entry is not found.
4805 (mount_info::set_flags_from_win32_path): Ditto.
4807 2002-06-04 Christopher Faylor <cgf@redhat.com>
4809 * dtable.cc (handle_to_fn): Correct placement and length of name
4810 buffer. (Suggested by Pavel Tsekov)
4812 2002-06-04 Christopher Faylor <cgf@redhat.com>
4814 Remove fcntl.h includes throughout.
4815 * fhandler.h: Move fcntl.h include here.
4816 (fhandler_base::set_flags): Accept supplied_bin argument. Make
4818 * dtable.cc (dtable::init_std_file_from_handle): Just use binmode from
4820 (reset_to_open_binmode): Use set_flags.
4821 * cygwin.din (open): Avoid newlib wrapper.
4825 * fhandler.cc (fhandler_base::set_flags): Accept supplied_bin argument.
4826 Make binmode decisions here.
4827 (fhandler_base::open): Avoid using pc if it is NULL. Eliminate binmode
4828 logic. Just call set_flags with binmode argument.
4829 (fhandler_base::init): Call set_flags with binmode argument.
4830 * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto.
4831 * fhandler_console.cc (fhandler_console::open): Ditto.
4832 (fhandler_console::init): Force binary on open.
4833 * fhandler_disk_file.cc (fhandler_disk_file::open): Don't set binmode
4834 here. Let it happen in base class.
4835 * fhandler_dsp.cc (fhandler_dev_dsp::open): Force binmode open. Set
4836 return value appropriately if unable to open.
4837 * fhandler_proc.cc (fhandler_proc::open): Make sure flags are set
4839 * fhandler_process.cc (fhandler_process::open): Ditto.
4840 * fhandler_registry.cc (fhandler_registry::open): Ditto.
4841 * fhandler_random.cc (fhandler_dev_random::fhandler_dev_random): Ditto.
4842 * fhandler_raw.cc (fhandler_dev_raw::open): Force O_BINARY by default.
4843 * fhandler_serial.cc (fhandler_serial::init): Ditto.
4844 * fhandler_tty.cc (fhandler_tty_slave::open): Ditto.
4845 (fhandler_pty_master::open): Ditto.
4846 * fhandler_virtual.cc (fhandler_virtual::open): Ditto.
4847 * fhandler_windows.cc (fhandler_windows::open): Ditto.
4848 * fhandler_zero.cc (fhandler_dev_zero::open): Ditto.
4849 * net.cc (fdsock): Ditto.
4850 * path.cc (path_conv::check): Avoid checking for executable extension
4851 when directory. (Suggested by Pavel Tsekov)
4852 (set_flags): Set PATH_TEXT explicitly, when appropriate.
4853 (mount_info::conv_to_win32_path): Use set_flags() to set path flags.
4854 * path.h (PATH_TEXT): New enum.
4855 (path_conv::binmode): Return appropriate constant based on binmode.
4856 * pipe.cc (make_pipe): Set binmode to O_TEXT xor O_BINARY.
4857 * syscalls.cc (setmode_helper): Make debugging message a little
4859 (setmode): Set binmode via set_flags.
4861 2002-06-04 Corinna Vinschen <corinna@vinschen.de>
4863 * fhandler.h (class fhandler_socket): Add private method
4864 fixup_after_fork (bool, HANDLE).
4865 * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Move
4866 functionality to new private method. Add closing parent socket
4867 if not called from dup(). Create method new calling private method
4868 with appropriate parameter.
4869 (fhandler_socket::fixup_after_exec): Call private method
4870 fixup_after_fork with appropriate parameter.
4871 (fhandler_socket::dup): Ditto.
4873 2002-06-04 Corinna Vinschen <corinna@vinschen.de>
4875 * fhandler_dsp.cc (fhandler_dev_dsp::open): Set errno to EACCES if
4876 requested mode isn't supported.
4878 2002-06-03 Christopher Faylor <cgf@redhat.com>
4880 * fhandler.cc (fhandler_base::open): Don't set binmode if already set.
4881 Don't check for file. Files should already be set. Report on binary
4883 (fhandler_base::fhandler_base): Don't set default binmode here. That's
4885 * fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set
4886 binmode, ever, for console.
4887 * fhandler_disk_file.cc (fhandler_disk_file::open): Always set the
4888 binary mode to the value derived from mount table.
4889 * path.cc (mount_info::conv_to_win32_path): Default to binmode if path
4890 does not translate into anything in the mount table.
4892 2002-06-03 Corinna Vinschen <corinna@vinschen.de>
4894 * external.cc (cygwin_internal): Add CW_EXTRACT_DOMAIN_AND_USER
4895 handling to call extract_nt_dom_user() from applications.
4896 * include/sys/cygwin.h (cygwin_getinfo_types): Add
4897 CW_EXTRACT_DOMAIN_AND_USER.
4899 2002-06-03 Corinna Vinschen <corinna@vinschen.de>
4901 * syscalls.cc (stat64_to_stat32): Transform st_dev correctly.
4902 (fstat64): Add evaluating st_ino and st_dev.
4903 (stat_worker): Evaluate st_dev as 32 bit value.
4904 * include/cygwin/stat.h: Use new dev_t definition throughout.
4905 * include/cygwin/types.h: Define __dev16_t and __dev32_t. Define
4906 dev_t according to __CYGWIN_USE_BIG_TYPES__ setting.
4907 * include/sys/sysmacros.h: Define major, minor and makedev
4908 according to __CYGWIN_USE_BIG_TYPES__ setting.
4910 2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
4912 * syscalls.cc (setegid32): Verify the correctness of the gid
4913 of the group returned by getgrgid32.
4915 2002-06-03 Pierre Humblet <pierre.humblet@ieee.org>
4917 * security.cc (lsa2wchar): Suppressed.
4918 (get_lsa_srv_inf): Suppressed.
4919 (get_logon_server_and_user_domain): Suppressed.
4920 (get_logon_server): Essentially new.
4921 (get_user_groups): Add "domain" argument. Only lookup the
4922 designated server and use "domain" in LookupAccountName.
4923 (is_group_member): Simplify the arguments.
4924 (get_user_local_groups): Simplify the arguments. Do only a
4925 local lookup. Use "BUILTIN" and local domain in LookupAccountName.
4926 (get_user_primary_group). Only lookup the designated server.
4927 (get_group_sidlist): Remove logonserver argument. Do not lookup
4928 any server for the SYSTEM account.
4929 (create_token): Delete logonserver and call to get_logon_server.
4930 Adjust arguments of get_group_sidlist, see above.
4931 * security.h: Delete declaration of get_logon_server_and_user_domain
4932 and add declaration of get_logon_server.
4933 * uinfo.cc (internal_get_login): Call get_logon_server instead of
4934 get_logon_server_and_user_domain.
4936 2002-06-02 Christopher Faylor <cgf@redhat.com>
4938 * dtable.cc (handle_to_fn): Use largest match for device. Correctly
4939 (?) deal with remote drive weirdness.
4941 2002-06-02 Christopher Faylor <cgf@redhat.com>
4943 * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Check
4944 specifically for non-existent file, first.
4945 (fhandler_disk_file::fstat): Perform fd open on files with funny
4948 2002-06-02 Christopher January <chris@atomice.net>
4950 * fhandler_process.cc (fhandler_process::open): Set fileid.
4952 2002-06-02 Christopher Faylor <cgf@redhat.com>
4954 Remove unneeded sigproc.h includes throughout.
4955 * fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument.
4956 * fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search
4958 (fhandler_proc::readdir): Assume that pid exists if it shows up in the
4960 * fhandler_process.cc (fhandler_process::open): Simplify search for
4961 given pid. Call fill_filebuf with pinfo argument.
4962 (fhandler_process::fill_filebuf): Pass pinfo here and assume that it
4964 * pinfo.h (pinfo::remember): Define differently if sigproc.h is not
4967 2002-06-02 Christopher Faylor <cgf@redhat.com>
4969 * dll_init.cc (dll_list::detach): Don't run destructor on exit.
4971 2002-06-01 Christopher Faylor <cgf@redhat.com>
4973 * fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into
4975 * syscalls.cc (stat_worker): Calculate dev and ino calculation here, if
4977 * fhandler_proc.cc (fhandler_proc::fhandler_proc): Minor reorg for
4979 * fhandler_process.cc (fhandler_process::exists): Return 0 on
4981 (fhandler_process::fstat): Simplify pid logic.
4982 * fhandler_tape.cc (fhandler_dev_tape::fstat): Minor reformatting.
4984 2002-06-01 Christopher Faylor <cgf@redhat.com>
4986 * path.cc (chdir): Don't allow cd'ing to a non-directory virtual path.
4988 2002-05-31 Christopher Faylor <cgf@redhat.com>
4990 * fhandler_disk_file.cc (readdir): Move inode calculation into caller.
4991 (fhandler_cygdrive::readdir): Add "." and "..".
4992 * dir.cc (readdir): Move inode calculation here so that fhandler
4993 readdirs can benefit.
4995 2002-05-31 Christopher Faylor <cgf@redhat.com>
4997 * fhandler_console.cc (fhandler_console::open): Reinstate setting of
5000 * dtable.cc (dtable::init_std_file_from_handle): Default to using
5001 binmode derived from path_conv, when required.
5002 * fhandler.h (fhandler_base::get_w_binary): Default to binmode if
5003 nothing else is specified.
5004 * fhandler.h (fhandler_base::get_r_binary): Ditto.
5006 * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_handle): Work
5009 * path.cc (path_conv::check): Remove a debugging statement.
5011 2002-05-31 Christopher Faylor <cgf@redhat.com>
5013 * fhandler_console.cc (fhandler_console::open): Always default to
5015 (fhandler_console::write_normal): Don't honor binmode setting. There
5016 is already a termios setting for this.
5017 (fhandler_console::init): Correct argument order in init call.
5019 2002-05-31 Christopher Faylor <cgf@redhat.com>
5021 * fhandler.cc (fhandler_base::open): Make default open mode == binmode.
5022 (fhandler_base::init): Set open flags based on derived binmode argument.
5024 2002-05-31 Christopher Faylor <cgf@redhat.com>
5026 * dll_init.cc (dll_list::init): Eliminate unneeded debugging statement.
5028 2002-05-31 Christopher Faylor <cgf@redhat.com>
5030 * fhandler_proc.cc (fhandler_proc::readdir): Set errno when no more
5032 * fhandler_process.cc (fhandler_process::readdir): Ditto.
5033 * fhandler_registry.cc (fhandler_registry::readdir): Ditto.
5035 2002-05-30 Christopher Faylor <cgf@redhat.com>
5037 * path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES
5038 for nonexistent virtual device path.
5039 (chdir): Set correct errno when attempt is made to cd to nonexistent
5040 virtual device path.
5042 2002-05-30 Christopher Faylor <cgf@redhat.com>
5044 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Always call
5045 fstat_by_name if fd is not opened to allow fstat_by_name to properly
5048 2002-05-30 Corinna Vinschen <corinna@vinschen.de>
5050 * autoload.cc: Replace autoload statments for ZwXXX by NtXXX.
5051 Drop ZwQuerySystemInformation since NtQuerySystemInformation was
5053 * fhandler_proc.cc (format_proc_uptime): Replace call to
5054 ZwQuerySystemInformation by call to NtQuerySystemInformation.
5055 (format_proc_stat): Ditto.
5056 * fhandler_process.cc (format_process_stat): Replace call to
5057 ZwQueryInformationProcess by call to NtQueryInformationProcess.
5058 (get_process_state): Ditto.
5059 (get_mem_values): Ditto. Replace call to ZwQueryVirtualMemory by
5060 call to NtQueryVirtualMemory.
5061 * ntdll.h: Cleanup. Drop ZwQuerySystemInformation since
5062 NtQuerySystemInformation was already available. Replace declarations
5063 of ZwXXX functions by declarations of NtXXX.
5064 * pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
5065 by call to NtQuerySystemInformation.
5067 2002-05-29 Christopher Faylor <cgf@redhat.com>
5069 * fhandler.cc (binmode): Default to binmode when mode is not known.
5071 2002-05-29 Christopher Faylor <cgf@redhat.com>
5073 * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate.
5074 * external.cc (fillout_pinfo): Use it.
5076 2002-05-29 Corinna Vinschen <corinna@vinschen.de>
5078 * external.cc (fillout_pinfo): Use new version define.
5079 * include/sys/cygwin.h (external_pinfo): Define
5080 EXTERNAL_PINFO_VERSION_16_BIT and EXTERNAL_PINFO_VERSION_32_BIT
5081 instead of just EXTERNAL_PINFO_VERSION.
5083 2002-05-29 Christopher Faylor <cgf@redhat.com>
5085 * external.cc (fillout_pinfo): Set new version field in external_pinfo
5087 * include/sys/cygwin.h (external_pinfo): Replace strace_file with
5090 2002-05-29 Corinna Vinschen <corinna@vinschen.de>
5092 Change internal uid datatype from __uid16_t to __uid32_t
5094 * cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32,
5095 geteuid32, setuid32, seteuid32.
5096 * passwd.cc (getpwuid32): New function.
5097 (getpwuid_r32): Ditto.
5098 * syscalls.cc (seteuid32): Ditto.
5100 * uinfo.cc (getuid32): Ditto.
5102 * winsup.h (uid16touid32): New macro, correct casting from __uid16_t
5104 (gid16togid32): Ditto fir gids.
5105 (getuid32): Declare.
5107 (getpwuid32): Ditto.
5108 * include/sys/cygwin.h (struct external_pinfo): Add members uid32 and
5111 2002-05-29 Corinna Vinschen <corinna@vinschen.de>
5113 * include/cygwin/socket.h: Protect some symbols against multiple
5115 * include/netinet/ip.h: Ditto.
5116 * include/netinet/tcp.h: Ditto.
5118 2002-05-29 Wu Yongwei <adah@netstd.com>
5120 * include/netinet/ip.h: Replace by BSD derived version of the file.
5121 * include/netinet/tcp.h: Ditto.
5122 * include/netinet/udp.h: New file.
5123 * include/cygwin/ip.h: Remove.
5125 2002-05-29 Christopher Faylor <cgf@redhat.com>
5127 * dtable.cc (dtable::init_std_file_from_handle): Attempt stronger
5128 detection of invalid handle.
5129 (handle_to_fn): Detect pathological condition where NT resets the
5130 buffer pointer to NULL on an invalid handle.
5132 2002-05-28 Christopher Faylor <cgf@redhat.com>
5134 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly
5135 check for whether we should be opening the file to search for #!
5136 characters. Set path_conv structure execability, too, when
5139 2002-05-28 Corinna Vinschen <corinna@vinschen.de>
5141 * security.cc (set_security_attribute): Call getegid32() instead of
5143 * include/cygwin/grp.h: Declare getegid32().
5145 2002-05-28 Corinna Vinschen <corinna@vinschen.de>
5147 Change internal gid datatype from __gid16_t to __gid32_t
5149 * cygwin.din: Export new symbols chown32, fchown32, getegid32,
5150 getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32,
5151 setgid32, setegid32, getgrent32.
5152 * grp.cc (grp32togrp16): New static function.
5153 (getgrgid32): New function.
5154 (getgrnam32): Ditto.
5155 (getgrent32): Ditto.
5156 (getgroups32): Change name of internal function from getgroups.
5157 (getgroups32): New function.
5158 (initgroups32): Ditto.
5159 * syscalls.cc (chown32): Ditto.
5164 * uinfo.cc (getgid32): Ditto.
5166 * include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam().
5167 Declare getgrgid32() and getgrnam32() instead. Declare getgid32().
5169 2002-05-27 Christopher Faylor <cgf@redhat.com>
5171 * autoload.cc (noload): Properly mask low order word for determining
5172 number of bytes to pop.
5174 2002-05-27 Christopher Faylor <cgf@redhat.com>
5176 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Minor logic
5179 2002-05-27 Christopher Faylor <cgf@redhat.com>
5181 * autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.
5182 (LoadFuncEx2): Adapt from LoadFuncEx. Provides control of return
5183 value for nonexistent function.
5184 (NtQueryObject): Declare.
5185 (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if
5187 * debug.h (being_debugged): Just rely on IsDebuggerPresent return
5189 * dtable.cc (handle_to_fn): New function.
5190 (dtable::init_std_file_from_handle): Attempt to derive std handle's
5191 name via handle_to_fn.
5192 (dtable::build_fhandler_from_name): Fill in what we can in path_conv
5193 structure when given a handle and path doesn't exist.
5194 * fhandler.cc (fhandler_base::open): Don't set the file pointer here.
5195 Use pc->exists () to determine if file exists rather than calling
5196 GetFileAttributes again.
5197 * fhandler.h (fhandler_base::exec_state_isknown): New method.
5198 (fhandler_base::fstat_helper): Add extra arguments to declaration.
5199 (fhandler_base::fstat_by_handle): Declare new method.
5200 (fhandler_base::fstat_by_name): Declare new method.
5201 * fhandler_disk_file (num_entries): Make __stdcall.
5202 (fhandler_base::fstat_by_handle): Define new method.
5203 (fhandler_base::fstat_by_name): Define new method.
5204 (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate.
5205 (fhandler_disk_file::fstat_helper): Accept extra arguments for filling
5206 out stat structure. Move handle or name specific stuff to new methods
5208 (fhandler_disk_file::open): Use real_path->exists rather than calling
5209 GetFileAttributes again.
5210 * ntdll.h (FILE_NAME_INFORMATION): Define new structure.
5211 (OBJECT_INFORMATION_CLASS): Partially define new enum.
5212 (OBJECT_NAME_INFORMATION): Define new structure.
5213 (NtQueryInformationFile): New declaration.
5214 (NtQueryObject): New declaration.
5215 * path.cc (path_conv::fillin): Define new method.
5216 * path.h (path_conv::fillin): Declare new method.
5217 (path_conv::drive_thpe): Rename from 'get_drive_type'.
5218 (path_conv::volser): Declare new method.
5219 (path_conv::volname): Declare new method.
5220 (path_conv::root_dir): Declare new method.
5221 * syscalls.cc (fstat64): Send real path_conv to fstat as second
5224 2002-05-24 Pierre Humblet <pierre.humblet@ieee.org>
5226 * security.cc (lsa2str): New function.
5227 (get_priv_list): Call lsa2str instead of sys_wcstombs.
5229 2002-05-22 Pierre Humblet <pierre.humblet@ieee.org>
5231 * syscalls.cc (seteuid): Do not take allow_ntsec into account.
5232 Attempt to use an existing or new token even when the uid
5233 matches orig_uid, but the gid is not in the process token.
5234 Major reorganization after several incremental changes.
5235 (setegid): Do not take allow_ntsec into account. Minor
5236 reorganization after several incremental changes.
5238 2002-05-26 Christopher Faylor <cgf@redhat.com>
5240 * debug.h (being_debugged): New macro.
5241 * dtable.cc (dtable::extend): Use new macro.
5242 * exceptions.cc (try_to_debug): Ditto.
5243 * strace.cc (strace::hello): Only output debugging info when we think
5244 we're being debugged.
5246 2002-05-25 Robert Collins <rbtcollins@hotmail.com>
5248 * winsup.h: Remove duplicate declarations of malloc_lock and
5251 2002-05-24 Christopher Faylor <cgf@redhat.com>
5253 Remove unneeded sync.h, where appropriate, throughout.
5254 Remove unneeded heap.h, where appropriate, throughout.
5255 Remove unneeded exceptions.h, where appropriate, throughout.
5256 Remove unneeded perprocess.h, where appropriate, throughout.
5258 2002-05-22 Pierre Humblet <pierre.humblet@ieee.org>
5260 * security.cc (create_token): Call __sec_user() instead of
5261 sec_user() to remove dependence on allow_ntsec. Verify that
5262 the returned sd is non-null.
5264 2002-05-25 Robert Collins <rbtcollins@hotmail.com>
5266 * gmon.c (fake_sbrk): Correctly return -1 on failed malloc's.
5268 2002-05-24 Christopher Faylor <cgf@redhat.com>
5270 * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path
5271 along to set_name via return_and_clear_normalized_path.
5272 (dtable::build_fhandler): New method with const char * argument.
5273 (dtable::reset_unix_path_name): Eliminate.
5274 (dtable::dup_worker): Use correct build_fhandler method.
5275 * mmap.cc (mmap_record::alloc_fh): Ditto.
5276 * dtable.h (dtable::build_fhandler): New method.
5277 (dtable::reset_unix_path_name): Eliminate.
5278 * fhandler.cc (fhandler_base::set_name): Assume that unix_name has
5279 already been cmalloced.
5280 (fhandler_base::reset_unix_path_name): Eliminate.
5281 (fhandler_base::~fhandler_base): Coercion for cfree.
5282 * fhandler.h (fhandler_base::unix_path_name): Make const char *.
5283 (fhandler_base::win32_path_name): Ditto.
5284 (fhandler_base::reset_unix_path_name): Eliminate.
5285 * fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate
5286 const char *ness of win32_path_name.
5287 * fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name
5289 * path.cc (path_conv::return_and_clear_normalized_path): New method.
5290 (path_conv::clear_normalized_path): Eliminate.
5291 (path_conv::~path_conv): Ditto.
5292 (path_conv::check): Accommodate new build_fhandler method.
5293 * path.h (path_conv::~path_conv): Eliminate.
5294 (path_conv::clear_normalized_path): Ditto.
5295 (path_conv::return_and_clear_normalized_path): Declare new method.
5297 2002-05-23 Christopher Faylor <cgf@redhat.com>
5299 * path.cc (path_conv::check): Make sure any trailing path component is
5300 part of potential normalized posix path.
5302 2002-05-23 Christopher Faylor <cgf@redhat.com>
5304 * smallprint.c (__small_vsprintf): Implement '%o' after all these
5307 2002-05-22 Christopher Faylor <cgf@redhat.com>
5309 * fhandler.h (fhandler_virtual::exists): Eliminate path argument.
5310 (fhandler_proc::exists): Ditto.
5311 (fhandler_registry::exists): Ditto.
5312 (fhandler_process::exists): Ditto.
5313 * fhandler_proc.cc (fhandler_proc::exists): Ditto. Use built-in name.
5314 * fhandler_process.cc (fhandler_process::exists): Ditto.
5316 * fhandler_registry.cc (fhandler_registry::exists): Ditto.
5317 (fhandler_registry::fstat): Ditto.
5318 * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
5319 * path.cc (path_conv::check): Ditto. Add debugging.
5321 2002-05-22 Christopher Faylor <cgf@redhat.com>
5323 * syscalls.cc (dup): Always call dup2 for error handling.
5325 2002-05-22 Corinna Vinschen <corinna@vinschen.de>
5327 * include/cygwin/types.h: Revert previous patch.
5329 2002-05-22 Corinna Vinschen <corinna@vinschen.de>
5331 * include/cygwin/types.h: Define pthread stuff only if _POSIX_THREADS
5334 2002-05-19 Pierre Humblet <pierre.humblet@ieee.org>
5336 * security.cc (open_local_policy): Initialize lsa to
5337 INVALID_HANDLE_VALUE instead of NULL.
5338 (get_logon_server_and_user_domain): Test for INVALID_HANDLE_VALUE
5340 (create_token): Both of the above.
5342 2002-05-18 Christopher Faylor <cgf@redhat.com>
5344 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Make handling of
5345 nlink consistent for remote files.
5347 2002-05-18 Christopher Faylor <cgf@redhat.com>
5349 * path.cc (path_conv::check): Always set executable bit for executable
5352 2002-05-17 Christopher Faylor <cgf@redhat.com>
5354 * fhandler.cc (fhandler_base::lseek): Avoid calling SetFilePointer with
5355 high order part of 64 bit address on OS's which do not support that
5356 kind of operation. Otherwise Windows 95 will become confused.
5358 2002-05-16 Pierre Humblet <pierre.humblet@ieee.org>
5360 * fhandler_raw.cc (fhandler_dev_raw::open): Replace set_errno()
5361 by __seterrno_from_win_error().
5362 * security.cc (open_local_policy): Ditto.
5363 (get_lsa_srv_inf): Ditto.
5364 (get_user_groups): Ditto.
5365 (get_user_primary_group): Ditto.
5366 (create_token): Ditto.
5369 2002-05-17 Corinna Vinschen <corinna@vinschen.de>
5371 * times.cc (utimes): Use FILE_WRITE_ATTRIBUTES even on 9x/Me when
5372 opening file for writing timestamp.
5373 * wincap.cc: Remove flag has_specific_access_rights.
5376 2002-05-13 Pierre Humblet <pierre.humblet@ieee.org>
5378 * syscalls.cc (seteuid): Set default dacl in process token.
5379 Replace in-line code by call to verify_token().
5380 (setegid): Reverse change from 2002-01-21. Add call to
5381 RevertToSelf and set primary group in impersonation token.
5382 * security.cc (create_token): Store pgrpsid in token security
5383 descriptor, except if it already appears in my_grps.
5384 Use sec_acl() in place of get_dacl().
5385 (verify_token): Create from code in seteuid(), with tighter checks.
5386 (get_dacl): Deleted.
5387 (get_group_sidlist): Add argument to indicate if pgrpsid is already
5389 * security.h: Define verify_token().
5390 * autoload.cc: Load GetKernelObjectSecurity().
5392 2002-05-13 Mark Bradshaw <bradshaw@staff.crosswalk.com>
5394 * cygwin.din: Add strlcat and strlcpy.
5395 * include/cygwin/version.h: Increment API minor version number.
5397 2002-05-09 Pierre Humblet <pierre.humblet@ieee.org>
5399 * shared.cc (__sec_user): Split into sec_acl() and call orig_sid().
5400 (sec_acl): Create from part of __sec_user(), except creator/owner.
5401 * security.h: Define sec_acl() and MAX_DACL_LEN.
5403 2002-05-12 Christopher Faylor <cgf@redhat.com>
5405 * fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using
5406 O_DIROPEN when OS doesn't support it. Return proper errno in that
5409 2002-05-12 Christopher Faylor <cgf@redhat.com>
5411 * syscalls.cc (_read): Change error to EBADF if attempt to read from a
5414 2002-05-11 Christopher Faylor <cgf@redhat.com>
5416 * fhandler.h (executable_states): For now, make dont_care_if_executable
5417 equivalent to not_executable.
5418 * sys/mount.h: Define MOUNT_NOTEXEC.
5419 * path.h (fs_info): New class.
5420 (path_conv): Move fs-specific fields to new 'fs' structure.
5421 (path_conv::update_fs_info): Move to fs_info and rename to just 'update'.
5422 * path.cc (fs_info::update): Ditto. Return 'true' if successful.
5423 (fillout_mntent): Add ',noexec' to list of reported options.
5425 2002-05-11 Christopher Faylor <cgf@redhat.com>
5427 * fhandler_virtual.cc (fhandler_virtual::close): Quiet a compiler
5430 2002-05-10 Christopher January <chris@atomice.net>
5432 * autoload.cc: Add dynamic load statements for
5433 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'.
5434 * fhandler.h: Change type of bufalloc and filesize members of
5435 fhandler_virtual from int to size_t. Change type of position member
5436 from __off32_t to __off64_t. Add new fileid member to fhandler_virtual
5437 class. Make seekdir take an __off64_t argument. Make lseek take an
5438 __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add
5439 fill_filebuf method to fhandler_proc. Add fill_filebuf method to
5440 fhandler_registry. Add fill_filebuf method to fhandler_process. Add
5441 saved_pid and saved_p members to fhandler_process.
5442 * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'.
5443 (proc_fhandlers array): Ditto.
5444 (fhandler_proc::open): Use fill_filebuf to flesh out the file contents.
5445 (fhandler_proc::fill_filebuf): New method.
5446 (fhandler_proc::format_proc_meminfo): Ditto.
5447 (fhandler_proc::format_proc_stat): Ditto.
5448 (fhandler_proc::format_proc_uptime): Ditto.
5449 * fhandler_process.cc (process_listing): Add 'stat' and 'statm'.
5450 (fhandler_process::fstat): Find the _pinfo structure for the process
5451 named in the filename. Return ENOENT if the process is no longer
5452 around. Set the gid and uid fields of the stat structure.
5453 (fhandler_process::open): Store pid and pointer to _pinfo structure in
5454 saved_pid and saved_p respectively. Use fill_filebuf to flesh out file
5456 (fhandler_proc::fill_filebuf): New method.
5457 (format_process_stat): New function.
5458 (format_process_status): Ditto.
5459 (format_process_statm): Ditto.
5460 (get_process_state): Ditto.
5461 (get_mem_values): Ditto.
5462 * fhandler_registry.cc (fhandler_registry::seekdir): Change argument
5463 type from __off32_t to __off64_t.
5464 (fhandler_registry::fill_filebuf): New method.
5465 * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type
5466 from __off32_t to __off64_t.
5467 (fhandler_virtual::lseek): Ditto.
5468 (fhandler_virtual::fill_filebuf): New method.
5469 (fhandler_virtual::fhandler_virtual): Initialise fileid to -1.
5470 * wincap.cc: Set flag has_process_io_counters appropriately.
5471 * wincap.h: Add flag has_process_io_counters.
5473 2002-05-09 Christopher Faylor <cgf@redhat.com>
5475 * syscalls.cc (_write): Change error to EBADF if attempt to write to a
5478 2002-05-08 Corinna Vinschen <corinna@vinschen.de>
5480 * cygheap.h (class cygheap_user): Add member `orig_psid'.
5481 Add method `orig_sid()'.
5482 * cygheap.cc (cygheap_user::set_sid): Maintain orig_psid.
5484 2002-04-28 Norbert Schulze <norbert.schulze@web.de>
5486 * localtime.cc (tzsetwall): Use wildabbr if generated timezone name
5489 2002-05-05 Pierre Humblet <pierre.humblet@ieee.org>
5491 * spawn.cc (spawn_guts): Move call to set_process_privilege()
5492 to load_registry_hive().
5493 * registry.cc (load_registry_hive): ditto.
5494 * fork.cc (fork_parent): Call sec_user_nih() only once.
5496 2002-05-04 Christopher January <chris@atomice.net>
5498 * path.h (path_conv::path_conv): Initialise normalized_path to NULL.
5500 2002-05-03 Christopher Faylor <cgf@redhat.com>
5502 * net.cc (getdomainname): Change second argument of getdomainname to
5505 2002-05-03 Christopher January <chris@atomice.net>
5507 * fhandler_proc.cc (proc_listing): Add '.' and '..' to directory
5509 (fhandler_proc::open): Change use of mode to flags. If the file does
5510 not exist already, fail with EROFS if O_CREAT flag is set. Change
5511 EROFS error to EACCES error when writing to a file. Use cmalloc to
5512 allocate memory for filebuf.
5513 (fhandler_proc::close): Use cfree to free filebuf.
5514 (fhandler_proc::get_proc_fhandler): Properly detect attempts to access
5516 * fhandler_process.cc (process_listing): Add '.' and '..' to directory
5518 (fhandler_process::open): Use cmalloc to allocate memory for filebuf.
5519 (fhandler_process::close): Use cfree to free filebuf.
5520 * fhandler_registry.cc (registry_listing): Add . and '..' to directory
5522 (fhandler_registry::open): Move check for open for writing before
5523 open_key. Use cmalloc to allocate memory for filebuf.
5524 (fhandler_registry::close): Use cfree to free filebuf.
5525 (fhandler_registry::telldir): Use lower 16 bits of __d_position as
5526 position in directory.
5527 (fhandler_registry::seekdir): Ditto.
5528 * fhandler_virtual.cc (fhandler_virtual::write): Change EROFS error to
5530 (fhandler_virtual::open): Set the NOHANDLE flag.
5531 (fhandler_virtual::dup): Add call to fhandler_base::dup. Allocate
5532 child's filebuf using cmalloc. Copy filebuf from parent to child.
5533 (fhandler_virtual::close): Use cfree to free filebuf.
5534 (fhandler_virtual::~fhandler_virtual): Ditto.
5535 (from Chris Faylor <cgf@redhat.com>).
5536 (fhandler_registry::readdir): Add support for '.' and '..' files in
5537 subdirectories of /proc/registry.
5538 * path.cc (path_conv::check): Do not return ENOENT if a file is not
5541 2002-05-02 Christopher Faylor <cgf@redhat.com>
5543 * fhandler_proc.cc (fhandler_proc::fstat): Use fhandler name rather
5544 than path_conv name.
5545 (fhandler_proc::open): Ditto.
5546 * fhandler_process.cc (fhandler_process::fstat): Use fhandler name
5547 rather than path_conv name.
5548 (fhandler_process::open): Ditto.
5549 * fhandler_registry.cc (fhandler_registry::fstat): Use fhandler name
5550 rather than path_conv name.
5551 (fhandler_registry::open): Ditto.
5552 * path.cc (path_conv::check): Don't copy posix path when virtual.
5553 (mount_info::conv_to_win32_path): Don't zero string when isproc. Just
5554 derive normal windows path.
5556 * path.h (path_conv::clear_normalized_path): Declare new method.
5557 * path.cc (path_conv::clear_normalized_path): Define new method.
5558 * dtable.cc (build_fhandler_from_name): Clear normalized path when
5559 finished to conserve space.
5561 2002-05-02 Christopher Faylor <cgf@redhat.com>
5563 * fhandler_proc.cc (fhandler_proc::fstat): Prime with information from
5564 fhandler_base::fstat. Use defines rather than constants for permission
5567 2002-04-30 Eric Blake <ebb9@email.byu.edu>
5569 * path.cc (hash_path_name): Improve hash function strength.
5571 2002-05-02 Robert Collins <rbtcollins@hotmail.com>
5573 * thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
5574 thread woken by the same condition variable it's signalling on. Thanks
5575 to Michael Beach for the report and test case.
5577 2002-05-02 Christopher Faylor <cgf@redhat.com>
5579 * path.h (pathconv_arg): Add PC_POSIX.
5580 (path_conv): Add normalized_path field.
5581 * path.cc (path_conv::~path_conv): New destructor.
5582 (path_conv::check): Set normalized_path, where appropriate.
5583 * dtable.cc (build_fhandler_from_name): Use normalized path from
5585 * syscalls.cc (chroot): Ditto.
5587 * cygheap.h: Remove path_prefix_p declaration.
5589 2002-02-26 Christopher January <chris@atomice.net>
5590 Christopher Faylor <cgf@redhat.com> (minor fixups)
5592 * Makefile.in: Add fhandler_proc.o, fhandler_registry.o,
5593 fhandler_process.o and fhandler_virtual.o.
5594 * dtable.cc (dtable::build_fhandler): Add entries for FH_PROC,
5595 FH_REGISTRY and FH_PROCESS. Set unix_name to the normalized posix
5597 * fhandler.h: Add constants for FH_PROC, FH_REGISTRY and FH_PROCESS.
5598 Add class declarations for fhandler_virtual, fhandler_proc,
5599 fhandler_registry and fhandler_virtual. Update fhandler_union
5601 * fhandler_proc.cc: New file. Add implementation for fhandler_proc.
5602 * fhandler_virtual.cc: New file. Add implementation for
5604 * fhandler_process.cc: New file. Add implementation for
5606 * fhandler_registry.cc: New file. Add implementation for
5608 * path.cc (isproc): New macro.
5609 (isvirtual_dev): Ditto.
5610 * path.cc (path_conv::check): Add check for virtual devices.
5611 * path.cc (mount_info::conv_to_win32_path): Convert paths in /proc to
5613 * path.cc (chdir): Replace check for FH_CYGDRIVE with more generic
5614 isvirtual_dev macro. Force setting of posix path for virtual
5616 * path.h (path_prefix_p): Declare.
5619 Wed May 1 16:06:02 2002 Jason Tishler <jason@tishler.net>
5621 * include/cygwin/types.h: Include <sys/sysmacros.h>.
5623 Wed Apr 17 11:27:04 2002 Jason Tishler <jason@tishler.net>
5625 * security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
5628 2002-04-12 Corinna Vinschen <corinna@vinschen.de>
5630 * net.cc (cygwin_accept): Set socket type for accepted socket.
5631 (socketpair): Set socket type for both sockets.
5633 2002-04-12 Egor Duda <deo@logos-m.ru>
5635 * fhandler.h (class fhandler_socket): New member to store socket type.
5636 (fhandler_socket::get_socket_type): Access it.
5637 (fhandler_socket::set_socket_type): Ditto.
5638 * net.cc (cygwin_socket): Store socket type.
5639 (cygwin_connect): Disable security checks for connectionless sockets.
5640 (cygwin_accept): Ditto.
5642 2002-04-09 Mark Bradshaw <bradshaw@staff.crosswalk.com>
5644 * cygwin.din: Add strptime.
5645 * include/cygwin/version.h: Increment API version number.
5647 2002-04-09 Corinna Vinschen <corinna@vinschen.de>
5649 * fork.cc (fork_child): Call fixup_mmaps_after_fork() somewhat earlier.
5651 2002-04-09 Corinna Vinschen <corinna@vinschen.de>
5653 * fhandler.cc (fhandler_base::open): Set read-only bit in
5654 file_attributes when adequate.
5656 2002-03-28 Christopher Faylor <cgf@redhat.com>
5658 * times.cc (gettimeofday): Fix typo in previous patch.
5660 2002-03-27 Wu Yongwei <adah@netstd.com>
5662 * times.cc (gettimeofday): Revert to setting timezone info if tz !=
5665 2002-03-21 Christopher Faylor <cgf@redhat.com>
5667 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Always set
5668 st_[ug]id to value derived from get_file_attributes.
5670 2002-03-21 Christopher Faylor <cgf@redhat.com>
5672 * spawn.cc (find_exec): Return input if file not found.
5674 2002-03-19 Boris Schaeling <boriss@web.de>
5676 * poll.cc (poll): Add support for invalid descriptors.
5678 2002-03-15 Robert Collins <rbtcollins@hotmail.com>
5680 * fhandler.h (fhandler_termios::lseek): Override lseek.
5681 * fhandler_termios.cc (fhandler_termios::lseek): Implement this.
5683 2002-03-15 Christopher Faylor <cgf@redhat.com>
5685 * cygserver.cc: Include stdlib.h for exit declaration.
5686 * threaded_queue.cc: Ditto.
5688 2002-03-15 Christopher Faylor <cgf@redhat.com>
5690 * pinfo.cc (pinfo::init): Use PID_ALLPIDS flag to control when a
5691 redirected block should be marked as nonexistent.
5692 (winpids::add): Use PID_ALLPIDS when looking for all pids.
5693 * cygwin.h (PID_ALLPIDS): New enum element.
5695 2002-03-15 Corinna Vinschen <corinna@vinschen.de>
5697 * glob.c (stat32_to_STAT): New function.
5698 (g_lstat): Call user space functions always with 32 bit struct stat
5701 * include/glob.h (struct glob): Don't prototype function pointers
5702 when compiling Cygwin.
5704 2002-03-14 Christopher Faylor <cgf@redhat.com>
5706 * pinfo.cc (pinfo::init): Properly handle execed process stub when
5707 PID_NOREDIR is specified.
5709 2002-03-13 Boris Schaeling <boriss@web.de>
5711 * poll.cc (poll): Remove variable open_fds. Rearrange and add code to
5712 fix settings of revents.
5714 2002-03-13 Corinna Vinschen <corinna@vinschen.de>
5716 * mmap.cc (mmap_record::map_map): Return -1 if VirtualProtect fails.
5717 (list::erase): New method with no argument. Erase latest record
5719 (mmap64): Fail if map_map() fails.
5721 2002-03-12 Corinna Vinschen <corinna@vinschen.de>
5723 * sysconf.cc (sysconf): Fix condition.
5725 2002-03-11 Corinna Vinschen <corinna@vinschen.de>
5727 * mmap.cc (msync): Check area given by addr and len for being a
5728 contigeous mmap'd region.
5730 2002-03-11 Corinna Vinschen <corinna@vinschen.de>
5732 * fork.cc (fork_child): Call fixup_mmaps_after_fork() before
5733 closing parent process handle. Call fixup_mmaps_after_fork()
5734 with parent process handle as parameter.
5735 * mmap.cc (mmap_record::access): New method.
5736 (fixup_mmaps_after_fork): Take process handle as parameter.
5737 In case of FILE_MAP_COPY access, copy valid memory regions to child.
5738 * pinfo.h (fixup_mmaps_after_fork): Change prototype accordingly.
5740 2002-03-07 Corinna Vinschen <corinna@vinschen.de>
5742 * autoload.cc (NetGetDCName): Add symbol.
5743 (NetServerEnum): Remove symbol.
5744 * security.cc (get_lsa_srv_inf): Call NetGetDCName() instead of
5745 NetServerEnum() since it's faster. Don't call it at all if machine
5746 is not a domain member.
5748 2002-03-06 Christopher Faylor <cgf@redhat.com>
5750 * path.cc (normalize_posix_path): Avoid runs of '.'s > 2.
5752 2002-03-05 Christopher Faylor <cgf@redhat.com>
5754 * errno.cc: Change EPERM associated text to "Operation not permitted"
5757 2002-03-05 Christopher Faylor <cgf@redhat.com>
5759 * fhandler_socket.cc (fhandler_socket::close): Respond to signals while
5760 looping, waiting for socket to close. Superstitiously clear last error
5761 when WSAEWOULDBLOCK.
5763 2002-03-05 Robert Collins <rbtcollins@hotmail.com>
5765 * cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
5766 Always init - until static members work correctly.
5767 * shm.cc (shmget): Initialize the security descriptor - thanks Corinna!
5768 * include/sys/ipc.h: Make the ipc control constants partitioned off from the sem
5771 2002-03-04 Christian Lestrade <christian.lestrade@free.fr>
5773 * include/sys/termios.h: Define _POSIX_VDISABLE. Define CCEQ macro.
5774 * fhandler_termios.cc: Include <sys/termios.h>.
5775 (line_edit): Recognize disabled c_cc[] chars. Ignore VDISCARD when
5778 2002-03-04 Dmitry Timoshkov <dmitry@baikal.ru>
5780 * syscalls.cc (truncate64): Use ftruncate64 directly to not lose
5783 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
5785 * cygserver_shm.cc (delete_shmnode): New function.
5786 (client_request_shm::serve): Use it.
5788 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
5790 * cygserver_shm.cc (client_request_shm::serve): Implement SHM_DETACH.
5791 * shm.cc (shmdt): Implement.
5793 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
5795 * cygserver_shm.cc: Run indent.
5796 (deleted_head): New global for storing shm id's pending deletion.
5797 (client_request_shm::serve): Return ENOSYS for invalid request types.
5798 Implement SHM_DEL - delete a shm id.
5799 * cygserver_shm.h (SHM_DEL): New type value.
5800 * shm.cc (delete_inprocess_shmds): New function, does what it's name implies.
5801 (shmctl): Implement shm_rmid control type.
5803 2002-03-04 Robert Collins <rbtcollins@hotmail.com>
5805 * Makefile.in (install): Remove install-bin to allow make install to work.
5807 2002-03-03 Robert Collins <rbtcollins@hotmail.com>
5809 * shm.cc (shmat): Prevent a compile error.
5810 (shmdt): Set errno as this function is incomplete.
5812 2002-02-28 Christopher Faylor <cgf@redhat.com>
5814 * times.cc: Remove if 0'd code. Clean up slightly.
5816 2002-02-28 Robert Collins <rbtcollins@hotmail.com>
5818 * Merge cygwin_daemon into head minus the new shm and ipc exports.
5820 2002-02-28 Robert Collins <rbtcollins@hotmail.com>
5822 * fhandler_tty.cc (fhandler_tty_slave::open): More debugging.
5823 (fhandler_tty_slave::read): Fix printf type for the handle.
5824 * tty.cc (tty::common_init): Add a FIXME for security.
5826 2002-01-29 Robert Collins <rbtcollins@hotmail.com>
5828 * Makefile.in (OBJS): Remove duplicate localtime.o.
5830 2002-01-17 Robert Collins <rbtcollins@hotmail.com>
5832 * cygserver.cc (check_and_dup_handle): Consolidate the two variants for
5834 Add Some basic debug output.
5835 (client_request_attach_tty::serve): Use the new debug_printf for clarity.
5836 Mark the duplicated handles as inheritable - fixup_after_fork() doesn't reopen
5839 2002-01-16 Robert Collins <rbtcollins@hotmail.com>
5841 * cygserver.cc (transport): Correct scope.
5842 (client_request_attach_tty::serve): Add more debug information.
5843 Fix erroneous use of transport instead of conn.
5844 * cygserver_transport_pipes.cc (transport_layer_pipes::close): More debug.
5845 (transport_layer_pipes::read): Ditto.
5846 (transport_layer_pipes::write): Ditto.
5847 (transport_layer_pipes::impersonate_client): Ditto.
5849 Mon Oct 8 7:41:00 2001 Robert Collins <rbtcollins@hotmail.com>
5851 * cygserver.cc (server_request::process): Rename client_request_shm_get to
5853 * cygserver_process.cc (process_cache::add): Rename to add_task.
5854 Use process_cleanup instead of process_request.
5855 (process_cache::remove_process): New method.
5856 (process::process): Initialize new members.
5857 (process::~process): New member.
5858 (process::cleanup): New method.
5859 (process::add_cleanup_routine): New method.
5860 (process_request::process): Rename to process_cleanup.
5861 Call the process object's cleanup method and then delete it.
5862 (process_process_param::request_loop): Remove the signalling process.
5863 * cygserver_shm.cc: Globally rename client_request_shm_get to client_request_shm.
5864 (client_request_shm_get::serve): Handle attach request counting.
5865 * cygserver_shm.h: Globally rename client_request_shm_get to client_request_shm.
5866 (class shm_cleanup): New class.
5867 * shm.cc: Globally rename client_request_shm_get to client_request_shm.
5868 (client_request_shm::client_request_shm): New constructor for attach requests.
5870 * include/cygwin/cygserver_process.h (class process_request): Rename to
5872 (class cleanup_routine): New class.
5873 (class process): New members and methods to allow calling back when the process
5876 Thu Oct 4 14:12:00 2001 Robert Collins <rbtcollins@hotmail.com>
5877 * cygserver.cc (request_loop): Make static.
5878 (main): Use new cache constructor syntax.
5879 Start cache worker threads.
5880 Cleanup the cache at shutdown.
5881 * cygserver_process.cc: Run indent.
5882 (process_cache::process_cache): Add a trigger to use when adding a process.
5883 (process_cache::process): Move process_entry to process.
5884 Insert at the end of the list.
5885 Trigger the request loop when new process's inserted.
5886 (process_cache::process_requests): Do it.
5887 (process_cache::add): New method.
5888 (process_cache::handle_snapshot): New method.
5889 (process::process): Merge in the process_entry fields.
5890 (process::handle): Make a stub function.
5891 (process::exit_code): New method.
5892 (process_request::process): New method.
5893 (process_process_param::request_loop): New method.
5894 * cygserver_shm.cc: New header dependency - threaded_queue.h.
5895 * threaded_queue.cc (threaded_queue::cleanup): Clearer messages.
5896 (queue_process_param::stop): Short spinlock on interruptible threads.
5897 * threaded_queue.h (class threaded_queue): New constructor.
5898 * include/cygwin/cygserver_process.h (process_request): New class.
5899 (process_entry): Remove.
5900 (process): Merge in process_entry.
5901 (process_cache): Inherit from threaded_queue.
5903 Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com>
5905 * cygserver.cc (class server_process_param): Use new constructor syntax.
5906 * cygserver_process.cc (process_cache::~process_cache): New function.
5907 * threaded_queue.cc: Define condition debug_printf.
5909 (threaded_queue::cleanup): Move queue_process_param guts to a method.
5910 (threaded_queue::process_requests): Ditto.
5911 (queue_process_param::queue_process_param): New method.
5912 (queue_process_param::~queue_process_param): Ditto.
5913 (queue_process_param::start): Ditto.
5914 (queue_process_param::stop): Ditto.
5915 * threaded_queue.h (class queue_process_param): Add support for
5916 interruptible request loops.
5917 * cygwin/include/cygwin/cygserver_process.h (class process_cache): Add
5920 Tue Oct 2 23:24:00 2001 Robert Collins <rbtcollins@hotmail.com>
5922 * cygserver_client.cc: New flag allow_daemon to disable the daemon completely.
5923 (cygserver_request): Check it.
5924 (cygserver_init): Ditto.
5925 * environ.cc (parse_thing): Add (no)daemon option.
5927 Tue Oct 2 23:00:00 2001 Robert Collins <rbtcollins@hotmail.com>
5929 * shm.cc: Update to handle include changes from HEAD.
5931 Tue Oct 2 16:06:00 2001 Robert Collins <rbtcollins@hotmail.com>
5933 * Makefile.in: Remove cygserver_shm.o from cygwin1.dll.
5934 Rename cygserver_shm_outside.o to cygserver_shm.o.
5935 * cygserver.cc (server_request::process): Use the new client_request
5937 * cygserver_client.cc: Remove the #ifdef's stubs for the server method
5939 (client_request_attach_tty::client_request_attach_tty): Use the new
5940 client_request constructor.
5941 (client_request_shutdown::client_request_shutdown): Ditto.
5942 (client_request::client_request): Ditto.
5943 * cygserver_shm.cc (client_request_shm_get::serve): Remove the
5944 #ifdef'd stub for in-cygwin builds.
5945 (client_request_shm_get::client_request_shm_get): Use the new
5946 client_request constructor, and remove the in-cygwin variants.
5947 * cygserver_shm.h (class client_request_shm_get): #ifndef test the
5948 serve method - it's only used in cygserver.
5949 * shm.cc (client_request_shm_get::client_request_shm_get): New function.
5950 * include/cygwin/cygserver.h (request_header): New constructor.
5951 (class client_request): Use it.
5952 New constructor accepting the header size.
5953 #ifndef test the server method - it's only used within cygserver.
5954 (client_request_get_version): #ifdef test the server method.
5955 (client_request_shutdown): Ditto.
5956 (client_request_attach_tty): Ditto.
5958 Tue Oct 2 9:57:00 2001 Robert Collins <rbtcollins@hotmail.com>
5960 * Makefile.in: add threaded_queue.o to cygserver.exe.
5961 * cygserver.cc: Include threaded_queue.h
5962 (class server_request): Inherit from queue_request.
5963 (class server_process_param): Inherit from queue_process_param.
5964 (class server_request_queue): Inherit from threaded_queue.
5965 (request_loop): Adjust for new types.
5966 (server_request_queue::process_requests): Remove guts to
5967 threaded_queue::process_requests.
5968 (server_request::server_request): Adjust for new types.
5969 (worker_function): Delete.
5970 (server_request_queue::create_workers): Delete.
5971 (server_request_queue::cleanup): Delete.
5972 (server_request_queue::add): Move guts to threaded_queue::add.
5973 * threaded_queue.cc: New file.
5974 * threaded_queue.h: New file.
5976 Mon Oct 1 12:38:00 2001 Robert Collins <rbtcollins@hotmail.com>
5978 * cygserver.cc (client_request::serve): New function.
5979 * cygserver_process.cc: Inlude <pthread.h> for pthread_once.
5980 (process_cache::process_cache): Initialise a crtiical section for write access.
5981 (process_cache::process): Use the critical section. Also add missing entries to
5983 (do_process_init): New function to initalise class process static variables.
5984 (process::process): Ensure that the process access critical section is
5986 (process::handle): Close the handle of old process's when they have terminated
5987 and we are returning the handle for a process with the same pid.
5988 * cygserver_shm.cc: Run indent.
5989 Include cygserver_process.h to allow process cache functionality.
5990 (client_request_shm_get::serve): New parameter for process cache support.
5991 Use the process cache, not OpenProcess to get a handle to the originating process.
5992 Fix a handle leak with token_handle.
5993 * cygserver_shm.h (class client_request_shm_get): Update ::serve for process
5995 * cygserver_transport_pipes.cc: Redefine debug_printf to be conditional on DEBUG.
5996 * include/cygwin/cygserver.h: Do not implement client_request::serve in the
5998 * include/cygwin/cygserver_process.h (class process_cache): Add a write access
5999 critical section to prevent races when requests from a multithreaded
6002 Sun Sep 30 23:41:00 2001 Robert Collins <rbtcollins@hotmail.com>
6004 * Makefile.in: Add cygserver_process.o to cygserver.exe.
6005 * cygserver.cc: Include signal.h and cygwin_version.h.
6006 Define debug_printf as a macro.
6007 Define DEBUG to a value.
6008 (client_request_attach_tty::serve): Add beginning of process cache support.
6009 Change from #ifdef DEBUG to work with new DEBUG style.
6010 (client_request_get_version::serve): Add beginning of process cache support.
6011 (class server_request): New prototype for support of process cache.
6012 (class queue_process_param): New class to allow request loop threading.
6013 (class server_request_queue): Add beginning of process cache support.
6014 Allow request loop threading.
6015 (request_loop): Thread function for request loops.
6016 (server_request_queue::process_requests): Initiator for threaded request loops.
6017 (client_request_shutdown::serve): Add beginning of process cache support.
6018 (server_request::server_request): Ditto.
6019 (server_request::process): Use debug_printf. Add beginning of process cache
6021 (server_request_queue::cleanup): Kill off any request loop threads.
6022 (server_request_queue::add): Add beginning of process cache support.
6023 (handle_signal): Trigger a shutdown.
6024 (main): Print out some useful info at startup - version, date time.
6025 Add process cache support.
6026 Spawn a separate thread for the transport request loop, thus allowing concurrent
6027 support for multiple transports.
6028 * cygserver_client.cc (client_request_get_version::serve): Add process cache
6030 (client_request_attach_tty::serve): Add process cache support.
6031 (client_request_shutdown::serve): Add process cache support.
6032 * cygsserver_process.cc: New file with the process cache support.
6033 * cygserver_shm.cc: Redefine debug_printf to allow conditional output.
6034 * cygwin.din: Export shmdt().
6035 * shm.cc: Run indent.
6037 (shmdt): New function.
6038 * include/cygwin/cygserver.h (class client_request): Add process cache support.
6039 (class client_request_get_version): Ditto.
6040 (class client_request_shutdown): Ditto.
6041 (class client_request_attach_tty): Ditto.
6042 * include/cygwin/cygserver_process.h: New header for process cache support.
6044 Sun Sep 30 8:52:00 2001 Robert Collins <rbtcollins@hotmail.com>
6046 * include/cygwin/cygserver_transport.h: Add copyright header.
6047 * include/cygwin/cygserver_transport_pipes.h: Ditto.
6048 * include/cygwin/cygserver_transport_sockets.h: Ditto.
6050 Sat Sep 29 20:40:00 2001 Robert Collins <rbtcollins@hotmail.com>
6052 * Makefile.in: Add cygserver_transport_sockets.o to DLL_OFILES.
6053 Add cygserver_transport_sockets_outside.o to cygserver.exe.
6054 * cygserver.cc: Include new include files.
6055 * cygserver_client.cc: Ditto.
6056 * cygserver_shm.h: No need to include <sys/socket.h> now.
6057 * cygerver_transport.cc: Include new include files.
6058 (transport_layer_base::transport_layer_base): Strip back to a stub.
6059 (transport_layer_base::listen): Ditto.
6060 (transport_layer_base::accept): Ditto.
6061 (transport_layer_base::close): Ditto.
6062 (transport_layer_base::read): Ditto.
6063 (transport_layer_base::write): Ditto.
6064 (transport_layer_base::connect): Ditto.
6065 * cygserver_transport_pipes.cc: Include new header
6066 "cygwin/cygserver_transport_pipes.h".
6067 * cygserver_transport_sockets.cc: New file.
6068 * dcrt0.cc: No need to include <sys/socket.h> now.
6069 * fhandler_tty.cc: Ditto.
6071 * include/cygwin/cygserver_transport.h: Strip the base class to a stub.
6072 Remove the cygserver_transport_pipes class.
6073 * include/cygwin/cygserver_transport_pipes.h: New file.
6074 * include/cygwin/cygserver_transport_sockets.h: New file.
6076 Tue Sep 25 16:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
6078 * autoload.cc: Add dynamic load statement for 'ImpersonateNamedPipeClient'.
6079 * Makefile.in: Add new object files, and build instructions for cygserver.exe.
6080 * cygwin.din: Export ftok, shmat, shmctl and shmget.
6081 * dcrt0.cc: Additional includes for cygserver support.
6082 (dll_crt0_1): Initialise the cygserver client.
6083 * fhandler.h (fhandler_tty): New method cygserver_attach_tty.
6084 * fhandler_tty.cc: Additional includes for cygserver support.
6085 (fhandler_tty_slave::open): Attempt to use the cygserver when obtaining
6086 handles from the parent process. On failure or 9x use the current method.
6087 (fhandler_tty_slave::cygserver_attach_tty): New function.
6088 * fork.cc (fork_child): Fixup shm memory mapped areas.
6089 * pinfo.h: Declare fixup_shms_after_fork().
6090 * security.h: Declare alloc_sd().
6091 * tty.cc: Additonal includes to support cygserver.
6092 (tty::common_init): Don't allow others to open us if the cygserver is running.
6093 * winsup.h: Declare cygserver_running.
6094 * cygserver.cc: New file.
6095 * cygserver_client.cc: New file.
6096 * cygserver_shm.cc: New file.
6097 * cygserver_shm.h: New file.
6098 * cygserver_transport.cc: New file.
6099 * cygserver_transport_pipes.cc: New file.
6102 * include/cygwin/cygserver.h: New file.
6103 * include/cygwin/cygserver_transport.h: New file.
6104 * include/sys/ipc.h: New file.
6105 * include/sys/shm.h: New file.
6107 2002-02-28 Robert Collins <rbtcollins@hotmail.com>
6109 * thread.cc (semaphore::TryWait): Set errno as required by posix 1003.1.
6110 (__sem_wait): Ditto.
6111 (__sem_trywait): Ditto.
6113 2002-02-27 Christopher Faylor <cgf@redhat.com>
6115 * include/cygwin/version.h: Bump DLL minor number.
6117 2002-02-23 Corinna Vinschen <corinna@vinschen.de>
6119 * cygwin.din (fstat64): New symbol.
6120 (ftruncate64): Ditto.
6127 (truncate64): Ditto.
6128 * dir.cc (telldir64): New function.
6129 (telldir): Call telldir64().
6130 (seekdir64): New function.
6131 (seekdir): Call seekdir64().
6132 * fhandler.h: Redefine all methods using __off32_t to use __off64_t.
6133 * fhandler.cc: Use __off64_t and struct __stat64 throughout.
6134 * fhandler_clipboard.cc: Ditto.
6135 * fhandler_disk_file.cc: Ditto.
6136 * fhandler_dsp.cc: Ditto.
6137 * fhandler_floppy.cc: Ditto.
6138 * fhandler_mem.cc: Ditto.
6139 * fhandler_random.cc: Ditto.
6140 * fhandler_socket.cc: Ditto.
6141 * fhandler_tape.cc: Ditto.
6142 * fhandler_zero.cc: Ditto.
6144 * glob.c: Ditto, call lstat64 and stat64 in Cygwin.
6145 * mmap.cc: Use __off64_t throughout.
6146 (mmap64): New function.
6147 * sec_acl.cc (acl_worker): Use struct __stat64, call stat64 and lstat64.
6148 * syscalls.cc (lseek64): New function.
6149 (stat64_to_stat32): Ditto.
6153 (ftruncate64): Ditto.
6154 (truncate64): Ditto.
6155 (_fstat): Call fstat64.
6156 (_stat): Call stat64.
6157 (cygwin_lstat): Rename to avoid declaration problem. Call lstat64.
6158 (stat_worker): Use struct __stat64.
6160 (ftruncate): Call ftruncate64.
6161 (truncate): Call truncate64.
6162 * wincap.cc: Set flag has_64bit_file_access appropriately.
6163 * wincap.h: Add flag has_64bit_file_access.
6164 * winsup.h (ILLEGAL_SEEK): Define as __off64_t.
6165 (stat_dev): Declare using struct __stat64.
6166 (stat_worker): Ditto.
6167 * include/cygwin/stat.h (struct __stat32): Define if compiling Cygwin.
6168 (struct __stat64): Ditto.
6169 (struct stat): Revert definition with explicitly sized datatypes.
6170 Eliminate sized field names.
6171 * include/cygwin/types.h (blksize_t): New type.
6172 (__blkcnt32_t): Ditto.
6173 (__blkcnt64_t): Ditto.
6176 2002-02-22 Christopher Faylor <cgf@redhat.com>
6178 * sync.h (new_muto): Just accept an argument which denotes the name of
6179 the muto. Use this argument to construct static storage.
6180 * cygheap.cc (cygheap_init): Reflect above change.
6181 * exceptions.cc (events_init): Ditto.
6182 * malloc.cc (malloc_init): Ditto.
6183 * path.cc (cwdstuff::init): Ditto.
6184 * cygheap.h (cwdstuff): Change name of lock element to make it less
6186 * path.cc (cwdstuff::get_hash): Ditto.
6187 (cwdstuff::get_initial): Ditto.
6188 (cwdstuff::set): Ditto.
6189 (cwdstuff::get): Ditto.
6190 * sigproc.cc (proc_subproc): Ditto.
6192 * debug.cc (lock_debug): Change to method. Use method rather than
6195 * tty.h (tty_min::kill_pgrp): Declare new method.
6196 * fhandler_termios.cc (tty_min::kill_pgrp): New method.
6197 (fhandler_termios::line_edit): Use new method for killing process.
6198 * dcrt0.cc (do_exit): Ditto.
6200 * dtable.cc (dtable::get_debugger_info): New method for inheriting
6201 dtable info from a debugger.
6202 * tty.cc (tty_init): Attempt to grab file handle info from parent
6203 debugger, if appropriate.
6205 # dtable.cc (dtable::stdio_init): Make this a method.
6206 (dtable::init_std_file_from_handle): Don't set fd unless it's not open.
6207 (dtable::build_fhandler_from_name): Move name setting to
6208 dtable::build_fhandler.
6209 (dtable::build_fhandler): Add win32 name parameter.
6210 * dcrt0.cc (dll_crt0_1): Change to use dtable stdio_init.
6211 * dtable.h (dtable): Reflect build_fhandler parameter change.
6212 * mmap.cc (mmap_record::alloc_fh): Don't set name parameter in
6214 * net.cc (fdsock): Remove set_name call since it is now handled by
6217 * sigproc.cc (proc_subproc): Release muto as early as possible.
6219 2001-02-22 Corinna Vinschen <corinna@vinschen.de>
6221 * smallprint.c (rn): Allow long long values.
6222 (__small_vsprintf): Add 'D', 'U' and 'X' formats for long long
6225 2002-02-19 Christopher Faylor <cgf@redhat.com>
6227 * fhandler.cc (fhandler_base::puts_readahead): Remove default parameter
6228 setting. Newer gcc's complain about this.
6229 (fhandler_base::set_readahead_valid): Ditto.
6230 * fhandler_dsp.cc (Audio::open): Ditto.
6231 (fhandler_dev_dsp::open): Ditto.
6233 2002-02-19 Christopher Faylor <cgf@redhat.com>
6235 * fork.cc (fork_parent): Use sec_user_nih to control process/thread
6236 inheritance/permission.
6237 * spawn.cc (spawn_guts): Ditto.
6238 * security.cc (create_token): Initialize token so that it is not tested
6239 for bogus value later. Use sec_user to control process/thread
6241 * security.h (__sec_user): Rename declaration from sec_user.
6242 (sec_user_nih): Declare here as inline function wrapper for __sec_user.
6244 * sigproc.cc (czombies): Allocate a character array for zombies to
6245 avoid constructor overhead
6246 (extremely hackish, I know).
6247 (cpchildren): Ditto.
6248 (pchildren): New define.
6250 (getsem): Use sec_user_nih to control semaphore inheritance/permission.
6252 2002-02-16 Christopher Faylor <cgf@redhat.com>
6254 * times.cc (hires::prime): Restore thread priority on failure
6257 * uinfo.cc (uinfo_init): Use more robust method for determining if
6258 process was invoked from a non-cygwin process.
6260 * sync.h (muto::init): Eliminate "inheritance" parameter.
6261 (new_muto): Reflect removal of parameter.
6262 * sync.cc (muto::init): Ditto.
6263 * cygheap.cc (cygheap_init): Ditto.
6264 * debug.cc (threadname_init): Ditto.
6265 * exceptions.cc (events_init): Ditto.
6266 * malloc.cc (malloc_init): Ditto.
6267 * path.cc (cwdstuff::init): Ditto.
6268 * sigproc.cc (sigproc_init): Ditto.
6270 * grp.cc (group_lock): Use different method for locking with static
6272 (read_etc_group): REALLY ensure that read lock mutex is released.
6273 * passwd.cc (passwd_lock): Use different method for locking with static
6275 (read_etc_passwd): REALLY ensure that read lock mutex is released.
6277 * shared.cc (sec_user): Correct reversed inheritance test.
6279 2002-02-15 Christopher Faylor <cgf@redhat.com>
6281 * hires.h (hires::usecs): Rename from utime. Accept an argument.
6282 * strace.cc (strace::microseconds): Use hires class for calculating
6284 * sync.h (new_muto): Use NO_COPY explicitly in declaration.
6285 * times.cc (gettimeofday): Reflect change in usecs argument.
6286 (hires::usecs): Ditto. Changed name from utime.
6287 * winsup.h (NO_COPY): Add nocommon attribute to force setting aside
6289 * regcomp.c (REQUIRE): Add a void cast to bypass a warning.
6291 2002-02-15 Christopher Faylor <cgf@redhat.com>
6293 * hires.h: New file.
6294 * times.cc (gettimeofday): Use hires class for calculating current time.
6295 (hires::prime): New method.
6296 (hires::utime): Ditto.
6298 2002-02-14 Christopher Faylor <cgf@redhat.com>
6300 * include/sys/cygwin.h (cygwin_getinfo_types): New CW_STRACE_ACTIVE.
6301 * external.cc (cygwin_internal): Handle CW_STRACE_ACTIVE.
6303 2002-02-14 Christopher Faylor <cgf@redhat.com>
6305 * exceptions.cc (unused_sig_wrapper): Eliminate unused parameter to
6307 * external.cc (cygwin_internal): Change CW_STRACE_ON to
6309 * strace.cc (strace::hello): Toggle strace on and off.
6310 * sync.cc (muto::init): Rename from constructor.
6311 * sync.h (muto::new): Delete.
6312 (muto::delete): Ditto.
6313 (new_muto): Simplify. Use muto.init for nearly everything.
6314 * uinfo.cc (uinfo_init): Avoid closing a NULL handle.
6315 * include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_STRACE_OFF to
6316 CW_STRACE_TOGGLE. Delete CW_STRACE_OFF.
6317 * include/sys/strace.h (strace): Add "inited" field.
6319 2001-02-12 Corinna Vinschen <corinna@vinschen.de>
6321 * include/cygwin/acl.h: Fix definition of aclent_t.
6323 2002-02-10 Christopher Faylor <cgf@redhat.com>
6325 * Makefile.in (DLL_OFILES): Consolidate object files.
6327 2002-02-10 Corinna Vinschen <corinna@vinschen.de>
6329 * child_info.h, cygheap.h, fhandler_clipboard.cc, fhandler_dsp.cc,
6330 fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
6331 fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
6332 pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
6333 security.h, thread.h, uinfo.cc, include/cygwin/acl.h: Fix copyright.
6335 2002-02-10 Corinna Vinschen <corinna@vinschen.de>
6337 * child_info.h, cygheap.h, dcrt0.cc, dir.cc, fhandler.cc, fhandler.h,
6338 fhandler_clipboard.cc, fhandler_disk_file.cc, fhandler_dsp.cc,
6339 fhandler_floppy.cc, fhandler_mem.cc, fhandler_random.cc,
6340 fhandler_tape.cc, fhandler_zero.cc, grp.cc, mmap.cc, passwd.cc,
6341 pinfo.cc, pinfo.h, pipe.cc, sec_acl.cc, sec_helper.cc, security.cc,
6342 security.h, spawn.cc, syscalls.cc, thread.h, uinfo.cc, winsup.h:
6343 Change usage of uid_t to __uid16_t, gid_t to __gid16_t and
6344 off_t to __off32_t throughout. Use INVALID_UID, INVALID_GID and
6345 INVALID_SEEK instead casting -1 to the appropriate type.
6346 * winsup.h: Define INVALID_UID, INVALID_GID and INVALID_SEEK.
6347 * include/cygwin/acl.h: Define internal __aclent16_t and __aclent32_t
6348 types. Don't declare acl functions when compiling Cygwin.
6349 * include/cygwin/grp.h: Declare getgrgid() and getgrnam() with
6350 correct types for internal usage.
6352 2002-02-10 Corinna Vinschen <corinna@vinschen.de>
6354 Patch suggested by Pierre A. Humblet <Pierre.Humblet@ieee.org>:
6355 * uinfo.cc (internal_getlogin): Try evaluating user by SID even if
6357 (uinfo_init): Set primary group even if ntsec is off.
6359 2002-02-09 Corinna Vinschen <corinna@vinschen.de>
6361 * include/cygwin/grp.h: New file.
6362 * include/cygwin/stat.h: Ditto.
6363 * include/cygwin/types.h: Add definitions for __off32_t,
6364 __off64_t, off_t, __uid16_t, __uid32_t, uid_t, __gid16_t,
6365 __gid32_t and gid_t.
6366 * include/sys/cygwin.h: Use correct uid and gid types.
6368 2002-02-09 Corinna Vinschen <corinna@vinschen.de>
6370 * dtable.cc (dtable::dup2): Revert previous patch.
6371 * fhandler.h: Ditto.
6372 (fhandler_socket::recv): Define new method.
6373 (fhandler_socket::send): Ditto.
6374 * fhandler_socket.cc (fhandler_socket::recv): New method.
6375 (fhandler_socket::send): Ditto.
6376 (fhandler_socket::read): Call fhandler_socket::recv() now.
6377 (fhandler_socket::write): Call fhandler_socket::send() now.
6378 * net.cc (class wsock_event): Move definition to wsock_event.h.
6379 (fdsock): Revert previous patch.
6380 (cygwin_recv): Move implementation to fhandler_socket::recv().
6381 (cygwin_send): Move implementation to fhandler_socket::send().
6382 * wsock_event.h: New file.
6384 2002-02-06 Alexander Gottwald <Alexander.Gottwald@s1999.tuchemnitz.de>
6386 * net.cc (get_2k_ifconf): Create interface entries for tokenring cards.
6388 2002-02-08 Corinna Vinschen <corinna@vinschen.de>
6390 * dtable.cc (dtable::dup2): Store fd for fhandler_socket.
6391 * fhandler.h (fhandler_base::set_fd): New virtual method.
6392 (fhandler_base::get_fd): Ditto.
6393 (fhandler_socket::set_fd): Ditto.
6394 (fhandler_socket::get_fd): Ditto.
6395 * fhandler_socket.cc (fhandler_socket::read): Call cygwin_recv instead
6396 of native Winsock recv.
6397 (fhandler_socket::write): Call cygwin_send instead of native Winsock
6399 * net.cc (fdsock): Store fd in fhandler_socket.
6401 2002-02-07 Corinna Vinschen <corinna@vinschen.de>
6403 * net.cc (cygwin_getsockname): Fix handling of NULL sun_path.
6405 2002-01-29 Corinna Vinschen <corinna@vinschen.de>
6407 * net.cc (getdomainname): Fix registry key for 9x systems, too.
6409 2002-01-29 Corinna Vinschen <corinna@vinschen.de>
6411 * net.cc (getdomainname): Fix registry key for NT systems.
6413 2002-01-28 Christopher Faylor <cgf@redhat.com>
6415 * external.cc (cygwin_internal): Initialize various internal settings
6416 if required to allow use of some things from user loaded DLL.
6417 (CW_STRACE_ON): Add new feature.
6418 (CW_CYGWIN_PID_TO_WINPID): Ditto.
6419 * pinfo.cc (set_myself): Call "strace.hello" to initiate possible
6421 (pinfo::init): Guard against dereferencing uninitialized myself.
6422 * sigproc.cc (wait_sig): Call strace.hello() when __SIGTRACE "signal"
6424 * strace.cc (strace::hello): New method.
6425 * wincap.cc (wincapc::init): Avoid initializing if already initialized.
6426 * wincap.h (wincapc::wincapc): New method.
6427 * include/sys/cygwin.h: Add new CW_ enums. Kludge typedefs of
6428 {g,u}id_t if required.
6429 * strace.h (strace::hello): Declare new method.
6431 2002-01-28 Earnie Boyd <earnie@users.sf.net>
6433 * include/sys/strace.h (_STRACE_ON): Define.
6434 (_STRACE_OFF): Ditto.
6436 2002-01-24 Christopher Faylor <cgf@redhat.com>
6438 * speclib: Ensure that temporary def file is removed.
6440 2002-01-23 Christopher Faylor <cgf@redhat.com>
6442 * speclib: Use rm -f to remove temp file just to quiet any potential
6445 2002-01-23 Corinna Vinschen <corinna@vinschen.de>
6447 * security.cc (create_token): Use sec_user() to create
6448 SECURITY_ATTRIBUTES structure for primary token. Use
6449 MAXIMUM_ALLOWED access rights instead of TOKEN_ALL_ACCESS.
6451 2002-01-23 Corinna Vinschen <corinna@vinschen.de>
6453 * path.cc (symlink): Fix check for already existing file.
6455 2002-01-21 Christopher Faylor <cgf@redhat.com>
6457 * cygmagic: Suppress error output when figuring out if sum takes an
6460 2002-01-21 Christopher Faylor <cgf@redhat.com>
6462 * cygmagic: Attempt to figure out if sum takes an option.
6464 2002-01-21 DJ Delorie <dj@redhat.com>
6466 * Makefile.in (libpthread.a): Pass the assembler also.
6469 * speclib: Specify the assembler to dlltool.
6471 2002-01-21 Christopher Faylor <cgf@redhat.com>
6473 * include/cygwin/version.h: Bump DLL minor number.
6475 2002-01-21 Corinna Vinschen <corinna@vinschen.de>
6477 * grp.cc (getgrgid): Don't return default gid entry when ntsec is on.
6478 * syscalls.cc (setegid): Don't set primary group in process token.
6480 2002-01-21 Christopher Faylor <cgf@redhat.com>
6482 * speclib: Don't use /dev/null as DLL name. Just default to what's
6483 already in .def file.
6485 2002-01-21 Christopher Faylor <cgf@redhat.com>
6487 * exceptions.cc (sig_handle): Remove last vestiges of SA_NOCLDSTOP code
6488 which caused SIGCHLD to be ignored.
6490 2002-01-20 Christopher Faylor <cgf@redhat.com>
6492 * include/cygwin/version.h: Bump DLL minor number.
6494 2002-01-20 Christopher Faylor <cgf@redhat.com>
6496 * syscalls.cc (regfree): Make dll_export.
6498 2002-01-20 Christopher Faylor <cgf@redhat.com>
6500 * exceptions.cc (ctrl_c_handler): Convert windows pid to cygwin pid
6501 when detecting if we should actually handle CTRL-C.
6503 2002-01-19 Christopher Faylor <cgf@redhat.com>
6505 * Makefile.in (new-cygwin1.dll): Revert previous change. libsupc++.a
6506 is only available in libstdc++-v3.
6508 2002-01-19 Christopher Faylor <cgf@redhat.com>
6510 * exceptions.cc (sig_handle_tty_stop): Don't send SIGCHLD if parent
6512 (sig_handle): Don't check for SA_NOCLDSTOP here. We don't have enough
6515 2002-01-19 Christopher Faylor <cgf@redhat.com>
6517 * include/cygwin/version.h: Bump DLL minor number.
6519 2002-01-19 Christopher Faylor <cgf@redhat.com>
6521 * Makefile.in (new-cygwin1.dll): Just use -lsupc++ for link.
6522 * sigproc.cc (proc_exists): Change existence criteria.
6523 * sync.h (new_muto): Add volatile to definition to avoid gcc
6524 optimization problems.
6526 2002-01-19 Corinna Vinschen <corinna@vinschen.de>
6528 * include/cygwin/version.h: Bump API minor version to 51.
6530 2002-01-19 Mark Bradshaw <bradshaw@staff.crosswalk.com>
6532 * cygwin.din: Add recvmsg and sendmsg.
6533 * net.cc: Add cygwin_recvmsg and cygwin_sendmsg.
6534 * /usr/include/sys/socket.h: Add recvmsg and sendmsg.
6536 2002-01-19 Corinna Vinschen <corinna@vinschen.de>
6538 * security.cc (create_token): Close processes token handle as soon
6539 as it's not used anymore.
6541 2002-01-17 Corinna Vinschen <corinna@vinschen.de>
6543 * Makefile.in: Add fnmatch.o to DLL_OFILES.
6544 * cygwin.din: Add fnmatch export symbol.
6545 * fnmatch.c: New file.
6546 * include/fnmatch.h: Ditto.
6547 * include/cygwin/version.h: Bump API minor version to 50.
6549 2002-01-15 Corinna Vinschen <corinna@vinschen.de>
6551 * path.cc (fchdir): Call chdir with full windows path.
6553 2002-01-14 Corinna Vinschen <corinna@vinschen.de>
6555 * dir.cc: Use INVALID_FILE_ATTRIBUTES instead of "(DWORD) -1"
6556 for file attributes throughout.
6557 * fhandler.cc: Ditto.
6558 * fhandler_disk_file.cc: Ditto.
6561 * syscalls.cc: Ditto.
6562 * times.cc (utimes): Use path_conv::isdir() instead of explicit
6563 GetFileAttributes() call.
6565 2002-01-13 Christopher Faylor <cgf@redhat.com>
6567 * dcrt0.cc (multiple_cygwin_problem): Clarify logic and make
6568 CYGWIN_MISMATCH_OK more powerful.
6570 2002-01-10 Christopher Faylor <cgf@redhat.com>
6572 * exceptions.cc (sig_handle): Accept a second argument indicating
6573 whether the signal came from this process or not.
6574 * sigproc.h: Reflect sig_handle arg change.
6575 * signal.cc (kill_pgrp): Add sigframe info.
6576 (abort): New function. Eliminates newlib function of same name.
6577 * sigproc.cc (wait_sig): Pass "signal from this process" value as arg
6580 2002-01-10 Corinna Vinschen <corinna@vinschen.de>
6582 * syscalls.cc (pathconf): Guard _PC_PATH_MAX branch against invalid
6585 2002-01-09 Christopher Faylor <cgf@redhat.com>
6586 Robert Collins <rbtcollins@hotmail.com>
6588 * exceptions.cc (early_stuff_init): Rename from misnamed
6589 set_console_handler.
6590 (ctrl_c_handler): Attempt to work around potential signal duplication
6591 during process startup.
6592 (sig_handle): Ignore SIGINT when we're just an "exec stub".
6593 * spawn.cc (spawn_guts): Store pid of spawned process in global for use
6595 * dcrt0.cc (dll_crt0_1): Call renamed initialization function.
6596 * winsup.h: Reflect function name change.
6598 2002-01-08 Corinna Vinschen <corinna@vinschen.de>
6600 * net.cc (cygwin_accept): Set sun_path for newly connected socket.
6602 2002-01-07 Ralf Habacker <Ralf.Habacker@freenet.de>
6604 * Makefile.in: Add uninstall target.
6606 2002-01-07 Christopher Faylor <cgf@redhat.com>
6608 * sigproc.cc (getsem): Clean up debugging output.
6610 2002-01-07 Christopher Faylor <cgf@redhat.com>
6612 * sigproc.cc (getsem): Set errno when unable to create own semaphore.
6613 Reorganize to make clearer that error should only come from initial
6614 creation of process semaphore.
6616 2002-01-06 Christopher Faylor <cgf@redhat.com>
6618 * dtable.cc (dtable::init_std_file_from_handle): Add some defensive
6619 code to invalid handle case.
6621 2002-01-06 Corinna Vinschen <corinna@vinschen.de>
6623 * ioctl.cc (ioctl): Make third argument optional.
6624 * include/sys/ioctl.h: Ditto in declaration.
6625 * dtable.cc (dtable::init_std_file_from_handle): Revert previous
6627 * window.cc (WndProc): Raise SIGURG instead of SIGIO in case of FD_OOB
6630 2002-01-05 Christopher Faylor <cgf@redhat.com>
6632 * dir.cc (opendir): Guarantee release of alloced fhandler structure on
6635 2002-01-05 Corinna Vinschen <corinna@vinschen.de>
6637 * exceptions.cc (sig_handle): Set default action for SIGURG to SIG_IGN.
6639 2002-01-05 Corinna Vinschen <corinna@vinschen.de>
6641 * dtable.cc (dtable::init_std_file_from_handle): Don't treat NULL
6642 handle as errorneous.
6644 2002-01-04 Christopher Faylor <cgf@redhat.com>
6646 * cygmagic: Change logic for equality test.
6648 2002-01-04 Christopher Faylor <cgf@redhat.com>
6650 * dir.cc (opendir): Don't attempt to call sub-opendir if ENOENT.
6652 2002-01-04 Corinna Vinschen <corinna@vinschen.de>
6654 * net.cc: Replace usage of AF_UNIX by Posix compliant AF_LOCAL
6656 (socketpair): Explicitly allow SOCK_STREAM and SOCK_DGRAM socket types
6657 in families AF_UNIX and AF_LOCAL. Explicitly allow PF_UNSPEC, PF_LOCAL
6658 and PF_INET protocols. Return error otherwise. Implement datagram
6661 2002-01-01 Christopher Faylor <cgf@redhat.com>
6663 * speclib: Remove temp files automatically.
6665 2002-01-01 Corinna Vinschen <corinna@vinschen.de>
6666 * fhandler.h (fhandler_socket::sun_path): New private member.
6667 (fhandler_socket::set_sun_path): New method.
6668 (fhandler_socket::get_sun_path): Ditto.
6669 * fhandler_socket.cc (fhandler_socket::fhandler_socket): Initialize
6671 (fhandler_socket::~fhandler_socket): Free sun_path if needed.
6672 (fhandler_socket::set_sun_path): New method.
6673 * net.cc (cygwin_bind): Set sun_path to path of local socket file.
6674 (cygwin_getsockname): Add code to return correct sockaddr for unix