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

Side by Side Diff: base/process/launch_posix.cc

Issue 2932053002: Use C++11 alignment primitives (Closed)
Patch Set: Fix merge Created 3 years, 6 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
« no previous file with comments | « base/metrics/persistent_memory_allocator.h ('k') | cc/base/list_container.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process/launch.h" 5 #include "base/process/launch.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sched.h> 10 #include <sched.h>
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 #endif 719 #endif
720 NOINLINE pid_t CloneAndLongjmpInChild(unsigned long flags, 720 NOINLINE pid_t CloneAndLongjmpInChild(unsigned long flags,
721 pid_t* ptid, 721 pid_t* ptid,
722 pid_t* ctid, 722 pid_t* ctid,
723 jmp_buf* env) { 723 jmp_buf* env) {
724 // We use the libc clone wrapper instead of making the syscall 724 // We use the libc clone wrapper instead of making the syscall
725 // directly because making the syscall may fail to update the libc's 725 // directly because making the syscall may fail to update the libc's
726 // internal pid cache. The libc interface unfortunately requires 726 // internal pid cache. The libc interface unfortunately requires
727 // specifying a new stack, so we use setjmp/longjmp to emulate 727 // specifying a new stack, so we use setjmp/longjmp to emulate
728 // fork-like behavior. 728 // fork-like behavior.
729 char stack_buf[PTHREAD_STACK_MIN] ALIGNAS(16); 729 alignas(16) char stack_buf[PTHREAD_STACK_MIN];
730 #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \ 730 #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
731 defined(ARCH_CPU_MIPS_FAMILY) 731 defined(ARCH_CPU_MIPS_FAMILY)
732 // The stack grows downward. 732 // The stack grows downward.
733 void* stack = stack_buf + sizeof(stack_buf); 733 void* stack = stack_buf + sizeof(stack_buf);
734 #else 734 #else
735 #error "Unsupported architecture" 735 #error "Unsupported architecture"
736 #endif 736 #endif
737 return clone(&CloneHelper, stack, flags, env, ptid, nullptr, ctid); 737 return clone(&CloneHelper, stack, flags, env, ptid, nullptr, ctid);
738 } 738 }
739 739
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 jmp_buf env; 773 jmp_buf env;
774 if (setjmp(env) == 0) { 774 if (setjmp(env) == 0) {
775 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); 775 return CloneAndLongjmpInChild(flags, ptid, ctid, &env);
776 } 776 }
777 777
778 return 0; 778 return 0;
779 } 779 }
780 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) 780 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI)
781 781
782 } // namespace base 782 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/persistent_memory_allocator.h ('k') | cc/base/list_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698