🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #10908

Help: close() returns -1 (errno 1 - not owner)

#10908
From: Jack Morrison
Date: Tue, 14 Feb 1989 10:06
44 lines
2034 bytes
Attention device driver wizards:

I've written a simple driver for a parallel port card on a Sun. The driver
works fine, with one exception: close() returns a -1 with errno == 1.

Details:

The device entry is

c-w--w--w-  1 root      63,   0 Feb  2 13:40 /dev/vs0

My test program does open("/dev/vs0", 1) [which succeeds and returns an
fd], write(fd, buf, n) [which succeeds, returning n and actually
outputting the data], and close(fd).

If I skip the write(), close returns 0. If I *do* write, the date (but not
owner) of the /dev/vs0 entry changes; then when I close, I get the error,
and the date on /dev/vs0 *goes back* to the way it was.

If I'm root when I do this, of course, there is no error on close() and
the updated /dev/vs0 entry *stays* updated. Likewise if I manually chown
/dev/vs0 to my non-root ID.

If I go through the same motions on /dev/null, everything works as
expected (i.e. everything is the same except that close() succeeds, even
as non-root, and the date on /dev/null stays updated).

If I open()/write()/close() the device while another process already has
it open, the first one to close() gets a good status back (the device
driver is not called in this case), but the last one to close still gets
the error.

My driver ALWAYS returns zero from vsclose().

I've tried:
	- changing permissions on /dev/vs0 (777, 666)
	- opening with append, truncate, ...

Any clues?????

Thanks much.

-- 
Jack C. Morrison, Jet Propulsion Laboratory
Technical Details
Message-ID: <4364@jpl-devvax.JPL.NASA.GOV>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: jackm@jpl-devvax.jpl.nasa.gov (Jack Morrison)
Newsgroups: comp.sys.sun
Subject: Help: close() returns -1 (errno 1 - not owner)
Message-ID: <4364@jpl-devvax.JPL.NASA.GOV>
Date: 14 Feb 89 10:06:36 GMT
Sender: usenet@rice.edu
Organization: Jet Propulsion Laboratory, Pasadena, CA.
Lines: 44
Approved: Sun-Spots@rice.edu
Original-Date: 2 Feb 89 23:19:10 GMT
X-Sun-Spots-Digest: Volume 7, Issue 153, message 4 of 16