Re: fd_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- "James Bradshaw" <jbradsha@xxxxxxxxxxxxx> wrote:

> In fd_init() in filesys.c the namelist file is opened and pc->nfd is
> initialized:
> 
> 
> if ((pc->nfd = open(pc->namelist, O_RDONLY)) < 0)
>         error(FATAL, "%s: %s\n", pc->namelist, strerror(errno));
> else {
>         close(pc->nfd);
>         pc->nfd = -1;
> }
> 
> 
> In the event of a successful open the else clause is executed, and the
> file that was just opened is closed. Why?

In the case of normal crash usage, the pc->nfd is basically
a throw-away file descriptor.  It's just there to kill off the
crash session immediately if the vmlinux file cannot be opened
for whatever reason.  The crash utility itself doesn't do an
open() call on the vmlinux file, but rather it passes that
responsibility down to the embedded gdb module, which essentially
is invoked as "gdb vmlinux".

The pc->nfd descriptor used to be used by the "remote" capability
of the crash utility, where the vmcore (and perhaps the vmlinux)
files existed on a remote system.  If the vmlinux was remote, it
would be copied to a local version that was handled by that pc->nfd
during the copy operation.  But anyway, that's all deprecated
code, but I've never gotten around to ripping it all out because
it has tentacles in places other than "remote.c".  But I think that
it's most likely a (harmless) no-op at this point.

Dave

  

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux