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

Side by Side Diff: sysdeps/nacl/sysdep.h

Issue 759833008: NaCl: Fix off-by-one in getcwd() syscall emulation. (Closed) Base URL: http://git.chromium.org/native_client/nacl-glibc.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | 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
1 #ifndef _NACL_SYSDEP_H 1 #ifndef _NACL_SYSDEP_H
2 #define _NACL_SYSDEP_H 1 2 #define _NACL_SYSDEP_H 1
3 3
4 #if !defined(__ASSEMBLER__) 4 #if !defined(__ASSEMBLER__)
5 #include <futex_emulation.h> 5 #include <futex_emulation.h>
6 #include <irt_syscalls.h> 6 #include <irt_syscalls.h>
7 #include <lowlevellock.h> 7 #include <lowlevellock.h>
8 #include <string.h>
8 9
9 /* Implementation of all syscalls for use in platform- and OS- independent code 10 /* Implementation of all syscalls for use in platform- and OS- independent code
10 as inline functions. Each function translates the syscall arguments into IRT 11 as inline functions. Each function translates the syscall arguments into IRT
11 arguments and allows to intercept each call in user code. 12 arguments and allows to intercept each call in user code.
12 TODO(khim): implement the interception logic. */ 13 TODO(khim): implement the interception logic. */
13 14
14 # define INTERNAL_SYSCALL(name, err, nr, args...) \ 15 # define INTERNAL_SYSCALL(name, err, nr, args...) \
15 INTERNAL_SYSCALL_ ## name ## _ ## nr (&err , ## args) 16 INTERNAL_SYSCALL_ ## name ## _ ## nr (&err , ## args)
16 17
17 # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ 18 # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 The system call just returns the length of the buffer filled (which includes 592 The system call just returns the length of the buffer filled (which includes
592 the ending '\0' character), or zero in case of error. */ 593 the ending '\0' character), or zero in case of error. */
593 __extern_always_inline int 594 __extern_always_inline int
594 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size) 595 INTERNAL_SYSCALL_getcwd_2 (int *err, char *buf, size_t size)
595 { 596 {
596 int len; 597 int len;
597 *err = __nacl_irt_getcwd (buf, size); 598 *err = __nacl_irt_getcwd (buf, size);
598 if (*err) { 599 if (*err) {
599 return 0; 600 return 0;
600 } 601 }
601 for (len = 0; len < size && buf[len] != '\0'; ++len); 602 return __strnlen(buf, size - 1) + 1;
602 return len;
603 } 603 }
604 604
605 __extern_always_inline gid_t 605 __extern_always_inline gid_t
606 INTERNAL_SYSCALL_getegid_0 (int *err) 606 INTERNAL_SYSCALL_getegid_0 (int *err)
607 { 607 {
608 *err = (38 /* ENOSYS */); 608 *err = (38 /* ENOSYS */);
609 return 0; 609 return 0;
610 } 610 }
611 611
612 __extern_always_inline uid_t 612 __extern_always_inline uid_t
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 #define PSEUDO_END_ERRVAL(name) \ 2255 #define PSEUDO_END_ERRVAL(name) \
2256 END (name) 2256 END (name)
2257 2257
2258 #undef SYSCALL_ERROR_HANDLER_TLS_STORE 2258 #undef SYSCALL_ERROR_HANDLER_TLS_STORE
2259 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \ 2259 #define SYSCALL_ERROR_HANDLER_TLS_STORE(src, destoff) \
2260 movl %gs:0, %eax; \ 2260 movl %gs:0, %eax; \
2261 movl src, (%eax,destoff) 2261 movl src, (%eax,destoff)
2262 2262
2263 #endif 2263 #endif
2264 #endif 2264 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698