OLD | NEW |
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 // For linux_syscall_support.h. This makes it safe to call embedded system | 5 // For linux_syscall_support.h. This makes it safe to call embedded system |
6 // calls when in seccomp mode. | 6 // calls when in seccomp mode. |
7 | 7 |
8 #include "chrome/app/breakpad_linux.h" | 8 #include "chrome/app/breakpad_linux.h" |
9 | 9 |
10 #include <fcntl.h> | 10 #include <fcntl.h> |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 msg.msg_iovlen = kCrashIovSize; | 802 msg.msg_iovlen = kCrashIovSize; |
803 char cmsg[kControlMsgSpaceSize]; | 803 char cmsg[kControlMsgSpaceSize]; |
804 my_memset(cmsg, 0, kControlMsgSpaceSize); | 804 my_memset(cmsg, 0, kControlMsgSpaceSize); |
805 msg.msg_control = cmsg; | 805 msg.msg_control = cmsg; |
806 msg.msg_controllen = sizeof(cmsg); | 806 msg.msg_controllen = sizeof(cmsg); |
807 | 807 |
808 struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); | 808 struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); |
809 hdr->cmsg_level = SOL_SOCKET; | 809 hdr->cmsg_level = SOL_SOCKET; |
810 hdr->cmsg_type = SCM_RIGHTS; | 810 hdr->cmsg_type = SCM_RIGHTS; |
811 hdr->cmsg_len = kControlMsgLenSize; | 811 hdr->cmsg_len = kControlMsgLenSize; |
812 ((int*) CMSG_DATA(hdr))[0] = fds[0]; | 812 memcpy(CMSG_DATA(hdr), fds, sizeof(fds)); |
813 ((int*) CMSG_DATA(hdr))[1] = fds[1]; | |
814 | 813 |
815 if (HANDLE_EINTR(sys_sendmsg(fd, &msg, 0)) < 0) { | 814 if (HANDLE_EINTR(sys_sendmsg(fd, &msg, 0)) < 0) { |
816 static const char errmsg[] = "Failed to tell parent about crash.\n"; | 815 static const char errmsg[] = "Failed to tell parent about crash.\n"; |
817 WriteLog(errmsg, sizeof(errmsg) - 1); | 816 WriteLog(errmsg, sizeof(errmsg) - 1); |
818 IGNORE_RET(sys_close(fds[1])); | 817 IGNORE_RET(sys_close(fds[1])); |
819 return false; | 818 return false; |
820 } | 819 } |
821 IGNORE_RET(sys_close(fds[1])); | 820 IGNORE_RET(sys_close(fds[1])); |
822 | 821 |
823 if (HANDLE_EINTR(sys_read(fds[0], &b, 1)) != 1) { | 822 if (HANDLE_EINTR(sys_read(fds[0], &b, 1)) != 1) { |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 } else { | 1677 } else { |
1679 EnableNonBrowserCrashDumping(minidump_fd); | 1678 EnableNonBrowserCrashDumping(minidump_fd); |
1680 } | 1679 } |
1681 } | 1680 } |
1682 } | 1681 } |
1683 #endif // OS_ANDROID | 1682 #endif // OS_ANDROID |
1684 | 1683 |
1685 bool IsCrashReporterEnabled() { | 1684 bool IsCrashReporterEnabled() { |
1686 return g_is_crash_reporter_enabled; | 1685 return g_is_crash_reporter_enabled; |
1687 } | 1686 } |
OLD | NEW |