From: Bela Lubkin <belal@sco.com>
Subject: Re: Rare Error 65 (ENOPKG) occurrence on open() call
Date: 30 Sep 2003 21:03:15 -0400
Apolon wrote:
> Does anyone know what the meaning of errno=65 (ENOPKG) is when an
> open() call fails on SCO Open Server 5.0.6? That error code doesn't
> appear in the open function man pages.
>
> The error occurs very rarely (say once a month) in a process that runs
> continuously closing/opening/creating/moving files around once every 2
> hours. The open is performed directly after a system() call which
> copies a file to another location. A system( "cp ..." ) call is being
> used instead of the rename() function call because of the limitation
> with not being able to rename across filesystems.
>
> Here are the code excerpts which encounters the error 65. The open
> function call is the one that fails occassionally. Most of the time
> the program is running it works fine.
>
> HIST_mv(tmpName, fullname);
> if ((hdr->fd = open(fullname, O_RDWR , A_READ | U_WRITE)) == H_ERROR)
> {
> char lvCurrentDir[1024];
> getcwd (lvCurrentDir, sizeof (lvCurrentDir) - 1);
> xfatal_err("Fatal Error %d opening file %s in directory %s.",
> errno, fullname, lvCurrentDir);
> }
First, make sure that `errno' was 0 before the open() call, and that
getcwd() isn't affecting its value:
if (errno == ENOPKG) {
/* aha!? */
}
errno = 0; /* might be something weird from prior calls */
if ((hdr->fd = open(fullname, O_RDWR , A_READ | U_WRITE)) == H_ERROR)
{
int my_errno = errno; /* save errno */
char lvCurrentDir[1024];
getcwd (lvCurrentDir, sizeof (lvCurrentDir) - 1);
xfatal_err("Fatal Error %d opening file %s in directory %s.",
my_errno, fullname, lvCurrentDir); /* saved errno */
Other than that: where is the file it's trying to open? A local
filesystem, an NFS mount, something else? Are these your own files, or
are they arbitrary files you find on the filesystem? (For instance, is
this a backup program that searches for files and copies them?)
There are very few things in the kernel that return ENOPKG. Candidates
include the System V shared memory driver ("shm"), the Xenix shared data
driver ("xsd"), and the Advanced Power Management drivers ("uapm" and
"pwr"). Each of these drivers has "stubs.c" code -- code that gets
linked into the kernel when the driver is _not_ present -- that returns
ENOPKG for certain operations.
It isn't clear to me whether any of these could return ENOPKG for an
open() call. More typically it would be on calling shmsys(), any of the
xsd*() functions, and on attempting certain ioctls with the APM stuff.
But... there exists an obscure file type which is an on-disk
representation of a Xenix Shared Data memory segment. If you had one of
those and tried to open it, it _might_ return ENOPKG if "xsd" wasn't
linked into your kernel.
Or might not. I just tried it and:
$ mknod test-m m $ cat test-m cat: cannot open test-m: Is a name file (error 139) EISNAM is not ENOPKG. >Bela<

Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar