LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 04-14-2005, 05:25 PM   #1
LavieX
LQ Newbie
 
Registered: Apr 2005
Location: Boulder, CO
Distribution: Redhat LInux 7.3
Posts: 7

Rep: Reputation: 0
core files appending PIDS - they shouldn't be!


Hey all, this is my first post to linuxquestions.org. I'm hoping one of you geniuses out there can help!

I have a set of enterprise servers running Redhat Linux 7.3 (don't ask me why, I'm not the SA). It looks like everything is set so that no PIDs should be attached to my core files, however, they are still being attached.

[dce3@/usr/local/dce3]>cat /proc/sys/kernel/core_uses_pid
0
[dce3@/usr/local/dce3]>cat /proc/sys/kernel/core_pattern
core
[dce3@/usr/local/dce3]>ls -l core.25745
-rw------- 1 dce3 dce3 573911040 Apr 14 22:23 core.25745
[dce3@/usr/local/dce3]>


Can anyone shed some light on this?!?! Everything I've seen says that the 2 files above dictate whether or not the PID is attached, and my box seems to be consistent with what I've read on the web.
 
Old 04-15-2005, 02:09 PM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,994

Rep: Reputation: 76
Just to check, did you generate the core dump file after changing the settings in /proc/? This may be stating the obvious, but the settings will only effect new core dump files; it won't go through and modify the hard disk for you.

core_uses_pid should only be ignored if core_pattern contains %p.

You'll find the code that builds the filename in /usr/src/linux/fs/exec.c (if you have the kernel sources installed); the function is called format_corename. You didn't specify your kernel version, but I have (for the appending core bit):
Code:
if (!pid_in_pattern
            && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) {
                rc = snprintf(out_ptr, out_end - out_ptr,
                              ".%d", current->tgid);
                if (rc > out_end - out_ptr)
                        goto out;
                out_ptr += rc;
        }
So it will also be ignored if mm_users is not 1; I am not sure what mm_users actually is (it's part of the mm_struct structure which deals with memory mapping) but it seems to be related to the number of users involved with the given process. Can anyone shed some more light on this?

Of course, if you never want the PID, then you can always hack it by deleteing the block of code above from the kernel and recompiling. But you'll then have to repeat this process every kernel update…
 
Old 04-15-2005, 02:26 PM   #3
LavieX
LQ Newbie
 
Registered: Apr 2005
Location: Boulder, CO
Distribution: Redhat LInux 7.3
Posts: 7

Original Poster
Rep: Reputation: 0
This was definitely done after the core_uses_pid file was updated (just to be sure, I did this again, just now):

Code:
[dce3@/usr/local/dce3]>rm core.25745
[dce3@/usr/local/dce3]>ls
COPYRIGHT  bin  brix  data  etc  lib  lost+found  mibs  tmp  var
[dce3@/usr/local/dce3]>bin/run_dce
[dce3@/usr/local/dce3]>pkill -7 dce.ip
[dce3@/usr/local/dce3]>ls -l core.2159
-rw-------    1 dce3     dce3     573911040 Apr 15 19:20 core.2159
[dce3@/usr/local/dce3]>
Hacking and recompiling the kernel is really not an option. Any other ideas??
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting PIDs which have files open / waiting for file write to complete prell Programming 2 03-29-2005 09:39 AM
Appending Text Files From Bash Script alts Programming 3 11-18-2004 06:36 PM
C++ and PIDs dbcoder Programming 1 07-15-2004 08:58 PM
[c] Appending to files using fopen() in mandrake wedamija Programming 4 11-01-2002 09:39 AM
Multiple PIDs ? Si|entKey Linux - General 0 03-27-2001 11:03 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration