From a17e87b2734257e9e94dd783f77a7c24c68e89f0 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 24 Oct 1994 06:45:06 +0000 Subject: [PATCH] Cleanup for prototype world. --- semex.c | 21 ++++++++------------- semex.xml | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/semex.c b/semex.c index dc7a6fe..144f2b8 100644 --- a/semex.c +++ b/semex.c @@ -1,5 +1,5 @@ /* - * semex.c --- System V semaphore exerciser + * semex.c --- System V and Linux semaphore exerciser * * by Eric S. Raymond */ @@ -15,7 +15,7 @@ extern char *strchr(), *strcat(), *ctime(); extern unsigned sleep(); /* - * This will need to change if any future version changes the define values + * This will need to change if any future version changes the #define values * of any UNIX error types. The highest value currently recognized is * EIDRM; the code that uses it in errmsg() will issue a generic error type * for higher values. @@ -238,37 +238,33 @@ char *argv[]; (void) sscanf(cmdline, "v %d %d\n", &semid, &semnum); if (tty) (void) printf("semctl(%d, %d, GETVAL) returns %d\n", - semid, semnum, semctl(semid, semnum, GETVAL)); + semid, semnum, semctl(semid, semnum, GETVAL, NULL)); break; case 'p': (void) sscanf(cmdline, "p %d %d\n", &semid, &semnum); if (tty) (void) printf("semctl(%d, %d, GETPID) returns %d\n", - semid, semnum, semctl(semid, semnum, GETPID)); + semid, semnum, semctl(semid, semnum, GETPID, NULL)); break; case 'n': (void) sscanf(cmdline, "n %d %d\n", &semid, &semnum); if (tty) (void) printf("semctl(%d, %d, GETNCNT) returns %d\n", - semid, semnum, semctl(semid, semnum, GETNCNT)); + semid, semnum, semctl(semid, semnum, GETNCNT, NULL)); break; case 'z': (void) sscanf(cmdline, "z %d %d\n", &semid, &semnum); if (tty) (void) printf("semctl(%d, %d, GETZCNT) returns %d\n", - semid, semnum, semctl(semid, semnum, GETZCNT)); + semid, semnum, semctl(semid, semnum, GETZCNT, NULL)); break; case 's': /* set the value of a semaphore */ { - union { - int val; - struct semid_ds *buf; - unsigned short *array; - } semval; + union semun semval; semval.val = 0; @@ -340,8 +336,7 @@ char *argv[]; case 'r': /* delete an existing semaphore */ (void) sscanf(cmdline, "r %d", &semid); - rv = semctl(semid, 0, IPC_RMID); - + rv = semctl(semid, 0, IPC_RMID, NULL); if (tty) { (void) printf("semctl(%d, 0, IPC_RMID) ", semid); diff --git a/semex.xml b/semex.xml index 5efec6e..3328012 100644 --- a/semex.xml +++ b/semex.xml @@ -140,7 +140,7 @@ but its lint library checks for the correct type, which is struct sembuf * as one can actually deduce from the description text for both entries. -System V Release 3 and 4 seems to get this right. +System V Release 3 and 4 and Linux all seem to get this right. .SH BUGS The 'p' and 'v' commands are not Dyskstra's P and V operations. .PP -- 2.43.0