comparison agent/src/os/linux/libproc_impl.c @ 4919:54d3535a6dd3

7009098: SA cannot open core files larger than 2GB on Linux 32-bit Summary: Added Large File Support by compiling libsaproc.so with -D_FILE_OFFSET_BITS=64, and a small change with which SA should first load libraries from the path specified with SA_ALTROOT. Reviewed-by: dholmes, kevinw, dcubed, minqi
author poonam
date Sun, 12 Feb 2012 19:33:11 -0800
parents 0a8e0d4345b3
children 2394a89e89f4
comparison
equal deleted inserted replaced
4918:ea527c5cde03 4919:54d3535a6dd3
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
48 int pathmap_open(const char* name) { 48 int pathmap_open(const char* name) {
49 int fd; 49 int fd;
50 char alt_path[PATH_MAX + 1]; 50 char alt_path[PATH_MAX + 1];
51 51
52 init_alt_root(); 52 init_alt_root();
53 fd = open(name, O_RDONLY);
54 if (fd >= 0) {
55 return fd;
56 }
57 53
58 if (alt_root_len > 0) { 54 if (alt_root_len > 0) {
59 strcpy(alt_path, alt_root); 55 strcpy(alt_path, alt_root);
60 strcat(alt_path, name); 56 strcat(alt_path, name);
61 fd = open(alt_path, O_RDONLY); 57 fd = open(alt_path, O_RDONLY);
70 fd = open(alt_path, O_RDONLY); 66 fd = open(alt_path, O_RDONLY);
71 if (fd >= 0) { 67 if (fd >= 0) {
72 print_debug("path %s substituted for %s\n", alt_path, name); 68 print_debug("path %s substituted for %s\n", alt_path, name);
73 return fd; 69 return fd;
74 } 70 }
71 }
72 } else {
73 fd = open(name, O_RDONLY);
74 if (fd >= 0) {
75 return fd;
75 } 76 }
76 } 77 }
77 78
78 return -1; 79 return -1;
79 } 80 }