4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-20 05:19:21 +08:00

whitespace cleanup, update copyright

This commit is contained in:
Christopher Faylor 2002-03-13 02:34:05 +00:00
parent 2b1c041081
commit 73ea29f42c
21 changed files with 235 additions and 237 deletions

View File

@ -1,6 +1,6 @@
/* cygserver_client.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>
@ -98,7 +98,7 @@ client_request::send (transport_layer_base *conn)
if ((bytes_read = conn->read ((char *)&header, sizeof (header)))
!= sizeof (header) || (header.cb &&
(bytes_read = conn->read (buffer, header.cb) ) != header.cb))
(bytes_read = conn->read (buffer, header.cb)) != header.cb))
{
header.error_code = -1;
debug_printf("failed reading response \n");
@ -188,11 +188,11 @@ cygserver_init ()
if (rc < 0)
cygserver_running = CYGSERVER_DEAD;
else if (rc > 0)
api_fatal ( "error connecting to cygwin server. error: %d", rc );
api_fatal ("error connecting to cygwin server. error: %d", rc);
else if (req->version.major != CYGWIN_SERVER_VERSION_MAJOR ||
req->version.api != CYGWIN_SERVER_VERSION_API ||
req->version.minor > CYGWIN_SERVER_VERSION_MINOR)
api_fatal ( "incompatible version of cygwin server.\n\
api_fatal ("incompatible version of cygwin server.\n\
client version %d.%d.%d.%d, server version%ld.%ld.%ld.%ld",
CYGWIN_SERVER_VERSION_MAJOR,
CYGWIN_SERVER_VERSION_API,
@ -201,7 +201,7 @@ cygserver_init ()
req->version.major,
req->version.api,
req->version.minor,
req->version.patch );
req->version.patch);
else
cygserver_running = CYGSERVER_OK;
}

View File

@ -1,6 +1,6 @@
/* cygserver.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>
@ -47,26 +47,26 @@ setup_privileges ()
HANDLE hToken = NULL;
TOKEN_PRIVILEGES sPrivileges;
rc = OpenProcessToken ( GetCurrentProcess() , TOKEN_ALL_ACCESS , &hToken ) ;
if ( !rc )
rc = OpenProcessToken (GetCurrentProcess() , TOKEN_ALL_ACCESS , &hToken) ;
if (!rc)
{
printf ( "error opening process token (%lu)\n", GetLastError () );
printf ("error opening process token (%lu)\n", GetLastError ());
ret_val = FALSE;
goto out;
}
rc = LookupPrivilegeValue ( NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid );
if ( !rc )
rc = LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid);
if (!rc)
{
printf ( "error getting prigilege luid (%lu)\n", GetLastError () );
printf ("error getting prigilege luid (%lu)\n", GetLastError ());
ret_val = FALSE;
goto out;
}
sPrivileges.PrivilegeCount = 1 ;
sPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED ;
rc = AdjustTokenPrivileges ( hToken, FALSE, &sPrivileges, 0, NULL, NULL ) ;
if ( !rc )
rc = AdjustTokenPrivileges (hToken, FALSE, &sPrivileges, 0, NULL, NULL) ;
if (!rc)
{
printf ( "error adjusting prigilege level. (%lu)\n", GetLastError () );
printf ("error adjusting prigilege level. (%lu)\n", GetLastError ());
ret_val = FALSE;
goto out;
}
@ -79,16 +79,16 @@ setup_privileges ()
ret_val = TRUE;
out:
CloseHandle ( hToken );
CloseHandle (hToken);
return ret_val;
}
int
check_and_dup_handle (HANDLE from_process, HANDLE to_process,
HANDLE from_process_token,
DWORD access,
HANDLE from_handle,
HANDLE* to_handle_ptr, BOOL bInheritHandle = FALSE)
DWORD access,
HANDLE from_handle,
HANDLE* to_handle_ptr, BOOL bInheritHandle = FALSE)
{
HANDLE local_handle = NULL;
int ret_val = EACCES;
@ -100,47 +100,47 @@ check_and_dup_handle (HANDLE from_process, HANDLE to_process,
BOOL status;
if (from_process != GetCurrentProcess ())
{
{
if (!DuplicateHandle (from_process, from_handle,
GetCurrentProcess (), &local_handle,
0, bInheritHandle,
DUPLICATE_SAME_ACCESS))
GetCurrentProcess (), &local_handle,
0, bInheritHandle,
DUPLICATE_SAME_ACCESS))
{
printf ( "error getting handle(%u) to server (%lu)\n", (unsigned int)from_handle, GetLastError ());
printf ("error getting handle(%u) to server (%lu)\n", (unsigned int)from_handle, GetLastError ());
goto out;
}
} else
local_handle = from_handle;
if (!GetKernelObjectSecurity (local_handle,
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
sd, sizeof (sd_buf), &bytes_needed))
{
printf ( "error getting handle SD (%lu)\n", GetLastError ());
printf ("error getting handle SD (%lu)\n", GetLastError ());
goto out;
}
MapGenericMask (&access, &access_mapping);
if (!AccessCheck (sd, from_process_token, access, &access_mapping,
&ps, &ps_len, &access, &status))
&ps, &ps_len, &access, &status))
{
printf ( "error checking access rights (%lu)\n", GetLastError ());
printf ("error checking access rights (%lu)\n", GetLastError ());
goto out;
}
if (!status)
{
printf ( "access to object denied\n");
printf ("access to object denied\n");
goto out;
}
if (!DuplicateHandle (from_process, from_handle,
to_process, to_handle_ptr,
access, bInheritHandle, 0))
to_process, to_handle_ptr,
access, bInheritHandle, 0))
{
printf ( "error getting handle to client (%lu)\n", GetLastError ());
printf ("error getting handle to client (%lu)\n", GetLastError ());
goto out;
}
debug_printf ("Duplicated %p to %p\n", from_handle, *to_handle_ptr);
@ -178,7 +178,7 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
}
debug_printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid,
req.from_master, req.to_master,
req.from_master, req.to_master,
req.pid);
debug_printf ("opening process %ld\n", req.master_pid);
@ -197,8 +197,8 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
debug_printf ("about to open thread token\n");
rc = OpenThreadToken (GetCurrentThread (),
TOKEN_QUERY,
TRUE,
TOKEN_QUERY,
TRUE,
&token_handle);
debug_printf ("opened thread token, rc=%lu\n", rc);
@ -212,10 +212,10 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
}
if (check_and_dup_handle (from_process_handle, to_process_handle,
token_handle,
GENERIC_READ,
req.from_master,
&req.from_master, TRUE) != 0)
token_handle,
GENERIC_READ,
req.from_master,
&req.from_master, TRUE) != 0)
{
printf ("error duplicating from_master handle (%lu)\n", GetLastError ());
header.error_code = EACCES;
@ -238,7 +238,7 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
#if DEBUG
printf ("%ld -> %ld(%p,%p)\n", req.master_pid, req.pid,
req.from_master, req.to_master);
req.from_master, req.to_master);
#endif
header.error_code = 0;
@ -309,7 +309,7 @@ request_loop (LPVOID LpParam)
* _AFTER_ the shutdown request. And sending ourselves a request is ugly
*/
if (new_conn && queue->active)
queue->add (new_conn);
queue->add (new_conn);
}
return 0;
}
@ -382,10 +382,10 @@ server_request::process ()
bytes_read = conn->read (req->buffer, req->header.cb);
if (bytes_read != req->header.cb)
{
debug_printf ("error reading from connection (%lu)\n", GetLastError ());
goto out;
}
{
debug_printf ("error reading from connection (%lu)\n", GetLastError ());
goto out;
}
debug_printf ("got body (%ld)\n",bytes_read);
}
@ -458,10 +458,10 @@ main (int argc, char **argv)
switch (i)
{
case 's':
shutdown = 1;
break;
shutdown = 1;
break;
default:
break;
break;
/*NOTREACHED*/
}
@ -489,17 +489,17 @@ main (int argc, char **argv)
char version[200];
/* Cygwin dll release */
snprintf (version, 200, "%d.%d.%d(%d.%d/%d/%d)-(%d.%d.%d.%d) %s",
cygwin_version.dll_major / 1000,
cygwin_version.dll_major % 1000,
cygwin_version.dll_minor,
cygwin_version.api_major,
cygwin_version.api_minor,
cygwin_version.shared_data,
cygwin_version.dll_major / 1000,
cygwin_version.dll_major % 1000,
cygwin_version.dll_minor,
cygwin_version.api_major,
cygwin_version.api_minor,
cygwin_version.shared_data,
CYGWIN_SERVER_VERSION_MAJOR,
CYGWIN_SERVER_VERSION_API,
CYGWIN_SERVER_VERSION_MINOR,
CYGWIN_SERVER_VERSION_PATCH,
cygwin_version.mount_registry,
cygwin_version.mount_registry,
cygwin_version.dll_build_date);
setbuf (stdout, NULL);
printf ("daemon version %s starting up", version);

View File

@ -1,6 +1,6 @@
/* cygserver_process.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
@ -117,10 +117,10 @@ process_cache::remove_process (class process *theprocess)
{
entry = (class process *) InterlockedExchangePointer (&head, theprocess->next);
if (entry != theprocess)
{
printf ("Bug encountered, process cache corrupted\n");
{
printf ("Bug encountered, process cache corrupted\n");
exit (1);
}
}
}
else
{
@ -138,7 +138,6 @@ process_cache::remove_process (class process *theprocess)
add_task (theprocess);
}
/* copy <= max_copy HANDLEs to dest[], starting at an offset into _our list_ of
* begin_at. (Ie begin_at = 5, the first copied handle is still written to dest[0]
* NOTE: Thread safe, but not thread guaranteed - a newly added process may be missed.

View File

@ -1,6 +1,6 @@
/* cygserver_shm.cc: Single unix specification IPC interface for Cygwin
Copyright 2001 Red Hat, Inc.
Copyright 2001, 2002 Red Hat, Inc.
Originally written by Robert Collins <robert.collins@hotmail.com>
@ -182,9 +182,9 @@ delete_shmnode (shmnode **nodeptr)
{
shmnode *tempnode = shm_head;
while (tempnode && tempnode->next != node)
tempnode = tempnode->next;
tempnode = tempnode->next;
if (tempnode)
tempnode->next = node->next;
tempnode->next = node->next;
// else log the unexpected !
}
@ -207,7 +207,7 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) parameters.in.sd_buf;
// /* create a sd for our open requests based on shmflag & 0x01ff */
// psd = alloc_sd (getuid (), getgid (), cygheap->user.logsrv (),
// parameters.in.shmflg & 0x01ff, psd, &sd_size);
// parameters.in.shmflg & 0x01ff, psd, &sd_size);
HANDLE from_process_handle = NULL;
HANDLE token_handle = NULL;
@ -364,9 +364,9 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
delete_shmnode (&temp2);
}
header.error_code = 0;
CloseHandle (token_handle);
return;
header.error_code = 0;
CloseHandle (token_handle);
return;
}
tempnode = &(*tempnode)->next;
}
@ -623,7 +623,7 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
/* we now have the area in the daemon list, opened.
FIXME: leave the system wide shm mutex */
FIXME: leave the system wide shm mutex */
parameters.out.shm_id = tempnode->shm_id;
if (check_and_dup_handle (GetCurrentProcess (), from_process_handle,

View File

@ -1,6 +1,6 @@
/* cygserver_shm.h
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
This file is part of Cygwin.

View File

@ -1,6 +1,6 @@
/* cygserver_transport.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>

View File

@ -1,6 +1,6 @@
/* cygserver_transport_pipes.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
@ -80,11 +80,11 @@ transport_layer_pipes::accept ()
}
pipe = CreateNamedPipe (pipe_name,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
0, 0, 1000,
&sec_all_nih );
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
0, 0, 1000,
&sec_all_nih );
if (pipe == INVALID_HANDLE_VALUE)
{
debug_printf ("error creating pipe (%lu)\n.", GetLastError ());
@ -164,24 +164,24 @@ transport_layer_pipes::connect ()
while (1)
{
pipe = CreateFile (pipe_name,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
&sec_all_nih,
OPEN_EXISTING,
0, NULL);
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
&sec_all_nih,
OPEN_EXISTING,
0, NULL);
if (pipe != INVALID_HANDLE_VALUE)
/* got the pipe */
return true;
return true;
if (GetLastError () != ERROR_PIPE_BUSY)
{
debug_printf ("Error opening the pipe (%lu)\n", GetLastError ());
pipe = NULL;
return false;
}
{
debug_printf ("Error opening the pipe (%lu)\n", GetLastError ());
pipe = NULL;
return false;
}
if (!WaitNamedPipe (pipe_name, 20000))
debug_printf ( "error connecting to server pipe after 20 seconds (%lu)\n", GetLastError () );
debug_printf ( "error connecting to server pipe after 20 seconds (%lu)\n", GetLastError () );
/* We loop here, because the pipe exists but is busy. If it doesn't exist
* the != ERROR_PIPE_BUSY will catch it.
*/

View File

@ -1,6 +1,6 @@
/* cygserver_transport_sockets.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
@ -28,7 +28,7 @@ extern "C" int
cygwin_socket (int af, int type, int protocol);
extern "C" int
cygwin_connect (int fd,
const struct sockaddr *name,
const struct sockaddr *name,
int namelen);
extern "C" int
cygwin_accept (int fd, struct sockaddr *peer, int *len);

View File

@ -1,6 +1,6 @@
/* cygserver.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>
@ -47,26 +47,26 @@ setup_privileges ()
HANDLE hToken = NULL;
TOKEN_PRIVILEGES sPrivileges;
rc = OpenProcessToken ( GetCurrentProcess() , TOKEN_ALL_ACCESS , &hToken ) ;
if ( !rc )
rc = OpenProcessToken (GetCurrentProcess() , TOKEN_ALL_ACCESS , &hToken) ;
if (!rc)
{
printf ( "error opening process token (%lu)\n", GetLastError () );
printf ("error opening process token (%lu)\n", GetLastError ());
ret_val = FALSE;
goto out;
}
rc = LookupPrivilegeValue ( NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid );
if ( !rc )
rc = LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &sPrivileges.Privileges[0].Luid);
if (!rc)
{
printf ( "error getting prigilege luid (%lu)\n", GetLastError () );
printf ("error getting prigilege luid (%lu)\n", GetLastError ());
ret_val = FALSE;
goto out;
}
sPrivileges.PrivilegeCount = 1 ;
sPrivileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED ;
rc = AdjustTokenPrivileges ( hToken, FALSE, &sPrivileges, 0, NULL, NULL ) ;
if ( !rc )
rc = AdjustTokenPrivileges (hToken, FALSE, &sPrivileges, 0, NULL, NULL) ;
if (!rc)
{
printf ( "error adjusting prigilege level. (%lu)\n", GetLastError () );
printf ("error adjusting prigilege level. (%lu)\n", GetLastError ());
ret_val = FALSE;
goto out;
}
@ -79,16 +79,16 @@ setup_privileges ()
ret_val = TRUE;
out:
CloseHandle ( hToken );
CloseHandle (hToken);
return ret_val;
}
int
check_and_dup_handle (HANDLE from_process, HANDLE to_process,
HANDLE from_process_token,
DWORD access,
HANDLE from_handle,
HANDLE* to_handle_ptr, BOOL bInheritHandle = FALSE)
DWORD access,
HANDLE from_handle,
HANDLE* to_handle_ptr, BOOL bInheritHandle = FALSE)
{
HANDLE local_handle = NULL;
int ret_val = EACCES;
@ -100,47 +100,47 @@ check_and_dup_handle (HANDLE from_process, HANDLE to_process,
BOOL status;
if (from_process != GetCurrentProcess ())
{
{
if (!DuplicateHandle (from_process, from_handle,
GetCurrentProcess (), &local_handle,
0, bInheritHandle,
DUPLICATE_SAME_ACCESS))
GetCurrentProcess (), &local_handle,
0, bInheritHandle,
DUPLICATE_SAME_ACCESS))
{
printf ( "error getting handle(%u) to server (%lu)\n", (unsigned int)from_handle, GetLastError ());
printf ("error getting handle(%u) to server (%lu)\n", (unsigned int)from_handle, GetLastError ());
goto out;
}
} else
local_handle = from_handle;
if (!GetKernelObjectSecurity (local_handle,
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
sd, sizeof (sd_buf), &bytes_needed))
{
printf ( "error getting handle SD (%lu)\n", GetLastError ());
printf ("error getting handle SD (%lu)\n", GetLastError ());
goto out;
}
MapGenericMask (&access, &access_mapping);
if (!AccessCheck (sd, from_process_token, access, &access_mapping,
&ps, &ps_len, &access, &status))
&ps, &ps_len, &access, &status))
{
printf ( "error checking access rights (%lu)\n", GetLastError ());
printf ("error checking access rights (%lu)\n", GetLastError ());
goto out;
}
if (!status)
{
printf ( "access to object denied\n");
printf ("access to object denied\n");
goto out;
}
if (!DuplicateHandle (from_process, from_handle,
to_process, to_handle_ptr,
access, bInheritHandle, 0))
to_process, to_handle_ptr,
access, bInheritHandle, 0))
{
printf ( "error getting handle to client (%lu)\n", GetLastError ());
printf ("error getting handle to client (%lu)\n", GetLastError ());
goto out;
}
debug_printf ("Duplicated %p to %p\n", from_handle, *to_handle_ptr);
@ -178,7 +178,7 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
}
debug_printf ("pid %ld:(%p,%p) -> pid %ld\n", req.master_pid,
req.from_master, req.to_master,
req.from_master, req.to_master,
req.pid);
debug_printf ("opening process %ld\n", req.master_pid);
@ -197,8 +197,8 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
debug_printf ("about to open thread token\n");
rc = OpenThreadToken (GetCurrentThread (),
TOKEN_QUERY,
TRUE,
TOKEN_QUERY,
TRUE,
&token_handle);
debug_printf ("opened thread token, rc=%lu\n", rc);
@ -212,10 +212,10 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
}
if (check_and_dup_handle (from_process_handle, to_process_handle,
token_handle,
GENERIC_READ,
req.from_master,
&req.from_master, TRUE) != 0)
token_handle,
GENERIC_READ,
req.from_master,
&req.from_master, TRUE) != 0)
{
printf ("error duplicating from_master handle (%lu)\n", GetLastError ());
header.error_code = EACCES;
@ -238,7 +238,7 @@ client_request_attach_tty::serve(transport_layer_base *conn, class process_cache
#if DEBUG
printf ("%ld -> %ld(%p,%p)\n", req.master_pid, req.pid,
req.from_master, req.to_master);
req.from_master, req.to_master);
#endif
header.error_code = 0;
@ -309,7 +309,7 @@ request_loop (LPVOID LpParam)
* _AFTER_ the shutdown request. And sending ourselves a request is ugly
*/
if (new_conn && queue->active)
queue->add (new_conn);
queue->add (new_conn);
}
return 0;
}
@ -382,10 +382,10 @@ server_request::process ()
bytes_read = conn->read (req->buffer, req->header.cb);
if (bytes_read != req->header.cb)
{
debug_printf ("error reading from connection (%lu)\n", GetLastError ());
goto out;
}
{
debug_printf ("error reading from connection (%lu)\n", GetLastError ());
goto out;
}
debug_printf ("got body (%ld)\n",bytes_read);
}
@ -458,10 +458,10 @@ main (int argc, char **argv)
switch (i)
{
case 's':
shutdown = 1;
break;
shutdown = 1;
break;
default:
break;
break;
/*NOTREACHED*/
}
@ -489,17 +489,17 @@ main (int argc, char **argv)
char version[200];
/* Cygwin dll release */
snprintf (version, 200, "%d.%d.%d(%d.%d/%d/%d)-(%d.%d.%d.%d) %s",
cygwin_version.dll_major / 1000,
cygwin_version.dll_major % 1000,
cygwin_version.dll_minor,
cygwin_version.api_major,
cygwin_version.api_minor,
cygwin_version.shared_data,
cygwin_version.dll_major / 1000,
cygwin_version.dll_major % 1000,
cygwin_version.dll_minor,
cygwin_version.api_major,
cygwin_version.api_minor,
cygwin_version.shared_data,
CYGWIN_SERVER_VERSION_MAJOR,
CYGWIN_SERVER_VERSION_API,
CYGWIN_SERVER_VERSION_MINOR,
CYGWIN_SERVER_VERSION_PATCH,
cygwin_version.mount_registry,
cygwin_version.mount_registry,
cygwin_version.dll_build_date);
setbuf (stdout, NULL);
printf ("daemon version %s starting up", version);

View File

@ -1,6 +1,6 @@
/* cygserver_client.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>
@ -98,7 +98,7 @@ client_request::send (transport_layer_base *conn)
if ((bytes_read = conn->read ((char *)&header, sizeof (header)))
!= sizeof (header) || (header.cb &&
(bytes_read = conn->read (buffer, header.cb) ) != header.cb))
(bytes_read = conn->read (buffer, header.cb)) != header.cb))
{
header.error_code = -1;
debug_printf("failed reading response \n");
@ -188,11 +188,11 @@ cygserver_init ()
if (rc < 0)
cygserver_running = CYGSERVER_DEAD;
else if (rc > 0)
api_fatal ( "error connecting to cygwin server. error: %d", rc );
api_fatal ("error connecting to cygwin server. error: %d", rc);
else if (req->version.major != CYGWIN_SERVER_VERSION_MAJOR ||
req->version.api != CYGWIN_SERVER_VERSION_API ||
req->version.minor > CYGWIN_SERVER_VERSION_MINOR)
api_fatal ( "incompatible version of cygwin server.\n\
api_fatal ("incompatible version of cygwin server.\n\
client version %d.%d.%d.%d, server version%ld.%ld.%ld.%ld",
CYGWIN_SERVER_VERSION_MAJOR,
CYGWIN_SERVER_VERSION_API,
@ -201,7 +201,7 @@ cygserver_init ()
req->version.major,
req->version.api,
req->version.minor,
req->version.patch );
req->version.patch);
else
cygserver_running = CYGSERVER_OK;
}

View File

@ -1,6 +1,6 @@
/* cygserver_process.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
@ -117,10 +117,10 @@ process_cache::remove_process (class process *theprocess)
{
entry = (class process *) InterlockedExchangePointer (&head, theprocess->next);
if (entry != theprocess)
{
printf ("Bug encountered, process cache corrupted\n");
{
printf ("Bug encountered, process cache corrupted\n");
exit (1);
}
}
}
else
{
@ -138,7 +138,6 @@ process_cache::remove_process (class process *theprocess)
add_task (theprocess);
}
/* copy <= max_copy HANDLEs to dest[], starting at an offset into _our list_ of
* begin_at. (Ie begin_at = 5, the first copied handle is still written to dest[0]
* NOTE: Thread safe, but not thread guaranteed - a newly added process may be missed.

View File

@ -1,6 +1,6 @@
/* cygserver_shm.cc: Single unix specification IPC interface for Cygwin
Copyright 2001 Red Hat, Inc.
Copyright 2001, 2002 Red Hat, Inc.
Originally written by Robert Collins <robert.collins@hotmail.com>
@ -182,9 +182,9 @@ delete_shmnode (shmnode **nodeptr)
{
shmnode *tempnode = shm_head;
while (tempnode && tempnode->next != node)
tempnode = tempnode->next;
tempnode = tempnode->next;
if (tempnode)
tempnode->next = node->next;
tempnode->next = node->next;
// else log the unexpected !
}
@ -207,7 +207,7 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) parameters.in.sd_buf;
// /* create a sd for our open requests based on shmflag & 0x01ff */
// psd = alloc_sd (getuid (), getgid (), cygheap->user.logsrv (),
// parameters.in.shmflg & 0x01ff, psd, &sd_size);
// parameters.in.shmflg & 0x01ff, psd, &sd_size);
HANDLE from_process_handle = NULL;
HANDLE token_handle = NULL;
@ -364,9 +364,9 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
delete_shmnode (&temp2);
}
header.error_code = 0;
CloseHandle (token_handle);
return;
header.error_code = 0;
CloseHandle (token_handle);
return;
}
tempnode = &(*tempnode)->next;
}
@ -623,7 +623,7 @@ client_request_shm::serve (transport_layer_base * conn, process_cache * cache)
/* we now have the area in the daemon list, opened.
FIXME: leave the system wide shm mutex */
FIXME: leave the system wide shm mutex */
parameters.out.shm_id = tempnode->shm_id;
if (check_and_dup_handle (GetCurrentProcess (), from_process_handle,

View File

@ -1,6 +1,6 @@
/* cygserver_shm.h
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
This file is part of Cygwin.

View File

@ -1,6 +1,6 @@
/* cygserver_transport.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>

View File

@ -1,6 +1,6 @@
/* cygserver_transport_pipes.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
@ -80,11 +80,11 @@ transport_layer_pipes::accept ()
}
pipe = CreateNamedPipe (pipe_name,
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
0, 0, 1000,
&sec_all_nih );
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_BYTE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
0, 0, 1000,
&sec_all_nih );
if (pipe == INVALID_HANDLE_VALUE)
{
debug_printf ("error creating pipe (%lu)\n.", GetLastError ());
@ -164,24 +164,24 @@ transport_layer_pipes::connect ()
while (1)
{
pipe = CreateFile (pipe_name,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
&sec_all_nih,
OPEN_EXISTING,
0, NULL);
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
&sec_all_nih,
OPEN_EXISTING,
0, NULL);
if (pipe != INVALID_HANDLE_VALUE)
/* got the pipe */
return true;
return true;
if (GetLastError () != ERROR_PIPE_BUSY)
{
debug_printf ("Error opening the pipe (%lu)\n", GetLastError ());
pipe = NULL;
return false;
}
{
debug_printf ("Error opening the pipe (%lu)\n", GetLastError ());
pipe = NULL;
return false;
}
if (!WaitNamedPipe (pipe_name, 20000))
debug_printf ( "error connecting to server pipe after 20 seconds (%lu)\n", GetLastError () );
debug_printf ( "error connecting to server pipe after 20 seconds (%lu)\n", GetLastError () );
/* We loop here, because the pipe exists but is busy. If it doesn't exist
* the != ERROR_PIPE_BUSY will catch it.
*/

View File

@ -1,6 +1,6 @@
/* cygserver_transport_sockets.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>
@ -28,7 +28,7 @@ extern "C" int
cygwin_socket (int af, int type, int protocol);
extern "C" int
cygwin_connect (int fd,
const struct sockaddr *name,
const struct sockaddr *name,
int namelen);
extern "C" int
cygwin_accept (int fd, struct sockaddr *peer, int *len);

View File

@ -1,6 +1,6 @@
/* cygserver.h
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Egor Duda <deo@logos-m.ru>

View File

@ -1,6 +1,6 @@
/* cygserver_process.h
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>

View File

@ -1,6 +1,6 @@
/* cygserver.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>

View File

@ -1,6 +1,6 @@
/* cygserver.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>

View File

@ -1,6 +1,6 @@
/* cygserver.cc
Copyright 2001 Red Hat Inc.
Copyright 2001, 2002 Red Hat Inc.
Written by Robert Collins <rbtcollins@hotmail.com>