mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Properly document return value of strpos().
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.291 2005/11/04 23:13:59 petere Exp $
|
$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.291.2.1 2005/11/16 03:56:33 momjian Exp $
|
||||||
PostgreSQL documentation
|
PostgreSQL documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -1483,7 +1483,7 @@ PostgreSQL documentation
|
|||||||
|
|
||||||
<row>
|
<row>
|
||||||
<entry><literal><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</literal></entry>
|
<entry><literal><function>strpos</function>(<parameter>string</parameter>, <parameter>substring</parameter>)</literal></entry>
|
||||||
<entry><type>text</type></entry>
|
<entry><type>int</type></entry>
|
||||||
<entry>
|
<entry>
|
||||||
Location of specified substring (same as
|
Location of specified substring (same as
|
||||||
<literal>position(<parameter>substring</parameter> in
|
<literal>position(<parameter>substring</parameter> in
|
||||||
|
@ -2,4 +2,5 @@ This program tests fsync. The tests are described as part of the program output
|
|||||||
|
|
||||||
Usage: test_fsync [-f filename] [loops]
|
Usage: test_fsync [-f filename] [loops]
|
||||||
|
|
||||||
Loops defaults to 1000.
|
Loops defaults to 1000. The default output file is /var/tmp/test_fsync.out.
|
||||||
|
Consider that /tmp or /var/tmp might be memory-based file systems.
|
||||||
|
@ -59,7 +59,7 @@ main(int argc, char *argv[])
|
|||||||
strout[i] = 'a';
|
strout[i] = 'a';
|
||||||
|
|
||||||
if ((tmpfile = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
write(tmpfile, strout, WAL_FILE_SIZE);
|
write(tmpfile, strout, WAL_FILE_SIZE);
|
||||||
fsync(tmpfile); /* fsync so later fsync's don't have to do it */
|
fsync(tmpfile); /* fsync so later fsync's don't have to do it */
|
||||||
close(tmpfile);
|
close(tmpfile);
|
||||||
@ -70,7 +70,7 @@ main(int argc, char *argv[])
|
|||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
write(tmpfile, strout, 8192);
|
write(tmpfile, strout, 8192);
|
||||||
close(tmpfile);
|
close(tmpfile);
|
||||||
}
|
}
|
||||||
@ -87,12 +87,12 @@ main(int argc, char *argv[])
|
|||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
write(tmpfile, strout, 8192);
|
write(tmpfile, strout, 8192);
|
||||||
fsync(tmpfile);
|
fsync(tmpfile);
|
||||||
close(tmpfile);
|
close(tmpfile);
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
/* do nothing but the open/close the tests are consistent. */
|
/* do nothing but the open/close the tests are consistent. */
|
||||||
close(tmpfile);
|
close(tmpfile);
|
||||||
}
|
}
|
||||||
@ -106,12 +106,12 @@ main(int argc, char *argv[])
|
|||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
write(tmpfile, strout, 8192);
|
write(tmpfile, strout, 8192);
|
||||||
close(tmpfile);
|
close(tmpfile);
|
||||||
/* reopen file */
|
/* reopen file */
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
fsync(tmpfile);
|
fsync(tmpfile);
|
||||||
close(tmpfile);
|
close(tmpfile);
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* 16k o_sync write */
|
/* 16k o_sync write */
|
||||||
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
write(tmpfile, strout, 16384);
|
write(tmpfile, strout, 16384);
|
||||||
@ -136,7 +136,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* 2*8k o_sync writes */
|
/* 2*8k o_sync writes */
|
||||||
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -154,7 +154,7 @@ main(int argc, char *argv[])
|
|||||||
#ifdef OPEN_DATASYNC_FLAG
|
#ifdef OPEN_DATASYNC_FLAG
|
||||||
/* open_dsync, write */
|
/* open_dsync, write */
|
||||||
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
write(tmpfile, strout, 8192);
|
write(tmpfile, strout, 8192);
|
||||||
@ -169,7 +169,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* open_fsync, write */
|
/* open_fsync, write */
|
||||||
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
write(tmpfile, strout, 8192);
|
write(tmpfile, strout, 8192);
|
||||||
@ -182,7 +182,7 @@ main(int argc, char *argv[])
|
|||||||
#ifdef HAVE_FDATASYNC
|
#ifdef HAVE_FDATASYNC
|
||||||
/* write, fdatasync */
|
/* write, fdatasync */
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -200,7 +200,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* write, fsync, close */
|
/* write, fsync, close */
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ main(int argc, char *argv[])
|
|||||||
#ifdef OPEN_DATASYNC_FLAG
|
#ifdef OPEN_DATASYNC_FLAG
|
||||||
/* open_dsync, write */
|
/* open_dsync, write */
|
||||||
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -236,7 +236,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* open_fsync, write */
|
/* open_fsync, write */
|
||||||
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -252,7 +252,7 @@ main(int argc, char *argv[])
|
|||||||
#ifdef HAVE_FDATASYNC
|
#ifdef HAVE_FDATASYNC
|
||||||
/* write, fdatasync */
|
/* write, fdatasync */
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -271,7 +271,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* write, fsync, close */
|
/* write, fsync, close */
|
||||||
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
if ((tmpfile = open(filename, O_RDWR)) == -1)
|
||||||
die("can't open /var/tmp/test_fsync.out");
|
die("Cannot open output file.");
|
||||||
gettimeofday(&start_t, NULL);
|
gettimeofday(&start_t, NULL);
|
||||||
for (i = 0; i < loops; i++)
|
for (i = 0; i < loops; i++)
|
||||||
{
|
{
|
||||||
@ -306,6 +306,6 @@ print_elapse(struct timeval start_t, struct timeval elapse_t)
|
|||||||
void
|
void
|
||||||
die(char *str)
|
die(char *str)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s", str);
|
fprintf(stderr, "%s\n", str);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user