Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/compat/sys Fix emulation issue of SETVAL, and make ...
details: https://anonhg.NetBSD.org/src/rev/d0b551de527f
branches: trunk
changeset: 761549:d0b551de527f
user: christos <christos%NetBSD.org@localhost>
date: Mon Jan 31 22:51:39 2011 +0000
description:
Fix emulation issue of SETVAL, and make the code look the same between the
two different versions.
diffstat:
lib/libc/compat/sys/compat___semctl13.c | 27 ++++++++++++++++++---------
lib/libc/compat/sys/compat_semctl.c | 29 ++++++++++++++++-------------
2 files changed, 34 insertions(+), 22 deletions(-)
diffs (127 lines):
diff -r 01867cdf37d7 -r d0b551de527f lib/libc/compat/sys/compat___semctl13.c
--- a/lib/libc/compat/sys/compat___semctl13.c Mon Jan 31 19:41:19 2011 +0000
+++ b/lib/libc/compat/sys/compat___semctl13.c Mon Jan 31 22:51:39 2011 +0000
@@ -1,6 +1,6 @@
-/* $NetBSD: compat___semctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
+/* $NetBSD: compat___semctl13.c,v 1.3 2011/01/31 22:51:39 christos Exp $ */
-/* $NetBSD: compat___semctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
+/* $NetBSD: compat___semctl13.c,v 1.3 2011/01/31 22:51:39 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat___semctl13.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
+__RCSID("$NetBSD: compat___semctl13.c,v 1.3 2011/01/31 22:51:39 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -77,14 +77,25 @@
#else
semun = va_arg(ap, union __semun);
#endif
+ break;
+ default:
+ break;
}
va_end(ap);
- ds13 = (struct semid_ds13 *)(void *)semun.buf;
- semun.buf = &ds;
+ switch (cmd) {
+ case IPC_SET:
+ case IPC_STAT:
+ ds13 = (void *)semun.buf;
+ semun.buf = &ds;
+ if (cmd == IPC_SET)
+ __semid_ds13_to_native(ds13, &ds);
+ break;
+ default:
+ ds13 = NULL;
+ break;
+ }
- if (cmd == IPC_SET)
- __semid_ds13_to_native(ds13, &ds);
error = ____semctl50(semid, semnum, cmd, &semun);
if (error)
@@ -92,7 +103,5 @@
if (cmd == IPC_STAT)
__native_to_semid_ds13(&ds, ds13);
-
- semun.buf = (struct semid_ds *)(void *)ds13;
return 0;
}
diff -r 01867cdf37d7 -r d0b551de527f lib/libc/compat/sys/compat_semctl.c
--- a/lib/libc/compat/sys/compat_semctl.c Mon Jan 31 19:41:19 2011 +0000
+++ b/lib/libc/compat/sys/compat_semctl.c Mon Jan 31 22:51:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_semctl.c,v 1.2 2009/01/11 02:46:26 christos Exp $ */
+/* $NetBSD: compat_semctl.c,v 1.3 2011/01/31 22:51:39 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Christopher G. Demetriou
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat_semctl.c,v 1.2 2009/01/11 02:46:26 christos Exp $");
+__RCSID("$NetBSD: compat_semctl.c,v 1.3 2011/01/31 22:51:39 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#define __LIBC12_SOURCE__
@@ -53,7 +53,7 @@
va_list ap;
union __semun semun;
struct semid_ds ds;
- struct semid_ds14 *ds14 = NULL;
+ struct semid_ds14 *ds14;
int error;
va_start(ap, cmd);
@@ -68,27 +68,30 @@
#else
semun = va_arg(ap, union __semun);
#endif
+ break;
+ default:
+ break;
}
va_end(ap);
switch (cmd) {
case IPC_SET:
case IPC_STAT:
- ds14 = (struct semid_ds14 *)(void *)semun.buf;
+ ds14 = (void *)semun.buf;
if (cmd == IPC_SET)
__semid_ds14_to_native(ds14, &ds);
semun.buf = &ds;
break;
+ default:
+ ds14 = NULL;
+ break;
}
error = __semctl50(semid, semnum, cmd, &semun);
- switch (cmd) {
- case IPC_SET:
- case IPC_STAT:
- semun.buf = (struct semid_ds *)(void *)ds14;
- if (cmd == IPC_STAT && error == 0)
- __native_to_semid_ds14(&ds, ds14);
- break;
- }
- return error;
+ if (error)
+ return error;
+
+ if (cmd == IPC_STAT)
+ __native_to_semid_ds14(&ds, ds14);
+ return 0;
}
Home |
Main Index |
Thread Index |
Old Index