* miscfuncs.h (transform_chars): Declare. Define inline variation here.
* mount.cc (mount_info::from_fstab): Remove extern declaration of
transform_chars.
* path.cc (tfx_chars): Move to strfuncs.cc.
(transform_chars): Ditto.
* strfunc.cc (tfx_chars): Moved here from path.cc.
(transform_chars): Ditto.
(sys_cp_wcstombs): Make UNICODE private use area conversion roundtrip
save for all characters.
(sys_cp_mbstowcs): Ditto, by removing special case for UTF-8 sequences
representing U+f0XX UNICODE chars. Fix typo in comment.
Corinna Vinschen [Sat, 31 Oct 2009 13:24:43 +0000 (13:24 +0000)]
* transport_pipes.h (PIPE_NAME_PREFIX): New define.
(PIPE_NAME_SUFFIX): Ditto.
(class transport_layer_pipes): Convert _pipe_name from char pointer
to wchar_t array.
* transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
Accommodate the fact that _pipe_name is a wchar_t array, rather than
a char pointer.
(transport_layer_pipes::transport_layer_pipes): Initialize _pipe_name
with variable pipe name based in installation key fetched from Cygwin
DLL.
(transport_layer_pipes::accept): Call CreateNamedPipeW explicitely.
(transport_layer_pipes::connect): Call CreateFileW and WaitNamedPipeW
explicitely.
Corinna Vinschen [Sat, 31 Oct 2009 13:24:06 +0000 (13:24 +0000)]
* cygprops.h: New file.
* dtable.cc (handle_to_fn): Add check for correct installation_key
string in object name for pipes and ttys.
* external.cc (cygwin_internal): Add CW_GET_INSTKEY to allow fetching
the installation_key from cygserver.
* fhandler_fifo.cc (fhandler_fifo::fifo_name): Add installation_key
to fifo name.
* globals.cc: Include cygprops.h.
(_RDATA): Move slightly and add comment.
(cygwin_props): Define.
* mount.cc (mount_info::init): Accommodate the fact that
installation_root is now a global variable in DLL common shared memory,
rather than a member of cygwin_shared.
* pipe.cc (fhandler_pipe::create_selectable): Add installation_key to
pipe name.
* shared.cc (installation_root): Define here for storage in DLL
common shared memory.
(installation_key): Ditto.
(installation_key_buf): Ditto.
(init_installation_root): Convert from shared_info method to ordinary
function. Add initializing installation_key. Invalidate
installation_key depending of value of disable_key property. Add
comment to explain.
(get_shared_parent_dir): Add installation_key to directory name.
(get_session_parent_dir): Ditto.
(shared_info::initialize): Move call to init_installation_root from
here...
(memory_init): ...to here. Add debug output to print installation root
and installation key. Add comment to explain why.
* shared_info.h (SHARED_INFO_CB): Recalculate.
(CURR_SHARED_MAGIC): Ditto.
(class shared_info): Remove definition of installation_root and
declaration of init_installation_root.
(init_installation_root): Declare.
(installation_root): Declare.
(installation_key): Declare.
* uinfo.cc (pwdgrp::load): Accommodate the fact that installation_root
is now a global variable in DLL common shared memory.
* include/cygwin/version.h: Bump API minor number.
(CYGWIN_INFO_INSTALLATIONS_NAME): Add.
* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_INSTKEY.
Corinna Vinschen [Fri, 30 Oct 2009 19:58:53 +0000 (19:58 +0000)]
* sec_helper.cc (security_descriptor::free): If sd_size is 0, call
LocalFree instead of ::free.
* sec_acl.cc: Throughout replace old ACE flag definitions with current
definitions as used in MSDN man pages.
* security.cc: Ditto.
* fhandler.cc (fhandler_base::open): Make sure file has really been
just created before fixing file permissions. Add S_JUSTCREATED
attribute to set_file_attribute call.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Always create dir
with default security descriptor and fix descriptor afterwards.
Add S_JUSTCREATED flag to set_file_attribute call.
* fhandler_socket.cc (fhandler_socket::bind): Ditto for AF_LOCAL
socket files.
* path.cc (symlink_worker): Ditto for symlinks.
* security.cc (get_file_sd): Call GetSecurityInfo rather than
NtQuerySecurityObject. Explain why. Change error handling accordingly.
(alloc_sd): Skip non-inherited, non-standard entries in ACL if
S_JUSTCREATED attribute is set. Explain why. Minor format fixes.
* security.h (S_JUSTCREATED): New define.
(security_descriptor::operator=): New operator.
Corinna Vinschen [Fri, 30 Oct 2009 09:02:30 +0000 (09:02 +0000)]
* smallprint.cc (hex_str): New const string.
(__rn): Drop str and use hex_str instead.
(__small_vsprintf): If 'l' modifier has been found, print subsequent
multibyte or wide char string using the s, S, or W options in extended
hex value layout.
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Print WCHAR
and resulting multibyte filename in extended hex value layout in
debug output.
Corinna Vinschen [Fri, 30 Oct 2009 08:26:41 +0000 (08:26 +0000)]
* libc/stdio/fflush.c (_fflush_r): Store old errno to check for
low-level seek error condition. Restore old errno in case of
success. Don't use new position after seek as error condition,
rather check for return value of -1 and errno. Handle EINVAL
just like ESPIPE. Only set fp->_offset if errno is 0.
Nick Clifton [Mon, 26 Oct 2009 10:05:23 +0000 (10:05 +0000)]
newlib:
* configure.host: Add support for RX architecture.
* libc/include/machine/ieeefp.h: Likewise.
* libc/include/machine/setjmp.h: Likewise.
* libc/include/machine/configure.in: Likewise.
* libc/include/machine/configure: Regenerate.
* libc/machine/rx: New directory.
* libc/machine/rx/*: New files to support RX architecture.
libgloss:
* configure.in: Add support for RX sub-directory.
* configure: Regenerate.
* rx: New directory.
* rx/*: New files to support RX architecture.
Eric Blake [Sat, 24 Oct 2009 13:24:29 +0000 (13:24 +0000)]
Fix isalpha(0x100000001LL) and friends on 64-bit machines.
* libc/include/ctype.h (__ctype_lookup): New macro.
(isalpha, isupper, islower, isdigit, isxdigit, isspace, ispunct)
(isalnum, isprint, isgraph, iscntrl, isblank): Use it to fix bug
on 64-bit machines.
include/opcode/
* cgen-bitset.h: Delete, moved to ../cgen/bitset.h.
* cgen.h: Update. Improve multi-inclusion macro name.
include/cgen/
* basic-modes.h: New file. Moved here from opcodes/cgen-types.h.
* basic-ops.h: New file. Moved here from opcodes/cgen-ops.h.
* bitset.h: New file. Moved here from ../opcode/cgen-bitset.h.
Update license to GPL v3.
Jeff Johnston [Tue, 20 Oct 2009 16:44:11 +0000 (16:44 +0000)]
2009-10-16 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/config.h[__CYGWIN__]: Set __USE_XOPEN2K flag
if not __STRICT_ANSI__ or stdc version C99 or greater.
* libc/include/stdio.h[__STRICT_ANSI__]: Add __USE_XOPEN2K check
for fseeko and ftello prototypes.
Corinna Vinschen [Thu, 15 Oct 2009 11:40:02 +0000 (11:40 +0000)]
* cygpath.cc (get_special_folder): Fetch path as WCHAR and convert
using my_wcstombs.
(get_user_folder): Remove.
(do_sysfolders): Use get_special_folder instead of get_user_folder.
Fetch system paths as WCHAR and convert using my_wcstombs.
Corinna Vinschen [Tue, 13 Oct 2009 10:23:31 +0000 (10:23 +0000)]
* include/sys/cygwin.h: Add new cygwin_getinfo_type
CW_SET_EXTERNAL_TOKEN.
Add new enum CW_TOKEN_IMPERSONATION, CW_TOKEN_RESTRICTED.
* cygheap.h (cyguser): New flags ext_token_is_restricted,
curr_token_is_restricted and setuid_to_restricted.
* external.cc (cygwin_internal): Add CW_SET_EXTERNAL_TOKEN.
* sec_auth.cc (set_imp_token): New function.
(cygwin_set_impersonation_token): Call set_imp_token ().
* security.h (set_imp_token): New prototype.
* spawn.cc (spawn_guts): Use CreateProcessAsUserW if restricted token
was enabled by setuid(). Do not create new window station in this case.
* syscalls.cc (seteuid32): Add handling of restricted external tokens.
Set HANDLE_FLAG_INHERIT for primary token.
(setuid32): Set setuid_to_restricted flag.
* uinfo.cc (uinfo_init): Do not reimpersonate if restricted token was
enabled by setuid (). Initialize user.*_restricted flags.
Eric Blake [Tue, 13 Oct 2009 02:26:33 +0000 (02:26 +0000)]
Improve clock_gettime and utimensat resolution.
* hires.h (hires_ms): Change initime_us to initime_ns, with 10x
more resolution.
(hires_ms::nsecs): New prototype.
(hires_ms::usecs, hires_ms::msecs, hires_ms::uptime): Adjust.
* times.cc (systime_ns): New helper function.
(hires_ms::prime): Use it for more resolution.
(hires_ms::usecs): Change to...
(hires_ms::nsecs): ...with more resolution.
(clock_gettime): Use more resolution.
(systime): Rewrite in terms of systime_ns.
(timespec_to_filetime): Rewrite math to reflect true operation.
* fhandler_disk_file.cc (utimens_fs): Use higher resolution.
* libc/locale/locale.c (DEFAULT_LOCALE): New define.
(__default_locale): New global variable set to the default locale.
(__get_locale_env): Return __default_locale rather than fixed "C".
Jeff Johnston [Thu, 8 Oct 2009 16:44:10 +0000 (16:44 +0000)]
2009-10-08 Jeff Johnston <jjohnstn@redhat.com>
* configure.host: For RTEMS, define HAVE_ASSERT_FUNC.
* libc/stdlib/assert.c (_assert_func): Do not specify
__assert_func if HAVE_ASSERT_FUNC flag is set.
* fhandler.h (fhandler_pty_master::tcgetpgrp): Declare.
* fhandler_termios.cc (fhandler_termios::tcgetpgrp): Only return
valid pgid if tty is controlling tty. Set errno to ENOTTY and
return -1 otherwise.
(fhandler_pty_master::tcgetpgrp): New function. Return 0 for
master side of pty if it's not the controlling tty of the process.
* dcrt0.cc (dll_crt0_1): Drop calls to setlocale/_setlocale_r. Just
call initial_setlocale from here.
* syscalls.cc (initial_setlocale): Set internal charset and revert
application locale to "C".
(setlocale): Don't set Cygwin's internal charset here.
* dcrt0.cc (dll_crt0_1): Move cxx_malloc reset kluge from here.
(check_sanity_and_sync): to here.
* path.cc (has_dot_last_component): Rewrite to detect some corner cases that
were previously uncaught.
* fhandler_console.cc (beep): Move up to avoid forward declaration.
(fhandler_console::read): Just beep on characters invalid in current
charset. Add comment.