Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author


On Nov 5, 12:23pm, Clint Adams wrote:
} Subject: MAXJOB
} What was the reasoning behind hardcoding MAXJOB to 50?

It's a fixed number so that the job table can be statically declared
rather than dynamically allocated.  I've forgotten (or never knew) why
the value 50 was chosen, or whether there's a still-valid reason to
avoid dynamic allocation of the job table.

} Furthermore, why does MAXJOB 50 result in a maximum
} job table size of 48?

The last job table slot is reserved for tracking builtin commands, so
that the whole shell doesn't become unusable when you fill up the rest
of the table with external processes.  It's nice to be able to kill
those runaway background jobs, is it not?

jobtab[0] is also reserved, but it may be for no better reason than to
avoid having to map 1-based user-visible job-numbers to 0-based table
locations.  I don't immediately recall anything else that's being done
with it.

In fact, it may be that 50 was chosen so that the number of job table
entries would *appear* to be a multiple of 8.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Messages sorted by: Reverse Date, Date, Thread, Author