1141cc406Sopenharmony_ci/* Copyright (C) 1997 Free Software Foundation, Inc.
2141cc406Sopenharmony_ciThis file is part of the GNU C Library.
3141cc406Sopenharmony_ci
4141cc406Sopenharmony_ciThe GNU C Library is free software; you can redistribute it and/or
5141cc406Sopenharmony_cimodify it under the terms of the GNU Library General Public License as
6141cc406Sopenharmony_cipublished by the Free Software Foundation; either version 2 of the
7141cc406Sopenharmony_ciLicense, or (at your option) any later version.
8141cc406Sopenharmony_ci
9141cc406Sopenharmony_ciThe GNU C Library is distributed in the hope that it will be useful,
10141cc406Sopenharmony_cibut WITHOUT ANY WARRANTY; without even the implied warranty of
11141cc406Sopenharmony_ciMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12141cc406Sopenharmony_ciLibrary General Public License for more details.
13141cc406Sopenharmony_ci
14141cc406Sopenharmony_ciYou should have received a copy of the GNU Library General Public
15141cc406Sopenharmony_ciLicense along with the GNU C Library; see the file COPYING.LIB.  If
16141cc406Sopenharmony_cinot, see <https://www.gnu.org/licenses/>.  */
17141cc406Sopenharmony_ci
18141cc406Sopenharmony_ci#include "../include/sane/config.h"
19141cc406Sopenharmony_ci
20141cc406Sopenharmony_ci#include <errno.h>
21141cc406Sopenharmony_ci
22141cc406Sopenharmony_ci#ifndef HAVE_SIGPROCMASK
23141cc406Sopenharmony_ci
24141cc406Sopenharmony_ci#define sigprocmask	SOMETHINGELSE
25141cc406Sopenharmony_ci#include <signal.h>
26141cc406Sopenharmony_ci#undef  sigprocmask
27141cc406Sopenharmony_ci
28141cc406Sopenharmony_ciint
29141cc406Sopenharmony_cisigprocmask (int how, int *new, int *old)
30141cc406Sopenharmony_ci{
31141cc406Sopenharmony_ci  int o, n = *new;
32141cc406Sopenharmony_ci
33141cc406Sopenharmony_ci/* FIXME: Get this working on Windows.  Probably should move to
34141cc406Sopenharmony_ci * POSIX sigaction API and emulate it before emulating this one.
35141cc406Sopenharmony_ci */
36141cc406Sopenharmony_ci#ifndef WIN32
37141cc406Sopenharmony_ci  switch (how)
38141cc406Sopenharmony_ci    {
39141cc406Sopenharmony_ci    case 1: o = sigblock (n); break;
40141cc406Sopenharmony_ci    case 2: o = sigsetmask (sigblock (0) & ~n); break;
41141cc406Sopenharmony_ci    case 3: o = sigsetmask (n); break;
42141cc406Sopenharmony_ci    default:
43141cc406Sopenharmony_ci      errno = EINVAL;
44141cc406Sopenharmony_ci      return -1;
45141cc406Sopenharmony_ci    }
46141cc406Sopenharmony_ci  if (old)
47141cc406Sopenharmony_ci    *old = o;
48141cc406Sopenharmony_ci#endif
49141cc406Sopenharmony_ci  return 0;
50141cc406Sopenharmony_ci}
51141cc406Sopenharmony_ci
52141cc406Sopenharmony_ci#endif /* !HAVE_SIGPROCMASK */
53