1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtCore module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #include "qfunctions_nacl.h"
41 #include <pthread.h>
42 #include <qglobal.h>
43 
44 /*
45     The purpose of this file is to stub out certain functions
46     that are not provided by the Native Client SDK. This is
47     done as an alterative to sprinkling the Qt sources with
48     NACL ifdefs.
49 
50     There are two main classes of functions:
51 
52     - Functions that are called but can have no effect:
53     For these we simply give an empty implementation
54 
55     - Functions that are referenced in the source code, but
56     is not/must not be called at run-time:
57     These we either leave undefined or implement with a
58     qFatal.
59 
60     This is a work in progress.
61 */
62 
63 extern "C" {
64 
pthread_cleanup_push(void (*)(void *),void *)65 void pthread_cleanup_push(void (*)(void *), void *)
66 {
67 
68 }
69 
pthread_cleanup_pop(int)70 void pthread_cleanup_pop(int)
71 {
72 
73 }
74 
pthread_setcancelstate(int,int *)75 int pthread_setcancelstate(int, int *)
76 {
77     return 0;
78 }
79 
pthread_setcanceltype(int,int *)80 int pthread_setcanceltype(int, int *)
81 {
82     return 0;
83 }
84 
pthread_testcancel(void)85 void pthread_testcancel(void)
86 {
87 
88 }
89 
90 
pthread_cancel(pthread_t)91 int pthread_cancel(pthread_t)
92 {
93     return 0;
94 }
95 
pthread_attr_setinheritsched(pthread_attr_t *,int)96 int pthread_attr_setinheritsched(pthread_attr_t *,int)
97 {
98     return 0;
99 }
100 
101 
pthread_attr_getinheritsched(const pthread_attr_t *,int *)102 int pthread_attr_getinheritsched(const pthread_attr_t *, int *)
103 {
104     return 0;
105 }
106 
107 // event dispatcher, select
108 //struct fd_set;
109 //struct timeval;
110 
fcntl(int,int,...)111 int fcntl(int, int, ...)
112 {
113     return 0;
114 }
115 
sigaction(int,const struct sigaction *,struct sigaction *)116 int sigaction(int, const struct sigaction *, struct sigaction *)
117 {
118     return 0;
119 }
120 
open(const char *,int,...)121 int open(const char *, int, ...)
122 {
123     return 0;
124 }
125 
open64(const char *,int,...)126 int open64(const char *, int, ...)
127 {
128     return 0;
129 }
130 
access(const char *,int)131 int access(const char *, int)
132 {
133     return 0;
134 }
135 
136 typedef long off64_t;
ftello64(void *)137 off64_t ftello64(void *)
138 {
139     qFatal("ftello64 called");
140     return 0;
141 }
142 
lseek64(int,off_t,int)143 off64_t lseek64(int, off_t, int)
144 {
145     qFatal("lseek64 called");
146     return 0;
147 }
148 
149 } // Extern C
150 
select(int,fd_set *,fd_set *,fd_set *,struct timeval *)151 int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
152 {
153     return 0;
154 }
155