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.
This commit is contained in:
parent
90f4337ea1
commit
c001dd883f
|
@ -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 ();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue