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

Side by Side Diff: src/untrusted/nacl/sbrk_private.c

Issue 12209042: Ensure syscall functions are consistently prefixed with "NaClSys" (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 10 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 | « src/untrusted/irt/irt_memory.c ('k') | src/untrusted/nacl/sysbrk.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * Non-IRT definition of sbrk for use only in private tests. 8 * Non-IRT definition of sbrk for use only in private tests.
9 */ 9 */
10 10
11 #include <errno.h> 11 #include <errno.h>
12 #include <unistd.h> 12 #include <unistd.h>
13 13
14 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" 14 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h"
15 15
16 static void *current_break; 16 static void *current_break;
17 17
18 void *sbrk(intptr_t increment) { 18 void *sbrk(intptr_t increment) {
19 void *old_break; 19 void *old_break;
20 void *new_break; 20 void *new_break;
21 21
22 if (0 == current_break) 22 if (0 == current_break)
23 current_break = NACL_SYSCALL(sysbrk)(0); 23 current_break = NACL_SYSCALL(brk)(0);
24 24
25 old_break = current_break; 25 old_break = current_break;
26 new_break = old_break + increment; 26 new_break = old_break + increment;
27 27
28 if (new_break != old_break) { 28 if (new_break != old_break) {
29 new_break = NACL_SYSCALL(sysbrk)(new_break); 29 new_break = NACL_SYSCALL(brk)(new_break);
30 if (new_break == old_break) { 30 if (new_break == old_break) {
31 errno = ENOMEM; 31 errno = ENOMEM;
32 return (void *) -1; 32 return (void *) -1;
33 } 33 }
34 current_break = new_break; 34 current_break = new_break;
35 } 35 }
36 36
37 return old_break; 37 return old_break;
38 } 38 }
OLDNEW
« no previous file with comments | « src/untrusted/irt/irt_memory.c ('k') | src/untrusted/nacl/sysbrk.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698