1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 /*
30 * We don't support Linux modules, but we have to emulate enough of the system
31 * calls to show that we don't have any modules installed.
32 */
33
34 #include <errno.h>
35 #include <sys/types.h>
36 #include <sys/lx_misc.h>
37
38 /*
39 * For query_module(), we provide an empty list of modules, and return ENOENT
40 * on any request for a specific module.
41 */
42 #define LX_QM_MODULES 1
43 #define LX_QM_DEPS 2
44 #define LX_QM_REFS 3
45 #define LX_QM_SYMBOLS 4
46 #define LX_QM_INFO 5
47
48 /*ARGSUSED*/
49 int
50 lx_query_module(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4,
51 uintptr_t p5)
52 {
53 /*
54 * parameter p1 is the 'name' argument.
55 */
56 int which = (int)p2;
57 char *buf = (char *)p3;
58 size_t bufsize = (size_t)p4;
59 size_t *ret = (size_t *)p5;
60
61 switch (which) {
62 case 0:
63 /*
64 * Special case: always return 0
65 */
66 return (0);
67
68 case LX_QM_MODULES:
69 /*
70 * Generate an empty list of modules.
71 */
72 if (bufsize && buf)
73 buf[0] = '\0';
74 if (ret)
75 *ret = 0;
76 return (0);
77
78 case LX_QM_DEPS:
79 case LX_QM_REFS:
80 case LX_QM_SYMBOLS:
81 case LX_QM_INFO:
82 /*
83 * Any requests for specific module information return ENOENT.
84 */
85 return (-ENOENT);
86
87 default:
88 return (-EINVAL);
89 }
90 }