Lines Matching defs:fp
36 FILE* fp = fopen("/proc/version", "r");
39 ASSERT_EQ(0U, __fbufsize(fp));
43 fgets(buf, sizeof(buf), fp);
44 ASSERT_EQ(1024U, __fbufsize(fp));
46 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 1));
47 ASSERT_EQ(1U, __fbufsize(fp));
49 ASSERT_EQ(0, setvbuf(fp, buf, _IOFBF, 8));
50 ASSERT_EQ(8U, __fbufsize(fp));
52 fclose(fp);
56 FILE* fp = fopen("/proc/version", "r");
58 ASSERT_FALSE(__flbf(fp));
61 ASSERT_EQ(0, setvbuf(fp, buf, _IOLBF, sizeof(buf)));
63 ASSERT_TRUE(__flbf(fp));
65 fclose(fp);
69 FILE* fp = fopen("/dev/null", "w");
70 ASSERT_EQ(0U, __fpending(fp));
71 ASSERT_EQ('x', fputc('x', fp));
72 ASSERT_EQ(1U, __fpending(fp));
73 ASSERT_EQ('y', fputc('y', fp));
74 ASSERT_EQ(2U, __fpending(fp));
75 fflush(fp);
76 ASSERT_EQ(0U, __fpending(fp));
77 fclose(fp);
81 FILE* fp = tmpfile();
83 ASSERT_EQ('a', fputc('a', fp));
84 ASSERT_EQ(1U, __fpending(fp));
85 __fpurge(fp);
86 ASSERT_EQ(0U, __fpending(fp));
88 ASSERT_EQ('b', fputc('b', fp));
89 ASSERT_EQ('\n', fputc('\n', fp));
90 ASSERT_EQ(2U, __fpending(fp));
92 rewind(fp);
95 char* s = fgets(buf, sizeof(buf), fp);
99 fclose(fp);
103 FILE* fp = fopen("/dev/null", "w");
106 ASSERT_EQ(0, setvbuf(fp, buf, _IOLBF, sizeof(buf)));
108 ASSERT_EQ('a', fputc('a', fp));
109 ASSERT_EQ(1U, __fpending(fp));
113 ASSERT_EQ(0U, __fpending(fp));
115 fclose(fp);
119 FILE* fp = fopen("/dev/null", "r");
120 ASSERT_TRUE(__freadable(fp));
121 ASSERT_FALSE(__fwritable(fp));
122 fclose(fp);
124 fp = fopen("/dev/null", "w");
125 ASSERT_FALSE(__freadable(fp));
126 ASSERT_TRUE(__fwritable(fp));
127 fclose(fp);
129 fp = fopen("/dev/null", "w+");
130 ASSERT_TRUE(__freadable(fp));
131 ASSERT_TRUE(__fwritable(fp));
132 fclose(fp);
136 FILE* fp = fopen("/proc/version", "r");
137 ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY));
138 ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_BYCALLER));
139 ASSERT_EQ(FSETLOCKING_BYCALLER, __fsetlocking(fp, FSETLOCKING_QUERY));
140 ASSERT_EQ(FSETLOCKING_BYCALLER, __fsetlocking(fp, FSETLOCKING_INTERNAL));
141 ASSERT_EQ(FSETLOCKING_INTERNAL, __fsetlocking(fp, FSETLOCKING_QUERY));
142 fclose(fp);