1c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes/*
2c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * Copyright (C) 2008 The Android Open Source Project
3c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * All rights reserved.
4c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *
5c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * Redistribution and use in source and binary forms, with or without
6c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * modification, are permitted provided that the following conditions
7c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * are met:
8c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *  * Redistributions of source code must retain the above copyright
9c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *    notice, this list of conditions and the following disclaimer.
10c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *  * Redistributions in binary form must reproduce the above copyright
11c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *    notice, this list of conditions and the following disclaimer in
12c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *    the documentation and/or other materials provided with the
13c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *    distribution.
14c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes *
15c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes * SUCH DAMAGE.
27c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes */
28c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes
29c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#include <errno.h>
30c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#include <pthread.h>
31c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes#include <signal.h>
32c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes
333e898476c7230b60a0f76968e64ff25f475b48c0Elliott Hughes#include "private/ErrnoRestorer.h"
34c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes
3519e62325c268a668692e2b65fde2284079f369aaElliott Hughesint pthread_sigmask(int how, const sigset_t* new_set, sigset_t* old_set) {
363e898476c7230b60a0f76968e64ff25f475b48c0Elliott Hughes  ErrnoRestorer errno_restorer;
3719e62325c268a668692e2b65fde2284079f369aaElliott Hughes  int result = sigprocmask(how, new_set, old_set);
3819e62325c268a668692e2b65fde2284079f369aaElliott Hughes  return (result == -1) ? errno : 0;
39c5d028fc913de84a781bd61084bf7ae2182fd48eElliott Hughes}
40