PERFORCE change 164419 for review

Zhao Shuai zhaoshuai at FreeBSD.org
Mon Jun 15 12:14:27 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=164419

Change 164419 by zhaoshuai at zhaoshuai on 2009/06/15 12:14:15

	-format pr_116770.c
	-add a header file in pr_76525.c to remove compile warnings

Affected files ...

.. //depot/projects/soc2009/fifo/fifo_test/functionality/pr_116770.c#2 edit
.. //depot/projects/soc2009/fifo/fifo_test/functionality/pr_76525.c#3 edit

Differences ...

==== //depot/projects/soc2009/fifo/fifo_test/functionality/pr_116770.c#2 (text+ko) ====

@@ -21,59 +21,59 @@
 
 int main(void)
 {
-	int rfd,wfd,qfd,n;
+	int rfd, wfd, qfd, n;
 	static struct timespec zero;
 	struct kevent kev;
 	char fifopath[64];
 
 	sprintf(fifopath,"/tmp/less-than-useful.%ld",(long)getpid());
-	if (mkfifo(fifopath,S_IRUSR|S_IWUSR)==-1) {
+	if (mkfifo(fifopath, S_IRUSR | S_IWUSR) == -1) {
 		perror("mkfifo");
 		return 1;
 	}
 
-	rfd=open(fifopath,O_RDONLY|O_NONBLOCK);
-	if (rfd==-1) {
+	rfd = open(fifopath, O_RDONLY | O_NONBLOCK);
+	if (rfd == -1) {
 		perror("open 1");
 		goto cleanup;
 	}
 
-	qfd=kqueue();
-	if (qfd==-1) {
+	qfd = kqueue();
+	if (qfd == -1) {
 		perror("kqueue");
 		goto cleanup;
 	}
 
-	EV_SET(&kev,rfd,EVFILT_READ,EV_ADD,0,0,NULL);
-	n=kevent(qfd,&kev,1,NULL,0,&zero);
-	if (n==-1) {
+	EV_SET(&kev, rfd, EVFILT_READ, EV_ADD, 0, 0, NULL);
+	n = kevent(qfd, &kev, 1, NULL, 0, &zero);
+	if (n == -1) {
 		perror("kevent 1");
 		goto cleanup;
 	}
-	n=kevent(qfd,NULL,0,&kev,1,&zero);
-	if (n==-1) {
+	n = kevent(qfd, NULL, 0, &kev, 1, &zero);
+	if (n == -1) {
 		perror("kevent 2");
 		goto cleanup;
 	}
-	if (n==1 && (kev.flags & EV_EOF)) {
+	if (n == 1 && (kev.flags & EV_EOF)) {
 		fputs("Immediate EOF (not useful)\n",stderr);
 	}
-	wfd=open(fifopath,O_WRONLY);
-	if (wfd==-1) {
+	wfd = open(fifopath, O_WRONLY);
+	if (wfd == -1) {
 		perror("open 2");
 		goto cleanup;
 	}
-	n=kevent(qfd,NULL,0,&kev,1,&zero);
-	if (n==-1) {
+	n = kevent(qfd, NULL, 0, &kev, 1, &zero);
+	if (n == -1) {
 		perror("kevent 3");
 		goto cleanup;
 	}
-	if (n==1 && (kev.flags & EV_EOF)) {
+	if (n == 1 && (kev.flags & EV_EOF)) {
 		fputs("EOF while there's still a writer (BUG!)\n",stderr);
 	}
 	close(wfd);
-	n=kevent(qfd,NULL,0,&kev,1,&zero);
-	if (n==-1) {
+	n = kevent(qfd, NULL, 0, &kev, 1, &zero);
+	if (n == -1) {
 		perror("kevent 4");
 		goto cleanup;
 	}

==== //depot/projects/soc2009/fifo/fifo_test/functionality/pr_76525.c#3 (text+ko) ====

@@ -142,6 +142,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>


More information about the p4-projects mailing list