Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-imgsrv
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-imgsrv
Commits
e0d4b063
Commit
e0d4b063
authored
Aug 02, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sendvile64() limit of 620756992 (0x25000000) bytes failed and did not continus if more)
parent
6190b834
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
imgsrv.c
src/imgsrv.c
+11
-2
No files found.
src/imgsrv.c
View file @
e0d4b063
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
#include <sys/reboot.h>
#include <sys/reboot.h>
// sendfile64 failed at this size: //620756992='0x25000000'
#define MAX_SENDFILE_SIZE 620756992
// change to 0 when done
// change to 0 when done
#define ELPHEL_DEBUG 0
#define ELPHEL_DEBUG 0
...
@@ -2152,7 +2154,7 @@ void listener_loop(struct file_set *fset)
...
@@ -2152,7 +2154,7 @@ void listener_loop(struct file_set *fset)
int
tiff_bin_shift
=
3
;
// histogram bin size is 1<<3 == 8
int
tiff_bin_shift
=
3
;
// histogram bin size is 1<<3 == 8
int
tiff_bin
=
1
;
int
tiff_bin
=
1
;
int
tiff_auto
=
-
1
;
int
tiff_auto
=
-
1
;
long
long
ssd_offs_byte
,
ssd_count_bytes
,
ssd_sent_bytes
;
//, ssd_set_byte;
long
long
ssd_offs_byte
,
ssd_count_bytes
,
ssd_sent_bytes
,
ssd_limited_count
;
//, ssd_set_byte;
// imgsrv -p 2323 -s /dev/sda2
// imgsrv -p 2323 -s /dev/sda2
// int bin_shift, // binsize = 1 << bin_shift
// int bin_shift, // binsize = 1 << bin_shift
...
@@ -2244,7 +2246,9 @@ void listener_loop(struct file_set *fset)
...
@@ -2244,7 +2246,9 @@ void listener_loop(struct file_set *fset)
//STDOUT_FILENO
//STDOUT_FILENO
//ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
//ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
fprintf
(
stderr
,
"Sending %lld bytes, offs=%lld
\n
"
,
ssd_count_bytes
,
ssd_offs_byte
);
fprintf
(
stderr
,
"Sending %lld bytes, offs=%lld
\n
"
,
ssd_count_bytes
,
ssd_offs_byte
);
#if 0
#if 0
// not updated with MAX_SENDFILE_SIZE
ssd_offs_byte=lseek64(fset->ssd_fd, ssd_offs_byte, SEEK_SET);
ssd_offs_byte=lseek64(fset->ssd_fd, ssd_offs_byte, SEEK_SET);
fprintf(stderr, "lseek64()-> %lld, STDOUT_FILENO=%d, errno=%d\n", ssd_offs_byte, STDOUT_FILENO, errno);
fprintf(stderr, "lseek64()-> %lld, STDOUT_FILENO=%d, errno=%d\n", ssd_offs_byte, STDOUT_FILENO, errno);
while (ssd_count_bytes > 0) {
while (ssd_count_bytes > 0) {
...
@@ -2260,8 +2264,13 @@ void listener_loop(struct file_set *fset)
...
@@ -2260,8 +2264,13 @@ void listener_loop(struct file_set *fset)
ssd_count_bytes -= ssd_sent_bytes;
ssd_count_bytes -= ssd_sent_bytes;
}
}
#else
#else
//MAX_SENDFILE_SIZE
while
(
ssd_count_bytes
>
0
)
{
while
(
ssd_count_bytes
>
0
)
{
ssd_sent_bytes
=
sendfile64
(
STDOUT_FILENO
,
fset
->
ssd_fd
,
&
ssd_offs_byte
,
ssd_count_bytes
);
ssd_limited_count
=
ssd_count_bytes
;
if
(
ssd_limited_count
>
MAX_SENDFILE_SIZE
)
{
ssd_limited_count
=
MAX_SENDFILE_SIZE
;
}
ssd_sent_bytes
=
sendfile64
(
STDOUT_FILENO
,
fset
->
ssd_fd
,
&
ssd_offs_byte
,
ssd_limited_count
);
if
(
ssd_sent_bytes
<=
0
){
if
(
ssd_sent_bytes
<=
0
){
fprintf
(
stderr
,
"sendfile64() failed: sent %lld bytes (wanted %lld), offs=%lld, errno=%d
\n
"
,
\
fprintf
(
stderr
,
"sendfile64() failed: sent %lld bytes (wanted %lld), offs=%lld, errno=%d
\n
"
,
\
ssd_sent_bytes
,
ssd_count_bytes
,
ssd_offs_byte
,
errno
);
ssd_sent_bytes
,
ssd_count_bytes
,
ssd_offs_byte
,
errno
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment