* cygtls.h (TP_NUM_C_BUFS): Raise to 50 to allow SYMLOOP_MAX recursions
path_conv <-> normalize_posix_path, plus a bit of buffer.
(TP_NUM_W_BUFS): Ditto.
(class san): Change type of _c_cnt and _w_cnt to unsigned.
* path.cc (normalize_posix_path): Guard recursion into path_conv
against tmp_pathbuf overflow. Generate normalized path in call to
path_conv. If the path is valid, replace dst with the normalized_path
from path_conv call. Add comment to explain why we're doing this.
* tls_pbuf.cc (tls_pathbuf::destroy): Only free buffers until the
first buffer pointer is NULL.
(tmp_pathbuf::c_get): Simplify error message.
(tmp_pathbuf::w_get): Ditto.
* tls_pbuf.h (class tmp_pathbuf): Change type of c_buf_old and w_buf_old
to unsigned.
(tmp_pathbuf::check_usage): New inline method to check if we have
enough tmp_pathbuf buffers left to call a function using tmp_pathbuf
buffers.
* tlsoffsets.h: Regenerate.
* tlsoffsets64.h: Regenerate.
* cygwin.sc.in: (Temporarily?) workaround serious ld bug which
truncates symbols in certain computations to 32 bit. See
https://sourceware.org/bugzilla/show_bug.cgi?id=16821
* cygserver_ipc.h (ipc_set_proc_info): Add bool parameter to specify
whether or not to send signal_arrived.
* shm.cc (client_request_shm::client_request_shm): Call
ipc_set_proc_info with bool parameter set to true to not send
signal_arrived.
Jeff Johnston [Fri, 4 Apr 2014 21:40:59 +0000 (21:40 +0000)]
2014-04-04 Ashish Kapania <akapania@ti.com>
* configure.host (sys_dir, newlib_cflags): Set sys_dir to tirtos and use
-D__DYNAMIC_REENT__ and -DMALLOC_PROVIDED compiler options for TIRTOS
target.
* libc/stdio/local.h (_STDIO_CLOSE_PER_REENT_STD_STREAMS): Change #ifdef
to not define this macro when __tirtos__ is defined.
* libc/sys/tirtos : Add support for TIRTOS.
* libc/sys/tirtos/Makefile.am, libc/sys/tirtos/lock.c: New files.
* libc/sys/tirtos/configure.in, libc/sys/tirtos/include/sys/lock.h: Ditto.
* ntea.cc (EA_BUFSIZ): Fix comment.
(read_ea): Use tmp_pathbuf for local buffer rather than alloca.
Throughout change ZwQueryEaFile to NtQueryEaFile in comments.
* DevNotes: Add entry cgf-000025.
* exceptions.cc (_cygtls::signal_debugger): Reorganize to avoid contacting the
debugger if we have already done so via the exception handler. Eliminate need
for goto. Remove an ifdef in favor of just allocating a larger buffer.
Corinna Vinschen [Fri, 28 Mar 2014 22:31:53 +0000 (22:31 +0000)]
* dcrt0.cc (dll_crt0_0): Install myfault exception handler on x86_64.
* exception.h (exception_list): Typedef as void on x86_64.
(exception::handler_installed): Remove.
(exception::handle_while_being_debugged): Remove.
(exception::myfault_handle): Declare for x86_64.
(exception::handle): Declare as ordinary exception handler on x86_64
as well.
(exception::exception): Drop previous code (again). Install
exception::handle as SEH handler.
(exception::install_myfault_handler): New x86_64-only method to
install exception::myfault_handle as VEH handler. Explain why.
(exception::~exception): For x86_64, define frame end label (again).
* exceptions.cc (CYG_EXC_CONTINUE_EXECUTION): Drop definition.
(CYG_EXC_CONTINUE_SEARCH): Ditto.
(exception::myfault_handle): New x86_64-only method, VEH handler to
handle myfault exceptions.
(exception::handle): Define as ordinary exception handler on x86_64
as well. Use ExceptionContinueExecution and ExceptionContinueSearch
throughout instead of deleted Cygwin macros. Don't handle myfault
exceptions on x86_64.
Corinna Vinschen [Thu, 27 Mar 2014 19:35:55 +0000 (19:35 +0000)]
* gendef (_sigbe/x86_64): Fix typo in .seh_proc pseudo-op.
(setjmp/x86_64): Drop storing ExceptionList pointer in jmp_buf->Frame.
Drop comment. Store likely frame in rdx. Jump to __setjmpex.
(__setjmpex): New function providing setjmp functionality. Fetch
jmp_buf->Frame from rdx, like MSVCRT setjmpex.
(__sjfault/x86_64): Store rdx content in jmp_buf->Frame.
(__ljfault/x86_64): Don't restore ExceptionList pointer.
(longjmp/x86_64): Ditto.
Jeff Johnston [Fri, 21 Mar 2014 20:55:57 +0000 (20:55 +0000)]
2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>
* nds32/Makefile.in: Alter filename.
* nds32/syscall_argv.S: Rename to _argv.S
* nds32/syscall_argvlen.S: Rename to _argvlen.S
* nds32/syscall_chdir.S: Rename to _chdir.S
* nds32/syscall_chmod.S: Rename to _chmod.S
* nds32/syscall_close.S: Rename to _close.S
* nds32/syscall_exit.S: Rename to _exit.S
* nds32/syscall_fstat.S: Rename to _fstat.S
* nds32/syscall_getpid.S: Rename to _getpid.S
* nds32/syscall_gettimeofday.S: Rename to _gettimeofday.S
* nds32/syscall_isatty.S: Rename to _isatty.S
* nds32/syscall_kill.S: Rename to _kill.S
* nds32/syscall_link.S: Rename to _link.S
* nds32/syscall_lseek.S: Rename to _lseek.S
* nds32/syscall_open.S: Rename to _open.S
* nds32/syscall_read.S: Rename to _read.S
* nds32/syscall_rename.S: Rename to _rename.S
* nds32/syscall_sbrk.S: Rename to _sbrk.S
* nds32/syscall_stat.S: Rename to _stat.S
* nds32/syscall_system.S: Rename to _system.S
* nds32/syscall_time.S: Rename to _time.S
* nds32/syscall_times.S: Rename to _times.S
* nds32/syscall_unlink.S: Rename to _unlink.S
* nds32/syscall_utime.S: Rename to _utime.S
* nds32/syscall_write.S: Rename to _write.S
* fhandler.h (fhandler_dev_dsp): Remove variable names from declarations.
(fhandler_dev_dsp::close_audio_in): Make __reg1.
(fhandler_dev_dsp::close_audio_out): Make __reg2.
* fhandler_dev_dsp.cc (fhandler_dev_dsp::close_audio_in): Make __reg1.
(fhandler_dev_dsp::close_audio_out): Make __reg2.
(fhandler_dev_dsp::close): Don't abruptly terminate sound just because we are
exiting.
* sigproc.h (no_thread_exit_protect): New class.
* sigproc.cc (thread_exit): Use no_thread_exit_protect to determine if we need
to coordinate ThreadExit/ExitProcess.
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Use
no_thread_exit_protect to kludge around waiting for waveOutClose as it waits
for a thread that never exits.
(fhandler_dev_dsp::Audio_in::stop): Ditto for waveInClose.
* fhandler.h (fhandler_dev_dsp::base): New method.
(fhandler_dev_dsp::_read): Ditto.
(fhandler_dev_dsp::_write): Ditto.
(fhandler_dev_dsp::_ioctl): Ditto.
(fhandler_dev_dsp::_fixup_after_fork): Ditto.
(fhandler_dev_dsp::_fixup_after_exec): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::read): Call real function via base()
pointer.
(fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::ioctl): Ditto.
(fhandler_dev_dsp::fixup_after_fork): Ditto.
(fhandler_dev_dsp::fixup_after_exec): Ditto.
(fhandler_dev_dsp::_read): Rename by adding an leading underscore.
(fhandler_dev_dsp::_write): Ditto.
(fhandler_dev_dsp::_ioctl): Ditto.
(fhandler_dev_dsp::_fixup_after_fork): Ditto.
(fhandler_dev_dsp::_fixup_after_exec): Ditto.
* fhandler.h (dev_console::b): Redefine as CONSOLE_SCREEN_BUFFER_INFO for use
with older OS.
* fhandler_console.cc (dev_console::fillin): Ditto for
GetConsoleScreenBufferInfo.
* fhandler_console.cc (fhandler_console::save_restore): Save only until last
written row and, because of this, don't bother trying to restore the screen
buffer size. Set cursor position after refilling buffer.
(fhandler_console::write): Use absolute paths when saving/restoring cursor
position or suffer odd problems after a saved screen is restored.
* fhandler.h (fhandler_console::dwBufferSize): Delete.
(fhandler_console::dwCursorPosition): Ditto.
(fhandler_console::wAttributes): Ditto.
(fhandler_console::b): New field encompassing previously disparate screen
buffer info.
(fhandler_console::save_bufsize): Rename from savebufsiz
(fhandler_console::save_buf): Rename sfrom savebuf.
(fhandler_console::save_cursor): New field.
(fhandler_console::save_restore): New function.
(fhandler_console::con): Rename from dev_state.
(fhandler_console::focus_aware): Accommodate name change.
* fhandler_console.cc: Use 'b' field of dev_console throughout instead of
disparate names. Accommodate dev_state -> con rename.
(dev_state:save_restore): New function. Attempt to save the entire screen
buffer rather than just the visible part. Clear the buffer when saving, like
Linux.
(fhandler_console::char_command): Use con.save_restore() for Save/restore
screen sequence.
* libc/include/stdlib.h (strtold): Define if _HAVE_LONG_DOUBLE is
defined.
* libc/stdlib/strtold.c (strtold): Ditto. Call strtod on systems
with long double == double, _strtold otherwise.
* passwd.cc (pg_ent::enumerate_builtin): Convert pwd_builtins and
grp_builtins to array of cygpsid pointers. Replace SID strings with
pointers to well known SIDs.
* sec_helper.cc (well_known_local_service_sid): Define.
(well_known_network_service_sid): Define.
(trusted_installer_sid): Define.
* security.h (well_known_local_service_sid): Declare.
(well_known_network_service_sid): Declare.
(trusted_installer_sid): Declare.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Throughout set acc_type
to SidTypeUnknown if LookupAccountXXX function failed. Create
simplified passwd entry for non-user accounts, except for LocalSystem.
Add comment.
* ldap.cc (rediscover_thread): Remove.
(cyg_ldap::open): Remove code to rediscover DC. It just won't do the
right thing.
(cyg_ldap::enumerate_ad_accounts): Change to be self-sufficient (no
explicit open call required). Enumerate on a DC of the domain itself
instead of relying on delegation. Remove ill-advised code trying to
generate rootdse from domain name.
* passwd.cc (pg_ent::enumerate_ad): Drop explicit call to
cyg_ldap::open.
* localtime.cc: Define TM_GMTOFF and TM_ZONE based on __TM_GMTOFF and
__TM_ZONE being defined. Throughout, write to these struct tm members
only if CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS is true.
* libc/strptime.cc: Ditto.
* include/cygwin/version.h (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS):
Define.
(CYGWIN_VERSION_API_MINOR): Bump to 272.
* sec_helper.cc (cygpsid::get_id): Move Samba SID->uid/gid mapping
from get_sids_info here.
(get_sids_info): Vice versa.
* security.cc (convert_samba_sd): New static function to map a Samba
security descriptor to a security descriptor with UNIX users and groups
converted to Windows SIDs per RFC 2307 mapping.
(check_file_access): Call convert_samba_sd on Samba security
descriptors.
Corinna Vinschen [Fri, 28 Feb 2014 11:37:02 +0000 (11:37 +0000)]
* cygheap.h (cygheap_user::sid): Return reference to cygpsid rather
than PSID.
(cygheap_user::saved_sid): Ditto.
(cygheap_pwdgrp::cache_t): New type.
(cygheap_pwdgrp::caching): Convert to cache_t.
(cygheap_pwdgrp::nss_db_caching): Change accordingly.
(cygheap_pwdgrp::nss_db_full_caching): New inline method.
* grp.cc (internal_getgroups): Reinvent. Take cyg_ldap pointer as
third parameter and use throughout.
(getgroups32): Call internal_getgroups.
* pwdgrp.h (internal_getgroups): Declare.
* uinfo.cc (internal_getlogin): Partial rewrite to accommodate having
no connection to the DC. Give primary group from user token more
weight. Generate group entries for all groups in the user token if
caching is set to NSS_FULL_CACHING.
(cygheap_pwdgrp::init): Initialize caching to NSS_FULL_CACHING.
(cygheap_pwdgrp::nss_init_line): Handle "db_cache: full".
(pwdgrp::add_account_from_windows): Fix group handling in non-caching
mode.
(pwdgrp::fetch_account_from_windows): Default primary group for the
current user to primary group from user token. Check for primary
domain first after LookupAccountSid failed.
Corinna Vinschen [Thu, 27 Feb 2014 12:57:27 +0000 (12:57 +0000)]
* autoload.cc (CheckTokenMembership): Import.
* external.cc (cygwin_internal): Call get_uid/get_gid instead of get_id.
* grp.cc (internal_getgrsid): Take additional cyg_ldap pointer.
Forward to pwdgrp::add_group_from_windows.
(internal_getgrnam): Ditto.
(internal_getgrgid): Ditto.
(gr_ent::enumerate_local): Drop ugid_caching bool from call to
pwdgrp::fetch_account_from_windows.
(getgroups32): Rename from internal_getgroups and drop getgroups32 stub.
Drop srchsid parameter and code handling it. Add local cyg_ldap
instance and forward to internal_getgrXXX.
(getgroups): Call getgroups32.
(get_groups): Add local cyg_ldap instance and forward to
internal_getgrXXX.
(getgrouplist): Ditto.
(setgroups32): Ditto.
* ldap.cc (cyg_ldap::open): Don't call close. Return true if connection
is already open.
(cyg_ldap::remap_uid): Forward this to internal_getpwsid.
(cyg_ldap::remap_gid): Forward this to internal_getgrsid.
* passwd.cc (internal_getpwsid): Take additional cyg_ldap pointer.
Forward to pwdgrp::add_user_from_windows.
(internal_getpwnam): Ditto.
(internal_getpwuid): Ditto.
(pg_ent::enumerate_builtin): Drop ugid_caching bool from call to
pwdgrp::fetch_account_from_windows.
(pg_ent::enumerate_sam): Ditto.
(pg_ent::enumerate_ad): Ditto. Forward local cldap instead.
* pwdgrp.h (internal_getpwsid): Align declaration to above change.
(internal_getpwnam): Ditto.
(internal_getpwuid): Ditto.
(internal_getgrsid): Ditto.
(internal_getgrgid): Ditto.
(internal_getgrnam): Ditto.
(internal_getgroups): Drop declaration.
(pwdgrp::add_account_from_windows): Align declaration to below change.
(pwdgrp::add_user_from_windows): Ditto.
(pwdgrp::add_group_from_windows): Ditto.
* sec_acl.cc (setacl): Add local cyg_ldap instance and forward to
internal_getpwuid and internal_getgrgid.
(getacl): Add local cyg_ldap instance and forward to cygpsid::get_id.
(aclfromtext32): Add local cyg_ldap instance and forward to
internal_getpwnam and internal_getgrnam.
* sec_helper.cc (cygpsid::get_id): Take additional cyg_ldap pointer.
Forward to internal_getgrsid and internal_getpwsid.
(get_sids_info): Drop ldap_open. Forward local cldap to
internal_getpwsid and internal_getgrXXX. Call CheckTokenMembership
rather than internal_getgroups.
* security.h (cygpsid::get_id): Add cyg_ldap pointer, drop default
parameter.
(cygpsid::get_uid): Add cyg_ldap pointer. Call get_id accordingly.
(cygpsid::get_gid): Ditto.
* uinfo.cc (internal_getlogin): Add local cyg_ldap instance and forward
to internal_getpwXXX and internal_getgrXXX calls.
(pwdgrp::add_account_from_windows): Take additional cyg_ldap pointer.
Forward to pwdgrp::fetch_account_from_windows.
(fetch_posix_offset): Drop ldap_open argument and handling. Get
cyg_ldap instance as pointer.
(pwdgrp::fetch_account_from_windows): Take additional cyg_ldap pointer.
Use it if it's not NULL, local instance otherwise. Drop ldap_open.
Drop fetching extended group arguments from AD for speed.
* fhandler.h (fhandler_console::scroll_buffer_screen): New function.
* fhandler_console.cc (fhandler_console::scroll_buffer_screen): New function.
(fhandler_console::char_command): Use scroll_buffer_screen as appropriate.
(dev_console::scroll_buffer): Remove if 0'ed block.
Corinna Vinschen [Mon, 24 Feb 2014 10:51:42 +0000 (10:51 +0000)]
* mkgroup.c (domlist_t): Drop id_offset.
(get_dcname): Remove.
(current_group): Remove.
(enum_unix_groups): Simplify. Change space to underscore in domain
name.
(enum_local_groups): Simplify to accommodate the fact that it's only
called for foreign machines.
(enum_groups): Ditto.
(print_special_by_sid): Remove.
(print_special_by_name): Remove.
(usage): Align to new code.
(fetch_primary_domain): Remove.
(main): Use cygwin_internal CW_SETENT, CW_GETENT and CW_ENDENT method.
Call enum_local_groups, enum_groups, and enum_unix_groups only for
foreign machines.
* mkpasswd.c (get_dcname): Remove.
(current_user): Remove.
(enum_unix_users): Simplify. Change space to underscore in domain name.
(enum_users): Simplify to accommodate the fact that it's only
called for foreign machines.
(print_special_by_sid): Remove.
(usage): Align to new code.
(longopts): Add -b/--no-builtin option.
(opts): Add -b option.
(print_special_by_name): Remove.
(enum_std_accounts): Remove.
(fetch_primary_domain): Remove.
(main): Use cygwin_internal CW_SETENT, CW_GETENT and CW_ENDENT method.
Call enum_users and enum_unix_users only for foreign machines.
* utils.xml (mkgroup): Align documentation to new usage.
(mkpasswd): Ditto.
* fhandler.h (dev_console::is_fullscreen): Delete.
(dev_console::scroll_window): Return bool indicating success.
(dev_console::scroll_screen): New function.
(dev_console::clear_screen): New function.
(fhandler_console::clear_screen): Make __reg3.
(fhandler_console::cursor_set): Ditto.
(fhandler_console::cursor_get): Ditto.
(fhandler_console::cursor_rel): Ditto.
* fhandler_console.cc (dev_console::scroll_buffer): Adapt from
fhandler_console.
(fhandler_console::scroll_buffer): Use dev_console function.
(dev_console::is_fullscreen): Delete.
(dev_console::scroll_window): Return true if we cleared the screen.
Shrink/grow buffer first before scrolling to ensure that there is sufficient
space after scrolling.
(fhandler_console::clear_screen): Make reg3, use dev_console function.
(dev_console::clear_screen): New function adapted from fhandler_console.
(fhandler_console::cursor_set): Make __reg3.
(fhandler_console::cursor_rel): Ditto.
(fhandler_console::cursor_get): Ditto.
(fhandler_console::write): Fix "reverse index".
Corinna Vinschen [Fri, 21 Feb 2014 10:01:00 +0000 (10:01 +0000)]
* pwdgrp.h (pwdgrp::fetch_account_from_windows): Add bool parameter
to declaration, set to true by default.
* uinfo.cc (pwdgrp::fetch_account_from_windows): Add bool parameter
"ugid_caching". Only add account to ugid_cache if set to true.
* grp.cc (gr_ent::enumerate_local): Call fetch_account_from_windows
with ugid_caching parameter set to false.
* passwd.cc (pg_ent::enumerate_builtin): Ditto.
(pg_ent::enumerate_sam): Ditto.
(pg_ent::enumerate_ad): Ditto.