summaryrefslogtreecommitdiff
path: root/pflocal
AgeCommit message (Collapse)Author
2023-12-17Update server handlers to return kern_return_error to fix ↵Flavio Cruz
-Werror=enum-int-mismatch warnings MiG expects those to return kern_return_t. Message-ID: <ZXqbbXpVqQAwd2qv@jupiter.tail36e24.ts.net>
2023-09-04pflocal: Remove unused write_addr fieldSamuel Thibault
It was never set, and re-connecting a socket to another address would try to deref the port, thus crashing.
2023-05-10Style tweaksSergey Bugaev
Message-Id: <20230508213136.608575-42-bugaevc@gmail.com>
2023-05-10pflocal: Port to x86_64Sergey Bugaev
Message-Id: <20230508213136.608575-30-bugaevc@gmail.com>
2023-05-02Use uintptr_t for message payloads.Flavio Cruz
A follow up to 92fad38a043b75ed6b435b3efa574ede91dbe9ee in gnumach. Message-Id: <ZFCNasf9bJ9qj+CG@jupiter.tail36e24.ts.net>
2023-04-08Further modernize Hurd code by enforcing strict prototypes and no implicit ↵Flavio Cruz
function declarations. Most of the changes land in one of these buckets: * Removed unused declarations. * Used (void) to represent no parameters instead of () which means an undeterminate number of parameters. * Included missing header files whenever necessary (stdlib.h, sys/mman.h, etc) * Typedefed function pointers to be able to fully declare the parameter types. * Added declarations of library functions that are used elsewhere (example is libps/ps.h). * Made functions static whenever they are only used in that file. * Forwarded declarations of some methods that were made static. Message-Id: <ZDD1o7/tVYeZew+G@jupiter.tail36e24.ts.net>
2023-04-03Modernize code by removing use of old style definitions.Flavio Cruz
Also add -Werror=old-style-definition to enforce new code. Message-Id: <ZBZ+8xf7GHy2RT/h@jupiter.tail36e24.ts.net>
2023-01-01pflocal: Fix unsafe increment of refsSamuel Thibault
2023-01-01pflocal: Avoid setting sock fields on errorSamuel Thibault
2022-08-29Fix types of read write and readables methodsEtienne Brateau
Message-Id: <20220829193617.13481-1-etienne.brateau@gmail.com>
2022-01-16Make RPC input array parameters constSamuel Thibault
This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
2021-04-03pflocal: Make io_stat allocate inode idSamuel Thibault
We may not have io_identity called before io_stat, and programs like diff rely on inode numbers being different for different files. * pflocal/io.c (S_io_stat): Allocate socket id if not already allocated.
2020-11-22pflocal: Fix warningSamuel Thibault
* pflocal/sock.c: Include <unistd.h>.
2020-11-11pflocal: Set default uid/gid to those of the translatorSamuel Thibault
* pflocal/sock.c (sock_create): Set uid to getpid () and gid to getgid ().
2020-11-11pflocal: Record socket creator so io_stat can return itSamuel Thibault
* pflocal/sock.h (struct sock): Add uid and gid fields. * pflocal/sock.c (sock_create): Set uid and gid to 0. * pflocal/mig-mutate.h (SOCKET_IMPORTS): Import ../libtrivfs/mig-decls.h. (PF_INTRAN, PF_INTRAN_PAYLOAD, PF_DESTRUCTOR): New macros. * pflocal/pf.c: Include hurd/trivfs.h. (S_socket_create): Update parameters. Set sock's uid and gid fields according to pf->user. * pflocal/io.c (S_io_stat): Set st_uid and st_gid according to pf.
2020-07-05pflocal: Fix referencing connection queue entries.Samuel Thibault
As asserted in connq_destroy, for each entry in the queue we are supposed to keep a reference to the socket that contains the queue. So we need to keep it when connecting and release it when accepting. * pflocal/socket.c (S_socket_connect): Do not deref the peer socket when sock_connect succeeded. (S_socket_accept): Deref the socket when the accept succeeded.
2020-07-05pflocal: support SO_SNDBUF for unconnected socketsSamuel Thibault
We can store the requested value, to be applied when we connect the sockets. * pflocal/sock.h (struct sock): Add req_write_limit field. * pflocal/sock.c (sock_create): Initialize req_write_limit field to 0. (sock_connect): Bump the write_limit of the write pipe to the req_write_limit value. (sock_shutdown): Update req_write_limit from the write_limit of the write pipe. * pflocal/socket.c (S_socket_getopt, S_socket_setopt): When write_pipe is NULL, use req_write_limit.
2020-07-05pflocal: return ENOTCONN on get/setpot(SO_SNDBUF) on unconnected socketSamuel Thibault
EPIPE would raise SIGPIPE, which applications do not expect to happen on a mere get/setsockopt. * pflocal/socket.c (S_socket_getopt, S_socket_setopt): Return ENOTCONN instead of EPIPE.
2020-06-27pflocal: Fix setsockopt(SO_SNDBUF)Samuel Thibault
* pflocal/socket.c (S_socket_setopt): Make SO_SNDBUF use write_pipe instead of read_pipe.
2020-06-27pflocal: Add support for setsockopt(SO_{RECV,SND}BUF)Samuel Thibault
Thanks Svante Signell for the initial patch. * libpipe/pipe.c (pipe_recv): Move writer wake code to... (_pipe_wake_writers): ... new function. * libpipe/pipe.h (_pipe_wake_writers): New prototype. * pflocal/sock.h (PFLOCAL_WRITE_LIMIT_MAX): New macro. * pflocal/socket.c (S_socket_setopt): Handle SO_RCVBUF and SO_SNDBUF cases.
2020-06-27pflocal: Fix crash on passing erroneous portSamuel Thibault
* pflocal/socket.c (S_socket_getopt): Read `user->sock' after checking `user'.
2020-06-27pflocal: Add support for getsockopt(SO_{RECV,SND}BUF)Svante Signell
* S_socket_getopt: Handle SO_RCVBUF and SO_SNDBUF cases.
2020-03-31Fix build with -fno-commonSamuel Thibault
which will be the default in gcc-10. * acpi/acpifs.h (fs, acpifs_maptime): Add extern qualifier. * boot/private.h (verbose): Likewise. * eth-multiplexer/netfs_impl.h (multiplexer_maptime): Likewise. * eth-multiplexer/vdev.h (port_bucket, vdev_portclass): Likewise. * exec/priv.h (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.h (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, zeroblock, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, node_to_page_lock, generation_lock, next_generation, group_desc_image, global_pokel, modified_global_blocks, use_xattr_translator_records): Likewise. * hostmux/hostmux.h (hostmux_maptime): Likewise. * isofs/isofs.h (host_name, mounted_on, disk_image, disk_image_len, logical_block_size, sblock): Likewise. * libdiskfs/diskfs.h (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Likewise. * libnetfs/callbacks.h (_netfs_translator_callback1, _netfs_translator_callback2): Likewise. * libnetfs/priv.h (netfs_mtime): Likewise. * libpager/priv.h (_pager_class): Likewise. * libtrivfs/trivfs.h (trivfs_check_access_hook, trivfs_check_open_hook, trivfs_open_hook, trivfs_protid_create_hook, trivfs_peropen_create_hook, trivfs_protid_destroy_hook, trivfs_peropen_destroy_hook, trivfs_getroot_hook): Likewise. * lwip/lwip-hurd.h (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_protid_portclasses, lwip_cntl_portclasses, lwip_bootstrap_portclass, fsys_identity, lwipcntl, lwip_owner, lwip_group): Likewise. * lwip/port/include/netif/hurdtunif.h (tunnel_cntlclass, tunnel_class): Likewise. * nfs/nfs.h (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/nfsd.h (mapped_time, authserver): Likewise. * pci-arbiter/pcifs.h (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.h (pci_shutdown_notify_class, arrange_shutdown_notification): Likewise. * pfinet/pfinet.h (pfinet_bucket, addrport_class, socketport_class, fsys_identity, pfinetctl, pfinet_owner, pfinet_group): Likewise. * pflocal/sserver.h (sock_port_bucket): Likewise. * proc/proc.h (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/term.h (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, inputq, rawq, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.h (usermux_maptime): Likewise. * utils/msgids.h (msgid_argp): Likewise. * libdiskfs/priv.h (_diskfs_mtime): Remove definition. * lwip/options.h (lwip_argp): Add prototype. * mach-defpager/priv.h (partitions): Name structure. (all_partitions): Add extern qualifier. * acpi/main.c (acpifs_maptime, fs): New variables. * exec/main.c (port_bucket, execboot_portclass): Likewise. * ext2fs/ext2fs.c (sblock, sblock_dirty, block_size, log2_block_size, log2_dev_blocks_per_fs_block, log2_stat_blocks_per_fs_block, frag_size, frags_per_block, inodes_per_block, itb_per_group, db_per_group, desc_per_block, addr_per_block, groups_count, next_generation, group_desc_image, global_pokel, use_xattr_translator_records): Likewise. * isofs/main.c (host_name, mounted_on, logical_block_size, sblock): Likewise. * libpager/pager-create.c (_pager_class): Likewise. * lwip/port/netif/hurdtunif.c (tunnel_cntlclass, tunnel_class): Likewise. * mach-defpager/default_pager.c (all_partitions): Likewise. * nfs/main.c (main_udp_socket, hostname, mapped_time): Likewise. * nfsd/main.c (mapped_time, authserver): Likewise. * pci-arbiter/main.c (fs, pcifs_maptime): Likewise. * pci-arbiter/startup.c (*pci_shutdown_notify_class): Likewise. * pfinet/main.c (pfinetctl, pfinet_owner, pfinet_group, pfinet_bucket, addrport_class, socketport_class, fsys_identity): Likewise. * proc/main.c (authserver, self_proc, init_proc, startup_proc, proc_bucket, proc_class, generic_port_class, exc_class, generic_port, kernel_proc, global_lock): Likewise. * term/main.c (termstate, termflags, global_lock, carrier_alert, select_alert, pty_select_alert, term_bucket, tty_cntl_class, tty_class, cttyid_class, pty_class, pty_cntl_class, termctl, ptyctl, outputq, remote_input_mode, external_processing, term_owner, term_group, term_mode, bottom): Likewise. * usermux/usermux.c (usermux_mapped_time): Rename to usermux_maptime. * lwip/main.c: Include "options.h". (lwip_argp, netif_list): Remove declarations. (lwip_bucket, socketport_class, addrport_class, shutdown_notify_class, lwip_cntl_portclasses, lwip_bootstrap_portclass, lwip_owner, lwip_group, fsys_identity, lwipcntl): New variables. * eth-multiplexer/multiplexer.c (multiplexer_maptime): Add variable. * hostmux/hostmux.c (hostmux_mapped_time): Rename variable to hostmux_maptime * libdiskfs/extra-version.c: Rename file to... * libdiskfs/priv.c: ... new file. (diskfs_shortcut_symlink, diskfs_shortcut_chrdev, diskfs_shortcut_blkdev, diskfs_shortcut_fifo, diskfs_shortcut_ifsock, diskfs_create_symlink_hook, diskfs_read_symlink_hook): Add weak variables. * libdiskfs/Makefile (OTHERSRCS): Replace extra-version.c with priv.c. * libtrivfs/priv.c: New file. * libtrivfs/Makefile (OTHERSRCS): Add priv.c * libcons/extra-version.c: Rename file to... * libcons/priv.c: ... new file. * libcons/Makefile (SRCS): Replace extra-version.c with priv.c. Fix build with #
2019-09-01Use the data_t type defined in hurd_types.h.Flavio Cruz
* boot/boot.c: Replace char* with data_t. * console-client/trans.c: Likewise. * exec/exec.c: Likewise. * ext2fs/storeinfo.c: Likewise. * fatfs/inode.c: Likewise. * fatfs/main.c: Likewise. * isofs/inode.c: Likewise. * libdiskfs/boot-start.c: Likewise. * libdiskfs/dir-readdir.c: Likewise. * libdiskfs/file-exec.c: Likewise. * libdiskfs/file-get-fs-opts.c: Likewise. * libdiskfs/file-get-trans.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-set-trans.c: Likewise. * libdiskfs/fsys-forward.c: Likewise. * libdiskfs/fsys-getfile.c: Likewise. * libdiskfs/fsys-options.c: Likewise. * libdiskfs/io-read.c: Likewise. * libdiskfs/io-write.c: Likewise. * libnetfs/dir-readdir.c: Likewise. * libnetfs/file-exec.c: Likewise. * libnetfs/file-get-fs-options.c: Likewise. * libnetfs/file-get-storage-info.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * libnetfs/fsstubs.c: Likewise. * libnetfs/fsys-get-options.c: Likewise. * libnetfs/fsys-set-options.c: Likewise. * libnetfs/fsysstubs.c: Likewise. * libnetfs/io-read.c: Likewise. * libnetfs/io-write.c: Likewise. * libtrivfs/dir-readdir.c: Likewise. * libtrivfs/file-get-fs-options.c: Likewise. * libtrivfs/file-get-storage-info.c: Likewise. * libtrivfs/file-get-trans.c: Likewise. * libtrivfs/file-getfh.c: Likewise. * libtrivfs/file-set-trans.c: Likewise. * libtrivfs/fsys-forward.c: Likewise. * libtrivfs/fsys-get-options.c: Likewise. * libtrivfs/fsys-set-options.c: Likewise. * libtrivfs/fsys-stubs.c: Likewise. * libtrivfs/io-read.c: Likewise. * libtrivfs/io-write.c: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/pfinet-ops.c: Likewise. * pfinet/socket-ops.c: Likewise. * pfinet/tunnel.c: Likewise. * pflocal/io.c: Likewise. * pflocal/pf.c: Likewise. * pflocal/socket.c: Likewise. * proc/info.c: Likewise. * startup/startup.c: Likewise. * storeio/io.c: Likewise. * term/users.c: Likewise. * tmpfs/node.c: Likewise. * trans/crash.c: Likewise. * trans/fakeroot.c: Likewise. * trans/fifo.c: Likewise. * trans/firmlink.c: Likewise. * trans/hello-mt.c: Likewise. * trans/hello.c: Likewise. * trans/mtab.c: Likewise. * trans/new-fifo.c: Likewise. * trans/null.c: Likewise. * trans/proxy-defpager.c: Likewise. * trans/streamio.c: Likewise.
2017-09-12pflocal: Use default stub implementations.Justus Winter
* pflocal/Makefile (fsServer-CFLAGS): Make use of default implementations. (ioServer-CFLAGS): Likewise. * pflocal/fs.c: Remove all stub functions. * pflocal/io.c: Likewise.
2017-08-05Use our own variant of 'assert' and 'assert_perror'.Justus Winter
Our variants print stack traces on failures. This will make locating errors much easier.
2016-08-09Support MSG_DONTWAIT in pflocal send/recvChristian Seiler
* pflocal/socket.c (S_socket_send): Also test for MSG_DONTWAIT in `flags' for the `noblock' parameter of pipe_send call. (S_socket_recv): Likewise for pipe_recv call.
2016-03-20pflocal: Add support for access() on pipesSamuel Thibault
bash's '<(' helper creates a pipe and gives /dev/fd/63 to the program, and gcc would then run access() on it. So we actually need to support at least some FS operations on pipes. * pflocal/fs.c: New file. * pflocal/mig-mutate.h (FILE_INTRAN, FILE_INTRAN_PAYLOAD, FILE_DESTRUCTOR, FILE_IMPORTS): New macros. * pflocal/sserver.c: Include "fs_S.h". (sock_demuxer): Call fs_server_routine. * pflocal/Makefile (SRCS): Add fs.c. (MIGSTUBS): Add fsServer.o.
2016-01-03pflocal: Do not abort on too small getopt parameterSamuel Thibault
* pflocal/socket.c (S_socket_getopt): When *value_len is too small, return EINVAL instead of aborting.
2016-01-03Add dumb SO_ERROR support to pflocalSamuel Thibault
pflocal does not currently have asynchronous operations, so we can make SO_ERROR just report 0. * pflocal/socket.c (S_socket_getopt): For `level' SOL_SOCKET and `opt' SO_ERROR, report 0.
2015-12-31Drop OTHERLIBS and use LDLIBS exclusivelyFlavio Cruz
When cross-compiling, OTHERLIBS magically turns -lpthread into the path to the host libpthread.so file, resulting in build issues. LDLIBS does not suffer from this problem and it seems that is already being used in other Makefiles. This patch removes OTHERLIBS entirely from the build system. * Makeconf: Remove references to OTHERLIBS * auth/Makefile: Replace OTHERLIBS with LDLIBS. * boot/Makefile: Likewise. * console/Makefile: Likewise. * exec/Makefile: Likewise. * ext2fs/Makefile: Likewise. * fatfs/Makefile: Likewise. * ftpfs/Makefile: Likewise. * hostmux/Makefile: Likewise. * isofs/Makefile: Likewise. * libhurd-slab/Makefile: Likewise. * nfs/Makefile: Likewise. * nfsd/Makefile: Likewise. * pfinet/Makefile: Likewise. * proc/Makefile: Likewise. * procfs/Makefile: Likewise. * random/Makefile: Likewise. * storeio/Makefile: Likewise. * term/Makefile: Likewise. * tmpfs/Makefile: Likewise. * usermux/Makefile: Likewise.
2015-10-29pflocal: avoid building the interrupt serverJustus Winter
* pflocal/io.c: Do not needlessly include `interrupt_S.h'.
2015-09-27pflocal: convert to trivfs dynamic classes and bucketsJustus Winter
libtrivfs contains two ways of managing more than one port class and bucket. There is the old way of using a statically allocated array with explicit length, and the new way with dynamically allocated vectors. Converting all users to the new way of handling multiple classes and/or buckets, we can simplify the code in libtrivfs. In many cases, the code will be simpler and more expressive for the user. This also fixes a mild bug. The classes and buckets given to `trivfs_startup' end up in the dynamic vectors too, making the object lookup code use the more complicated code path. * pflocal/pflocal.c: Convert to dynamic classes and buckets.
2015-09-12Turn EADDRNOTAVAIL to more commonly-understood ECONNREFUSEDSamuel Thibault
Thanks Svante Signell for the investigation. * pflocal/socket.c (S_socket_connect, S_socket_send): When addr_get_sock returns EADDRNOTAVAIL, translate into ECONNREFUSED.
2015-09-12Fix build warningSamuel Thibault
* pflocal/sock.h (sock_bind): Move declaration.
2015-09-11Fix closure of local server socketsSamuel Thibault
Since bound socks always have a ref for their address, they would never get freed. Thanks Svante Signell for the investigation. * pflocal/sock.h (sock_deref): When `sock' has one ref left and is bound to an address, unbound it, and thus shut it down.
2015-09-11Fix sock_bind(sock,NULL) supportSamuel Thibault
* pflocal/sock.c (sock_bind): When addr is NULL, do not take/release its mutex. When old_addr is also NULL, return EINVAL. When old_addr is not NULL, deref old_addr instead of addr.
2015-09-09pflocal: avoid nested functionJustus Winter
* pflocal/io.c (copy_time): Move function out of `S_io_stat', turning it into a static inline function.
2015-08-14pflocal: fix receiver lookupJustus Winter
* pflocal/mig-decls.h (begin_using_addr_payload): Use `ports_lookup_payload'.
2014-12-10Replace `bzero' with `memset'Justus Winter
For reference, this patch was created using the following semantic patch, and then manually applying the change in all functions containing nested functions, as those are not supported by Coccinelle. @@ expression A, B; @@ - bzero (A, B) + memset (A, 0, B) * auth/auth.c: Replace `bzero' with `memset'. * boot/boot.c: Likewise. * defpager/defpager.c: Likewise. * exec/exec.c: Likewise. Also, drop `safe_bzero' and just use `hurd_safe_memset' directly. * ext2fs/ext2fs.c: Likewise. * ext2fs/getblk.c: Likewise. * ext2fs/pager.c: Likewise. * fatfs/pager.c: Likewise. * ftpfs/dir.c: Likewise. * ftpfs/netfs.c: Likewise. * isofs/inode.c: Likewise. * isofs/pager.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-statfs.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libfshelp/start-translator.c: Likewise. * libftpconn/create.c: Likewise. * libftpconn/open.c: Likewise. * libftpconn/unix.c: Likewise. * libpipe/pipe.c: Likewise. * libps/procstat.c: Likewise. * libps/spec.c: Likewise. * libshouldbeinlibc/cacheq.c: Likewise. * libshouldbeinlibc/idvec.c: Likewise. * libshouldbeinlibc/ugids.c: Likewise. * libstore/argp.c: Likewise. * libstore/enc.c: Likewise. * libstore/kids.c: Likewise. * libthreads/alpha/thread.c: Likewise. * libtreefs/fsys.c: Likewise. * libtrivfs/file-statfs.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/glue-include/asm/uaccess.h: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/options.c: Likewise. * pfinet/socket.c: Likewise. * pfinet/timer-emul.c: Likewise. * pflocal/io.c: Likewise. * startup/startup.c: Likewise. * storeio/storeio.c: Likewise. * sutils/fstab.c: Likewise. * usermux/usermux.c: Likewise. * utils/fakeauth.c: Likewise. * utils/frobauth.c: Likewise. * utils/login.c: Likewise. * utils/x.c: Likewise.
2014-12-07pflocal: add payload-aware intrans functionsJustus Winter
* pflocal/mig-mutate.h: Add mutators. * pflocal/mig-decls.c (begin_using_sock_user_payload): New function. (begin_using_addr_payload): Likewise.
2014-05-26Avoid compiler warning about empty bodiesJustus Winter
Make empty bodies of control flow statements more explicit. Doing so will allow us to use stricter compiler settings. This would have cought 4ece292c. * console-client/xkb/xkb.c: Make empty bodies more explicit * libpipe/pipe.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/linux-src/net/ipv4/fib_hash.c: Likewise. * pflocal/connq.c: Likewise. * pflocal/socket.c: Likewise.
2014-01-20pflocal: include the mig-generated server headersJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * pflocal/demuxer.c: Include the mig-generated server headers. * pflocal/sserver.c: Likewise.
2013-12-02pflocal: improve the demuxer functionsJustus Winter
Handle multiple request types as recommended by the Mach Server Writer's Guide section 4, subsection "Handling Multiple Request Types". This avoids initializing the reply message in every X_server function. The reply message has already been properly initialized in libports, so there is no need to call mig_reply_setup. * pflocal/pflocal.c (pf_demuxer): Improve the demuxer function. * pflocal/sserver.c (sock_demuxer): Likewise.
2013-10-18pflocal: fix message flags on receiveRichard Braun
* pflocal/socket.c (S_socket_recv): Set the memory pointed by out_flags to 0 instead of the pointer.
2013-10-18pflocal: fix port leak when receiving port rightsRichard Braun
The socket_send and socket_recv routines can be used to transmit port rights along data. Unfortunately, pflocal retains a copy of these rights in the socket_recv RPC. These lingering references would in turn lead to other leaks in servers waiting for a no-sender notification to clean their resources. Since these copied rights aren't used at all by the server, it is safe to simply move them to the recipient instead. * pflocal/socket.c (S_socket_recv): Transmit port rights using MACH_MSG_TYPE_MOVE_SEND transfer type instead of MACH_MSG_TYPE_COPY_SEND.
2013-10-18pflocal: fix destruction of explicitely bound socketsRichard Braun
Sockets must have a weak reference on the address they're bound to so that addr_unbind is properly called before addr_clean. For sockets that are automatically bound, this weak reference is created in ensure_addr. Do the same in sock_bind. * pflocal/sock.c (sock_bind): Handle weak reference on addr.
2013-09-24Fix missing renamesSamuel Thibault
* pflocal/sock.c (sock_connect, sock_shutdown): Rename SOCK_CONNECTED to PFLOCAL_SOCK_CONNECTED.
2013-09-21Rename SOCK_* into PFLOCAL_SOCK_*Samuel Thibault
To avoid conflicting with glibc's SOCK_* * pflocal/io.c, pflocal/sock.c, pflocal/sock.h, pflocal/socket.c: Rename SOCK_CONNECTED into PFLOCAL_SOCK_CONNECTED, SOCK_NONBLOCK into PFLOCAL_SOCK_NONBLOCK, SOCK_SHUTDOWN_READ into PFLOCAL_SOCK_SHUTDOWN_READ, SOCK_SHUTDOWN_WRITE into PFLOCAL_SOCK_SHUTDOWN_WRITE.
2013-09-21Fix gcc warningSamuel Thibault
* pflocal/io.c (copy_time): Make `to_nsec` parameter a long * instead of an unsigned long *.