Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/syscalls/fdopen.c

Issue 417323002: Dropping fdopen workaround now that glibc has been fixed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/library.dsc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. */
4
5 #ifndef _GNU_SOURCE
6 #define _GNU_SOURCE
7 #endif
8 #include <stdio.h>
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 #if defined(__native_client__) && defined(__GLIBC__)
13
14 static ssize_t fdopen_read(void *cookie, char *buf, size_t size) {
15 return read((int) cookie, buf, size);
16 }
17
18 static ssize_t fdopen_write(void *cookie, const char *buf, size_t size) {
19 return write((int) cookie, buf, size);
20 }
21
22 static int fdopen_seek(void *cookie, off_t *offset, int whence) {
23 off_t ret = lseek((int) cookie, *offset, whence);
24 if (ret < 0) {
25 return -1;
26 }
27 *offset = ret;
28 return 0;
29 }
30
31 static int fdopen_close(void *cookie) {
32 return close((int) cookie);
33 }
34
35 static cookie_io_functions_t fdopen_functions = {
36 fdopen_read,
37 fdopen_write,
38 fdopen_seek,
39 fdopen_close,
40 };
41
42 /*
43 * TODO(bradnelson): Remove this glibc is fixed.
44 * See: https://code.google.com/p/nativeclient/issues/detail?id=3362
45 * Workaround fdopen in glibc failing due to it vetting the provided file
46 * handles with fcntl which is not currently interceptable.
47 */
48 FILE *fdopen(int fildes, const char *mode) {
49 return fopencookie((void *) fildes, mode, fdopen_functions);
50 }
51
52 #endif /* defined(__native_client__) && defined(__GLIBC__) */
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/library.dsc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698