set_security_attribute appropriately.
* external.cc (cygwin_internal): Ditto.
* fhandler.cc (fhandler_base::open): Ditto.
* fhandler_socket.cc (fhandler_socket::bind): Ditto.
* path.cc (symlink_worker): Ditto.
* sec_acl.cc (setacl): Ditto. Call read_sd appropriately.
(getace): Ditto.
* sec_helper.cc (security_descriptor::malloc): New method.
(security_descriptor::realloc): New method.
(security_descriptor::free): New method.
* security.cc (read_sd): Get security_descriptor as parameter instead
of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check.
Allocate the security_descriptor buffer according to size returned by
a call to GetFileSecurity. Return buffer size on success.
(write_sd): Get security_descriptor as parameter instead of
PSECURITY_DESCRIPTOR and a size.
(get_nt_attribute): Use local security_descriptor.
(get_nt_object_attribute): Ditto in case of type == SE_REGISTRY_KEY.
Allocate security_descriptor buffer according to size returned by
a call to RegGetKeySecurity.
(alloc_sd): Make static. Get security_descriptor as parameter instead
of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check.
(set_security_attribute): Get security_descriptor as parameter instead
of PSECURITY_DESCRIPTOR and a size.
(set_nt_attribute): Use local security_descriptor.
(check_file_access): Ditto.
* security.h: Add class security_descriptor.
(read_sd): Change declaration to get security_descriptor as parameter
instead of PSECURITY_DESCRIPTOR and a size.
(write_sd): Ditto.
(set_security_attribute): Ditto.
(alloc_sd): Remove declaration.
* thread.cc (semaphore::semaphore): Use local security_descriptor. Call
set_security_attribute appropriately.
(sig_send): Improve debugging output. Wait for pipe to be created before
trying to send to it. Call call_signal_handler_now if sending a signal to
myself.
CYGSERVER_REQUEST_MSG and CYGSERVER_REQUEST_SEM.
(admininstrator_group_sid): Add extern declaration.
* cygserver_ipc.h: Rewrite.
* cygserver_msg.h: New file.
* cygserver_sem.h: New file.
* cygserver_shm.h: More or less rewrite.
* cygwin.din: Add msgctl, msgget, msgrcv, msgsnd, semctl, semget and
semop.
* msg.cc: Rewrite.
* safe_memory.h: Remove.
* sem.cc: Rewrite.
* shm.cc: Rewrite.
* include/cygwin/ipc.h: Use appropriate guard.
(struct ipc_perm): Add seq.
(IPCID_TO_IX): New define from BSD.
(IPCID_TO_SEQ): Ditto.
(IXSEQ_TO_IPCID): Ditto.
(IPC_R): Ditto.
(IPC_W): Ditto.
(IPC_M): Ditto.
* include/cygwin/msg.h: Use appropriate guard. #ifdef _KERNEL all stuff
not explicitely defined by SUSv3. Use signed types in structs to match
types used in BSD.
(msgqnum_t): Define unsigned.
(msglen_t): Ditto.
(struct msqid_ds): Add msg_first and msg_last.
(struct msginfo): Remove msgpool. Add msgssz and msgseg.
* include/cygwin/sem.h: Use appropriate guard. #ifdef _KERNEL all stuff
not explicitely defined by SUSv3. Use signed types in structs to match
types used in BSD.
(SEM_UNDO): Define appropriately.
(struct semid_ds): Add sem_base.
(struct seminfo): Add semmap and semusz.
(SEM_A): New define from BSD.
(SEM_R): Ditto.
(SEM_ALLOC): Ditto.
(union semun): Define.
* include/cygwin/shm.h: Use appropriate guard. #ifdef _KERNEL all stuff
not explicitely defined by SUSv3. Use signed types in structs to match
types used in BSD.
(SHMLBA): Define using cygwin_internal(CW_GET_SHMLBA) call.
(struct shmid_ds): Add shm_internal.
(struct shm_info): Rename shm_ids to used_ids as in BSD. Add define
for shm_ids.
* include/cygwin/sysproto.h: New file.
* include/cygwin/version.h: Bump API minor number.
* include/sys/ipc.h: New file.
* include/sys/msg.h: New file.
* include/sys/queue.h: New file from BSD.
* include/sys/sem.h: New file.
* include/sys/shm.h: New file.
* include/sys/sysproto.h: New file.
throughout.
* Makefile.in: Accomodate all new files and name changes.
Add a *.d dependency.
(sbindir): Add.
(etcdir): Drop in favor of more appropriate sysconfdir definition.
(sysconfdir): Add.
(CXXFLAGS): Add -MMD flag. Add SYSCONFDIR definition.
(.SUFFIXES): Add.
(install): Add action items.
(libclean): New target.
(fullclean): Ditto.
* bsd_helper.cc: New file.
* bsd_helper.h: Ditto.
* bsd_log.cc: Ditto.
* bsd_log.h: Ditto.
* bsd_mutex.cc: Ditto.
* bsd_mutex.h: Ditto.
* client.cc: Rearrange to build as less as possible if
__INSIDE_CYGWIN__.
(client_request::handle_request): Add Message Queue and Semaphore
handling.
* cygserver.cc: Rearrange to build as less as possible if
__INSIDE_CYGWIN__. Use new debug/log/panic logging functions.
(DEF_CONFIG_FILE): New definition for configuration file. Use
throughout.
(getfunc): Remove.
(__cygserver__printf): Remove.
(client_request_attach_tty::serve): Return error if impersonation
fails.
(print_usage): Pump up help message.
(print_version): Add output of default configuration file.
(main): Accommodate new options. Allow overwrite of threading options
from config file. Call several new initialization functions. Drop
printing dots. Don't define SIGHANDLE inline.
* cygserver.conf: New file.
* cygserver_process.h: Rename to process.h.
* cygserver_transport.h: Rename to transport.h.
* cygserver_transport_pipes.h: Rename to transport_pipes.h.
* cygserver_transport_sockets.h: Rename to transport_sockets.h.
* msg.cc: Rewrite.
* sem.cc: Rewrite.
* shm.cc: Rewrite.
* sysv_msg.cc: New file, derived from FreeBSD version 1.52.
* sysv_sem.cc: New file, derived from FreeBSD version 1.66.
* sysv_shm.cc: New file, derived from FreeBSD version 1.89.
* threaded_queue.cc: Rearrange to build as less as possible if
__INSIDE_CYGWIN__.
* transport.cc (transport_layer_base::impersonate_client): Define bool.
(transport_layer_base::revert_to_self): Ditto.
* transport.h (transport_layer_base::impersonate_client): Declare bool.
(transport_layer_base::revert_to_self): Ditto.
* transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):
Don't call init_security.
(init_security): Remove.
(transport_layer_pipes::accept): Use global sec_all_nih.
(transport_layer_pipes::connect): Ditto.
(transport_layer_pipes::impersonate_client): Define bool.
(transport_layer_pipes::revert_to_self): Ditt.
* transport_pipes.h (transport_layer_pipes::impersonate_client): Declare
bool.
(transport_layer_pipes::revert_to_self): Ditto.
* woutsup.h: Include bsd compatibility headers.
(SIGHANDLE): Add definition.
(__cygserver__printf): Remove definition.
(__noop_printf): Ditto.
(debug_printf): Define using debug.
(syscall_printf): Define using log.
(system_printf): Ditto.
Drop all other _printf definitions.
CW_GET_GID_FROM_SID handling.
* include/cygwin/version.h: Bump API minor number.
* include/sys/cygwin.h (cygwin_getinfo_types): Add
CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID.
h as h would be NULL at this point.
(cygthread::operator new): Issue debugging info when overflowing the thread
pool.
(cygthread::cygthread): Set ev from h here after h has been initialized.
(version): Bump version number to 1.5.
(longopts): Add -c, -C, -e, -E, -p, -P options.
(opts): Ditto.
(PrintPW): Print values of UF_PASSWD_CANT_CHANGE and
UF_DONT_EXPIRE_PASSWD flags. Slightly reformat output. Don't suppress
correct system password settings just because the account has admin
privileges.
(usage): Define as "noreturn" function. Restructure and rephrase
output. Accomodate new options.
(print_version): Fix copyright dates.
(main): Accomodate new options for setting UF_PASSWD_CANT_CHANGE,
UF_DONT_EXPIRE_PASSWD and UF_PASSWD_NOTREQD settings.
* pthread.cc (+mangle_sem_name): New function.
(sem_open): Ditto.
(sem_close: Ditto.
(sem_timedwait): Ditto.
(sem_getvalue): Ditto.
* thread.cc (semaphore::semaphore): Rearrange member initialization.
Use appropriate security attribute for process shared semaphores.
(semaphore::semaphore): New constructor for named semaphores.
(semaphore::~semaphore): Care for semaphore name.
(semaphore::_post): Accomodate failing ReleaseSemaphore. Use value
returned by ReleaseSemaphore vor currentvalue.
(semaphore::_getvalue): New method.
(semaphore::_timedwait): Ditto.
(semaphore::_fixup_after_fork): Rearrange. Don't fail for process
shared semaphores.
(semaphore::open): New method.
(semaphore::timedwait): Ditto.
(semaphore::post): Fix return value. Set errno appropriately.
(semaphore::getvalue): New method.
* thread.h (class semaphore): Add prototypes for open, getvalue,
timedwait, _getvalue, _timedwait. Add prototypes for new constructor.
Add name member.
* include/semaphore.h: Add prototypes for sem_open, sem_close,
sem_timedwait and sem_getvalue.
include/cygwin/version.h: Bump API minor number.
Rename pthread_key::save_key_to_buffer to
pthread_key::_fixup_before_fork throughout.
Rename pthread_key::recreate_key_from_buffer to
pthread_key::_fixup_after_fork throughout.
* thread.cc (native_mutex::init): Remove.
(native_mutex::lock): Ditto.
(native_mutex::unlock): Ditto.
(pthread::push_cleanup_handler): InterlockedExchangePointer
is not needed here.
(pthread_rwlock::pthread_rwlock): Initialize readers list mutex.
(pthread_rwlock::add_reader): Add reader via List_insert.
(pthread_rwlock::lookup_reader): Lock list while walking through.
(pthread_cond::init): Locking the init mutex is now void.
(pthread_rwlock::init): Ditto.
(pthread_mutex::init): Ditto.
* thread.h: Include security.h.
(fast_mutex): New class. Replacement for native_mutex.
(List_insert): New template function.
(List_remove): Ditto.
(List::List): Initialize synchronising mutex.
(List::fixup_after_fork): New method.
(List::insert): Add node via List_insert.
(List::remove): Remove node via List_remove.
(List::pop): Remove.
(List::for_each): Lock list while walking through.
(List::mx_init): New method.
(pthread_mutex::fixup_after_fork): Fixup mutex list after fork.
(pthread::fixup_after_fork): Ditto.
(pthread_conds::fixup_after_fork): Ditto.
(pthread_rwlock::fixup_after_fork): Ditto.
(semaphore::fixup_after_fork): Ditto.
(pthread_rwlock::readers_mx): New member.
* cygserver.h: Moved from include/cygwin to here.
* cygserver_ipc.h: Moved from ../cygserver to here.
* cygserver_shm.h: Ditto.
* cygwin.din: Add shmat, shmctl, shmdt and shmget.
* fhandler_tty.cc (fhandler_tty_slave::open): Don't warn about handle
dup'ing if not build with USE_SERVER.
* shm.cc: Include cygerrno.h unconditionally.
(shmat): Set errno to ENOSYS and return -1 if not build with
USE_SERVER.
(shmctl): Ditto.
(shmdt): Ditto.
(shmget): Ditto.
* woutsup.h: Remove.
* include/cygwin/cygserver_process.h: Moved to ../cygserver directory.
* include/cygwin/cygserver_transport.h: Ditto.
* include/cygwin/cygserver_transport_pipes.h: Ditto.
* include/cygwin/cygserver_transport_sockets.h: Ditto.
* include/cygwin/version.h: Bump API minor number.
to here and cygwin dir.
* Makefile.in (EXEEXT): Drop as unused.
(EXEEXT_FOR_BUILD): Ditto.
(all): Don't build libcygserver.a.
* cygserver_process.h: Moved from cygwin/include/cygwin to here.
* cygserver_transport.h: Ditto.
* cygserver_transport_pipes.h: Ditto.
* cygserver_transport_sockets.h: Ditto.
* ipc.h: Moved to ../cygwin and renamed to cygserver_ipc.h.
* shm.h: Moved to ../cygwin and renamed to cygserver_shm.h.
* include/complex.h: New file.
* mingwex/complex: New directory.
* mingwex/complex/cabs.c: New file.
* mingwex/complex/cacos.c: New file.
* mingwex/complex/cacosh.c: New file.
* mingwex/complex/casin.c: New file.
* mingwex/complex/casinh.c: New file.
* mingwex/complex/catan.c: New file.
* mingwex/complex/catanh.c: New file.
* mingwex/complex/ccos.c: New file.
* mingwex/complex/ccosh.c: New file.
* mingwex/complex/cexp.c: New file.
* mingwex/complex/cimag.c: New file.
* mingwex/complex/clog.c: New file.
* mingwex/complex/cpow.c: New file.
* mingwex/complex/cproj.c: New file.
* mingwex/complex/creal.c: New file.
* mingwex/complex/csin.c: New file.
* mingwex/complex/csinh.c: New file.
* mingwex/complex/csqrt.c: New file.
* mingwex/complex/ctan.c: New file.
* mingwex/complex/ctanh.c: New file.
* mingwex/Makefile.in (COMPLEX_DISTFILES): New list of
files.
(dist): Use it.
(COMPLEX_OBJS): New list of objects.
(LIB_OBJS): Include it in the library.
* syscalls.cc (seteuid32): Always construct a default DACL including
the new sid, Admins and SYSTEM and copy it to the new thread token.
* security.cc (create_token): Use a NULL default DACL in NtCreateToken.
CTRL_LOGOFF_EVENT to processes running in invisible Windows Stations.
* window.cc (has_visible_window_station): New function.
* winsup.h: Add declaration for has_visible_window_station.
a function to be imported from user32.lib, it's actually a macro.
From the Delphi FAQ:
Question:
Where is the Windows API function CopyCursor defined in
32-Bit versions of Delphi and C++ Builder?
Answer:
While the call is documented in the Win32 help file, the
function is simply mapped to the Windows API function
CopyIcon(). Note that the 32 bit version of CopyIcon
does not take a hInstance parameter.
Add function. Sometimes I don't understand MSDN. This function is
available on Windows XP and Server 2003, but the SDK is supposed to
make it available when _WIN32_WINNT >= 0x0400, or so says the MSDN.
Mmmh...
* include/winbase.h [_WIN32_WINNT >= 0x0400] (CreateFiberEx):
Guard function. Same remark as above.
* lib/user32.def (ConvertFiberToThread, CreateFiberEx):
Add functions.
Add constants.
* include/winbase.h [_WIN32_WINNT >= 0x0501] (ACTCTX[AW]): Add
structures.
* include/winbase.h [_WIN32_WINNT >= 0x0501] (ActivateActCtx): Add
function. MSDN says the first argument is HACTCTX but I'm not sure
where such a specialized handle is defined, so use HANDLE instead.
* include/winbase.h [_WIN32_WINNT >= 0x0501] (AttachConsole,
CheckNameLegalDOS8Dot3[AW]): Add functions.
* lib/user32.def (ActivateActCtx, AttachConsole,
CheckNameLegalDOS8Dot3[AW]): Add functions.
* lib/user32.def (AddLocalAlternateComputerName[AW]): Add functions.
Unfortunately I don't know which header to put the declarations in.
Add constants.
* include/winnls.h (NLS_FUNCTION, SYSGEOCLASS, SYSGEOTYPE): Add
constants for National Language Support.
* include/winnls.h (NLSVERSIONINFO): Add structure for National
Language Support.
* include/winnls.h (GEO_ENUMPROC): Add callback for National
Language Support.
* include/winnls.h (EnumSystemGeoID, GetCalendarInfo[AW],
GetGeoInfo[AW], GetUserGeoID, SetCalendarInfo[AW], SetUserGeoID):
Add functions.
* include/winnls.h (IsNLSDefinedString, GetNLSVersion): Add
functions. Strange... I am unable to find which library contains
these functions. Can't find anything with pexports. Any clue?
* lib/user32.def (EnumSystemGeoID, GetGeoInfo[AW], GetUserGeoID,
SetUserGeoID): Add functions.
* child_info.h: YA update of another magic number.
* gendevices: New file.
* devices.in: New file.
* devices.cc: Regenerate.
* devices.shilka: Remove.
* devices.h: Correctly define device pointers.
(device): Remove now obsolete fields.
(device::native): Renamed from device::fmt.
* dtable.cc (build_fh_dev): Simplify in light of new unit parsing scheme.
(build_fh_pc): Ditto.
* path.cc (win32_device_name): Ditto.
* fhandler.h (fhandler_base::get_native_name): Reflect renaming of fmt to
native.
* fhandler_tty.cc (fhandler_tty_mster::init): Initialize slave device prior to
reporting unit.