| 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 // The following is the C version of code from base/process_utils_linux.cc. | 5 // The following is the C version of code from base/process_utils_linux.cc. |
| 6 // We shouldn't link against C++ code in a setuid binary. | 6 // We shouldn't link against C++ code in a setuid binary. |
| 7 | 7 |
| 8 #define _GNU_SOURCE // needed for O_DIRECTORY | 8 #define _GNU_SOURCE // needed for O_DIRECTORY |
| 9 | 9 |
| 10 #include "process_util.h" | 10 #include "process_util.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 char value[21]; | 87 char value[21]; |
| 88 switch (margin_mb) { | 88 switch (margin_mb) { |
| 89 case -1L: | 89 case -1L: |
| 90 snprintf(value, sizeof(value), "off"); | 90 snprintf(value, sizeof(value), "off"); |
| 91 break; | 91 break; |
| 92 case 0L: | 92 case 0L: |
| 93 case 25L: | 93 case 25L: |
| 94 case 50L: | 94 case 50L: |
| 95 case 100L: | 95 case 100L: |
| 96 case 200L: | 96 case 200L: |
| 97 snprintf(value, sizeof(value), "%zu", margin_mb); | 97 snprintf(value, sizeof(value), "%lld", (long long int)margin_mb); |
| 98 break; | 98 break; |
| 99 default: | 99 default: |
| 100 return false; | 100 return false; |
| 101 } | 101 } |
| 102 | 102 |
| 103 bool success = (write(file_descriptor, value, strlen(value)) >= 0); | 103 bool success = (write(file_descriptor, value, strlen(value)) >= 0); |
| 104 close(file_descriptor); | 104 close(file_descriptor); |
| 105 return success; | 105 return success; |
| 106 } | 106 } |
| OLD | NEW |