3.0.22

From Msim

(Difference between revisions)
Jump to: navigation, search
Jloew (Talk | contribs)
(Created page with "=== osf_sys_lseek === osf_sys_lseek does not return -1 when called on stdin, stdout or stderr on Tru64. Empirically, it appears to output the total number of characters printed f...")
Newer edit →

Revision as of 04:24, 3 September 2010

osf_sys_lseek

osf_sys_lseek does not return -1 when called on stdin, stdout or stderr on Tru64. Empirically, it appears to output the total number of characters printed for the current session.

#include <sys/types.h>
#include <unistd.h>
#include <iostream>

int main()
{
       cout << "Weeee!" << endl;
       for(int i=0;i<10;i++)
       {
               off_t sval = lseek(i,0,1);
               cout << i << ":  " << sval << endl;
       }
       return 0;
}

On a new session:

jloew@tru64:~/syscall$ ./a.out
Weeee!
0:  722
1:  730
2:  738
3:  -1
4:  -1
5:  -1
6:  -1
7:  -1
8:  -1
9:  -1

Second execution:

jloew@tru64:~/syscall$ ./a.out
Weeee!
0:  864
1:  872
2:  880
3:  -1
4:  -1
5:  -1
6:  -1
7:  -1
8:  -1
9:  -1

The difference is consistent (typing into the command prompt and deleting it will increase this counter).

Personal tools