mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
* rt/tst-shm.c: Use fstat64 instead of fstat.
This commit is contained in:
parent
69e5cbf596
commit
eb4b098a99
@ -1,5 +1,7 @@
|
|||||||
2007-05-18 Ulrich Drepper <drepper@redhat.com>
|
2007-05-18 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* rt/tst-shm.c: Use fstat64 instead of fstat.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/i386/sync_file_range.S: Fix case where
|
* sysdeps/unix/sysv/linux/i386/sync_file_range.S: Fix case where
|
||||||
__NR_sync_file_range is not defined.
|
__NR_sync_file_range is not defined.
|
||||||
|
|
||||||
|
15
rt/tst-shm.c
15
rt/tst-shm.c
@ -60,7 +60,7 @@ static void
|
|||||||
worker (int write_now)
|
worker (int write_now)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct stat st;
|
struct stat64 st;
|
||||||
int i;
|
int i;
|
||||||
int fd = do_open ();
|
int fd = do_open ();
|
||||||
char *mem;
|
char *mem;
|
||||||
@ -68,8 +68,10 @@ worker (int write_now)
|
|||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
exit (fd);
|
exit (fd);
|
||||||
|
|
||||||
if (fstat (fd, &st) == -1 || st.st_size != 4000)
|
if (fstat64 (fd, &st) == -1)
|
||||||
error (EXIT_FAILURE, 0, "stat failed");
|
error (EXIT_FAILURE, 0, "stat failed");
|
||||||
|
if (st.st_size != 4000)
|
||||||
|
error (EXIT_FAILURE, 0, "size incorrect");
|
||||||
|
|
||||||
mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
mem = mmap (NULL, 4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if (mem == NULL)
|
if (mem == NULL)
|
||||||
@ -131,7 +133,7 @@ do_test (void)
|
|||||||
pid_t pid2;
|
pid_t pid2;
|
||||||
int status1;
|
int status1;
|
||||||
int status2;
|
int status2;
|
||||||
struct stat st;
|
struct stat64 st;
|
||||||
|
|
||||||
/* Create the shared memory object. */
|
/* Create the shared memory object. */
|
||||||
fd = shm_open ("/shm-test", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
|
fd = shm_open ("/shm-test", O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600);
|
||||||
@ -155,11 +157,16 @@ do_test (void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat (fd, &st) == -1 || st.st_size != 4000)
|
if (fstat64 (fd, &st) == -1)
|
||||||
{
|
{
|
||||||
shm_unlink ("/shm-test");
|
shm_unlink ("/shm-test");
|
||||||
error (EXIT_FAILURE, 0, "initial stat failed");
|
error (EXIT_FAILURE, 0, "initial stat failed");
|
||||||
}
|
}
|
||||||
|
if (st.st_size != 4000)
|
||||||
|
{
|
||||||
|
shm_unlink ("/shm-test");
|
||||||
|
error (EXIT_FAILURE, 0, "initial size not correct");
|
||||||
|
}
|
||||||
|
|
||||||
/* Spawn to processes which will do the work. */
|
/* Spawn to processes which will do the work. */
|
||||||
pid1 = fork ();
|
pid1 = fork ();
|
||||||
|
Loading…
Reference in New Issue
Block a user