kopia lustrzana https://gitlab.com/sane-project/backends
Reindented.
rodzic
4bf0aa0851
commit
d63c6321a6
|
@ -1272,7 +1272,8 @@ reader_process (Test_Device * test_device, SANE_Int fd)
|
||||||
/*
|
/*
|
||||||
* this code either runs in child or thread context...
|
* this code either runs in child or thread context...
|
||||||
*/
|
*/
|
||||||
static int reader_task(void *data)
|
static int
|
||||||
|
reader_task (void *data)
|
||||||
{
|
{
|
||||||
SANE_Status status;
|
SANE_Status status;
|
||||||
sigset_t ignore_set;
|
sigset_t ignore_set;
|
||||||
|
@ -1280,12 +1281,15 @@ static int reader_task(void *data)
|
||||||
struct Test_Device *test_device = (struct Test_Device *) data;
|
struct Test_Device *test_device = (struct Test_Device *) data;
|
||||||
|
|
||||||
DBG (2, "reader_task started\n");
|
DBG (2, "reader_task started\n");
|
||||||
if( sanei_thread_is_forked()) {
|
if (sanei_thread_is_forked ())
|
||||||
|
{
|
||||||
DBG (3, "reader_task started (forked)\n");
|
DBG (3, "reader_task started (forked)\n");
|
||||||
close (test_device->pipe);
|
close (test_device->pipe);
|
||||||
test_device->pipe = -1;
|
test_device->pipe = -1;
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DBG (3, "reader_task started (as thread)\n");
|
DBG (3, "reader_task started (as thread)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1327,9 +1331,12 @@ finish_pass (Test_Device * test_device)
|
||||||
pid = sanei_thread_waitpid (test_device->reader_pid, &status);
|
pid = sanei_thread_waitpid (test_device->reader_pid, &status);
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
DBG (1, "finish_pass: sanei_thread_waitpid failed, already terminated? (%s)\n",
|
DBG (1,
|
||||||
|
"finish_pass: sanei_thread_waitpid failed, already terminated? (%s)\n",
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DBG (2, "finish_pass: reader process terminated with status: %s\n",
|
DBG (2, "finish_pass: reader process terminated with status: %s\n",
|
||||||
sane_strstatus (status));
|
sane_strstatus (status));
|
||||||
}
|
}
|
||||||
|
@ -1417,10 +1424,10 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
||||||
test_device = 0;
|
test_device = 0;
|
||||||
previous_device = 0;
|
previous_device = 0;
|
||||||
|
|
||||||
DBG (2, "sane_init: version_code= %p, authorize=%p\n", (void*)version_code,
|
DBG (2, "sane_init: version_code= %p, authorize=%p\n",
|
||||||
(void*)authorize);
|
(void *) version_code, (void *) authorize);
|
||||||
DBG (1, "sane_init: SANE test backend version %d.%d.%d from %s\n",
|
DBG (1, "sane_init: SANE test backend version %d.%d.%d from %s\n", V_MAJOR,
|
||||||
V_MAJOR, V_MINOR, BUILD, PACKAGE_STRING);
|
V_MINOR, BUILD, PACKAGE_STRING);
|
||||||
|
|
||||||
if (version_code)
|
if (version_code)
|
||||||
*version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD);
|
*version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BUILD);
|
||||||
|
@ -2479,11 +2486,13 @@ sane_start (SANE_Handle handle)
|
||||||
/* create reader routine as new process or thread */
|
/* create reader routine as new process or thread */
|
||||||
test_device->pipe = pipe_descriptor[0];
|
test_device->pipe = pipe_descriptor[0];
|
||||||
test_device->reader_fds = pipe_descriptor[1];
|
test_device->reader_fds = pipe_descriptor[1];
|
||||||
test_device->reader_pid = sanei_thread_begin(reader_task,(void*)test_device);
|
test_device->reader_pid =
|
||||||
|
sanei_thread_begin (reader_task, (void *) test_device);
|
||||||
|
|
||||||
if (test_device->reader_pid < 0)
|
if (test_device->reader_pid < 0)
|
||||||
{
|
{
|
||||||
DBG (1, "sane_start: sanei_thread_begin failed (%s)\n", strerror(errno));
|
DBG (1, "sane_start: sanei_thread_begin failed (%s)\n",
|
||||||
|
strerror (errno));
|
||||||
return SANE_STATUS_NO_MEM;
|
return SANE_STATUS_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue