| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This started as a customer request, where the customer wanted to
store a file in the ROM file system with a bunch of command line
parameters in it, and then use the @file syntax to run that file
and setup the interpreter. In essence a 'canned' setup stored in
the ROM file system.
That didn't work, at all, because of a dichotomy in the logic of
argument processing. The code used 'lib_file_open' in order to find
the file using the search path which, on Ghostscript, includes all
the iodevices, Rom file system, RAM file system etc.
That function returns a stream which the calling function 'lib_fopen'
would then reach inside and pull out the pointer to the underlying
gp__file *, and return, because the argument processing was written
to use a gp_file *, not a stream *.
But.... For the ROM file system, what we store in the 'file' member
of the stream is not a gp_file *, its a 'node' *. Trying to use that
as a gp_file * rapidly leads to a seg fault.
So this commit reworks the argument processing to use a stream *
instead of a gp_file *. In reality there is no real difference to the
logic we simply use a different call. There are a lot of fiddly
references to change unfortunately.
There are some consequences; we need to pass stream * around instead of
gp_file *, and in particular the 'encoding' functions, which are
OS-specific need to use a stream *. This isn't a problem for the
interpreters and graphics library, but mkromfs *also* uses those
OS-specific files, and it does not have the stream library available.
Rather than trying to include it, we note that we don't actually need
to use these functions for mkromfs and we do the same hackery as for
other missing functionality; we define a stub function that does nothing
but will permit the compile to complete.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some devices within Ghostscript (currently the x11 devices,
uniprint and opvp/oprp) use non const static variables, so cannot
be run in multiple instances at a time.
We now maintain a core "count" of how many non-threadsafe devices are
being used at any time. This value can be atomically adjusted by calls
to gs_lib_ctx_nts_adjust.
Non threadsafe devices now call gx_init_non_threadsafe_device either
as or as part of their initialise_device proc. This function attempts
to increment the non-threadsafe count and fails to init if there is
already a non-threadsafe device running.
On success, the device finalize method is modified so that it will
decrement the count at the end.
The known non-threadsafe devices are updated to call this.
In order to have somewhere safe to store this count, we introduce
a gs_globals structure, shared between instances. Setting this up
without race conditions requires some new gp_ functions that can
make use of platform specific threading primitives. We have these
implemented for both windows and pthread based platforms. On other
platforms, we drop back to the old unsafe mechanism for counting
instances.
While we do this work, we take the opportunity to push the
gs_memory_t pointer used for non-threadsafe debug printing into thread
local storage.
This enables us to remove the remaining GS_THREADSAFE guarded
compilation from the source code. What is left is broadly down to
allowing debugging collection for statistics, and these are now
controlled by specific COLLECT_STATS_XXX defines. It is assumed
that anyone wanting to collect such stats is smart enough to not
try to do so while using Ghostscript in a multi-instance environment.
|
| |
|
| |
|
| |
|
|
|
|
| |
Also, avoid gsapi_run_file within a gsapi_runstring.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow for a 'parsed' param type; this leverages the functions in
gsparaml.c to parse an input string into a param list, coping
with dictionaries and arrays.
We update those functions to improve behaviour on more exotically
formed numbers ("- 0.3e-10" etc), on 'tricksy' inputs (e.g.
"<< /Foo (>>) >>" etc) and to cope without relying on whitespace
(e.g. "<</Foo/Bar/Baz[1 0]/Fizz<1234>/Bang(A)>>" etc).
Update pl_implementation set_param entrypoint so that the language
interface itself is based upon param lists, rather than typed
params.
Update both implementations of gsapi_set_params so that if
we are too early in the setup process stuff goes into the list
and is held until we have devices/languages to pass it to. Also
add a flag to allow for 'more to come' so that we can effectively
set multiple params at once.
|
|
|
|
|
|
|
| |
For GS builds this doesn't matter, as psapi_new_instance is called
before users of the API get to set their own versions. With GPDL
builds, the call to psapi_new_instance is deferred to the point
where the API user may have already set their own functions.
|
|
|
|
|
|
|
| |
Add docs for gsapi_set_param (and update the code to cope with
long/int64_t/size_t's in line with the core code).
Add docs for path control functions.
|
|
|
|
|
|
| |
This allows us to specify specific caller_handles for each
callback type rather than using a default one specified at
gs instance creation time. The old functions still work.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(squash of commits from filesec branch)
Most of this commit is donkeywork conversions of calls from
FILE * -> gp_file *, fwrite -> gp_fwrite etc. Pretty much every
device is touched, along with the clist and parsing code.
The more interesting changes are within gp.h (where the actual
new API is defined), gpmisc.c (where the basic implementations
live), and the platform specific levels (gp_mswin.c, gp_unifs.c
etc where the platform specific implementations have been
tweaked/renamed).
File opening path validation
All file opening routines now call a central routine for
path validation.
This then consults new entries in gs_lib_ctx to see if validation
is enabled or not. If so, it validates the paths by seeing if
they match.
Simple C level functions for adding/removing/clearing paths, exposed
through the gsapi level.
Add 2 postscript operators for path control.
<name> <string> .addcontrolpath -
Add the given <string> (path) to the list of paths for
controlset <name>, where <name> can be:
/PermitFileReading
/PermitFileWriting
/PermitFileControl
(Anything else -> rangecheck)
- .activatepathcontrol -
Enable path control. At this point PS cannot make any
more changes, and all file access is checked.
|
| |
|
|
|
|
|
|
|
|
|
| |
This requires an "add_path" entrypoint be added for each language
(NULL for everything except PS).
This causes the block of memory used for the -I path to be leaked. I
suspect this is the same as in gs. A fix for this is a little involved
so it'll wait for now.
|
|
This commit is a squashed version of the gpdl-shared-device
branch. Essentially this is a first version of the new
language switching mechanism.
This does not build as part as "all", but rather as "experimental"
or "gpdl".
|