search for: seek_end

Displaying 20 results from an estimated 107 matches for "seek_end".

2013 Jun 20
2
[PATCH] ocfs2: llseek requires to ocfs2 inode lock for the file in SEEK_END
llseek requires ocfs2 inode lock for updating the file size in SEEK_END. because the file size maybe update on another node. if it not . after call llseek in SEEK_END. the position is old. this bug can be reproduce the following scenario: at first ,we dd a test fileA,the file size is 10k. on NodeA: --------- 1) open the test fileA, lseek the end of file. and print the...
2013 Jun 27
0
[PATCH V3] ocfs2: llseek requires to ocfs2 inode lock for the file in SEEK_END
llseek requires ocfs2 inode lock for updating the file size in SEEK_END. because the file size maybe update on another node. if it not . after call llseek in SEEK_END. the position is old. this bug can be reproduce the following scenario: at first ,we dd a test fileA,the file size is 10k. on NodeA: --------- 1) open the test fileA, lseek the end of file. and print the...
2001 Sep 26
2
openssh-2.9.9p2 session.c fails on Solaris 7,8 w/ SunPro C
FYI-- session.c fails from openSSH 2.9.9p2 with SunPro C compiler on Solaris 7, 8. The function do_pre_login had to be moved to before its use in do_exec_pty (a predeclaration would work). It does appear to work correctly, given the above fix. Still having the largefile problem (argh), so if anyone can help with /that/ ... -- Austin David -- Sr. Systems Architect Wink Communications
2023 Feb 17
2
fseek/fgetc puzzle
...ed. I reduced it to this test case: #include <stdio.h> int main(void) { FILE *f = fopen("testfile", "w"); putc('A', f); fclose(f); f = fopen("testfile", "a+"); /* same behaviour for r+ */ fseek(f, -1L, SEEK_END); printf("c=%d\n", fgetc(f)); /* fseek(f, 0, SEEK_END); -- with this it behaves as expected */ /* fflush(f); -- this too */ fputc('B', f); } $ gcc test.c && ./a.out; od -x -c testfile c=65 0000000 4141 0042 A A B 0000...
2010 Jun 15
3
about rsyncing of block devices
...y to determine the actual device size. */ + if (IS_DEVICE(sx.st.st_mode) && sx.st.st_size == 0) { + int fd; + + fd = open(fname, O_RDONLY); + + if (fd < 0) + rsyserr(FERROR, errno, "failed to open %s to determine size", fname); + else { + OFF_T off = lseek(fd, 0, SEEK_END); + if (off == (OFF_T) -1) + rsyserr(FERROR, errno, "failed to seek to end of %s to determine size", fname); + else { + sx.st.st_size = off; + } + close(fd); + } + } + if (append_mode > 0 && sx.st.st_size >= F_LENGTH(file)) { #ifdef SUPPORT_HARD_LINKS if...
2014 Feb 02
1
Trouble implementing ov_callbacks, endless loop calling seek_func
...kFn( void *datasource, ogg_int64_t offset, int whence ) { auto sourceFile = (SourceFileImplOggVorbis *)datasource; switch( whence ) { case SEEK_SET: sourceFile->mStream->seekAbsolute( (off_t)offset ); break; case SEEK_CUR: sourceFile->mStream->seekRelative( (off_t)offset ); break; case SEEK_END: sourceFile->mStream->seekAbsolute( (off_t)( - offset ) ); break; default: CI_ASSERT_NOT_REACHABLE(); return -1; } return 0; } int SourceFileImplOggVorbis::closeFn( void *datasource ) { return 0; } long SourceFileImplOggVorbis::tellFn( void *datasource ) { auto sourceFile = (SourceFileImpl...
2007 Sep 27
1
libFLAC++ Seeking
...ore thing. I complied the 1.2.1 sources with msvc6 sp6 and this works with debug libs... > > Any hints? > > Thanks, > Istvan > > I still couldn't figure out why's that, but finally I changed file_length_callback_ in stream_decoder.c; replaced fno/fstat with fseek(f,0,SEEK_END)/fgetpos pair and now it works perfectly. ________________________________________________________ A c?gek itt keresnek t?ged &#8211; te hol keresed ?ket? [origo] ?ll?s http://cthandler.adverticum.net/?cturl=http%3A%2F%2Fjpt.hu%2Forigo%2Findex.php%3Fpage%3Dselectform%26fm_levelalja ----...
2023 Feb 20
1
fseek/fgetc puzzle
...laris 5.10 and 5.11, messages in *record* where separated by four \n / U+000A instead of two. It turns out that the effective sequence if((fo = Zopen(name, "a+")) == NULL){ if((fo = Zopen(name, "wx")) == NULL){ ... if(fseek(fo, -2L, SEEK_END) == 0){ switch(fread(buf, sizeof *buf, 2, fo)){ ... if(emptyline){ putc('\n', fo); fflush(fo); } on a O_APPEND|O_RDWR file requires an intermediate fseek(fout, 0, SEEK_END)) or fflush()...
2014 Jul 11
1
[PATCH 00/05] Mending for mkdiskimage
On 07/11/2014 12:33 AM, Thomas Schmitt wrote: > Technical side note: > It turned out that the lseek(2) function of NetBSD does not work > with SEEK_END as expected from the manual. libburn had to resort > to a binary search with try-and-error to determine device sizes. > I did not check perl's sysseek() whether it suffers from the > lseek(2) shortcomming, but i would expect so. > It might be desirable to have an option for explicit...
2005 Feb 19
0
[PATCH] check read/write return values
...00000 -0500 +++ xen-unstable/tools/libxc/xc_private.c 2005-02-19 12:14:44.000000000 -0500 @@ -276,12 +276,14 @@ unsigned long sz; lseek(fd, 0, SEEK_SET); - read(fd, &sig, sizeof(sig)); + if ( read(fd, &sig, sizeof(sig)) != sizeof(sig) ) + return 0; sz = lseek(fd, 0, SEEK_END); if ( sig == 0x8b1f ) /* GZIP signature? */ { lseek(fd, -4, SEEK_END); - read(fd, &_sz, 4); + if ( read(fd, &_sz, 4) != 4 ) + return 0; sz = _sz; } lseek(fd, 0, SEEK_SET); @@ -304,6 +306,12 @@ *size = xc_get_filesz(kernel_fd...
2019 Mar 20
0
[PATCH nbdkit 8/8] file: Implement extents.
...bug_zero; static void file_unload (void) @@ -220,6 +227,21 @@ file_close (void *handle) #define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL +/* For block devices, stat->st_size is not the true size. */ +static int64_t +block_device_size (int fd) +{ + off_t size; + + size = lseek (fd, 0, SEEK_END); + if (size == -1) { + nbdkit_error ("lseek (to find device size): %m"); + return -1; + } + + return size; +} + /* Get the file size. */ static int64_t file_get_size (void *handle) @@ -227,15 +249,11 @@ file_get_size (void *handle) struct handle *h = handle; if (h-&gt...
2014 Jul 10
2
[PATCH 00/05] Mending for mkdiskimage
On 07/10/2014 12:18 PM, Geert Stappers wrote: >> >> following is a series of patches derived from my proposed diff. >> Based on syslinux-6.03-pre1, but should also apply down to 4.xx. >> >> I hope to have imitated the changelog style sufficiently. >> Mine are a bit longer than usual with patches in the archive, i fear. > > Yes, they are long. > There
2014 Jan 30
1
[PATCH] Mending proposals for mkdiskimage
...device or existing file size is larger than an explicitely given number of cylinders.) ----------------------------------------------------------------- The implemented solutions are: 1. Ignoring the outcome of truncate(). 2. Correcting the argument of truncate(). 3. Using sysseek(fd, 0, SEEK_END) to determine the random-access storage capacity of any type of file. (Perl's sysseek() promises to call POSIX lseek(). More portability can hardly be imagined. In my tests any unsuitable type of Linux file yielded size 0 which is correctly considered an error by mkdiskimage.)...
2013 Jun 05
2
dovecot and time
..., 8192) = 8192 write(11, "s bigger\nthan most realistic cyb"..., 8192) = 8192 write(11, "on't have any way to tell you\". "..., 11356) = 11356 fstat64(11, {st_mode=S_IFREG|0600, st_size=27740, ...}) = 0 fsync(11) = 0 _llseek(11, 0, [27740], SEEK_END) = 0 close(11) = 0 time(NULL) = 1370448645 umask(0177) = 077 when called from procmail (not working): pread64(10, "00.vfemail.net,S=10941\n968 W2552"..., 4064, 52993) = 4064 pread64(10, "5...
2009 May 04
1
[PATCH] oggz: inefficient seeking
...t;oggz_seek::guess: guess_ratio %lld = (%lld - %lld) / (%lld - %lld)\n", @@ -657,7 +663,16 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target) unit_at = reader->current_unit; unit_begin = 0; - unit_end = -1; + + og = &oggz->current_page; + + if (oggz_seek_raw (oggz, 0, SEEK_END) >= 0) { + ogg_int64_t granulepos; + + if (oggz_get_prev_start_page (oggz, og, &granulepos, &serialno) >= 0) { + unit_end = oggz_get_unit (oggz, serialno, granulepos); + } + } og = &oggz->current_page; @@ -682,6 +697,10 @@ oggz_seek_set (OGGZ * oggz, ogg_i...
2001 Jun 29
1
wtmpx problem on Solaris 8 sparcv9 (64bit) environment
...cv9 + struct futmpx utx; +#else struct utmpx utx; +#endif int fd, found=0; /* Clear the time entries */ @@ -1245,7 +1304,11 @@ } /* Seek to the start of the last struct utmpx */ +#ifdef __sparcv9 + if (lseek(fd, (off_t)(0-sizeof(struct futmpx)), SEEK_END) == -1 ) { +#else if (lseek(fd, (off_t)(0-sizeof(struct utmpx)), SEEK_END) == -1 ) { +#endif /* probably a newly rotated wtmpx file */ close(fd); return 0; @@ -1275,7 +1338,11 @@ # endif continue; } +#i...
2001 Jun 18
2
Client protocol error:(nil): lseek: Illegal seek
..."}, 9) = 0 shmat(3, 0x9, 0x2) = -1 ENOSYS (Function not implemented) fcntl(3, F_SETFD, FD_CLOEXEC) = 0 chdir("/c/Program Files/EverQuest") = 0 rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0 socketcall(0x11, 0xbffffbcc) = 1 lseek(4, 0, SEEK_END) = -1 ESPIPE (Illegal seek) write(2, "Client protocol error:(nil): ", 29Client protocol error:(nil): ) = 29 write(2, "lseek: Illegal seek\n", 20lseek: Illegal seek ) = 20 close(3) = 0 _exit(1) = ?
2001 Jan 18
2
ssh-add bug
...wait4(16582, [WIFEXITED(s) && WEXITSTATUS(s) == 255], 0, NULL) = 16582 open("/home/pimlott/.ssh/identity", O_RDONLY) = 4 fstat(4, {st_mode=S_IFREG|0600, st_size=529, ...}) = 0 getuid() = 1000 getuid() = 1000 lseek(4, 0, SEEK_END) = 529 lseek(4, 0, SEEK_SET) = 0 read(4, "SSH PRIVATE KEY FILE FORMAT 1.1\n"..., 529) = 529 close(4) = 0 pipe([4, 5]) = 0 fork() = 16583
2019 Mar 23
1
Re: [PATCH nbdkit 8/8] file: Implement extents.
...20,6 +227,21 @@ file_close (void *handle) > > #define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL > > +/* For block devices, stat->st_size is not the true size. */ > +static int64_t > +block_device_size (int fd) > +{ > + off_t size; > + > + size = lseek (fd, 0, SEEK_END); Calling lseek without the lock? I'm not sure if you can guarantee that .size won't be called in parallel with some other .extents. /me reads ahead Oh, the caller has the lock. I might add a comment to this function that it expects the caller to grab the lock. > > +#ifdef SEEK_HO...
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 15/19] file: Implement extents.
...oid) @@ -220,6 +227,23 @@ file_close (void *handle) #define THREAD_MODEL NBDKIT_THREAD_MODEL_PARALLEL +/* For block devices, stat->st_size is not the true size. The caller + * grabs the lseek_lock. + */ +static int64_t +block_device_size (int fd) +{ + off_t size; + + size = lseek (fd, 0, SEEK_END); + if (size == -1) { + nbdkit_error ("lseek (to find device size): %m"); + return -1; + } + + return size; +} + /* Get the file size. */ static int64_t file_get_size (void *handle) @@ -227,15 +251,11 @@ file_get_size (void *handle) struct handle *h = handle; if (h-&gt...