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