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

A couple of queries

Hello!  I have two problems; I wonder if you can help:

I'm having a small problem with my MiNT audio device.  I want to make
it act similarly to SunOS's /dev/audio, in that only one process may
open it at a time.  If a second process tries to open the device, it
should get EBUSY, which I think corresponds to TOS/MiNT's EDRVNR.

When a process opens /dev/audio, I set a flag to show that the device
has been opened, then check the flag on the next open and return EDRVNR
if the flag was set.  When the device is closed, I clear the flag.  The
problem is that when a process does Fcntl(..., F_DUPFD), the kernel
handles the dup itself, and the device doesn't get to see it.  That
means I can't update my flag, and when either of the two handles is
closed, the flag gets cleared when it shouldn't be.

So, am I going about this in the right way?  If so, how can I detect
duplicated handles?

Also, I've compiled up less v290 from the GNU-distributed sources.  It
works fine except for a problem with viewing the standard input.  When
I pipe data into it, less displays the first screen-full, then waits
for the pipe to close and quits.  I don't get less's prompt, and only
get to see one page of the file.  I've compiled the same sources under
SunOS, btw, and the problem does not appear.  Has anyone else had this
problem, and did you find out how to solve it?

Thanks for your help!