Lines Matching +full:x +full:- +full:rc

35 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
42 mycc -o suj30 -Wall -Wextra -O2 suj30.c -lpthread
43 rm -f suj30.c
45 mount | grep "on $mntpoint " | grep -q md$mdstart && umount $mntpoint
46 mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart
48 mdconfig -a -t swap -s 4g -u $mdstart
49 newfs -j md$mdstart > /dev/null
54 /tmp/suj30 $mntpoint/test-$i 100000 &
58 while mount | grep -q $mntpoint; do
61 mdconfig -d -u $mdstart
62 rm -f /tmp/suj30
68 * compile as `cc -o rename rename.c -lpthread'
90 #define LOCK(x) pthread_mutex_lock(&x.mtx)
91 #define UNLOCK(x) pthread_mutex_unlock(&x.mtx)
92 #define SIGNAL(x) pthread_cond_signal(&x.wait)
93 #define WAIT(x) pthread_cond_wait(&x.wait, &x.mtx)
122 int rc;
130 if (mkdir(dirname1, 0755) == -1)
132 if (mkdir(dirname2, 0755) == -1)
139 rc = pthread_mutex_init(&newfiles.mtx, NULL);
140 if (rc != 0)
141 errc(1, rc, "pthread_mutex_init()");
142 rc = pthread_cond_init(&newfiles.wait, NULL);
143 if (rc != 0)
144 errc(1, rc, "pthread_cond_init()");
145 rc = pthread_mutex_init(&renamedfiles.mtx, NULL);
146 if (rc != 0)
147 errc(1, rc, "pthread_mutex_init()");
148 rc = pthread_cond_init(&renamedfiles.wait, NULL);
149 if (rc != 0)
150 errc(1, rc, "pthread_cond_init()");
152 rc = pthread_create(&tid[0], NULL, loop_create, NULL);
153 if (rc != 0)
154 errc(1, rc, "pthread_create()");
155 rc = pthread_create(&tid[1], NULL, loop_rename, NULL);
156 if (rc != 0)
157 errc(1, rc, "pthread_create()");
158 rc = pthread_create(&tid[2], NULL, loop_unlink, NULL);
159 if (rc != 0)
160 errc(1, rc, "pthread_create()");
163 rc = pthread_join(tid[i], NULL);
164 if (rc != 0)
165 errc(1, rc, "pthread_join(%d)", i);
168 rc = pthread_mutex_destroy(&newfiles.mtx);
169 if (rc != 0)
170 errc(1, rc, "pthread_mutex_destroy(newfiles)");
171 rc = pthread_cond_destroy(&newfiles.wait);
172 if (rc != 0)
173 errc(1, rc, "pthread_cond_destroy(newfiles)");
174 rc = pthread_mutex_destroy(&renamedfiles.mtx);
175 if (rc != 0)
176 errc(1, rc, "pthread_mutex_destroy(renamedfiles)");
177 rc = pthread_cond_destroy(&renamedfiles.wait);
178 if (rc != 0)
179 errc(1, rc, "pthread_cond_destroy(renamedfiles)");
200 asprintf(&file->name, "%s/filename_too-long:%d", dirname1, i);
201 if (mkdir(file->name, 0666) == -1) {
202 warn("mkdir(%s)", file->name);
203 free(file->name);
238 filename = strrchr(file->name, '/');
240 if (rename(file->name, newname) == -1)
241 err(1, "rename(%s, %s)", file->name, newname);
242 free(file->name);
243 file->name = newname;
274 rmdir(file->name);
275 free(file->name);