newbie =?utf-8?B?77+9?=resource temporarily unavailable � questi on

Glynn Clements glynn at gclements.plus.com
Fri Jun 29 12:21:04 PDT 2012


Alan Corey wrote:

> I'm just plinking around after having read the early chapters of the
> O'Reilly volumes 4a and 6a plus some Athena and Xlib stuff. I was
> itching to try some things.  For my background see
> http://ab1jx.webs.com  For graphics programming I've mostly worked in
> Turbo Pascal and Delphi.

Okay, so you've progressed from the 1980's to the 1990's ;)

I wouldn't advise putting too much effort into Xt/Xaw stuff; they've
fallen so far into disuse that if X.org shipped a totally
non-functional version of one of those libraries, it might take a year
before anyone actually noticed.

And Xlib itself is slowly heading the same way; XRender and OpenGL are
frequently preferred for the graphics side.

OTOH, a basic understanding of the principles underlying X is never a
bad thing to have.

> when I try
> to use XCopyPlane to copy to the Panner I get the unavailable message.
>  I can use XDrawSegments directly on the Panner (well, once anyway),
> copy the grid into another Pixmap with XCopyPlane, most other things
> seem to work.    Aside from the unavailable message I get a black
> rectangle where the Pixmap should be.  Nothing shows up in
> /var/log/Xorg.0.log about it, and it's not fatal: I can keep running
> the program.  I wouldn't have known it was there except I put a perror
> after the XCopyPlane to investigate the black Pixmap.

I think that you may be chasing a phantom here.

Once something sets errno, it usually stays set until something
explicitly clears it. errno should only be considered meaningful in
the event that a function returns an error status (most Xlib functions
don't) and the function's documentation states that errno will be set
in this situation.

This is particularly applicable to "resource temporarily unavailable",
which is the message for the EAGAIN code. This often just means that a
non-blocking operation (such as read() or write() on a non-blocking
descriptor) cannot produce any data available right now (read() cannot
return 0 in this situation because that indicates EOF).

IOW, it's not an error; in fact, I wouldn't be surprised if
practically every Xlib call could set errno to EAGAIN even when the
call completes successfully.

As for your black rectangle, you'll need to look elsewhere. Are you
copying the correct plane? Are the foreground and background colours
of the GC set correctly? If you used an XColor to determine the
numeric value for the colours, don't forget that XColour uses 16-bit
values (0..65535) for the components; if you use 8-bit values
(0..255), you can have any colour you like so long as it's black.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list