magic/graphics
Darryl L. Miles 8d6571066d grMain.c select() usage fix and protect from higher numbered fd's
The old code would only work is the fileno(stream) returned an fd
in the range 0 <= 19.  It would silently fail, if the fd was in
the range 20..1023 because FD_SET() would work and syscall select()
would be limited to only look at the first 20 fd's.  Ignoring any
fd's higher even if set.
This would theoretically cause high CPU usage due to select()
never blocking because there are no active fd's in the fd_set
as far as the kernel interprets the request and the kernel would
immediately return.

But reading the code the 1st argument to select() seems self
limiting for no good reason.  It should be fileno(stream)+1 as
documented in man select(2).

Added the assertion as well, because we are trying to allow magic
to use fd's beyond the standard environmental limits.  So it
becomes an assertion condition if the fd is outside the range
0..1023 because the FD_SET() macro will not operate correctly /
undefined-behaviour.

I can't find any user of this func in the codebase right now.

If you look at sim/SimRsim.c and the use of select() there, it is
correctly using select() to wait on a single fd over there.  This
commit changes this code to match this correct usage.
2025-04-09 15:19:25 -04:00
..
cairo_new Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
cairo_orig graphics/cairo_orig/grTCairo5.c uninitialized local variable 2024-10-01 12:36:13 -04:00
DEFAULT.glyphs Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
FreeMono.pt3 Remove all the $XXX: YYY$ 2020-05-23 17:00:38 -04:00
FreeSans.pt3 Remove all the $XXX: YYY$ 2020-05-23 17:00:38 -04:00
FreeSerif.pt3 Remove all the $XXX: YYY$ 2020-05-23 17:00:38 -04:00
Makefile Implemented a new configuration variable "dist_prefix" for 2020-01-28 10:40:01 -05:00
README.X10a Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
READ_ME Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
W3Dmain.c Lookup() constify WindGetCommandTable() returns 'const' 2024-12-26 15:20:58 -05:00
X11Helper.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
bw.glyphs Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
color.glyphs Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
glyphs.h Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grCMap.c CodeQL File{MayNot,Never}BeClosed.ql file-handle resource leaks 2025-02-22 21:02:49 -05:00
grClip.c GCC14: warning: missing braces around initializer 2024-10-09 21:12:55 -04:00
grDStyle.c gcc11 -Wall -Wpedantic cleanup 2025-01-06 16:12:11 +00:00
grGlyphs.c CodeQL InconsistentNullnessTest.ql ourgl != NULL 2025-02-22 21:31:22 -05:00
grLock.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grMain.c grMain.c select() usage fix and protect from higher numbered fd's 2025-04-09 15:19:25 -04:00
grNull.c textio: create callback typedef cb_textio_input_t 2025-02-23 10:24:40 -05:00
grOGL1.c textio: create callback typedef cb_textio_input_t 2025-02-23 10:24:40 -05:00
grOGL2.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grOGL3.c grOGL3.c: add GrOGLTextSize() error return 2024-12-26 13:01:24 -05:00
grOGL4.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grOGL5.c graphics: multiple definition of `various_x11_symbols' 2024-10-09 20:35:19 -04:00
grOGLInt.h Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
grTCairo1.c TxParseString() refactor to 1-arg public form 2025-02-23 10:24:40 -05:00
grTCairo2.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTCairo3.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTCairo4.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTCairo5.c 38 x warning: suggest parentheses around assignment used as truth value 2024-10-09 21:12:55 -04:00
grTCairoInt.h Finished the implementation of Cairo 2D graphics (yay!). 2017-09-14 17:03:53 -04:00
grTOGL1.c TxParseString() refactor to 1-arg public form 2025-02-23 10:24:40 -05:00
grTOGL2.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTOGL3.c grTOGL3.c: warning: variable 'font' is used uninitialized 2024-10-09 21:34:12 -04:00
grTOGL4.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTOGL5.c 38 x warning: suggest parentheses around assignment used as truth value 2024-10-09 21:12:55 -04:00
grTOGLInt.h Compatibility with C99 standard 2022-10-29 06:07:46 +02:00
grText.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTk1.c TxParseString() refactor to 1-arg public form 2025-02-23 10:24:40 -05:00
grTk2.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grTk3.c grTk3.c: warning: variable 'font' is used uninitialized 2024-10-09 21:34:12 -04:00
grTk4.c Corrected a stack corruption error (that I have never seen in 2022-09-27 10:43:04 -04:00
grTk5.c 38 x warning: suggest parentheses around assignment used as truth value 2024-10-09 21:12:55 -04:00
grTkCommon.c TCL9: plugin createProc() function signature change ImgLayerCreate() 2025-01-04 11:08:01 -05:00
grTkCommon.h Compatibility with C99 standard 2022-10-29 06:07:46 +02:00
grTkInt.h Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
grX11Int.h Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
grX11su1.c textio: create callback typedef cb_textio_input_t 2025-02-23 10:24:40 -05:00
grX11su2.c C99 code compat when configured with no TCL support 2022-10-29 06:07:46 +02:00
grX11su3.c C99 code compat when configured with no TCL support 2022-10-29 06:07:46 +02:00
grX11su4.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grX11su5.c Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
grX11thread.c C99 code compat when configured with no TCL support 2022-10-29 06:07:46 +02:00
graphics.h Compatibility with C99 standard 2022-10-29 06:07:46 +02:00
graphicsInt.h Define Cairo functions prototypes only when support is enabled 2022-10-29 06:07:46 +02:00
prcolors.c Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
wind3d.h Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00

README.X10a

This driver is a modification of the Stanford X10 driver.  The modifications
were done by Walter Scott and Eric Lunow at Lawrence Livermore National Labs.