Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2021-05-05 22:45:12 +0300
committerKen Brown <kbrown@cornell.edu>2021-06-04 19:36:45 +0300
commitc001dd883fa657b6c96e3dae614f34368211deb5 (patch)
tree5e737d65b2c06ad9d55b8d0cbea13e9ae3186739
parent90f4337ea1f4a73c548faed1bc9e71c4c1071e56 (diff)
Cygwin: AF_UNIX: replace gen_pipe_name by gen_mqueue_name
The generated name is now an ordinary string instead of a UNICODE_STRING. Store it in pc.path. For clarity, add methods set_mqueue_name and get_mqueue name to do the storing and retrieving. Add a method path_conv::get_path to help with this.
-rw-r--r--winsup/cygwin/fhandler.h7
-rw-r--r--winsup/cygwin/fhandler_socket_unix.cc17
-rw-r--r--winsup/cygwin/path.h1
3 files changed, 13 insertions, 12 deletions
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 9358fdf6a..696c308fc 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1077,7 +1077,10 @@ class fhandler_socket_unix : public fhandler_socket
int create_shmem ();
int reopen_shmem ();
- void gen_pipe_name ();
+ void set_mqueue_name (const char *p) { pc.set_path (p); }
+ /* Returns empty string if mqueue name hasn't been generated. */
+ const char *get_mqueue_name () const { return pc.get_path (); }
+ void gen_mqueue_name ();
static HANDLE create_abstract_link (const sun_name_t *sun,
PUNICODE_STRING pipe_name);
static HANDLE create_reparse_point (const sun_name_t *sun,
@@ -1087,7 +1090,7 @@ class fhandler_socket_unix : public fhandler_socket
static int open_reparse_point (sun_name_t *sun, PUNICODE_STRING pipe_name);
static int open_file (sun_name_t *sun, int &type, PUNICODE_STRING pipe_name);
HANDLE autobind (sun_name_t *sun);
- wchar_t get_type_char ();
+ char get_type_char ();
void set_pipe_non_blocking (bool nonblocking);
int send_sock_info (bool from_bind);
int grab_admin_pkt ();
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 8f246ce99..3c5bb35e3 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -262,17 +262,14 @@ fhandler_socket_unix::reopen_shmem ()
#define CYGWIN_MQUEUE_SOCKET_TYPE_POS 9
void
-fhandler_socket_unix::gen_pipe_name ()
+fhandler_socket_unix::gen_mqueue_name ()
{
- WCHAR pipe_name_buf[CYGWIN_PIPE_SOCKET_NAME_LEN + 1];
- UNICODE_STRING pipe_name;
+ char mqueue_name_buf[CYGWIN_MQUEUE_SOCKET_NAME_LEN + 1];
- __small_swprintf (pipe_name_buf, L"cygwin-%S-unix-%C-%016_X",
- &cygheap->installation_key,
+ __small_sprintf (mqueue_name_buf, "/af-unix-%c-%016x",
get_type_char (),
get_unique_id ());
- RtlInitUnicodeString (&pipe_name, pipe_name_buf);
- pc.set_nt_native_path (&pipe_name);
+ set_mqueue_name (mqueue_name_buf);
}
HANDLE
@@ -596,7 +593,7 @@ fhandler_socket_unix::autobind (sun_name_t* sun)
return fh;
}
-wchar_t
+char
fhandler_socket_unix::get_type_char ()
{
switch (get_socket_type ())
@@ -1447,7 +1444,7 @@ fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags,
set_unique_id ();
set_ino (get_unique_id ());
/* bind/listen 1st socket */
- gen_pipe_name ();
+ gen_mqueue_name ();
pipe = create_pipe (true);
if (!pipe)
goto create_pipe_failed;
@@ -1513,7 +1510,7 @@ fhandler_socket_unix::bind (const struct sockaddr *name, int namelen)
}
binding_state (bind_pending);
bind_unlock ();
- gen_pipe_name ();
+ gen_mqueue_name ();
if (get_socket_type () == SOCK_DGRAM)
{
pipe = create_pipe (true);
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index adb0ca11f..05079e379 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -389,6 +389,7 @@ class path_conv
bool fs_is_prlfs () const {return fs.is_prlfs ();}
fs_info_type fs_type () const {return fs.what_fs ();}
ULONG fs_serial_number () const {return fs.serial_number ();}
+ inline const char *get_path () const { return path; }
inline const char *set_path (const char *p)
{
if (path)