Deleted Added
full compact
thr_syscalls.c (281454) thr_syscalls.c (281981)
1/*
2 * Copyright (c) 2014 The FreeBSD Foundation.
3 * Copyright (C) 2005 David Xu <davidxu@freebsd.org>.
4 * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>.
5 * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
6 * All rights reserved.
7 *
8 * Portions of this software were developed by Konstantin Belousov

--- 50 unchanged lines hidden (view full) ---

59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 */
65
66#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2014 The FreeBSD Foundation.
3 * Copyright (C) 2005 David Xu <davidxu@freebsd.org>.
4 * Copyright (c) 2003 Daniel Eischen <deischen@freebsd.org>.
5 * Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
6 * All rights reserved.
7 *
8 * Portions of this software were developed by Konstantin Belousov

--- 50 unchanged lines hidden (view full) ---

59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 *
64 */
65
66#include <sys/cdefs.h>
67__FBSDID("$FreeBSD: stable/10/lib/libthr/thread/thr_syscalls.c 281454 2015-04-12 06:52:43Z kib $");
67__FBSDID("$FreeBSD: stable/10/lib/libthr/thread/thr_syscalls.c 281981 2015-04-25 08:14:08Z kib $");
68
69#include "namespace.h"
70#include <sys/types.h>
71#include <sys/mman.h>
72#include <sys/param.h>
73#include <sys/select.h>
74#include <sys/signalvar.h>
75#include <sys/socket.h>

--- 246 unchanged lines hidden (view full) ---

322}
323
324/*
325 * Cancellation behavior:
326 * Thread may be canceled at start, but if the system call returns something,
327 * the thread is not canceled.
328 */
329static int
68
69#include "namespace.h"
70#include <sys/types.h>
71#include <sys/mman.h>
72#include <sys/param.h>
73#include <sys/select.h>
74#include <sys/signalvar.h>
75#include <sys/socket.h>

--- 246 unchanged lines hidden (view full) ---

322}
323
324/*
325 * Cancellation behavior:
326 * Thread may be canceled at start, but if the system call returns something,
327 * the thread is not canceled.
328 */
329static int
330__thr_ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *
331 timeout, const sigset_t *newsigmask)
332{
333 struct pthread *curthread;
334 int ret;
335
336 curthread = _get_curthread();
337 _thr_cancel_enter(curthread);
338 ret = __sys_ppoll(pfd, nfds, timeout, newsigmask);
339 _thr_cancel_leave(curthread, ret == -1);
340
341 return (ret);
342}
343
344/*
345 * Cancellation behavior:
346 * Thread may be canceled at start, but if the system call returns something,
347 * the thread is not canceled.
348 */
349static int
330__thr_pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
331 const struct timespec *timo, const sigset_t *mask)
332{
333 struct pthread *curthread;
334 int ret;
335
336 curthread = _get_curthread();
337 _thr_cancel_enter(curthread);

--- 202 unchanged lines hidden (view full) ---

540 _thr_cancel_enter(curthread);
541 ret = __sys_wait4(pid, status, options, rusage);
542 _thr_cancel_leave(curthread, ret <= 0);
543 return (ret);
544}
545
546/*
547 * Cancellation behavior:
350__thr_pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
351 const struct timespec *timo, const sigset_t *mask)
352{
353 struct pthread *curthread;
354 int ret;
355
356 curthread = _get_curthread();
357 _thr_cancel_enter(curthread);

--- 202 unchanged lines hidden (view full) ---

560 _thr_cancel_enter(curthread);
561 ret = __sys_wait4(pid, status, options, rusage);
562 _thr_cancel_leave(curthread, ret <= 0);
563 return (ret);
564}
565
566/*
567 * Cancellation behavior:
568 * Thread may be canceled at start, but if the system call returns
569 * a child pid, the thread is not canceled.
570 */
571static pid_t
572__thr_wait6(idtype_t idtype, id_t id, int *status, int options,
573 struct __wrusage *ru, siginfo_t *infop)
574{
575 struct pthread *curthread;
576 pid_t ret;
577
578 curthread = _get_curthread();
579 _thr_cancel_enter(curthread);
580 ret = __sys_wait6(idtype, id, status, options, ru, infop);
581 _thr_cancel_leave(curthread, ret <= 0);
582 return (ret);
583}
584
585/*
586 * Cancellation behavior:
548 * Thread may be canceled at start, but if the thread wrote some data,
549 * it is not canceled.
550 */
551static ssize_t
552__thr_write(int fd, const void *buf, size_t nbytes)
553{
554 struct pthread *curthread;
555 ssize_t ret;

--- 62 unchanged lines hidden (view full) ---

618 SLOT(system);
619 SLOT(tcdrain);
620 SLOT(wait4);
621 SLOT(write);
622 SLOT(writev);
623 SLOT(spinlock);
624 SLOT(spinunlock);
625 SLOT(kevent);
587 * Thread may be canceled at start, but if the thread wrote some data,
588 * it is not canceled.
589 */
590static ssize_t
591__thr_write(int fd, const void *buf, size_t nbytes)
592{
593 struct pthread *curthread;
594 ssize_t ret;

--- 62 unchanged lines hidden (view full) ---

657 SLOT(system);
658 SLOT(tcdrain);
659 SLOT(wait4);
660 SLOT(write);
661 SLOT(writev);
662 SLOT(spinlock);
663 SLOT(spinunlock);
664 SLOT(kevent);
665 SLOT(wait6);
666 SLOT(ppoll);
626#undef SLOT
627 *(__libc_interposing_slot(
628 INTERPOS__pthread_mutex_init_calloc_cb)) =
629 (interpos_func_t)_pthread_mutex_init_calloc_cb;
630}
667#undef SLOT
668 *(__libc_interposing_slot(
669 INTERPOS__pthread_mutex_init_calloc_cb)) =
670 (interpos_func_t)_pthread_mutex_init_calloc_cb;
671}