summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscottc <scottc>2002-07-16 12:13:56 +0000
committerscottc <scottc>2002-07-16 12:13:56 +0000
commita7cce3e7efc310a7a12bf9900c0c5bab9cd6f57c (patch)
tree414d59a6ceddfc3dca0394016f57f9e298f3a44b
parent05878213f2b9b7bf548084f6be3594b09bf06b5d (diff)
downloadgdb-a7cce3e7efc310a7a12bf9900c0c5bab9cd6f57c.tar.gz
Re-indent etc.
-rwxr-xr-xwinsup/cygwin/cygserver_transport_pipes.cc39
-rwxr-xr-xwinsup/cygwin/cygserver_transport_sockets.cc32
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport.h25
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport_pipes.h50
-rwxr-xr-xwinsup/cygwin/include/cygwin/cygserver_transport_sockets.h37
5 files changed, 100 insertions, 83 deletions
diff --git a/winsup/cygwin/cygserver_transport_pipes.cc b/winsup/cygwin/cygserver_transport_pipes.cc
index 5156fab4004..3a230cf11e1 100755
--- a/winsup/cygwin/cygserver_transport_pipes.cc
+++ b/winsup/cygwin/cygserver_transport_pipes.cc
@@ -34,10 +34,10 @@ details. */
#endif
enum
-{
- MAX_WAIT_NAMED_PIPE_RETRY = 64,
- WAIT_NAMED_PIPE_TIMEOUT = 10 // milliseconds
-};
+ {
+ MAX_WAIT_NAMED_PIPE_RETRY = 64,
+ WAIT_NAMED_PIPE_TIMEOUT = 10 // milliseconds
+ };
#ifndef __INSIDE_CYGWIN__
@@ -46,7 +46,7 @@ static CRITICAL_SECTION pipe_instance_lock;
static long pipe_instance = 0;
static void
-initialise_pipe_instance_lock()
+initialise_pipe_instance_lock ()
{
assert (pipe_instance == 0);
InitializeCriticalSection (&pipe_instance_lock);
@@ -63,7 +63,7 @@ transport_layer_pipes::transport_layer_pipes (const HANDLE new_pipe)
{
assert (pipe && pipe != INVALID_HANDLE_VALUE);
- init_security();
+ init_security ();
}
#endif /* !__INSIDE_CYGWIN__ */
@@ -73,11 +73,11 @@ transport_layer_pipes::transport_layer_pipes ()
pipe (NULL),
is_accepted_endpoint (false)
{
- init_security();
+ init_security ();
}
void
-transport_layer_pipes::init_security()
+transport_layer_pipes::init_security ()
{
assert (wincap.has_security ());
@@ -209,7 +209,7 @@ transport_layer_pipes::close ()
}
ssize_t
-transport_layer_pipes::read (void * const buf, const size_t len)
+transport_layer_pipes::read (void *const buf, const size_t len)
{
// verbose: debug_printf ("reading from pipe %p", pipe);
@@ -233,7 +233,7 @@ transport_layer_pipes::read (void * const buf, const size_t len)
}
ssize_t
-transport_layer_pipes::write (void * const buf, const size_t len)
+transport_layer_pipes::write (void *const buf, const size_t len)
{
// verbose: debug_printf ("writing to pipe %p", pipe);
@@ -284,12 +284,12 @@ transport_layer_pipes::connect ()
while (rc)
{
pipe = CreateFile (pipe_name,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- &sec_all_nih,
- OPEN_EXISTING,
- SECURITY_IMPERSONATION,
- NULL);
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ &sec_all_nih,
+ OPEN_EXISTING,
+ SECURITY_IMPERSONATION,
+ NULL);
if (pipe != INVALID_HANDLE_VALUE)
{
@@ -348,9 +348,10 @@ transport_layer_pipes::impersonate_client ()
assert (pipe != INVALID_HANDLE_VALUE);
if (!ImpersonateNamedPipeClient (pipe))
- debug_printf ("Failed to Impersonate the client, (%lu)", GetLastError ());
+ debug_printf ("Failed to Impersonate the client, (%lu)",
+ GetLastError ());
}
- // verbose: debug_printf("I am who you are");
+ // verbose: debug_printf ("I am who you are");
}
void
@@ -359,7 +360,7 @@ transport_layer_pipes::revert_to_self ()
assert (is_accepted_endpoint);
RevertToSelf ();
- // verbose: debug_printf("I am who I yam");
+ // verbose: debug_printf ("I am who I yam");
}
#endif /* !__INSIDE_CYGWIN__ */
diff --git a/winsup/cygwin/cygserver_transport_sockets.cc b/winsup/cygwin/cygserver_transport_sockets.cc
index 06038259469..bf79dffae70 100755
--- a/winsup/cygwin/cygserver_transport_sockets.cc
+++ b/winsup/cygwin/cygserver_transport_sockets.cc
@@ -42,28 +42,29 @@ extern "C" int
cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen);
#else
-#define cygwin_accept(A,B,C) ::accept(A,B,C)
-#define cygwin_socket(A,B,C) ::socket(A,B,C)
-#define cygwin_listen(A,B) ::listen(A,B)
-#define cygwin_bind(A,B,C) ::bind(A,B,C)
-#define cygwin_connect(A,B,C) ::connect(A,B,C)
+#define cygwin_accept(A,B,C) ::accept (A,B,C)
+#define cygwin_socket(A,B,C) ::socket (A,B,C)
+#define cygwin_listen(A,B) ::listen (A,B)
+#define cygwin_bind(A,B,C) ::bind (A,B,C)
+#define cygwin_connect(A,B,C) ::connect (A,B,C)
#endif
-transport_layer_sockets::transport_layer_sockets (int newfd): fd(newfd)
+transport_layer_sockets::transport_layer_sockets (int newfd)
+ : fd (newfd)
{
/* This may not be needed in this constructor - it's only used
* when creating a connection via bind or connect
*/
sockdetails.sa_family = AF_UNIX;
strcpy (sockdetails.sa_data, "/tmp/cygdaemo");
- sdlen = strlen(sockdetails.sa_data) + sizeof(sockdetails.sa_family);
+ sdlen = strlen (sockdetails.sa_data) + sizeof (sockdetails.sa_family);
};
transport_layer_sockets::transport_layer_sockets (): fd (-1)
{
sockdetails.sa_family = AF_UNIX;
strcpy (sockdetails.sa_data, "/tmp/cygdaemo");
- sdlen = strlen(sockdetails.sa_data) + sizeof(sockdetails.sa_family);
+ sdlen = strlen (sockdetails.sa_data) + sizeof (sockdetails.sa_family);
}
transport_layer_sockets::~transport_layer_sockets ()
@@ -79,17 +80,18 @@ transport_layer_sockets::listen ()
/* we want a thread pool based approach. */
if ((fd = cygwin_socket (AF_UNIX, SOCK_STREAM,0)) < 0)
system_printf ("Socket not created error %d", errno);
- if (cygwin_bind(fd, &sockdetails, sdlen))
+ if (cygwin_bind (fd, &sockdetails, sdlen))
system_printf ("Bind doesn't like you. Tsk Tsk. Bind said %d", errno);
- if (cygwin_listen(fd, 5) < 0)
- system_printf ("And the OS just isn't listening, all it says is %d", errno);
+ if (cygwin_listen (fd, 5) < 0)
+ system_printf ("And the OS just isn't listening, all it says is %d",
+ errno);
}
class transport_layer_sockets *
-transport_layer_sockets::accept (bool * const recoverable)
+transport_layer_sockets::accept (bool *const recoverable)
{
/* FIXME: check we have listened */
- const int accept_fd = cygwin_accept(fd, &sockdetails, &sdlen);
+ const int accept_fd = cygwin_accept (fd, &sockdetails, &sdlen);
if (accept_fd == -1)
{
@@ -118,7 +120,7 @@ transport_layer_sockets::accept (bool * const recoverable)
#endif /* !__INSIDE_CYGWIN__ */
void
-transport_layer_sockets::close()
+transport_layer_sockets::close ()
{
/* FIXME - are we open? */
if (fd != -1)
@@ -151,7 +153,7 @@ transport_layer_sockets::connect ()
fd = cygwin_socket (AF_UNIX, SOCK_STREAM, 0);
if (cygwin_connect (fd, &sockdetails, sdlen) < 0)
{
- debug_printf("client connect failure %d", errno);
+ debug_printf ("client connect failure %d", errno);
::close (fd);
return false;
}
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport.h b/winsup/cygwin/include/cygwin/cygserver_transport.h
index 76a1b847fa4..c18486c1c71 100755
--- a/winsup/cygwin/include/cygwin/cygserver_transport.h
+++ b/winsup/cygwin/include/cygwin/cygserver_transport.h
@@ -12,25 +12,28 @@ details. */
#ifndef _CYGSERVER_TRANSPORT_
#define _CYGSERVER_TRANSPORT_
+
class transport_layer_base *create_server_transport();
-/* the base class does nothing. */
class transport_layer_base
{
- public:
+public:
#ifndef __INSIDE_CYGWIN__
- virtual void listen () = 0;
- virtual class transport_layer_base * accept (bool * recoverable) = 0;
+ virtual void listen () = 0;
+ virtual class transport_layer_base *accept (bool *recoverable) = 0;
#endif
- virtual void close () = 0;
- virtual ssize_t read (void *buf, size_t len) = 0;
- virtual ssize_t write (void *buf, size_t len) = 0;
- virtual bool connect() = 0;
+
+ virtual void close () = 0;
+ virtual ssize_t read (void *buf, size_t len) = 0;
+ virtual ssize_t write (void *buf, size_t len) = 0;
+ virtual bool connect () = 0;
+
#ifndef __INSIDE_CYGWIN__
- virtual void impersonate_client ();
- virtual void revert_to_self ();
+ virtual void impersonate_client ();
+ virtual void revert_to_self ();
#endif
- virtual ~transport_layer_base();
+
+ virtual ~transport_layer_base ();
};
#endif /* _CYGSERVER_TRANSPORT_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h b/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
index 4ebdcb2b561..1f4a86ca7eb 100755
--- a/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
+++ b/winsup/cygwin/include/cygwin/cygserver_transport_pipes.h
@@ -12,34 +12,40 @@ details. */
#ifndef _CYGSERVER_TRANSPORT_PIPES_
#define _CYGSERVER_TRANSPORT_PIPES_
+
/* Named pipes based transport, for security on NT */
class transport_layer_pipes : public transport_layer_base
{
- public:
+public:
#ifndef __INSIDE_CYGWIN__
- virtual void listen ();
- virtual class transport_layer_pipes * accept (bool * recoverable);
+ virtual void listen ();
+ virtual class transport_layer_pipes *accept (bool *recoverable);
#endif
- virtual void close ();
- virtual ssize_t read (void *buf, size_t len);
- virtual ssize_t write (void *buf, size_t len);
- virtual bool connect();
+
+ virtual void close ();
+ virtual ssize_t read (void *buf, size_t len);
+ virtual ssize_t write (void *buf, size_t len);
+ virtual bool connect ();
+
#ifndef __INSIDE_CYGWIN__
- virtual void impersonate_client ();
- virtual void revert_to_self ();
+ virtual void impersonate_client ();
+ virtual void revert_to_self ();
#endif
- transport_layer_pipes ();
- virtual ~transport_layer_pipes ();
-
- private:
- /* for pipe based communications */
- void init_security ();
- //FIXME: allow inited, sd, all_nih_.. to be static members
- SECURITY_DESCRIPTOR sd;
- SECURITY_ATTRIBUTES sec_none_nih, sec_all_nih;
- const char * const pipe_name;
- HANDLE pipe;
- const bool is_accepted_endpoint;
- transport_layer_pipes (HANDLE new_pipe);
+
+ transport_layer_pipes ();
+ virtual ~transport_layer_pipes ();
+
+private:
+ /* for pipe based communications */
+ void init_security ();
+ //FIXME: allow inited, sd, all_nih_.. to be static members
+ SECURITY_DESCRIPTOR sd;
+ SECURITY_ATTRIBUTES sec_none_nih, sec_all_nih;
+ const char *const pipe_name;
+ HANDLE pipe;
+ const bool is_accepted_endpoint;
+
+ transport_layer_pipes (HANDLE new_pipe);
};
+
#endif /* _CYGSERVER_TRANSPORT_PIPES_ */
diff --git a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h b/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
index 10f604c5b86..0b646cdc6f6 100755
--- a/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
+++ b/winsup/cygwin/include/cygwin/cygserver_transport_sockets.h
@@ -12,25 +12,30 @@ details. */
#ifndef _CYGSERVER_TRANSPORT_SOCKETS_
#define _CYGSERVER_TRANSPORT_SOCKETS_
+
class transport_layer_sockets : public transport_layer_base
{
- public:
+public:
#ifndef __INSIDE_CYGWIN__
- virtual void listen ();
- virtual class transport_layer_sockets * accept (bool * recoverable);
+ virtual void listen ();
+ virtual class transport_layer_sockets *accept (bool *recoverable);
#endif
- virtual void close ();
- virtual ssize_t read (void *buf, size_t len);
- virtual ssize_t write (void *buf, size_t len);
- virtual bool connect();
- transport_layer_sockets ();
- virtual ~transport_layer_sockets ();
-
- private:
- /* for socket based communications */
- int fd;
- struct sockaddr sockdetails;
- int sdlen;
- transport_layer_sockets (int newfd);
+
+ virtual void close ();
+ virtual ssize_t read (void *buf, size_t len);
+ virtual ssize_t write (void *buf, size_t len);
+ virtual bool connect ();
+
+ transport_layer_sockets ();
+ virtual ~transport_layer_sockets ();
+
+private:
+ /* for socket based communications */
+ int fd;
+ struct sockaddr sockdetails;
+ int sdlen;
+
+ transport_layer_sockets (int newfd);
};
+
#endif /* _CYGSERVER_TRANSPORT_SOCKETS_ */