* shared_info.h: Match shared_name declaration with below change.
* shared.cc (shared_name): Use incoming char * parameter instead of local static buffer. (open_shared): Accomodate new calling convention for shared_name. * exceptions.cc (events_init): Ditto. * sigproc.cc (getsem): Ditto. * syscalls.cc (login): Ditto. (logout): Ditto. (pututline): Ditto.
This commit is contained in:
parent
3a9c82d011
commit
5c768c978c
|
@ -1,7 +1,19 @@
|
||||||
|
2003-05-21 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* shared_info.h: Match shared_name declaration with below change.
|
||||||
|
* shared.cc (shared_name): Use incoming char * parameter instead of
|
||||||
|
local static buffer.
|
||||||
|
(open_shared): Accomodate new calling convention for shared_name.
|
||||||
|
* exceptions.cc (events_init): Ditto.
|
||||||
|
* sigproc.cc (getsem): Ditto.
|
||||||
|
* syscalls.cc (login): Ditto.
|
||||||
|
(logout): Ditto.
|
||||||
|
(pututline): Ditto.
|
||||||
|
|
||||||
2003-05-20 Corinna Vinschen <corinna@vinschen.de>
|
2003-05-20 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_socket.cc (secret_event_name): Return void. Use incoming
|
* fhandler_socket.cc (secret_event_name): Return void. Use incoming
|
||||||
char *parameter instead of local static buffer.
|
char * parameter instead of local static buffer.
|
||||||
(fhandler_socket::create_secret_event): Accomodate new calling
|
(fhandler_socket::create_secret_event): Accomodate new calling
|
||||||
convention for secret_event_name.
|
convention for secret_event_name.
|
||||||
(fhandler_socket::close_secret_event): Ditto.
|
(fhandler_socket::close_secret_event): Ditto.
|
||||||
|
|
|
@ -1134,11 +1134,13 @@ void
|
||||||
events_init (void)
|
events_init (void)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
char mutex_name[MAX_PATH];
|
||||||
/* title_mutex protects modification of console title. It's necessary
|
/* title_mutex protects modification of console title. It's necessary
|
||||||
while finding console window handle */
|
while finding console window handle */
|
||||||
|
|
||||||
if (!(title_mutex = CreateMutex (&sec_all_nih, FALSE,
|
if (!(title_mutex = CreateMutex (&sec_all_nih, FALSE,
|
||||||
name = shared_name ("title_mutex", 0))))
|
name = shared_name (mutex_name,
|
||||||
|
"title_mutex", 0))))
|
||||||
api_fatal ("can't create title mutex '%s', %E", name);
|
api_fatal ("can't create title mutex '%s', %E", name);
|
||||||
|
|
||||||
ProtectHandle (title_mutex);
|
ProtectHandle (title_mutex);
|
||||||
|
|
|
@ -33,17 +33,16 @@ mount_info NO_COPY *mount_table;
|
||||||
HANDLE NO_COPY cygwin_mount_h;
|
HANDLE NO_COPY cygwin_mount_h;
|
||||||
|
|
||||||
char * __stdcall
|
char * __stdcall
|
||||||
shared_name (const char *str, int num)
|
shared_name (char *ret_buf, const char *str, int num)
|
||||||
{
|
{
|
||||||
static NO_COPY char buf[MAX_PATH] = {0};
|
|
||||||
extern bool _cygwin_testing;
|
extern bool _cygwin_testing;
|
||||||
|
|
||||||
__small_sprintf (buf, "%s%s.%s.%d",
|
__small_sprintf (ret_buf, "%s%s.%s.%d",
|
||||||
wincap.has_terminal_services () ? "Global\\" : "",
|
wincap.has_terminal_services () ? "Global\\" : "",
|
||||||
cygwin_version.shared_id, str, num);
|
cygwin_version.shared_id, str, num);
|
||||||
if (_cygwin_testing)
|
if (_cygwin_testing)
|
||||||
strcat (buf, cygwin_version.dll_build_date);
|
strcat (ret_buf, cygwin_version.dll_build_date);
|
||||||
return buf;
|
return ret_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define page_const (65535)
|
#define page_const (65535)
|
||||||
|
@ -88,11 +87,12 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat
|
||||||
if (!shared_h)
|
if (!shared_h)
|
||||||
{
|
{
|
||||||
char *mapname;
|
char *mapname;
|
||||||
|
char map_buf[MAX_PATH];
|
||||||
if (!name)
|
if (!name)
|
||||||
mapname = NULL;
|
mapname = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mapname = shared_name (name, n);
|
mapname = shared_name (map_buf, name, n);
|
||||||
shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE,
|
shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE,
|
||||||
TRUE, mapname);
|
TRUE, mapname);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,5 +186,5 @@ struct console_state
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *__stdcall shared_name (const char *, int);
|
char *__stdcall shared_name (char *, const char *, int);
|
||||||
void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locations);
|
void *__stdcall open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locations);
|
||||||
|
|
|
@ -883,6 +883,7 @@ static HANDLE __stdcall
|
||||||
getsem (_pinfo *p, const char *str, int init, int max)
|
getsem (_pinfo *p, const char *str, int init, int max)
|
||||||
{
|
{
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
char sem_name[MAX_PATH];
|
||||||
|
|
||||||
if (p != NULL)
|
if (p != NULL)
|
||||||
{
|
{
|
||||||
|
@ -906,7 +907,7 @@ getsem (_pinfo *p, const char *str, int init, int max)
|
||||||
|
|
||||||
DWORD winpid = GetCurrentProcessId ();
|
DWORD winpid = GetCurrentProcessId ();
|
||||||
h = CreateSemaphore (sec_user_nih (sa_buf), init, max,
|
h = CreateSemaphore (sec_user_nih (sa_buf), init, max,
|
||||||
str = shared_name (str, winpid));
|
str = shared_name (sem_name, str, winpid));
|
||||||
p = myself;
|
p = myself;
|
||||||
if (!h)
|
if (!h)
|
||||||
{
|
{
|
||||||
|
@ -917,7 +918,7 @@ getsem (_pinfo *p, const char *str, int init, int max)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
h = OpenSemaphore (SEMAPHORE_ALL_ACCESS, FALSE,
|
h = OpenSemaphore (SEMAPHORE_ALL_ACCESS, FALSE,
|
||||||
shared_name (str, p->dwProcessId));
|
shared_name (sem_name, str, p->dwProcessId));
|
||||||
|
|
||||||
if (!h)
|
if (!h)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2540,7 +2540,9 @@ login (struct utmp *ut)
|
||||||
pututline (ut);
|
pututline (ut);
|
||||||
endutent ();
|
endutent ();
|
||||||
/* Writing to wtmp must be atomic to prevent mixed up data. */
|
/* Writing to wtmp must be atomic to prevent mixed up data. */
|
||||||
HANDLE mutex = CreateMutex (NULL, FALSE, shared_name ("wtmp_mutex", 0));
|
char mutex_name[MAX_PATH];
|
||||||
|
HANDLE mutex = CreateMutex (NULL, FALSE,
|
||||||
|
shared_name (mutex_name, "wtmp_mutex", 0));
|
||||||
if (mutex)
|
if (mutex)
|
||||||
while (WaitForSingleObject (mutex, INFINITE) == WAIT_ABANDONED)
|
while (WaitForSingleObject (mutex, INFINITE) == WAIT_ABANDONED)
|
||||||
;
|
;
|
||||||
|
@ -2578,7 +2580,9 @@ logout (char *line)
|
||||||
memset (ut_buf.ut_user, 0, sizeof ut_buf.ut_user);
|
memset (ut_buf.ut_user, 0, sizeof ut_buf.ut_user);
|
||||||
time (&ut_buf.ut_time);
|
time (&ut_buf.ut_time);
|
||||||
/* Writing to wtmp must be atomic to prevent mixed up data. */
|
/* Writing to wtmp must be atomic to prevent mixed up data. */
|
||||||
HANDLE mutex = CreateMutex (NULL, FALSE, shared_name ("wtmp_mutex", 0));
|
char mutex_name[MAX_PATH];
|
||||||
|
HANDLE mutex = CreateMutex (NULL, FALSE,
|
||||||
|
shared_name (mutex_name, "wtmp_mutex", 0));
|
||||||
if (mutex)
|
if (mutex)
|
||||||
while (WaitForSingleObject (mutex, INFINITE) == WAIT_ABANDONED)
|
while (WaitForSingleObject (mutex, INFINITE) == WAIT_ABANDONED)
|
||||||
;
|
;
|
||||||
|
@ -2747,7 +2751,9 @@ pututline (struct utmp *ut)
|
||||||
return;
|
return;
|
||||||
/* Read/write to utmp must be atomic to prevent overriding data
|
/* Read/write to utmp must be atomic to prevent overriding data
|
||||||
by concurrent processes. */
|
by concurrent processes. */
|
||||||
HANDLE mutex = CreateMutex (NULL, FALSE, shared_name ("utmp_mutex", 0));
|
char mutex_name[MAX_PATH];
|
||||||
|
HANDLE mutex = CreateMutex (NULL, FALSE,
|
||||||
|
shared_name (mutex_name, "utmp_mutex", 0));
|
||||||
if (mutex)
|
if (mutex)
|
||||||
while (WaitForSingleObject (mutex, INFINITE) == WAIT_ABANDONED)
|
while (WaitForSingleObject (mutex, INFINITE) == WAIT_ABANDONED)
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue