aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-06-04Cygwin: AF_UNIX: implement recvmsggithub/topic/af_unix_mqtopic/af_unix_mqKen Brown2-30/+333
First cut. Not yet tested.
2021-06-04Cygwin: AF_UNIX: implement sendmsgKen Brown2-2/+164
First cut. Not yet tested.
2021-06-04Cygwin: AF_UNIX: adapt shutdown to mqueuesKen Brown1-10/+16
2021-06-04Cygwin: AF_UNIX: keep a reference count of open descriptorsKen Brown2-4/+14
Add a data member _ndesc to the af_unix_shmem_t class, along with methods to increment and decrement it. Increment it during socket/fork/exec/dup, and decrement it during close. When the last descriptor is closed, call shutdown (SHUT_RDWR) and unlink the socket's message queue. The shutdown call will make the socket's peer see EPIPE if it tries to write.
2021-06-04Cygwin: AF_UNIX: adapt close to mqueuesKen Brown1-1/+11
2021-06-04Cygwin: AF_UNIX: adapt socketpair to mqueuesKen Brown1-21/+41
2021-06-04Cygwin: AF_UNIX: adapt connect and accept to mqueuesKen Brown2-302/+202
- Flesh out connect_mqueue, which replaces connect_pipe. - A new method wait_mqueue replaces wait_pipe. - A new method wait_mqueue_thread replaces wait_pipe_thread. - New methods send_mqueue_name and recv_peer_mqueue_name are used for making connection requests and responding to them. - A new method xchg_sock_info is called after a connecting socket successfully receives its peer's mqueue name. This functionality was previously in open_pipe. - Remove open_pipe, listen_pipe, and create_pipe_instance, which are no longer needed.
2021-06-04Cygwin: AF_UNIX: adapt send_sock_info to mqueuesKen Brown1-12/+16
The socket info is sent as an administrative packet, for which we use a higher priority "af_un_prio_admin" than for normal packets.
2021-06-04Cygwin: AF_UNIX: adapt recv_peer_info to mqueuesKen Brown1-36/+14
2021-06-04Cygwin: AF_UNIX: new helper function set_mqueue_non_blockingKen Brown1-0/+17
This will replace set_pipe_non_blocking.
2021-06-04Cygwin: AF_UNIX: adapt grab_admin_pkt to mqueuesKen Brown2-80/+49
Use peek_mqueue instead of peek_pipe, and remove the latter. Use mq_receive instead of NtReadFile.
2021-06-04Cygwin: AF_UNIX: new method peek_mqueueKen Brown2-0/+12
This will replace peek_pipe.
2021-06-04Cygwin: AF_UNIX: add create_mqueue to replace create_pipeKen Brown2-65/+57
Also add new data members mqd_in and mqd_out, along with getter and setter methods. mqd_in and mqd_out are mqueue descriptors for input/output. create_mqueue creates an mqueue for reading and sets mqd_in to its descriptor. Make other provisional changes so that compilation will succeed.
2021-06-04Cygwin: AF_UNIX: new method open_mqueueKen Brown2-0/+11
This will replace open_pipe.
2021-06-04Cygwin: AF_UNIX: rework some internal methodsKen Brown2-51/+37
- open_abstract_link, open_reparse_point, and open_socket now return HANDLEs - connect no longer checks the validity of the sockaddr structure. It's done in open_socket.
2021-06-04Cygwin: AF_UNIX: rename {create,open}_file to {create,open}_socketKen Brown2-7/+7
2021-06-04Cygwin: AF_UNIX: adapt symlink and reparse point to mqueuesKen Brown2-57/+46
create_symlink, create_reparse_point, and create_file now take a char *mqueue_name argument instead of a PUNICODE_STRING. For create_symlink, convert the string to a UNICODE_STRING and make that the target of the symlink. For create_reparse_point, store the string in the reparse point as is. Make other provisional changes so that compilation will succeed. This includes adding a methode connect_mqueue that does nothing for now.
2021-06-04Cygwin: AF_UNIX: replace gen_pipe_name by gen_mqueue_nameKen Brown3-12/+13
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.
2021-06-04Cygwin: AF_UNIX: prepare for use of message queuesKen Brown2-43/+52
We will switch to using POSIX message queues instead of Windows pipes for data transport. In preparation for that, update the commentary in fhandler_socket_unix.cc. Also move the definition of class af_unix_pkt_hdr_t to fhandler.h and make a few minor changes.
2021-06-04Cygwin: AF_UNIX: first cut of mqueue modificationsKen Brown5-17/+117
2021-06-04Cygwin: AF_UNIX: add saw_shutdown_read and saw_shutdown_writeKen Brown1-0/+4
For consistency between the fhandler_socket_unix and fhandler_socket_wsock classes, add virtual methods saw_shutdown_read and saw_shutdown_write to fhandler_socket. Implement them for fhandler_socket_unix. (They were already implemented for fhandler_socket_wsock.)
2021-06-04Cygwin: AF_UNIX: getpeername: fail if not connectedKen Brown1-0/+6
2021-06-04Cygwin: AF_UNIX: reopen_shmem: fix view sizeKen Brown1-2/+2
Use sizeof (af_unix_shmem_t) as the view size, as when the shared memory was created. Previously PAGESIZE was used, causing NtMapViewOfSection to fail with STATUS_INVALID_VIEW_SIZE.
2021-06-04Cygwin: AF_UNIX: convert AF_UNIX_PKT helpers to inline functionsCorinna Vinschen1-26/+59
Add AF_UNIX_PKT_DATA_END and AF_UNIX_PKT_DATA_APPEND
2021-06-04Cygwin: AF_UNIX: implement constructorKen Brown1-1/+5
2021-06-04Cygwin: AF_UNIX: add socket testsKen Brown69-0/+4808
2021-05-26Cygwin: fhandler_mqueue::mq_open: fix typoKen Brown1-1/+1
2021-05-26aarch64: support binary mode for opening filesRichard Earnshaw1-0/+12
Newlib for aarch64 uses libgloss for the backend. One common libgloss implementation is the 'rdimon' implementation, which uses the Arm Semihosting protocol. In order to support a remote host that runs on Windows we need to know whether a file is to be opened in binary or text mode. That means that we need to preserve this information via O_BINARY until we know what the libgloss binding will be. This patch simply copies the arm implementation from sys/arm/sys and puts it in machine/aarch64/sys, because we don't have a 'sys' subtree on aarch64.
2021-05-26Cygwin: utils: enable -idirafter to fetch Cygwin headers from mingw sourcesCorinna Vinschen4-11/+11
Get rid of the last dreaded relative paths pointing to the cygwin dir. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26Cygwin: utils: set _WIN32_WINNT and NTDDI_VERSION via MakefileCorinna Vinschen9-11/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26Cygwin: set NTDDI_VERSION to enable more recent windows definitionsCorinna Vinschen3-12/+1
Set to WDK_NTDDI_VERSION since that enables all the latest. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-26Cygwin: fhandler_mqueue: add missing __reg2 for 32 bit buildCorinna Vinschen1-1/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: fhandler_mqueue: disable more methods, add fcntlCorinna Vinschen2-4/+31
Unsupported functionality returns EPERM, fcntl supports only F_GETFD and F_GETFL. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: fhandler_mqueue::mq_open: set all required fhandler flagsCorinna Vinschen1-1/+8
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: disable creating directories below /dev/mqueueCorinna Vinschen2-0/+8
...as on Linux. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: fhandler_mqueue: fix method declarationsCorinna Vinschen1-6/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: path_conv: fix mqueue path checkCorinna Vinschen4-15/+27
The check for a file or dir within /dev/mqueue is accidentally using the incoming path, which could be a relative path. Make sure to restore the absolute POSIX path in path_copy and only then test the path. Also, move the actual check for a valid path below /dev/mqueue into the fhandler_mqueue class. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: cwdstuff: check if /dev existsCorinna Vinschen1-2/+18
/dev has been handled as virtual dir in cwdstuff, thus not allowing to start native apps from /dev as CWD, even if /dev actually exists on disk. Unfortunately this also affects Cygwin executables started from a debugger. When chdir'ing to /dev, check if /dev exists on disk. If so, treat it as any other existing path. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: implement read(2)/lseek(2)Corinna Vinschen2-5/+110
reuse fhandler_virtual implementation to implement read and lseek. The output from read(2) is modelled after the output when reading from an mq file on Linux. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: implement ioctl(2)Corinna Vinschen2-0/+7
Call into fhandler_base::ioctl immediately, thus only allowing FIONBIO to manipulate blocking behaviour. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: move all mq_* functionality into fhandler_mqueueCorinna Vinschen4-476/+492
The POSIX entry points are just wrappers now, calling into fhandler_mqueue. While at it, eliminate mqi_flags, replace with standard fhandler nonblocking flag. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: allocate section views top downCorinna Vinschen1-2/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: Implement dupCorinna Vinschen2-18/+28
Create a private method fhandler_mqueue::_dup and call it from dup and fixup_after_fork methods. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: implement open/mq_open entirely in fhandlerCorinna Vinschen5-190/+293
The mq_open call is just a framework now. This patch moves the entire functionality into fhandler_mqueue. To support standard OS calls (as on Linux), make fhandler_mqueue a derived class from fhandler_disk_file and keep the base handle the handle to the default stream, to allow implementing O_PATH functionlaity as well as reading from the file and NOT reading binary message queue data. Implement a standard fhandler_mqueue::open method, allowing, for instance, to touch a file under /dev/mqueue and if it doesn't exist, to create a message queue file. FIXME: This introduces a BAD HACK into path_conv::check, which needs reviewing. Keep the posix path intact in the fhandler, and change get_proc_fd_name accordingly to return only the basename plus leading slash for /proc/<PID>/fd. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: slightly rephrase get_mqinfoCorinna Vinschen1-3/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: simplify mq_closeCorinna Vinschen2-7/+3
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: get_nt_native_path: allow to append suffixCorinna Vinschen2-2/+8
POSIX message queues will be moved into NTFS streams. Extend get_nt_native_path to provide a filename suffix which is not subject to special character transposition, to allow specifying a colon. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-25Cygwin: POSIX msg queues: move definition of struct msg_hdrCorinna Vinschen1-0/+7
...to mqueue_types.h header. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-22Cygwin: POSIX msg queues: improve error output in fixup_after_forkCorinna Vinschen1-15/+22
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2021-05-22Cygwin: Ensure PSAPI_VERSION is 1 when building lddJon Turney1-0/+1
The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to 0x0a00 when building ldd, which gets PSAPI_VERSION=2. This causes K32GetModuleFileNameEx to be used for GetModuleFileNameEx, which isn't available on Windows Vista. Define PSAPI_VERSION as 1 for the built executable to work on Windows Vista.