Changeset 8ff0bd2 in mainline for uspace/app
- Timestamp:
- 2011-09-04T11:30:58Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 03bc76a
- Parents:
- d2c67e7 (diff), deac215e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/app
- Files:
-
- 6 added
- 2 deleted
- 75 edited
- 3 moved
-
bdsh/Makefile (modified) (2 diffs)
-
bdsh/cmds/builtin_cmds.c (modified) (3 diffs)
-
bdsh/cmds/builtins/cd/cd.c (modified) (1 diff)
-
bdsh/cmds/builtins/exit/exit.c (modified) (1 diff)
-
bdsh/cmds/cmds.h (modified) (3 diffs)
-
bdsh/cmds/mod_cmds.c (modified) (2 diffs)
-
bdsh/cmds/modules/bdd/bdd.c (modified) (8 diffs)
-
bdsh/cmds/modules/cat/cat.c (modified) (1 diff)
-
bdsh/cmds/modules/cp/cp.c (modified) (3 diffs)
-
bdsh/cmds/modules/help/help.c (modified) (3 diffs)
-
bdsh/cmds/modules/kcon/kcon.c (modified) (1 diff)
-
bdsh/cmds/modules/ls/ls.c (modified) (2 diffs)
-
bdsh/cmds/modules/mkdir/mkdir.c (modified) (1 diff)
-
bdsh/cmds/modules/mkfile/mkfile.c (modified) (1 diff)
-
bdsh/cmds/modules/module_aliases.h (modified) (1 diff)
-
bdsh/cmds/modules/modules.h (modified) (1 diff)
-
bdsh/cmds/modules/pwd/pwd.c (modified) (1 diff)
-
bdsh/cmds/modules/rm/rm.c (modified) (1 diff)
-
bdsh/cmds/modules/sleep/sleep.c (modified) (1 diff)
-
bdsh/cmds/modules/touch/touch.c (modified) (1 diff)
-
bdsh/compl.c (added)
-
bdsh/compl.h (added)
-
bdsh/config.h (modified) (2 diffs)
-
bdsh/errors.c (modified) (2 diffs)
-
bdsh/errors.h (modified) (1 diff)
-
bdsh/errstr.h (modified) (1 diff)
-
bdsh/exec.c (modified) (6 diffs)
-
bdsh/exec.h (modified) (1 diff)
-
bdsh/input.c (modified) (7 diffs)
-
bdsh/input.h (modified) (2 diffs)
-
bdsh/scli.c (modified) (4 diffs)
-
bdsh/scli.h (modified) (3 diffs)
-
bdsh/tok.c (added)
-
bdsh/tok.h (added)
-
bdsh/util.c (modified) (2 diffs)
-
bdsh/util.h (modified) (1 diff)
-
blkdump/blkdump.c (modified) (9 diffs)
-
bnchmark/bnchmark.c (modified) (1 diff)
-
devctl/Makefile (moved) (moved from uspace/srv/hw/irc/fhc/Makefile ) (2 diffs)
-
devctl/devctl.c (added)
-
edit/sheet.c (modified) (8 diffs)
-
edit/sheet.h (modified) (2 diffs)
-
ext2info/ext2info.c (modified) (5 diffs)
-
init/init.c (modified) (11 diffs)
-
klog/klog.c (modified) (1 diff)
-
locinfo/Makefile (moved) (moved from uspace/srv/hid/adb_mouse/Makefile ) (2 diffs)
-
locinfo/locinfo.c (moved) (moved from uspace/app/tester/devs/devman1.c ) (2 diffs)
-
lsusb/main.c (modified) (4 diffs)
-
mkbd/main.c (modified) (5 diffs)
-
mkfat/fat.h (modified) (1 diff)
-
mkfat/mkfat.c (modified) (23 diffs)
-
ping/ping.c (modified) (5 diffs)
-
sbi/src/compat.h (modified) (2 diffs)
-
sbi/src/input.c (modified) (2 diffs)
-
sbi/src/list_t.h (modified) (1 diff)
-
sbi/src/os/helenos.c (modified) (2 diffs)
-
sbi/src/os/os.h (modified) (1 diff)
-
sbi/src/os/posix.c (modified) (1 diff)
-
sysinfo/sysinfo.c (modified) (3 diffs)
-
taskdump/elf_core.c (modified) (14 diffs)
-
taskdump/include/elf_core.h (modified) (1 diff)
-
taskdump/include/symtab.h (modified) (1 diff)
-
taskdump/symtab.c (modified) (8 diffs)
-
taskdump/taskdump.c (modified) (4 diffs)
-
tester/Makefile (modified) (2 diffs)
-
tester/devs/devman1.def (deleted)
-
tester/devs/devman2.def (deleted)
-
tester/hw/misc/virtchar1.c (modified) (2 diffs)
-
tester/hw/serial/serial1.c (modified) (1 diff)
-
tester/mm/common.c (modified) (1 diff)
-
tester/print/print2.c (modified) (1 diff)
-
tester/stdio/stdio1.c (modified) (1 diff)
-
tester/tester.c (modified) (1 diff)
-
tester/vfs/vfs1.c (modified) (1 diff)
-
testread/testread.c (modified) (1 diff)
-
top/top.c (modified) (1 diff)
-
trace/ipc_desc.c (modified) (1 diff)
-
trace/ipcp.c (modified) (1 diff)
-
trace/syscalls.c (modified) (2 diffs)
-
trace/trace.c (modified) (5 diffs)
-
usbinfo/Makefile (modified) (3 diffs)
-
usbinfo/dump.c (modified) (1 diff)
-
usbinfo/hid.c (added)
-
usbinfo/main.c (modified) (5 diffs)
-
usbinfo/usbinfo.h (modified) (1 diff)
-
vuhid/Makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/Makefile
rd2c67e7 r8ff0bd2 29 29 30 30 USPACE_PREFIX = ../.. 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) -I. -Icmds/ \ 33 -Icmds/builtins -Icmds/modules 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCLUI_PREFIX)/libclui.a \ 32 $(LIBFMTUTIL_PREFIX)/libfmtutil.a 33 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCLUI_PREFIX) \ 34 -I$(LIBFMTUTIL_PREFIX) -I. -Icmds/ -Icmds/builtins -Icmds/modules 34 35 BINARY = bdsh 35 36 … … 54 55 cmds/mod_cmds.c \ 55 56 cmds/builtin_cmds.c \ 57 compl.c \ 56 58 errors.c \ 57 59 input.c \ 58 60 util.c \ 59 61 exec.c \ 60 scli.c 62 scli.c \ 63 tok.c 61 64 62 65 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/bdsh/cmds/builtin_cmds.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 38 36 #include "cmds.h" 39 37 #include "builtin_aliases.h" 38 #include "scli.h" 40 39 41 40 extern volatile unsigned int cli_interactive; … … 97 96 cmd->help(extended); 98 97 return CL_EOK; 99 } else 98 } else { 100 99 return CL_ENOENT; 100 } 101 101 } 102 102 103 int run_builtin(int builtin, char *argv[], cliuser_t *usr )103 int run_builtin(int builtin, char *argv[], cliuser_t *usr, iostate_t *new_iostate) 104 104 { 105 int rc; 105 106 builtin_t *cmd = builtins; 106 107 107 108 cmd += builtin; 109 110 iostate_t *old_iostate = get_iostate(); 111 set_iostate(new_iostate); 112 113 if (NULL != cmd->entry) { 114 rc = ((int)cmd->entry(argv, usr)); 115 } else { 116 rc = CL_ENOENT; 117 } 118 119 set_iostate(old_iostate); 108 120 109 if (NULL != cmd->entry) 110 return((int)cmd->entry(argv, usr)); 111 112 return CL_ENOENT; 121 return rc; 113 122 } -
uspace/app/bdsh/cmds/builtins/cd/cd.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/cmds/builtins/exit/exit.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/cmds/cmds.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef CMDS_H 2 30 #define CMDS_H … … 59 87 extern char *alias_for_module(const char *); 60 88 extern int help_module(int, unsigned int); 61 extern int run_module(int, char *[] );89 extern int run_module(int, char *[], iostate_t *); 62 90 63 91 /* Prototypes for builtin launchers */ … … 67 95 extern char *alias_for_builtin(const char *); 68 96 extern int help_builtin(int, unsigned int); 69 extern int run_builtin(int, char *[], cliuser_t * );97 extern int run_builtin(int, char *[], cliuser_t *, iostate_t *); 70 98 71 99 #endif -
uspace/app/bdsh/cmds/mod_cmds.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 118 116 mod->help(extended); 119 117 return CL_EOK; 120 } else 118 } else { 121 119 return CL_ENOENT; 120 } 122 121 } 123 122 124 123 /* Invokes the module entry point modules[module], passing argv[] as an argument 125 124 * stack. */ 126 int run_module(int module, char *argv[] )125 int run_module(int module, char *argv[], iostate_t *new_iostate) 127 126 { 127 int rc; 128 128 module_t *mod = modules; 129 129 130 130 mod += module; 131 132 iostate_t *old_iostate = get_iostate(); 133 set_iostate(new_iostate); 131 134 132 if (NULL != mod->entry) 133 return ((int)mod->entry(argv)); 135 if (NULL != mod->entry) { 136 rc = ((int)mod->entry(argv)); 137 } else { 138 rc = CL_ENOENT; 139 } 140 141 set_iostate(old_iostate); 134 142 135 return CL_ENOENT;143 return rc; 136 144 } -
uspace/app/bdsh/cmds/modules/bdd/bdd.c
rd2c67e7 r8ff0bd2 39 39 40 40 #include <libblock.h> 41 #include < devmap.h>41 #include <loc.h> 42 42 #include <errno.h> 43 43 #include <assert.h> … … 69 69 unsigned int argc; 70 70 unsigned int i, j; 71 devmap_handle_t handle;71 service_id_t service_id; 72 72 aoff64_t offset; 73 73 uint8_t *blk; … … 96 96 size = 256; 97 97 98 rc = devmap_device_get_handle(argv[1], &handle, 0);98 rc = loc_service_get_id(argv[1], &service_id, 0); 99 99 if (rc != EOK) { 100 100 printf("%s: Error resolving device `%s'.\n", cmdname, argv[1]); … … 102 102 } 103 103 104 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);104 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 105 105 if (rc != EOK) { 106 106 printf("%s: Error initializing libblock.\n", cmdname); … … 108 108 } 109 109 110 rc = block_get_bsize( handle, &block_size);110 rc = block_get_bsize(service_id, &block_size); 111 111 if (rc != EOK) { 112 112 printf("%s: Error determining device block size.\n", cmdname); … … 117 117 if (blk == NULL) { 118 118 printf("%s: Error allocating memory.\n", cmdname); 119 block_fini( handle);119 block_fini(service_id); 120 120 return CMD_FAILURE; 121 121 } … … 124 124 125 125 while (size > 0) { 126 rc = block_read_direct( handle, ba, 1, blk);126 rc = block_read_direct(service_id, ba, 1, blk); 127 127 if (rc != EOK) { 128 128 printf("%s: Error reading block %" PRIuOFF64 "\n", cmdname, ba); 129 129 free(blk); 130 block_fini( handle);130 block_fini(service_id); 131 131 return CMD_FAILURE; 132 132 } … … 170 170 171 171 free(blk); 172 block_fini( handle);172 block_fini(service_id); 173 173 174 174 return CMD_SUCCESS; -
uspace/app/bdsh/cmds/modules/cat/cat.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * Copyright (c) 2011, Martin Sucha 3 4 * All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions 8 * are met: 7 9 * 8 * Redistributions of source code must retain the above copyright notice, this 9 * list of conditions and the following disclaimer. 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * - The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 10 17 * 11 * Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * Neither the name of the original program's authors nor the names of its 16 * contributors may be used to endorse or promote products derived from this 17 * software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 28 */ 31 29 -
uspace/app/bdsh/cmds/modules/cp/cp.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 73 71 size_t blen, int vb) 74 72 { 75 int fd1, fd2, bytes = 0;76 off64_t total = 0;73 int fd1, fd2, bytes; 74 off64_t total; 77 75 int64_t copied = 0; 78 76 char *buff = NULL; … … 106 104 } 107 105 108 for (;;) { 109 ssize_t res; 110 size_t written = 0; 111 112 bytes = read(fd1, buff, blen); 113 if (bytes <= 0) 106 while ((bytes = read_all(fd1, buff, blen)) > 0) { 107 if ((bytes = write_all(fd2, buff, bytes)) < 0) 114 108 break; 115 109 copied += bytes; 116 res = bytes;117 do {118 /*119 * Theoretically, it may not be enough to call write()120 * only once. Also the previous read() may have121 * returned less data than requested.122 */123 bytes = write(fd2, buff + written, res);124 if (bytes < 0)125 goto err;126 written += bytes;127 res -= bytes;128 } while (res > 0);129 130 /* TODO: re-insert assert() once this is stand alone,131 * removed as abort() exits the entire shell132 */133 if (res != 0) {134 printf("\n%zd more bytes than actually exist were copied\n", res);135 goto err;136 }137 110 } 138 111 139 112 if (bytes < 0) { 140 err:141 113 printf("\nError copying %s, (%d)\n", src, bytes); 142 114 copied = bytes; -
uspace/app/bdsh/cmds/modules/help/help.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 3 * Copyright (c) 2011 Martin Sucha 2 4 * All rights reserved. 3 5 * 4 6 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 7 * modification, are permitted provided that the following conditions 8 * are met: 6 9 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * - The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 9 17 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 28 */ 30 29 … … 32 31 #include <stdlib.h> 33 32 #include <str.h> 33 #include <fmtutil.h> 34 34 35 35 #include "config.h" … … 130 130 static void help_survival(void) 131 131 { 132 printf("Don't panic!\n\n"); 133 134 printf("This is Bdsh, the Brain dead shell, currently " 132 print_wrapped_console( 133 "Don't panic!\n\n" 134 135 "This is Bdsh, the Brain dead shell, currently " 135 136 "the primary user interface to HelenOS. Bdsh allows you to enter " 136 137 "commands and supports history (Up, Down arrow keys), " 137 138 "line editing (Left Arrow, Right Arrow, Home, End, Backspace), " 138 139 "selection (Shift + movement keys), copy and paste (Ctrl-C, " 139 "Ctrl-V), similar to common desktop environments.\n\n" );140 141 printf("The most basic filesystem commands are Bdsh builtins. Type "140 "Ctrl-V), similar to common desktop environments.\n\n" 141 142 "The most basic filesystem commands are Bdsh builtins. Type " 142 143 "'help commands' [Enter] to see the list of Bdsh builtin commands. " 143 144 "Other commands are external executables located in the /app and " 144 145 "/srv directories. Type 'ls /app' [Enter] and 'ls /srv' [Enter] " 145 146 "to see their list. You can execute an external command simply " 146 "by entering its name (e.g. type 'tetris' [Enter]).\n\n" );147 148 printf("HelenOS has virtual consoles (VCs). You can switch between "149 "these using the F1-F11 keys.\n\n" );150 151 printf("This is but a small glimpse of what you can do with HelenOS. "147 "by entering its name (e.g. type 'tetris' [Enter]).\n\n" 148 149 "HelenOS has virtual consoles (VCs). You can switch between " 150 "these using the F1-F11 keys.\n\n" 151 152 "This is but a small glimpse of what you can do with HelenOS. " 152 153 "To learn more please point your browser to the HelenOS User's " 153 "Guide: http://trac.helenos.org/trac.fcgi/wiki/UsersGuide\n\n"); 154 "Guide: http://trac.helenos.org/wiki/UsersGuide\n\n", 155 ALIGN_LEFT); 154 156 } 155 157 -
uspace/app/bdsh/cmds/modules/kcon/kcon.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/cmds/modules/ls/ls.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 171 169 172 170 /* fill the name field */ 173 tosort[nbdirs].name = (char *) malloc(str_ length(dp->d_name) + 1);171 tosort[nbdirs].name = (char *) malloc(str_size(dp->d_name) + 1); 174 172 if (!tosort[nbdirs].name) { 175 173 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); 176 174 goto out; 177 175 } 178 179 str_cpy(tosort[nbdirs].name, str_ length(dp->d_name) + 1, dp->d_name);176 177 str_cpy(tosort[nbdirs].name, str_size(dp->d_name) + 1, dp->d_name); 180 178 len = snprintf(buff, PATH_MAX - 1, "%s/%s", d, tosort[nbdirs].name); 181 179 buff[len] = '\0'; -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 31 28 32 29 #include <stdio.h> -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
rd2c67e7 r8ff0bd2 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 28 30 29 #include <stdio.h> -
uspace/app/bdsh/cmds/modules/module_aliases.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef MODULE_ALIASES_H 2 30 #define MODULE_ALIASES_H -
uspace/app/bdsh/cmds/modules/modules.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef MODULES_H 2 30 #define MODULES_H -
uspace/app/bdsh/cmds/modules/pwd/pwd.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/cmds/modules/rm/rm.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/cmds/modules/sleep/sleep.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/cmds/modules/touch/touch.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 -
uspace/app/bdsh/config.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 /* Various things that are used in many places including a few 2 30 * tidbits left over from autoconf prior to the HelenOS port */ … … 11 39 #define EXIT_FAILURE 1 12 40 #endif 13 14 /* Work around for getenv() */15 #define PATH "/srv:/app"16 #define PATH_DELIM ":"17 41 18 42 /* Used in many places */ -
uspace/app/bdsh/errors.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 38 36 #include "errors.h" 39 37 #include "errstr.h" 38 #include "scli.h" 40 39 41 40 volatile int cli_errno = CL_EOK; -
uspace/app/bdsh/errors.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef ERRORS_H 2 30 #define ERRORS_H -
uspace/app/bdsh/errstr.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef ERRSTR_H 2 30 #define ERRSTR_H -
uspace/app/bdsh/exec.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 42 40 #include <str_error.h> 43 41 #include <errno.h> 42 #include <vfs/vfs.h> 44 43 45 44 #include "config.h" … … 53 52 static char *find_command(char *); 54 53 static int try_access(const char *); 54 55 const char *search_dir[] = { "/app", "/srv", NULL }; 55 56 56 57 /* work-around for access() */ … … 71 72 static char *find_command(char *cmd) 72 73 { 73 char *path_tok; 74 char *path[PATH_MAX]; 75 int n = 0, i = 0; 76 size_t x = str_size(cmd) + 2; 74 size_t i; 77 75 78 76 found = (char *)malloc(PATH_MAX); … … 83 81 } 84 82 85 path_tok = str_dup(PATH);86 87 /* Extract the PATH env to a path[] array */88 path[n] = strtok(path_tok, PATH_DELIM);89 while (NULL != path[n]) {90 if ((str_size(path[n]) + x ) > PATH_MAX) {91 cli_error(CL_ENOTSUP,92 "Segment %d of path is too large, search ends at segment %d",93 n, n-1);94 break;95 }96 path[++n] = strtok(NULL, PATH_DELIM);97 }98 99 83 /* We now have n places to look for the command */ 100 for (i =0; path[i]; i++) {84 for (i = 0; search_dir[i] != NULL; i++) { 101 85 memset(found, 0, sizeof(found)); 102 snprintf(found, PATH_MAX, "%s/%s", path[i], cmd);86 snprintf(found, PATH_MAX, "%s/%s", search_dir[i], cmd); 103 87 if (-1 != try_access(found)) { 104 free(path_tok);105 88 return (char *) found; 106 89 } … … 108 91 109 92 /* We didn't find it, just give it back as-is. */ 110 free(path_tok);111 93 return (char *) cmd; 112 94 } 113 95 114 unsigned int try_exec(char *cmd, char **argv )96 unsigned int try_exec(char *cmd, char **argv, iostate_t *io) 115 97 { 116 98 task_id_t tid; 117 99 task_exit_t texit; 118 100 char *tmp; 119 int rc, retval; 101 int rc, retval, i; 102 int file_handles[3]; 103 int *file_handles_p[4]; 104 FILE *files[3]; 120 105 121 106 tmp = str_dup(find_command(cmd)); 122 107 free(found); 108 109 files[0] = io->stdin; 110 files[1] = io->stdout; 111 files[2] = io->stderr; 112 113 for (i = 0; i < 3 && files[i] != NULL; i++) { 114 if (fhandle(files[i], &file_handles[i]) == EOK) { 115 file_handles_p[i] = &file_handles[i]; 116 } 117 else { 118 file_handles_p[i] = NULL; 119 } 120 } 121 file_handles_p[i] = NULL; 123 122 124 rc = task_spawnv (&tid, tmp, (const char **) argv);123 rc = task_spawnvf(&tid, tmp, (const char **) argv, file_handles_p); 125 124 free(tmp); 126 125 -
uspace/app/bdsh/exec.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef EXEC_H 2 30 #define EXEC_H 3 31 4 32 #include <task.h> 33 #include "scli.h" 5 34 6 extern unsigned int try_exec(char *, char **); 35 extern const char *search_dir[]; 36 37 extern unsigned int try_exec(char *, char **, iostate_t *); 7 38 8 39 #endif -
uspace/app/bdsh/input.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 3 * Copyright (c) 2011 Jiri Svoboda 4 * Copyright (c) 2011 Martin Sucha 2 5 * All rights reserved. 3 6 * 4 7 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 8 * modification, are permitted provided that the following conditions 9 * are met: 6 10 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 11 * - Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * - Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * - The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 9 18 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 29 */ 30 30 … … 45 45 46 46 #include "config.h" 47 #include "compl.h" 47 48 #include "util.h" 48 49 #include "scli.h" … … 50 51 #include "errors.h" 51 52 #include "exec.h" 53 #include "tok.h" 52 54 53 55 extern volatile unsigned int cli_quit; … … 55 57 /** Text input field. */ 56 58 static tinput_t *tinput; 59 60 /* Private helpers */ 61 static int run_command(char **, cliuser_t *, iostate_t *); 62 static void print_pipe_usage(void); 57 63 58 64 /* Tokenizes input from console, sees if the first word is a built-in, if so 59 65 * invokes the built-in entry point (a[0]) passing all arguments in a[] to 60 66 * the handler */ 61 int tok_input(cliuser_t *usr) 62 { 67 int process_input(cliuser_t *usr) 68 { 69 token_t *tokens = calloc(WORD_MAX, sizeof(token_t)); 70 if (tokens == NULL) 71 return ENOMEM; 72 63 73 char *cmd[WORD_MAX]; 64 int n = 0, i = 0;65 74 int rc = 0; 66 char *tmp; 67 68 if (NULL == usr->line) 75 tokenizer_t tok; 76 unsigned int i, pipe_count, processed_pipes; 77 unsigned int pipe_pos[2]; 78 char *redir_from = NULL; 79 char *redir_to = NULL; 80 81 if (usr->line == NULL) { 82 free(tokens); 69 83 return CL_EFAIL; 70 71 tmp = str_dup(usr->line); 72 73 cmd[n] = strtok(tmp, " "); 74 while (cmd[n] && n < WORD_MAX) { 75 cmd[++n] = strtok(NULL, " "); 76 } 77 78 /* We have rubbish */ 79 if (NULL == cmd[0]) { 80 rc = CL_ENOENT; 81 goto finit; 82 } 83 84 /* Its a builtin command ? */ 85 if ((i = (is_builtin(cmd[0]))) > -1) { 86 rc = run_builtin(i, cmd, usr); 87 goto finit; 88 /* Its a module ? */ 89 } else if ((i = (is_module(cmd[0]))) > -1) { 90 rc = run_module(i, cmd); 91 goto finit; 92 } 93 94 /* See what try_exec thinks of it */ 95 rc = try_exec(cmd[0], cmd); 96 84 } 85 86 rc = tok_init(&tok, usr->line, tokens, WORD_MAX); 87 if (rc != EOK) { 88 goto finit; 89 } 90 91 size_t tokens_length; 92 rc = tok_tokenize(&tok, &tokens_length); 93 if (rc != EOK) { 94 goto finit; 95 } 96 97 if (tokens_length > 0 && tokens[0].type == TOKTYPE_SPACE) { 98 tokens++; 99 tokens_length--; 100 } 101 102 if (tokens_length > 0 && tokens[tokens_length-1].type == TOKTYPE_SPACE) { 103 tokens_length--; 104 } 105 106 /* Until full support for pipes is implemented, allow for a simple case: 107 * [from <file> |] command [| to <file>] 108 * 109 * First find the pipes and check that there are no more 110 */ 111 for (i = 0, pipe_count = 0; i < tokens_length; i++) { 112 if (tokens[i].type == TOKTYPE_PIPE) { 113 if (pipe_count >= 2) { 114 print_pipe_usage(); 115 rc = ENOTSUP; 116 goto finit; 117 } 118 pipe_pos[pipe_count] = i; 119 pipe_count++; 120 } 121 } 122 123 unsigned int cmd_token_start = 0; 124 unsigned int cmd_token_end = tokens_length; 125 126 processed_pipes = 0; 127 128 /* Check if the first part (from <file> |) is present */ 129 if (pipe_count > 0 && (pipe_pos[0] == 3 || pipe_pos[0] == 4) && str_cmp(tokens[0].text, "from") == 0) { 130 /* Ignore the first three tokens (from, file, pipe) and set from */ 131 redir_from = tokens[2].text; 132 cmd_token_start = pipe_pos[0]+1; 133 processed_pipes++; 134 } 135 136 /* Check if the second part (| to <file>) is present */ 137 if ((pipe_count - processed_pipes) > 0 && 138 (pipe_pos[processed_pipes] == tokens_length - 4 || 139 (pipe_pos[processed_pipes] == tokens_length - 5 && 140 tokens[tokens_length-4].type == TOKTYPE_SPACE )) && 141 str_cmp(tokens[tokens_length-3].text, "to") == 0) { 142 /* Ignore the last three tokens (pipe, to, file) and set to */ 143 redir_to = tokens[tokens_length-1].text; 144 cmd_token_end = pipe_pos[processed_pipes]; 145 processed_pipes++; 146 } 147 148 if (processed_pipes != pipe_count) { 149 print_pipe_usage(); 150 rc = ENOTSUP; 151 goto finit; 152 } 153 154 /* Convert tokens of the command to string array */ 155 unsigned int cmd_pos = 0; 156 for (i = cmd_token_start; i < cmd_token_end; i++) { 157 if (tokens[i].type != TOKTYPE_SPACE) { 158 cmd[cmd_pos++] = tokens[i].text; 159 } 160 } 161 cmd[cmd_pos++] = NULL; 162 163 if (cmd[0] == NULL) { 164 print_pipe_usage(); 165 rc = ENOTSUP; 166 goto finit; 167 } 168 169 iostate_t new_iostate = { 170 .stdin = stdin, 171 .stdout = stdout, 172 .stderr = stderr 173 }; 174 175 FILE *from = NULL; 176 FILE *to = NULL; 177 178 if (redir_from) { 179 from = fopen(redir_from, "r"); 180 if (from == NULL) { 181 printf("Cannot open file %s\n", redir_from); 182 rc = errno; 183 goto finit_with_files; 184 } 185 new_iostate.stdin = from; 186 } 187 188 189 if (redir_to) { 190 to = fopen(redir_to, "w"); 191 if (to == NULL) { 192 printf("Cannot open file %s\n", redir_to); 193 rc = errno; 194 goto finit_with_files; 195 } 196 new_iostate.stdout = to; 197 } 198 199 rc = run_command(cmd, usr, &new_iostate); 200 201 finit_with_files: 202 if (from != NULL) { 203 fclose(from); 204 } 205 if (to != NULL) { 206 fclose(to); 207 } 208 97 209 finit: 98 210 if (NULL != usr->line) { … … 100 212 usr->line = (char *) NULL; 101 213 } 102 if (NULL != tmp)103 free(tmp);214 tok_fini(&tok); 215 free(tokens); 104 216 105 217 return rc; 218 } 219 220 void print_pipe_usage() 221 { 222 printf("Invalid syntax!\n"); 223 printf("Usage of redirection (pipes in the future):\n"); 224 printf("from filename | command ...\n"); 225 printf("from filename | command ... | to filename\n"); 226 printf("command ... | to filename\n"); 227 228 } 229 230 int run_command(char **cmd, cliuser_t *usr, iostate_t *new_iostate) 231 { 232 int id = 0; 233 234 /* We have rubbish */ 235 if (NULL == cmd[0]) { 236 return CL_ENOENT; 237 } 238 239 /* Is it a builtin command ? */ 240 if ((id = (is_builtin(cmd[0]))) > -1) { 241 return run_builtin(id, cmd, usr, new_iostate); 242 } 243 244 /* Is it a module ? */ 245 if ((id = (is_module(cmd[0]))) > -1) { 246 return run_module(id, cmd, new_iostate); 247 } 248 249 /* See what try_exec thinks of it */ 250 return try_exec(cmd[0], cmd, new_iostate); 106 251 } 107 252 … … 111 256 int rc; 112 257 113 console_flush(tinput->console); 114 console_set_style(tinput->console, STYLE_EMPHASIS); 115 printf("%s", usr->prompt); 116 console_flush(tinput->console); 117 console_set_style(tinput->console, STYLE_NORMAL); 258 tinput_set_prompt(tinput, usr->prompt); 118 259 119 260 rc = tinput_read(tinput, &str); … … 148 289 } 149 290 291 tinput_set_compl_ops(tinput, &compl_ops); 292 150 293 return 0; 151 294 } -
uspace/app/bdsh/input.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef INPUT_H 2 30 #define INPUT_H … … 7 35 8 36 extern void get_input(cliuser_t *); 9 extern int tok_input(cliuser_t *);37 extern int process_input(cliuser_t *); 10 38 extern int input_init(void); 11 39 -
uspace/app/bdsh/scli.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> 1 /* 2 * Copyright (c) 2008 Tim Post 2 3 * All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 6 8 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 9 16 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the original program's authors nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 27 */ 30 28 … … 42 40 /* See scli.h */ 43 41 static cliuser_t usr; 42 static iostate_t *iostate; 43 static iostate_t stdiostate; 44 44 45 45 /* Globals that are modified during start-up that modules/builtins … … 82 82 } 83 83 84 iostate_t *get_iostate(void) 85 { 86 return iostate; 87 } 88 89 90 void set_iostate(iostate_t *ios) 91 { 92 iostate = ios; 93 stdin = ios->stdin; 94 stdout = ios->stdout; 95 stderr = ios->stderr; 96 } 97 84 98 int main(int argc, char *argv[]) 85 99 { 86 100 int ret = 0; 101 102 stdiostate.stdin = stdin; 103 stdiostate.stdout = stdout; 104 stdiostate.stderr = stderr; 105 iostate = &stdiostate; 87 106 88 107 if (cli_init(&usr)) … … 92 111 get_input(&usr); 93 112 if (NULL != usr.line) { 94 ret = tok_input(&usr);113 ret = process_input(&usr); 95 114 cli_set_prompt(&usr); 96 115 usr.lasterr = ret; -
uspace/app/bdsh/scli.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef SCLI_H 2 30 #define SCLI_H … … 4 32 #include "config.h" 5 33 #include <stdint.h> 34 #include <stdio.h> 6 35 7 36 typedef struct { … … 13 42 } cliuser_t; 14 43 44 typedef struct { 45 FILE *stdin; 46 FILE *stdout; 47 FILE *stderr; 48 } iostate_t; 49 15 50 extern const char *progname; 16 51 52 extern iostate_t *get_iostate(void); 53 extern void set_iostate(iostate_t *); 54 17 55 #endif -
uspace/app/bdsh/util.c
rd2c67e7 r8ff0bd2 1 /* Copyright (c) 2008, Tim Post <tinkertim@gmail.com> - All rights reserved 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 2 4 * 3 5 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions 7 * are met: 5 8 * 6 * Redistributions of source code must retain the above copyright notice, this 7 * list of conditions and the following disclaimer. 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 8 16 * 9 * Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 * and/or other materials provided with the distribution. 12 * 13 * Neither the name of the original program's authors nor the names of its 14 * contributors may be used to endorse or promote products derived from this 15 * software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 27 */ 29 28 … … 69 68 return 0; 70 69 } 71 72 -
uspace/app/bdsh/util.h
rd2c67e7 r8ff0bd2 1 /* 2 * Copyright (c) 2008 Tim Post 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * - Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * - Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * - The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 1 29 #ifndef UTIL_H 2 30 #define UTIL_H -
uspace/app/blkdump/blkdump.c
rd2c67e7 r8ff0bd2 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 59 59 int rc; 60 60 char *dev_path; 61 devmap_handle_t handle;61 service_id_t service_id; 62 62 size_t block_size; 63 63 char *endptr; … … 128 128 dev_path = *argv; 129 129 130 rc = devmap_device_get_handle(dev_path, &handle, 0);130 rc = loc_service_get_id(dev_path, &service_id, 0); 131 131 if (rc != EOK) { 132 132 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 134 134 } 135 135 136 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);136 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 137 137 if (rc != EOK) { 138 138 printf(NAME ": Error initializing libblock.\n"); … … 140 140 } 141 141 142 rc = block_get_bsize( handle, &block_size);142 rc = block_get_bsize(service_id, &block_size); 143 143 if (rc != EOK) { 144 144 printf(NAME ": Error determining device block size.\n"); … … 146 146 } 147 147 148 rc = block_get_nblocks( handle, &dev_nblocks);148 rc = block_get_nblocks(service_id, &dev_nblocks); 149 149 if (rc != EOK) { 150 150 printf(NAME ": Warning, failed to obtain block device size.\n"); … … 156 156 if (data == NULL) { 157 157 printf(NAME ": Error allocating data buffer of %" PRIuOFF64 " bytes", (aoff64_t) block_size); 158 block_fini( handle);158 block_fini(service_id); 159 159 return 3; 160 160 } … … 162 162 limit = block_offset + block_count; 163 163 for (current = block_offset; current < limit; current++) { 164 rc = block_read_direct( handle, current, 1, data);164 rc = block_read_direct(service_id, current, 1, data); 165 165 if (rc != EOK) { 166 166 printf(NAME ": Error reading block at %" PRIuOFF64 " \n", current); … … 186 186 free(data); 187 187 188 block_fini( handle);188 block_fini(service_id); 189 189 190 190 return 0; -
uspace/app/bnchmark/bnchmark.c
rd2c67e7 r8ff0bd2 41 41 #include <stdlib.h> 42 42 #include <mem.h> 43 #include < devmap.h>43 #include <loc.h> 44 44 #include <byteorder.h> 45 45 #include <sys/types.h> -
uspace/app/devctl/Makefile
rd2c67e7 r8ff0bd2 1 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 2 # Copyright (c) 2011 Jiri Svoboda 4 3 # All rights reserved. 5 4 # … … 28 27 # 29 28 30 USPACE_PREFIX = ../.. /../..31 BINARY = fhc29 USPACE_PREFIX = ../.. 30 BINARY = devctl 32 31 33 32 SOURCES = \ 34 fhc.c33 devctl.c 35 34 36 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/edit/sheet.c
rd2c67e7 r8ff0bd2 75 75 return ENOMEM; 76 76 77 list_initialize(&sh->tags _head);77 list_initialize(&sh->tags); 78 78 79 79 return EOK; … … 97 97 char *ipp; 98 98 size_t sz; 99 link_t *link;100 99 tag_t *tag; 101 100 char *newp; … … 121 120 /* Adjust tags. */ 122 121 123 link = sh->tags_head.next; 124 while (link != &sh->tags_head) { 122 list_foreach(sh->tags, link) { 125 123 tag = list_get_instance(link, tag_t, link); 126 124 … … 129 127 else if (tag->b_off == pos->b_off && dir == dir_before) 130 128 tag->b_off += sz; 131 132 link = link->next;133 129 } 134 130 … … 150 146 char *spp; 151 147 size_t sz; 152 link_t *link;153 148 tag_t *tag; 154 149 char *newp; … … 162 157 163 158 /* Adjust tags. */ 164 link = sh->tags_head.next; 165 while (link != &sh->tags_head) { 159 list_foreach(sh->tags, link) { 166 160 tag = list_get_instance(link, tag_t, link); 167 161 … … 170 164 else if (tag->b_off >= spos->b_off) 171 165 tag->b_off = spos->b_off; 172 173 link = link->next;174 166 } 175 167 … … 328 320 tag->b_off = pt->b_off; 329 321 tag->sh = sh; 330 list_append(&tag->link, &sh->tags _head);322 list_append(&tag->link, &sh->tags); 331 323 } 332 324 -
uspace/app/edit/sheet.h
rd2c67e7 r8ff0bd2 57 57 char *data; 58 58 59 li nk_t tags_head;59 list_t tags; 60 60 } sheet_t; 61 61 … … 91 91 /* Note: This structure is opaque for the user. */ 92 92 93 /** Link to list of all tags in the sheet (see sheet_t.tags _head) */93 /** Link to list of all tags in the sheet (see sheet_t.tags) */ 94 94 link_t link; 95 95 sheet_t *sh; -
uspace/app/ext2info/ext2info.c
rd2c67e7 r8ff0bd2 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 81 81 char *endptr; 82 82 char *dev_path; 83 devmap_handle_t handle;83 service_id_t service_id; 84 84 ext2_filesystem_t filesystem; 85 85 int arg_flags; … … 178 178 dev_path = *argv; 179 179 180 rc = devmap_device_get_handle(dev_path, &handle, 0);180 rc = loc_service_get_id(dev_path, &service_id, 0); 181 181 if (rc != EOK) { 182 182 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 184 184 } 185 185 186 rc = ext2_filesystem_init(&filesystem, handle);186 rc = ext2_filesystem_init(&filesystem, service_id); 187 187 if (rc != EOK) { 188 188 printf(NAME ": Error initializing libext2.\n"); … … 590 590 printf(" Directory contents:\n"); 591 591 592 rc = ext2_directory_iterator_init(&it, fs, inode_ref );592 rc = ext2_directory_iterator_init(&it, fs, inode_ref, 0); 593 593 if (rc != EOK) { 594 594 printf("Failed initializing directory iterator\n"); -
uspace/app/init/init.c
rd2c67e7 r8ff0bd2 46 46 #include <macros.h> 47 47 #include <str.h> 48 #include < devmap.h>48 #include <loc.h> 49 49 #include <str_error.h> 50 50 #include "init.h" … … 53 53 #define ROOT_MOUNT_POINT "/" 54 54 55 #define DEVFS_FS_TYPE "devfs"56 #define DEVFS_MOUNT_POINT "/dev"55 #define LOCFS_FS_TYPE "locfs" 56 #define LOCFS_MOUNT_POINT "/loc" 57 57 58 58 #define TMPFS_FS_TYPE "tmpfs" … … 66 66 #define APP_GETTERM "/app/getterm" 67 67 68 /** Print banner */ 68 69 static void info_print(void) 69 70 { … … 71 72 } 72 73 74 /** Report mount operation success */ 73 75 static bool mount_report(const char *desc, const char *mntpt, 74 76 const char *fstype, const char *dev, int rc) … … 100 102 } 101 103 104 /** Mount root filesystem 105 * 106 * The operation blocks until the root filesystem 107 * server is ready for mounting. 108 * 109 * @param[in] fstype Root filesystem type. 110 * 111 * @return True on success. 112 * @return False on failure. 113 * 114 */ 102 115 static bool mount_root(const char *fstype) 103 116 { … … 113 126 } 114 127 115 static bool mount_devfs(void) 116 { 117 int rc = mount(DEVFS_FS_TYPE, DEVFS_MOUNT_POINT, "", "", 128 /** Mount locfs filesystem 129 * 130 * The operation blocks until the locfs filesystem 131 * server is ready for mounting. 132 * 133 * @return True on success. 134 * @return False on failure. 135 * 136 */ 137 static bool mount_locfs(void) 138 { 139 int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "", 118 140 IPC_FLAG_BLOCKING); 119 return mount_report(" Device filesystem", DEVFS_MOUNT_POINT, DEVFS_FS_TYPE,120 NULL, rc);141 return mount_report("Location service filesystem", LOCFS_MOUNT_POINT, 142 LOCFS_FS_TYPE, NULL, rc); 121 143 } 122 144 … … 157 179 rc = task_wait(id, &texit, &retval); 158 180 if (rc != EOK) { 159 printf("%s: Error waiting for %s (%s (\n", NAME, fname,181 printf("%s: Error waiting for %s (%s)\n", NAME, fname, 160 182 str_error(rc)); 161 183 return; … … 174 196 } 175 197 176 static void console(const char * dev)177 { 178 printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, dev);179 180 /* Wait for the input device to be ready */181 devmap_handle_t handle;182 int rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);183 if (rc != EOK) { 184 printf("%s: Error waiting on %s (%s)\n", NAME, dev,185 str_error(rc)); 186 return; 187 } 188 189 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, dev, NULL);198 static void console(const char *svc) 199 { 200 printf("%s: Spawning %s %s\n", NAME, SRV_CONSOLE, svc); 201 202 /* Wait for the input service to be ready */ 203 service_id_t service_id; 204 int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 205 if (rc != EOK) { 206 printf("%s: Error waiting on %s (%s)\n", NAME, svc, 207 str_error(rc)); 208 return; 209 } 210 211 rc = task_spawnl(NULL, SRV_CONSOLE, SRV_CONSOLE, svc, NULL); 190 212 if (rc != EOK) { 191 213 printf("%s: Error spawning %s %s (%s)\n", NAME, SRV_CONSOLE, 192 dev, str_error(rc));193 } 194 } 195 196 static void getterm(const char * dev, const char *app, bool wmsg)197 { 198 char term[ DEVMAP_NAME_MAXLEN];214 svc, str_error(rc)); 215 } 216 } 217 218 static void getterm(const char *svc, const char *app, bool wmsg) 219 { 220 char term[LOC_NAME_MAXLEN]; 199 221 int rc; 200 222 201 snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);223 snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc); 202 224 203 225 printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app); 204 226 205 /* Wait for the terminal device to be ready */206 devmap_handle_t handle;207 rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);227 /* Wait for the terminal service to be ready */ 228 service_id_t service_id; 229 rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING); 208 230 if (rc != EOK) { 209 231 printf("%s: Error waiting on %s (%s)\n", NAME, term, … … 257 279 } 258 280 259 spawn("/srv/ devfs");281 spawn("/srv/locfs"); 260 282 spawn("/srv/taskmon"); 261 283 262 if (!mount_ devfs()) {284 if (!mount_locfs()) { 263 285 printf("%s: Exiting\n", NAME); 264 286 return -2; … … 270 292 spawn("/srv/apic"); 271 293 spawn("/srv/i8259"); 272 spawn("/srv/fhc");273 294 spawn("/srv/obio"); 274 295 srv_start("/srv/cuda_adb"); 275 296 srv_start("/srv/i8042"); 276 297 srv_start("/srv/s3c24ser"); 277 srv_start("/srv/adb_ms");278 srv_start("/srv/char_ms");279 298 srv_start("/srv/s3c24ts"); 280 299 281 300 spawn("/srv/fb"); 282 spawn("/srv/ kbd");283 console("hid _in/kbd");301 spawn("/srv/input"); 302 console("hid/input"); 284 303 285 304 spawn("/srv/clip"); … … 297 316 298 317 #ifdef CONFIG_MOUNT_DATA 318 /* Make sure fat is running. */ 319 if (str_cmp(STRING(RDFMT), "fat") != 0) { 320 srv_start("/srv/fat"); 321 } 299 322 mount_data(); 300 323 #else -
uspace/app/klog/klog.c
rd2c67e7 r8ff0bd2 143 143 * Receives kernel klog notifications. 144 144 * 145 * @param callid IPC call ID. 146 * @param call IPC call structure. 145 * @param callid IPC call ID 146 * @param call IPC call structure 147 * @param arg Local argument 147 148 * 148 149 */ -
uspace/app/locinfo/Makefile
rd2c67e7 r8ff0bd2 1 1 # 2 # Copyright (c) 201 0Jiri Svoboda2 # Copyright (c) 2011 Jiri Svoboda 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 USPACE_PREFIX = ../.. /..29 USPACE_PREFIX = ../.. 30 30 EXTRA_CFLAGS = -Iinclude 31 BINARY = adb_ms31 BINARY = locinfo 32 32 33 33 SOURCES = \ 34 adb_mouse.c \ 35 adb_dev.c 34 locinfo.c 36 35 37 36 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/locinfo/locinfo.c
rd2c67e7 r8ff0bd2 1 1 /* 2 * Copyright (c) 2011 Vojtech Horky2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup tester 30 * @brief Test devman service. 29 /** @addtogroup locinfo 31 30 * @{ 32 31 */ 33 /** 34 * @file 32 /** @file locinfo.c Print information from location service. 35 33 */ 36 34 37 #include <inttypes.h>38 35 #include <errno.h> 39 #include <str_error.h> 36 #include <loc.h> 37 #include <stdio.h> 38 #include <stdlib.h> 39 #include <str.h> 40 40 #include <sys/types.h> 41 #include <async.h> 42 #include <devman.h> 43 #include <str.h> 44 #include <vfs/vfs.h> 45 #include <sys/stat.h> 46 #include <fcntl.h> 47 #include "../tester.h" 41 #include <sys/typefmt.h> 48 42 49 #define DEVICE_PATH_NORMAL "/virt/null/a" 50 #define DEVICE_CLASS "virt-null" 51 #define DEVICE_CLASS_NAME "1" 52 #define DEVICE_PATH_CLASSES DEVICE_CLASS "/" DEVICE_CLASS_NAME 43 #define NAME "locinfo" 53 44 54 const char *test_devman1(void)45 int main(int argc, char *argv[]) 55 46 { 56 devman_handle_t handle_primary; 57 devman_handle_t handle_class; 58 47 category_id_t *cat_ids; 48 size_t cat_cnt; 49 service_id_t *svc_ids; 50 size_t svc_cnt; 51 52 size_t i, j; 53 char *cat_name; 54 char *svc_name; 59 55 int rc; 60 61 TPRINTF("Asking for handle of `%s'...\n", DEVICE_PATH_NORMAL); 62 rc = devman_device_get_handle(DEVICE_PATH_NORMAL, &handle_primary, 0); 56 57 rc = loc_get_categories(&cat_ids, &cat_cnt); 63 58 if (rc != EOK) { 64 TPRINTF(" ...failed: %s.\n", str_error(rc)); 65 if (rc == ENOENT) { 66 TPRINTF("Have you compiled the test drivers?\n"); 67 } 68 return "Failed getting device handle"; 59 printf(NAME ": Error getting list of categories.\n"); 60 return 1; 69 61 } 70 62 71 TPRINTF("Asking for handle of `%s' by class..\n", DEVICE_PATH_CLASSES); 72 rc = devman_device_get_handle_by_class(DEVICE_CLASS, DEVICE_CLASS_NAME, 73 &handle_class, 0); 74 if (rc != EOK) { 75 TPRINTF(" ...failed: %s.\n", str_error(rc)); 76 return "Failed getting device class handle"; 63 for (i = 0; i < cat_cnt; i++) { 64 rc = loc_category_get_name(cat_ids[i], &cat_name); 65 if (rc != EOK) 66 cat_name = str_dup("<unknown>"); 67 68 if (cat_name == NULL) { 69 printf(NAME ": Error allocating memory.\n"); 70 return 1; 71 } 72 73 printf("%s (%" PRIun "):\n", cat_name, cat_ids[i]); 74 75 rc = loc_category_get_svcs(cat_ids[i], &svc_ids, &svc_cnt); 76 if (rc != EOK) { 77 printf(NAME ": Failed getting list of services in " 78 "category %s, skipping.\n", cat_name); 79 free(cat_name); 80 continue; 81 } 82 83 for (j = 0; j < svc_cnt; j++) { 84 rc = loc_service_get_name(svc_ids[j], &svc_name); 85 if (rc != EOK) { 86 printf(NAME ": Unknown service name (SID %" 87 PRIun ").\n", svc_ids[j]); 88 continue; 89 } 90 printf("\t%s (%" PRIun ")\n", svc_name, svc_ids[j]); 91 } 92 93 free(svc_ids); 94 free(cat_name); 77 95 } 78 96 79 TPRINTF("Received handles %" PRIun " and %" PRIun ".\n", 80 handle_primary, handle_class); 81 if (handle_primary != handle_class) { 82 return "Retrieved different handles for the same device"; 83 } 84 85 return NULL; 97 free(cat_ids); 98 return 0; 86 99 } 87 100 -
uspace/app/lsusb/main.c
rd2c67e7 r8ff0bd2 43 43 #include <getopt.h> 44 44 #include <devman.h> 45 #include < devmap.h>45 #include <loc.h> 46 46 #include <usb/dev/hub.h> 47 47 #include <usb/hc.h> … … 50 50 51 51 #define MAX_USB_ADDRESS USB11_ADDRESS_MAX 52 #define MAX_FAILED_ATTEMPTS 1053 52 #define MAX_PATH_LENGTH 1024 54 53 55 static void print_found_hc(s ize_t class_index, const char *path)54 static void print_found_hc(service_id_t sid, const char *path) 56 55 { 57 // printf(NAME ": host controller %zu is `%s'.\n", class_index, path); 58 printf("Bus %02zu: %s\n", class_index, path); 56 printf("Bus %" PRIun ": %s\n", sid, path); 59 57 } 60 58 static void print_found_dev(usb_address_t addr, const char *path) 61 59 { 62 // printf(NAME ": device with address %d is `%s'.\n", addr, path);63 60 printf(" Device %02d: %s\n", addr, path); 64 61 } … … 84 81 } 85 82 char path[MAX_PATH_LENGTH]; 86 rc = devman_ get_device_path(dev_handle, path, MAX_PATH_LENGTH);83 rc = devman_fun_get_path(dev_handle, path, MAX_PATH_LENGTH); 87 84 if (rc != EOK) { 88 85 continue; … … 95 92 int main(int argc, char *argv[]) 96 93 { 97 size_t class_index = 0; 98 size_t failed_attempts = 0; 94 category_id_t usbhc_cat; 95 service_id_t *svcs; 96 size_t count; 97 size_t i; 98 int rc; 99 99 100 while (failed_attempts < MAX_FAILED_ATTEMPTS) { 101 class_index++; 100 rc = loc_category_get_id(USB_HC_CATEGORY, &usbhc_cat, 0); 101 if (rc != EOK) { 102 printf(NAME ": Error resolving category '%s'", 103 USB_HC_CATEGORY); 104 return 1; 105 } 106 107 rc = loc_category_get_svcs(usbhc_cat, &svcs, &count); 108 if (rc != EOK) { 109 printf(NAME ": Error getting list of host controllers.\n"); 110 return 1; 111 } 112 113 for (i = 0; i < count; i++) { 102 114 devman_handle_t hc_handle = 0; 103 int rc = usb_ddf_get_hc_handle_by_ class(class_index, &hc_handle);115 int rc = usb_ddf_get_hc_handle_by_sid(svcs[i], &hc_handle); 104 116 if (rc != EOK) { 105 failed_attempts++; 117 printf(NAME ": Error resolving handle of HC with SID %" 118 PRIun ", skipping.\n", svcs[i]); 106 119 continue; 107 120 } 108 121 char path[MAX_PATH_LENGTH]; 109 rc = devman_ get_device_path(hc_handle, path, MAX_PATH_LENGTH);122 rc = devman_fun_get_path(hc_handle, path, MAX_PATH_LENGTH); 110 123 if (rc != EOK) { 124 printf(NAME ": Error resolving path of HC with SID %" 125 PRIun ", skipping.\n", svcs[i]); 111 126 continue; 112 127 } 113 print_found_hc( class_index, path);128 print_found_hc(svcs[i], path); 114 129 print_hc_devices(hc_handle); 115 130 } 131 132 free(svcs); 116 133 117 134 return 0; -
uspace/app/mkbd/main.c
rd2c67e7 r8ff0bd2 43 43 #include <getopt.h> 44 44 #include <devman.h> 45 #include < devmap.h>45 #include <loc.h> 46 46 #include <usb/dev/hub.h> 47 47 #include <usb/hid/iface.h> … … 52 52 #include <usb/hid/hiddescriptor.h> 53 53 #include <usb/hid/usages/consumer.h> 54 #include <io/console.h> 55 #include <io/keycode.h> 54 56 #include <assert.h> 55 57 … … 166 168 167 169 usb_hid_report_path_free(path); 170 } 171 172 static int wait_for_quit_fibril(void *arg) 173 { 174 console_ctrl_t *con = console_init(stdin, stdout); 175 176 printf("Press <ESC> to quit the application.\n"); 177 178 while (1) { 179 kbd_event_t ev; 180 bool ok = console_get_kbd_event(con, &ev); 181 if (!ok) { 182 printf("Connection with console broken: %s.\n", 183 str_error(errno)); 184 break; 185 } 186 187 if (ev.key == KC_ESCAPE) { 188 break; 189 } 190 } 191 192 console_done(con); 193 194 exit(0); 195 196 return EOK; 168 197 } 169 198 … … 211 240 212 241 char path[MAX_PATH_LENGTH]; 213 rc = devman_ get_device_path(dev_handle, path, MAX_PATH_LENGTH);242 rc = devman_fun_get_path(dev_handle, path, MAX_PATH_LENGTH); 214 243 if (rc != EOK) { 215 244 return ENOMEM; … … 242 271 } 243 272 273 fid_t quit_fibril = fibril_create(wait_for_quit_fibril, NULL); 274 if (quit_fibril == 0) { 275 printf("Failed to start extra fibril.\n"); 276 return -1; 277 } 278 fibril_add_ready(quit_fibril); 279 244 280 size_t actual_size; 245 281 int event_nr; -
uspace/app/mkfat/fat.h
rd2c67e7 r8ff0bd2 38 38 #define BS_BLOCK 0 39 39 #define BS_SIZE 512 40 #define DIRENT_SIZE 32 40 41 41 #define DIRENT_SIZE 32 42 #define FAT12_CLST_MAX 4085 43 #define FAT16_CLST_MAX 65525 44 45 #define FAT12 12 46 #define FAT16 16 47 #define FAT32 32 48 49 #define FAT_CLUSTER_DOUBLE_SIZE(a) ((a) / 4) 42 50 43 51 typedef struct fat_bs { -
uspace/app/mkfat/mkfat.c
rd2c67e7 r8ff0bd2 35 35 * @brief Tool for creating new FAT file systems. 36 36 * 37 * Currently we can only create 16-bit FAT.37 * Currently we can create 12/16/32-bit FAT. 38 38 */ 39 39 … … 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 55 55 #define div_round_up(a, b) (((a) + (b) - 1) / (b)) 56 56 57 /** Predefinedfile-system parameters */57 /** Default file-system parameters */ 58 58 enum { 59 sector_size = 512,60 sectors_per_cluster = 8,61 fat_count = 2,62 reserved_clusters = 2,63 media_descriptor = 0xF8 /**< fixed disk */59 default_sector_size = 512, 60 default_sectors_per_cluster = 4, 61 default_fat_count = 2, 62 default_reserved_clusters = 2, 63 default_media_descriptor = 0xF8 /**< fixed disk */ 64 64 }; 65 65 66 66 /** Configurable file-system parameters */ 67 67 typedef struct fat_cfg { 68 int fat_type; /* FAT12 = 12, FAT16 = 16, FAT32 = 32 */ 69 size_t sector_size; 68 70 uint32_t total_sectors; 69 71 uint16_t root_ent_max; 70 uint16_t addt_res_sectors; 72 uint32_t addt_res_sectors; 73 uint8_t sectors_per_cluster; 74 75 uint16_t reserved_sectors; 76 uint32_t rootdir_sectors; 77 uint32_t fat_sectors; 78 uint32_t total_clusters; 79 uint8_t fat_count; 71 80 } fat_cfg_t; 72 81 73 /** Derived file-system parameters */74 typedef struct fat_params {75 struct fat_cfg cfg;76 uint16_t reserved_sectors;77 uint16_t rootdir_sectors;78 uint32_t fat_sectors;79 uint16_t total_clusters;80 } fat_params_t;81 82 82 static void syntax_print(void); 83 83 84 static int fat_params_compute(struct fat_cfg const *cfg, 85 struct fat_params *par); 86 static int fat_blocks_write(struct fat_params const *par, 87 devmap_handle_t handle); 88 static void fat_bootsec_create(struct fat_params const *par, struct fat_bs *bs); 84 static int fat_params_compute(struct fat_cfg *cfg); 85 static int fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id); 86 static void fat_bootsec_create(struct fat_cfg const *cfg, struct fat_bs *bs); 89 87 90 88 int main(int argc, char **argv) 91 89 { 92 struct fat_params par;93 90 struct fat_cfg cfg; 94 91 95 92 int rc; 96 93 char *dev_path; 97 devmap_handle_t handle; 98 size_t block_size; 94 service_id_t service_id; 99 95 char *endptr; 100 96 aoff64_t dev_nblocks; 101 97 98 cfg.sector_size = default_sector_size; 99 cfg.sectors_per_cluster = default_sectors_per_cluster; 100 cfg.fat_count = default_fat_count; 102 101 cfg.total_sectors = 0; 103 102 cfg.addt_res_sectors = 0; 104 103 cfg.root_ent_max = 128; 104 cfg.fat_type = FAT16; 105 105 106 106 if (argc < 2) { … … 111 111 112 112 --argc; ++argv; 113 114 113 if (str_cmp(*argv, "--size") == 0) { 115 114 --argc; ++argv; … … 130 129 } 131 130 131 if (str_cmp(*argv, "--type") == 0) { 132 --argc; ++argv; 133 if (*argv == NULL) { 134 printf(NAME ": Error, argument missing.\n"); 135 syntax_print(); 136 return 1; 137 } 138 139 cfg.fat_type = strtol(*argv, &endptr, 10); 140 if (*endptr != '\0') { 141 printf(NAME ": Error, invalid argument.\n"); 142 syntax_print(); 143 return 1; 144 } 145 146 --argc; ++argv; 147 } 148 132 149 if (argc != 1) { 133 150 printf(NAME ": Error, unexpected argument.\n"); … … 137 154 138 155 dev_path = *argv; 139 140 rc = devmap_device_get_handle(dev_path, &handle, 0); 156 printf("Device: %s\n", dev_path); 157 158 rc = loc_service_get_id(dev_path, &service_id, 0); 141 159 if (rc != EOK) { 142 160 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 144 162 } 145 163 146 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);164 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 147 165 if (rc != EOK) { 148 166 printf(NAME ": Error initializing libblock.\n"); … … 150 168 } 151 169 152 rc = block_get_bsize( handle, &block_size);170 rc = block_get_bsize(service_id, &cfg.sector_size); 153 171 if (rc != EOK) { 154 172 printf(NAME ": Error determining device block size.\n"); … … 156 174 } 157 175 158 rc = block_get_nblocks( handle, &dev_nblocks);176 rc = block_get_nblocks(service_id, &dev_nblocks); 159 177 if (rc != EOK) { 160 178 printf(NAME ": Warning, failed to obtain block device size.\n"); … … 162 180 printf(NAME ": Block device has %" PRIuOFF64 " blocks.\n", 163 181 dev_nblocks); 164 cfg.total_sectors = dev_nblocks; 165 } 166 167 if (block_size != 512) { 168 printf(NAME ": Error. Device block size is not 512 bytes.\n"); 169 return 2; 182 if (!cfg.total_sectors || dev_nblocks < cfg.total_sectors) 183 cfg.total_sectors = dev_nblocks; 170 184 } 171 185 … … 175 189 } 176 190 177 printf(NAME ": Creating FAT filesystem on device %s.\n", dev_path); 178 179 rc = fat_params_compute(&cfg, &par); 191 if (cfg.fat_type != FAT12 && cfg.fat_type != FAT16 && cfg.fat_type != FAT32) { 192 printf(NAME ": Error. Unknown FAT type.\n"); 193 return 2; 194 } 195 196 printf(NAME ": Creating FAT%d filesystem on device %s.\n", cfg.fat_type, dev_path); 197 198 rc = fat_params_compute(&cfg); 180 199 if (rc != EOK) { 181 200 printf(NAME ": Invalid file-system parameters.\n"); … … 183 202 } 184 203 185 rc = fat_blocks_write(& par, handle);204 rc = fat_blocks_write(&cfg, service_id); 186 205 if (rc != EOK) { 187 206 printf(NAME ": Error writing device.\n"); … … 189 208 } 190 209 191 block_fini( handle);210 block_fini(service_id); 192 211 printf("Success.\n"); 193 212 … … 197 216 static void syntax_print(void) 198 217 { 199 printf("syntax: mkfat [--size < num_blocks>] <device_name>\n");218 printf("syntax: mkfat [--size <sectors>] [--type 12|16|32] <device_name>\n"); 200 219 } 201 220 … … 205 224 * file system params. 206 225 */ 207 static int fat_params_compute(struct fat_cfg const *cfg, struct fat_params *par)226 static int fat_params_compute(struct fat_cfg *cfg) 208 227 { 209 228 uint32_t fat_bytes; … … 211 230 212 231 /* 213 * Make a conservative guess on the FAT size needed for the file 214 * system. The optimum could be potentially smaller since we 215 * do not subtract size of the FAT itself when computing the 216 * size of the data region. 217 */ 218 219 par->reserved_sectors = 1 + cfg->addt_res_sectors; 220 par->rootdir_sectors = div_round_up(cfg->root_ent_max * DIRENT_SIZE, 221 sector_size); 222 non_data_sectors_lb = par->reserved_sectors + par->rootdir_sectors; 223 224 par->total_clusters = div_round_up(cfg->total_sectors - non_data_sectors_lb, 225 sectors_per_cluster); 226 227 fat_bytes = (par->total_clusters + 2) * 2; 228 par->fat_sectors = div_round_up(fat_bytes, sector_size); 229 230 par->cfg = *cfg; 232 * Make a conservative guess on the FAT size needed for the file 233 * system. The optimum could be potentially smaller since we 234 * do not subtract size of the FAT itself when computing the 235 * size of the data region. 236 */ 237 238 cfg->reserved_sectors = 1 + cfg->addt_res_sectors; 239 if (cfg->fat_type != FAT32) { 240 cfg->rootdir_sectors = div_round_up(cfg->root_ent_max * DIRENT_SIZE, 241 cfg->sector_size); 242 } else 243 cfg->rootdir_sectors = 0; 244 non_data_sectors_lb = cfg->reserved_sectors + cfg->rootdir_sectors; 245 246 cfg->total_clusters = div_round_up(cfg->total_sectors - non_data_sectors_lb, 247 cfg->sectors_per_cluster); 248 249 if ((cfg->fat_type == FAT12 && cfg->total_clusters > FAT12_CLST_MAX) || 250 (cfg->fat_type == FAT16 && (cfg->total_clusters <= FAT12_CLST_MAX || 251 cfg->total_clusters > FAT16_CLST_MAX)) || 252 (cfg->fat_type == FAT32 && cfg->total_clusters <= FAT16_CLST_MAX)) 253 return ENOSPC; 254 255 fat_bytes = div_round_up((cfg->total_clusters + 2) * 256 FAT_CLUSTER_DOUBLE_SIZE(cfg->fat_type), 2); 257 cfg->fat_sectors = div_round_up(fat_bytes, cfg->sector_size); 231 258 232 259 return EOK; … … 234 261 235 262 /** Create file system with the given parameters. */ 236 static int fat_blocks_write(struct fat_ params const *par, devmap_handle_t handle)263 static int fat_blocks_write(struct fat_cfg const *cfg, service_id_t service_id) 237 264 { 238 265 aoff64_t addr; … … 243 270 struct fat_bs bs; 244 271 245 fat_bootsec_create( par, &bs);246 247 rc = block_write_direct( handle, BS_BLOCK, 1, &bs);272 fat_bootsec_create(cfg, &bs); 273 274 rc = block_write_direct(service_id, BS_BLOCK, 1, &bs); 248 275 if (rc != EOK) 249 276 return EIO; … … 251 278 addr = BS_BLOCK + 1; 252 279 253 buffer = calloc( sector_size, 1);280 buffer = calloc(cfg->sector_size, 1); 254 281 if (buffer == NULL) 255 282 return ENOMEM; 283 memset(buffer, 0, cfg->sector_size); 256 284 257 285 /* Reserved sectors */ 258 for (i = 0; i < par->reserved_sectors - 1; ++i) {259 rc = block_write_direct( handle, addr, 1, buffer);286 for (i = 0; i < cfg->reserved_sectors - 1; ++i) { 287 rc = block_write_direct(service_id, addr, 1, buffer); 260 288 if (rc != EOK) 261 289 return EIO; … … 265 293 266 294 /* File allocation tables */ 267 for (i = 0; i < fat_count; ++i) {295 for (i = 0; i < cfg->fat_count; ++i) { 268 296 printf("Writing allocation table %d.\n", i + 1); 269 297 270 for (j = 0; j < par->fat_sectors; ++j) {271 memset(buffer, 0, sector_size);298 for (j = 0; j < cfg->fat_sectors; ++j) { 299 memset(buffer, 0, cfg->sector_size); 272 300 if (j == 0) { 273 buffer[0] = media_descriptor;301 buffer[0] = default_media_descriptor; 274 302 buffer[1] = 0xFF; 275 303 buffer[2] = 0xFF; 276 buffer[3] = 0xFF; 304 if (cfg->fat_type == FAT16) { 305 buffer[3] = 0xFF; 306 } else if (cfg->fat_type == FAT32) { 307 buffer[3] = 0x0F; 308 buffer[4] = 0xFF; 309 buffer[5] = 0xFF; 310 buffer[6] = 0xFF; 311 buffer[7] = 0x0F; 312 buffer[8] = 0xF8; 313 buffer[9] = 0xFF; 314 buffer[10] = 0xFF; 315 buffer[11] = 0x0F; 316 } 277 317 } 278 318 279 rc = block_write_direct( handle, addr, 1, buffer);319 rc = block_write_direct(service_id, addr, 1, buffer); 280 320 if (rc != EOK) 281 321 return EIO; … … 285 325 } 286 326 327 /* Root directory */ 287 328 printf("Writing root directory.\n"); 288 289 memset(buffer, 0, sector_size); 290 291 /* Root directory */ 292 for (i = 0; i < par->rootdir_sectors; ++i) { 293 rc = block_write_direct(handle, addr, 1, buffer); 294 if (rc != EOK) 295 return EIO; 296 297 ++addr; 329 memset(buffer, 0, cfg->sector_size); 330 if (cfg->fat_type != FAT32) { 331 size_t idx; 332 for (idx = 0; idx < cfg->rootdir_sectors; ++idx) { 333 rc = block_write_direct(service_id, addr, 1, buffer); 334 if (rc != EOK) 335 return EIO; 336 337 ++addr; 338 } 339 } else { 340 for (i = 0; i < cfg->sectors_per_cluster; i++) { 341 rc = block_write_direct(service_id, addr, 1, buffer); 342 if (rc != EOK) 343 return EIO; 344 345 ++addr; 346 } 298 347 } 299 348 … … 304 353 305 354 /** Construct boot sector with the given parameters. */ 306 static void fat_bootsec_create(struct fat_ params const *par, struct fat_bs *bs)355 static void fat_bootsec_create(struct fat_cfg const *cfg, struct fat_bs *bs) 307 356 { 308 357 memset(bs, 0, sizeof(*bs)); … … 315 364 316 365 /* BIOS Parameter Block */ 317 bs->bps = host2uint16_t_le(sector_size); 318 bs->spc = sectors_per_cluster; 319 bs->rscnt = host2uint16_t_le(par->reserved_sectors); 320 bs->fatcnt = fat_count; 321 bs->root_ent_max = host2uint16_t_le(par->cfg.root_ent_max); 322 323 if (par->cfg.total_sectors < 0x10000) 324 bs->totsec16 = host2uint16_t_le(par->cfg.total_sectors); 325 else 326 bs->totsec16 = host2uint16_t_le(0); 327 328 bs->mdesc = media_descriptor; 329 bs->sec_per_fat = host2uint16_t_le(par->fat_sectors); 366 bs->bps = host2uint16_t_le(cfg->sector_size); 367 bs->spc = cfg->sectors_per_cluster; 368 bs->rscnt = host2uint16_t_le(cfg->reserved_sectors); 369 bs->fatcnt = cfg->fat_count; 370 bs->root_ent_max = host2uint16_t_le(cfg->root_ent_max); 371 372 if (cfg->total_sectors < 0x10000) { 373 bs->totsec16 = host2uint16_t_le(cfg->total_sectors); 374 bs->totsec32 = 0; 375 } else { 376 bs->totsec16 = 0; 377 bs->totsec32 = host2uint32_t_le(cfg->total_sectors); 378 } 379 380 bs->mdesc = default_media_descriptor; 330 381 bs->sec_per_track = host2uint16_t_le(63); 382 bs->signature = host2uint16_t_be(0x55AA); 331 383 bs->headcnt = host2uint16_t_le(6); 332 384 bs->hidden_sec = host2uint32_t_le(0); 333 385 334 if (par->cfg.total_sectors >= 0x10000) 335 bs->totsec32 = host2uint32_t_le(par->cfg.total_sectors); 336 else 337 bs->totsec32 = host2uint32_t_le(0); 338 339 /* Extended BPB */ 340 bs->pdn = 0x80; 341 bs->ebs = 0x29; 342 bs->id = host2uint32_t_be(0x12345678); 343 344 memcpy(bs->label, "HELENOS_NEW", 11); 345 memcpy(bs->type, "FAT16 ", 8); 346 bs->signature = host2uint16_t_be(0x55AA); 386 if (cfg->fat_type == FAT32) { 387 bs->sec_per_fat = 0; 388 bs->fat32.sectors_per_fat = host2uint32_t_le(cfg->fat_sectors); 389 390 bs->fat32.pdn = 0x80; 391 bs->fat32.ebs = 0x29; 392 bs->fat32.id = host2uint32_t_be(0x12345678); 393 bs->fat32.root_cluster = 2; 394 395 memcpy(bs->fat32.label, "HELENOS_NEW", 11); 396 memcpy(bs->fat32.type, "FAT32 ", 8); 397 } else { 398 bs->sec_per_fat = host2uint16_t_le(cfg->fat_sectors); 399 bs->pdn = 0x80; 400 bs->ebs = 0x29; 401 bs->id = host2uint32_t_be(0x12345678); 402 403 memcpy(bs->label, "HELENOS_NEW", 11); 404 memcpy(bs->type, "FAT ", 8); 405 } 347 406 } 348 407 -
uspace/app/ping/ping.c
rd2c67e7 r8ff0bd2 36 36 37 37 #include <async.h> 38 #include <async_obsolete.h>39 38 #include <stdio.h> 40 39 #include <str.h> … … 341 340 config.dest_str, config.size, config.size); 342 341 343 int icmp_phone = icmp_connect_module(ICMP_CONNECT_TIMEOUT);344 if ( icmp_phone < 0) {342 async_sess_t *sess = icmp_connect_module(); 343 if (!sess) { 345 344 fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME, 346 str_error( icmp_phone));347 return icmp_phone;345 str_error(errno)); 346 return errno; 348 347 } 349 348 … … 356 355 str_error(ret)); 357 356 358 async_ obsolete_hangup(icmp_phone);357 async_hangup(sess); 359 358 return ret; 360 359 } 361 360 362 361 /* Ping! */ 363 int result = icmp_echo_msg( icmp_phone, config.size, config.timeout,362 int result = icmp_echo_msg(sess, config.size, config.timeout, 364 363 config.ttl, config.tos, !config.fragments, config.dest_raw, 365 364 config.dest_len); … … 371 370 str_error(ret)); 372 371 373 async_ obsolete_hangup(icmp_phone);372 async_hangup(sess); 374 373 return ret; 375 374 } … … 391 390 } 392 391 393 async_ obsolete_hangup(icmp_phone);392 async_hangup(sess); 394 393 395 394 return 0; -
uspace/app/sbi/src/compat.h
rd2c67e7 r8ff0bd2 38 38 #ifdef __HELENOS__ 39 39 40 #define list sbi_list 41 #define list_t sbi_list_t 42 40 43 /* 41 44 * Avoid name conflicts with ADT library. … … 44 47 #define list_prepend sbi_list_prepend 45 48 #define list_remove sbi_list_remove 49 #define list_first sbi_list_first 50 #define list_last sbi_list_last 46 51 47 52 #endif -
uspace/app/sbi/src/input.c
rd2c67e7 r8ff0bd2 176 176 int input_get_line(input_t *input, char **line) 177 177 { 178 const char *prompt; 178 179 const char *sp; 179 180 char *dp; … … 212 213 /* Interactive mode */ 213 214 if (input->line_no == 0) 214 pr intf("sbi> ");215 prompt = "sbi> "; 215 216 else 216 pr intf("... ");217 prompt = "... "; 217 218 218 219 fflush(stdout); 219 if (os_input_line( &line_p) != EOK)220 if (os_input_line(prompt, &line_p) != EOK) 220 221 return EIO; 221 222 -
uspace/app/sbi/src/list_t.h
rd2c67e7 r8ff0bd2 30 30 #define LIST_T_H_ 31 31 32 #include "compat.h" 33 32 34 typedef struct list_node { 33 35 struct list_node *prev, *next; -
uspace/app/sbi/src/os/helenos.c
rd2c67e7 r8ff0bd2 210 210 * @param ptr Place to store pointer to new string. 211 211 */ 212 int os_input_line(c har **ptr)212 int os_input_line(const char *prompt, char **ptr) 213 213 { 214 214 char *line; … … 219 219 if (tinput == NULL) 220 220 return EIO; 221 222 tinput_set_prompt(tinput, prompt); 221 223 } 222 224 -
uspace/app/sbi/src/os/os.h
rd2c67e7 r8ff0bd2 38 38 char *os_chr_to_astr(wchar_t chr); 39 39 void os_input_disp_help(void); 40 int os_input_line(c har **ptr);40 int os_input_line(const char *prompt, char **ptr); 41 41 int os_exec(char * const cmd[]); 42 42 -
uspace/app/sbi/src/os/posix.c
rd2c67e7 r8ff0bd2 193 193 * @param ptr Place to store pointer to new string. 194 194 */ 195 int os_input_line(char **ptr) 196 { 195 int os_input_line(const char *prompt, char **ptr) 196 { 197 printf("%s", prompt); 198 197 199 if (fgets(os_input_buffer, OS_INPUT_BUFFER_SIZE, stdin) == NULL) 198 200 os_input_buffer[0] = '\0'; -
uspace/app/sysinfo/sysinfo.c
rd2c67e7 r8ff0bd2 51 51 int rc; 52 52 char *ipath; 53 sysinfo_item_ tag_t tag;53 sysinfo_item_val_type_t tag; 54 54 55 55 if (argc != 2) { … … 60 60 ipath = argv[1]; 61 61 62 tag = sysinfo_get_ tag(ipath);62 tag = sysinfo_get_val_type(ipath); 63 63 64 64 /* Silence warning */ … … 75 75 case SYSINFO_VAL_DATA: 76 76 rc = print_item_data(ipath); 77 break; 78 default: 79 printf("Error: Sysinfo item '%s' with unknown value type.\n", 80 ipath); 81 rc = 2; 77 82 break; 78 83 } -
uspace/app/taskdump/elf_core.c
rd2c67e7 r8ff0bd2 1 1 /* 2 * Copyright (c) 201 0Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 * Looking at core files produced by Linux, these don't have section headers, 39 39 * only program headers, although objdump shows them as having sections. 40 * Basically at the beginning there should be a note segment (which we 41 * do not write) and one loadable segment per memory area (which we do write). 42 * 43 * The note segment probably contains register state, etc. -- we don't 44 * deal with these yet. Nevertheless you can use these core files with 45 * objdump or gdb. 46 */ 47 40 * Basically at the beginning there should be a note segment followed 41 * by one loadable segment per memory area. 42 * 43 * The note segment contains a series of records with register state, 44 * process info etc. We only write one record NT_PRSTATUS which contains 45 * process/register state (anything which is not register state we fill 46 * with zeroes). 47 */ 48 49 #include <align.h> 50 #include <elf/elf.h> 51 #include <elf/elf_linux.h> 48 52 #include <stdio.h> 49 53 #include <stdlib.h> … … 58 62 #include <udebug.h> 59 63 #include <macros.h> 60 61 #include <elf.h> 62 #include " include/elf_core.h"64 #include <libarch/istate.h> 65 66 #include "elf_core.h" 63 67 64 68 static off64_t align_foff_up(off64_t, uintptr_t, size_t); 65 static int write_all(int, void *, size_t);69 static int align_pos(int, size_t); 66 70 static int write_mem_area(int, as_area_info_t *, async_sess_t *); 67 71 … … 83 87 */ 84 88 int elf_core_save(const char *file_name, as_area_info_t *ainfo, unsigned int n, 85 async_sess_t *sess )89 async_sess_t *sess, istate_t *istate) 86 90 { 87 91 elf_header_t elf_hdr; … … 90 94 elf_word flags; 91 95 elf_segment_header_t *p_hdr; 96 elf_prstatus_t pr_status; 97 elf_note_t note; 98 size_t word_size; 92 99 93 100 int fd; 94 int rc;101 ssize_t rc; 95 102 unsigned int i; 96 103 97 n_ph = n; 98 99 p_hdr = malloc(sizeof(elf_segment_header_t) * n); 104 #ifdef __32_BITS__ 105 word_size = 4; 106 #endif 107 #ifdef __64_BITS__ 108 /* 109 * This should be 8 per the 64-bit ELF spec, but the Linux kernel 110 * screws up and uses 4 anyway (and screws up elf_note_t as well) 111 * and we are trying to be compatible with Linux GDB target. Sigh. 112 */ 113 word_size = 4; 114 #endif 115 memset(&pr_status, 0, sizeof(pr_status)); 116 istate_to_elf_regs(istate, &pr_status.regs); 117 118 n_ph = n + 1; 119 120 p_hdr = malloc(sizeof(elf_segment_header_t) * n_ph); 100 121 if (p_hdr == NULL) { 101 122 printf("Failed allocating memory.\n"); … … 115 136 * ELF header 116 137 * program headers 138 * note segment 117 139 * repeat: 118 140 * (pad for alignment) 119 * segment data141 * core segment 120 142 * end repeat 121 143 */ … … 147 169 foff = elf_hdr.e_phoff + n_ph * sizeof(elf_segment_header_t); 148 170 149 for (i = 1; i <= n; ++i) { 150 foff = align_foff_up(foff, ainfo[i - 1].start_addr, PAGE_SIZE); 171 memset(&p_hdr[0], 0, sizeof(p_hdr[0])); 172 p_hdr[0].p_type = PT_NOTE; 173 p_hdr[0].p_offset = foff; 174 p_hdr[0].p_vaddr = 0; 175 p_hdr[0].p_paddr = 0; 176 p_hdr[0].p_filesz = sizeof(elf_note_t) 177 + ALIGN_UP((str_size("CORE") + 1), word_size) 178 + ALIGN_UP(sizeof(elf_prstatus_t), word_size); 179 p_hdr[0].p_memsz = 0; 180 p_hdr[0].p_flags = 0; 181 p_hdr[0].p_align = 1; 182 183 foff += p_hdr[0].p_filesz; 184 185 for (i = 0; i < n; ++i) { 186 foff = align_foff_up(foff, ainfo[i].start_addr, PAGE_SIZE); 151 187 152 188 flags = 0; 153 if (ainfo[i - 1].flags & AS_AREA_READ)189 if (ainfo[i].flags & AS_AREA_READ) 154 190 flags |= PF_R; 155 if (ainfo[i - 1].flags & AS_AREA_WRITE)191 if (ainfo[i].flags & AS_AREA_WRITE) 156 192 flags |= PF_W; 157 if (ainfo[i - 1].flags & AS_AREA_EXEC)193 if (ainfo[i].flags & AS_AREA_EXEC) 158 194 flags |= PF_X; 159 195 160 memset(&p_hdr[i - 1], 0, sizeof(p_hdr[i -1]));161 p_hdr[i -1].p_type = PT_LOAD;162 p_hdr[i -1].p_offset = foff;163 p_hdr[i - 1].p_vaddr = ainfo[i - 1].start_addr;164 p_hdr[i -1].p_paddr = 0;165 p_hdr[i - 1].p_filesz = ainfo[i - 1].size;166 p_hdr[i - 1].p_memsz = ainfo[i - 1].size;167 p_hdr[i -1].p_flags = flags;168 p_hdr[i -1].p_align = PAGE_SIZE;169 170 foff += ainfo[i - 1].size;196 memset(&p_hdr[i + 1], 0, sizeof(p_hdr[i + 1])); 197 p_hdr[i + 1].p_type = PT_LOAD; 198 p_hdr[i + 1].p_offset = foff; 199 p_hdr[i + 1].p_vaddr = ainfo[i].start_addr; 200 p_hdr[i + 1].p_paddr = 0; 201 p_hdr[i + 1].p_filesz = ainfo[i].size; 202 p_hdr[i + 1].p_memsz = ainfo[i].size; 203 p_hdr[i + 1].p_flags = flags; 204 p_hdr[i + 1].p_align = PAGE_SIZE; 205 206 foff += ainfo[i].size; 171 207 } 172 208 173 209 rc = write_all(fd, &elf_hdr, sizeof(elf_hdr)); 174 if (rc != EOK) {210 if (rc != sizeof(elf_hdr)) { 175 211 printf("Failed writing ELF header.\n"); 176 212 free(p_hdr); … … 180 216 for (i = 0; i < n_ph; ++i) { 181 217 rc = write_all(fd, &p_hdr[i], sizeof(p_hdr[i])); 182 if (rc != EOK) {218 if (rc != sizeof(p_hdr[i])) { 183 219 printf("Failed writing program header.\n"); 184 220 free(p_hdr); … … 187 223 } 188 224 189 for (i = 0; i < n_ph; ++i) { 225 if (lseek(fd, p_hdr[0].p_offset, SEEK_SET) == (off64_t) -1) { 226 printf("Failed writing memory data.\n"); 227 free(p_hdr); 228 return EIO; 229 } 230 231 /* 232 * Write note header 233 */ 234 note.namesz = str_size("CORE") + 1; 235 note.descsz = sizeof(elf_prstatus_t); 236 note.type = NT_PRSTATUS; 237 238 rc = write_all(fd, ¬e, sizeof(elf_note_t)); 239 if (rc != sizeof(elf_note_t)) { 240 printf("Failed writing note header.\n"); 241 free(p_hdr); 242 return EIO; 243 } 244 245 rc = write_all(fd, "CORE", note.namesz); 246 if (rc != (ssize_t) note.namesz) { 247 printf("Failed writing note header.\n"); 248 free(p_hdr); 249 return EIO; 250 } 251 252 rc = align_pos(fd, word_size); 253 if (rc != EOK) { 254 printf("Failed writing note header.\n"); 255 free(p_hdr); 256 return EIO; 257 } 258 259 rc = write_all(fd, &pr_status, sizeof(elf_prstatus_t)); 260 if (rc != sizeof(elf_prstatus_t)) { 261 printf("Failed writing register data.\n"); 262 free(p_hdr); 263 return EIO; 264 } 265 266 for (i = 1; i < n_ph; ++i) { 190 267 if (lseek(fd, p_hdr[i].p_offset, SEEK_SET) == (off64_t) -1) { 191 268 printf("Failed writing memory data.\n"); … … 193 270 return EIO; 194 271 } 195 if (write_mem_area(fd, &ainfo[i ], sess) != EOK) {272 if (write_mem_area(fd, &ainfo[i - 1], sess) != EOK) { 196 273 printf("Failed writing memory data.\n"); 197 274 free(p_hdr); … … 210 287 off64_t rva = vaddr % page_size; 211 288 off64_t rfo = foff % page_size; 212 289 213 290 if (rva >= rfo) 214 291 return (foff + (rva - rfo)); 215 292 216 293 return (foff + (page_size + (rva - rfo))); 217 294 } … … 231 308 size_t total; 232 309 uintptr_t addr; 233 int rc;310 ssize_t rc; 234 311 235 312 addr = area->start_addr; … … 245 322 246 323 rc = write_all(fd, buffer, to_copy); 247 if (rc != EOK) {324 if (rc != (ssize_t) to_copy) { 248 325 printf("Failed writing memory contents.\n"); 249 326 return EIO; … … 257 334 } 258 335 259 /** Write until the buffer is written in its entirety. 260 * 261 * This function fails if it cannot write exactly @a len bytes to the file. 262 * 263 * @param fd The file to write to. 264 * @param buf Data, @a len bytes long. 265 * @param len Number of bytes to write. 266 * 267 * @return EOK on error, return value from write() if writing 268 * failed. 269 */ 270 static int write_all(int fd, void *data, size_t len) 336 static int align_pos(int fd, size_t align) 271 337 { 272 int cnt = 0;273 274 do { 275 data += cnt;276 len -= cnt;277 cnt = write(fd, data, len);278 } while (cnt > 0 && (len - cnt) > 0); 279 280 if (cnt < 0)281 return cnt; 282 283 if ( len - cnt >0)284 return EIO;338 off64_t cur_pos; 339 size_t rem, adv; 340 341 cur_pos = lseek(fd, 0, SEEK_CUR); 342 if (cur_pos < 0) 343 return -1; 344 345 rem = cur_pos % align; 346 adv = align - rem; 347 348 cur_pos = lseek(fd, adv, SEEK_CUR); 349 if (cur_pos < 0) 350 return -1; 285 351 286 352 return EOK; 287 353 } 288 354 289 290 355 /** @} 291 356 */ -
uspace/app/taskdump/include/elf_core.h
rd2c67e7 r8ff0bd2 37 37 38 38 #include <async.h> 39 #include <elf/elf_linux.h> 40 #include <libarch/istate.h> 39 41 40 42 extern int elf_core_save(const char *, as_area_info_t *, unsigned int, 41 async_sess_t * );43 async_sess_t *, istate_t *); 42 44 43 45 #endif -
uspace/app/taskdump/include/symtab.h
rd2c67e7 r8ff0bd2 36 36 #define SYMTAB_H_ 37 37 38 #include <elf/elf.h> 38 39 #include <sys/types.h> 39 #include <elf.h>40 40 41 41 typedef struct { -
uspace/app/taskdump/symtab.c
rd2c67e7 r8ff0bd2 36 36 */ 37 37 38 #include <elf/elf.h> 38 39 #include <stdio.h> 39 40 #include <stdlib.h> … … 43 44 #include <fcntl.h> 44 45 45 #include <elf.h>46 46 #include "include/symtab.h" 47 47 … … 50 50 elf_section_header_t *shdr); 51 51 static int chunk_load(int fd, off64_t start, size_t size, void **ptr); 52 static int read_all(int fd, void *buf, size_t len);53 52 54 53 /** Load symbol table from an ELF file. … … 90 89 91 90 rc = read_all(fd, &elf_hdr, sizeof(elf_header_t)); 92 if (rc != EOK) {91 if (rc != sizeof(elf_header_t)) { 93 92 printf("failed reading elf header\n"); 94 93 free(stab); … … 312 311 313 312 rc = read_all(fd, sec_hdr, sizeof(elf_section_header_t)); 314 if (rc != EOK)313 if (rc != sizeof(elf_section_header_t)) 315 314 return EIO; 316 315 … … 331 330 static int chunk_load(int fd, off64_t start, size_t size, void **ptr) 332 331 { 333 int rc; 334 335 rc = lseek(fd, start, SEEK_SET); 336 if (rc == (off64_t) -1) { 332 ssize_t rc; 333 off64_t offs; 334 335 offs = lseek(fd, start, SEEK_SET); 336 if (offs == (off64_t) -1) { 337 337 printf("failed seeking chunk\n"); 338 338 *ptr = NULL; … … 347 347 348 348 rc = read_all(fd, *ptr, size); 349 if (rc != EOK) {349 if (rc != (ssize_t) size) { 350 350 printf("failed reading chunk\n"); 351 351 free(*ptr); … … 357 357 } 358 358 359 /** Read until the buffer is read in its entirety.360 *361 * This function fails if it cannot read exactly @a len bytes from the file.362 *363 * @param fd The file to read from.364 * @param buf Buffer for storing data, @a len bytes long.365 * @param len Number of bytes to read.366 *367 * @return EOK on error, EIO if file is short or return value368 * from read() if reading failed.369 */370 static int read_all(int fd, void *buf, size_t len)371 {372 int cnt = 0;373 374 do {375 buf += cnt;376 len -= cnt;377 cnt = read(fd, buf, len);378 } while (cnt > 0 && (len - cnt) > 0);379 380 if (cnt < 0)381 return cnt;382 383 if (len - cnt > 0)384 return EIO;385 386 return EOK;387 }388 389 359 /** @} 390 360 */ -
uspace/app/taskdump/taskdump.c
rd2c67e7 r8ff0bd2 34 34 35 35 #include <async.h> 36 #include <elf/elf_linux.h> 36 37 #include <stdio.h> 37 38 #include <stdlib.h> … … 72 73 static char *get_app_task_name(void); 73 74 static char *fmt_sym_address(uintptr_t addr); 75 76 static istate_t reg_state; 74 77 75 78 int main(int argc, char *argv[]) … … 293 296 if (write_core_file) { 294 297 printf("Writing core file '%s'\n", core_file_name); 295 rc = elf_core_save(core_file_name, ainfo_buf, n_areas, sess); 298 299 rc = elf_core_save(core_file_name, ainfo_buf, n_areas, sess, 300 ®_state); 301 296 302 if (rc != EOK) { 297 303 printf("Failed writing core file.\n"); … … 321 327 pc = istate_get_pc(&istate); 322 328 fp = istate_get_fp(&istate); 329 330 /* Save register state for dumping to core file later. */ 331 reg_state = istate; 323 332 324 333 sym_pc = fmt_sym_address(pc); -
uspace/app/tester/Makefile
rd2c67e7 r8ff0bd2 29 29 30 30 USPACE_PREFIX = ../.. 31 LIBS = $(LIB BLOCK_PREFIX)/libblock.a $(LIBEXT2_PREFIX)/libext2.a31 LIBS = $(LIBEXT2_PREFIX)/libext2.a $(LIBBLOCK_PREFIX)/libblock.a 32 32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBEXT2_PREFIX) 33 33 BINARY = tester … … 56 56 mm/malloc3.c \ 57 57 mm/mapping1.c \ 58 devs/devman1.c \59 devs/devman2.c \60 58 hw/misc/virtchar1.c \ 61 59 hw/serial/serial1.c \ -
uspace/app/tester/hw/misc/virtchar1.c
rd2c67e7 r8ff0bd2 48 48 #include "../../tester.h" 49 49 50 #define DEVICE_PATH_NORMAL "/dev/devices/\\virt\\null\\a" 51 #define DEVICE_PATH_CLASSES "/dev/class/virt-null\\1" 50 #define DEVICE_PATH_NORMAL "/loc/devices/\\virt\\null\\a" 52 51 #define BUFFER_SIZE 64 53 52 … … 105 104 } 106 105 107 res = test_virtchar1_internal(DEVICE_PATH_CLASSES);108 if (res != NULL) {109 return res;110 }111 112 106 return NULL; 113 107 } -
uspace/app/tester/hw/serial/serial1.c
rd2c67e7 r8ff0bd2 72 72 73 73 devman_handle_t handle; 74 int res = devman_ device_get_handle("/hw/pci0/00:01.0/com1/a", &handle,74 int res = devman_fun_get_handle("/hw/pci0/00:01.0/com1/a", &handle, 75 75 IPC_FLAG_BLOCKING); 76 76 if (res != EOK) -
uspace/app/tester/mm/common.c
rd2c67e7 r8ff0bd2 73 73 link_t *link; 74 74 75 while ((link = list_ head(&mem_blocks)) != NULL) {75 while ((link = list_first(&mem_blocks)) != NULL) { 76 76 mem_block_t *block = list_get_instance(link, mem_block_t, link); 77 77 free_block(block); 78 78 } 79 79 80 while ((link = list_ head(&mem_areas)) != NULL) {80 while ((link = list_first(&mem_areas)) != NULL) { 81 81 mem_area_t *area = list_get_instance(link, mem_area_t, link); 82 82 unmap_area(area); -
uspace/app/tester/print/print2.c
rd2c67e7 r8ff0bd2 45 45 TPRINTF("Real output: [%d] [%3.2d] [%-3.2d] [%2.3d] [%-2.3d]\n\n", -1, -2, -3, -4, -5); 46 46 47 TPRINTF("Testing printf(\"%%lld %%3.2lld %%-3.2lld %%2.3lld %%-2.3lld\", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5):\n"); 48 TPRINTF("Expected output: [-1] [-02] [-03] [-004] [-005]\n"); 49 TPRINTF("Real output: [%lld] [%3.2lld] [%-3.2lld] [%2.3lld] [%-2.3lld]\n\n", (long long) -1, (long long) -2, (long long) -3, (long long) -4, (long long) -5); 50 47 51 TPRINTF("Testing printf(\"%%#x %%5.3#x %%-5.3#x %%3.5#x %%-3.5#x\", 17, 18, 19, 20, 21):\n"); 48 52 TPRINTF("Expected output: [0x11] [0x012] [0x013] [0x00014] [0x00015]\n"); -
uspace/app/tester/stdio/stdio1.c
rd2c67e7 r8ff0bd2 39 39 { 40 40 FILE *file; 41 const char *file_name = "/ readme";41 const char *file_name = "/textdemo"; 42 42 43 43 TPRINTF("Open file \"%s\"...", file_name); -
uspace/app/tester/tester.c
rd2c67e7 r8ff0bd2 68 68 #include "hw/misc/virtchar1.def" 69 69 #include "libext2/libext2_1.def" 70 #include "devs/devman1.def"71 #include "devs/devman2.def"72 70 {NULL, NULL, NULL, false} 73 71 }; -
uspace/app/tester/vfs/vfs1.c
rd2c67e7 r8ff0bd2 35 35 #include <fcntl.h> 36 36 #include <dirent.h> 37 #include < devmap.h>37 #include <loc.h> 38 38 #include <sys/types.h> 39 39 #include <sys/stat.h> -
uspace/app/testread/testread.c
rd2c67e7 r8ff0bd2 50 50 #include <stdlib.h> 51 51 #include <mem.h> 52 #include < devmap.h>52 #include <loc.h> 53 53 #include <byteorder.h> 54 54 #include <sys/types.h> -
uspace/app/top/top.c
rd2c67e7 r8ff0bd2 42 42 #include <thread.h> 43 43 #include <sys/time.h> 44 #include <arch/barrier.h>45 44 #include <errno.h> 46 45 #include <sort.h> -
uspace/app/trace/ipc_desc.c
rd2c67e7 r8ff0bd2 33 33 */ 34 34 35 #include <kernel/ipc/ipc.h> 36 #include <kernel/ipc/ipc_methods.h> 35 #include <abi/ipc/methods.h> 37 36 #include <stdlib.h> 38 37 #include "ipc_desc.h" -
uspace/app/trace/ipcp.c
rd2c67e7 r8ff0bd2 37 37 #include <adt/hash_table.h> 38 38 #include <sys/typefmt.h> 39 #include < kernel/ipc/ipc_methods.h>39 #include <abi/ipc/methods.h> 40 40 #include "ipc_desc.h" 41 41 #include "proto.h" -
uspace/app/trace/syscalls.c
rd2c67e7 r8ff0bd2 33 33 */ 34 34 35 #include < kernel/syscall/syscall.h>35 #include <abi/syscall.h> 36 36 #include "syscalls.h" 37 37 #include "trace.h" … … 75 75 [SYS_UNREGISTER_IRQ] = { "unregister_irq", 2, V_ERRNO }, 76 76 77 [SYS_SYSINFO_GET_ TAG] = { "sysinfo_get_tag", 2, V_INTEGER },77 [SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type", 2, V_INTEGER }, 78 78 [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO }, 79 79 [SYS_SYSINFO_GET_DATA_SIZE] = { "sysinfo_get_data_size", 3, V_ERRNO }, 80 80 [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO }, 81 81 82 [SYS_DEBUG_ ENABLE_CONSOLE] = { "debug_enable_console", 0, V_ERRNO },82 [SYS_DEBUG_ACTIVATE_CONSOLE] = { "debug_activate_console", 0, V_ERRNO }, 83 83 [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 1, V_ERRNO } 84 84 }; -
uspace/app/trace/trace.c
rd2c67e7 r8ff0bd2 50 50 #include <sys/types.h> 51 51 #include <sys/typefmt.h> 52 #include <vfs/vfs.h> 52 53 53 54 #include <libc.h> … … 586 587 587 588 /* Send default files */ 588 fdi_node_t *files[4];589 fdi_node_t stdin_node;590 fdi_node_t stdout_node;591 fdi_node_t stderr_node;592 593 if ((stdin != NULL) && (f node(stdin, &stdin_node) == EOK))594 files[0] = & stdin_node;589 int *files[4]; 590 int fd_stdin; 591 int fd_stdout; 592 int fd_stderr; 593 594 if ((stdin != NULL) && (fhandle(stdin, &fd_stdin) == EOK)) 595 files[0] = &fd_stdin; 595 596 else 596 597 files[0] = NULL; 597 598 598 if ((stdout != NULL) && (f node(stdout, &stdout_node) == EOK))599 files[1] = & stdout_node;599 if ((stdout != NULL) && (fhandle(stdout, &fd_stdout) == EOK)) 600 files[1] = &fd_stdout; 600 601 else 601 602 files[1] = NULL; 602 603 603 if ((stderr != NULL) && (f node(stderr, &stderr_node) == EOK))604 files[2] = & stderr_node;604 if ((stderr != NULL) && (fhandle(stderr, &fd_stderr) == EOK)) 605 files[2] = &fd_stderr; 605 606 else 606 607 files[2] = NULL; … … 761 762 o = oper_new("open", 2, arg_def, V_INT_ERRNO, 0, resp_def); 762 763 proto_add_oper(p, VFS_IN_OPEN, o); 763 o = oper_new("open_node", 4, arg_def, V_INT_ERRNO, 0, resp_def);764 proto_add_oper(p, VFS_IN_OPEN_NODE, o);765 764 o = oper_new("read", 1, arg_def, V_ERRNO, 1, resp_def); 766 765 proto_add_oper(p, VFS_IN_READ, o); … … 792 791 proto_register(SERVICE_VFS, p); 793 792 793 #if 0 794 794 p = proto_new("console"); 795 795 … … 827 827 proto_console = p; 828 828 proto_register(SERVICE_CONSOLE, p); 829 #endif 829 830 } 830 831 -
uspace/app/usbinfo/Makefile
rd2c67e7 r8ff0bd2 31 31 32 32 LIBS = \ 33 $(LIBUSBHID_PREFIX)/libusbhid.a \ 33 34 $(LIBUSBDEV_PREFIX)/libusbdev.a \ 34 35 $(LIBUSB_PREFIX)/libusb.a \ … … 37 38 -I$(LIBUSB_PREFIX)/include \ 38 39 -I$(LIBUSBDEV_PREFIX)/include \ 40 -I$(LIBUSBHID_PREFIX)/include \ 39 41 -I$(LIBDRV_PREFIX)/include 40 42 … … 43 45 dev.c \ 44 46 dump.c \ 47 hid.c \ 45 48 info.c \ 46 49 main.c -
uspace/app/usbinfo/dump.c
rd2c67e7 r8ff0bd2 103 103 void dump_match_ids(match_id_list_t *matches, const char *line_prefix) 104 104 { 105 link_t *link; 106 for (link = matches->ids.next; 107 link != &matches->ids; 108 link = link->next) { 105 list_foreach(matches->ids, link) { 109 106 match_id_t *match = list_get_instance(link, match_id_t, link); 110 107 -
uspace/app/usbinfo/main.c
rd2c67e7 r8ff0bd2 42 42 #include <getopt.h> 43 43 #include <devman.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <usb/hc.h> 46 46 #include <usb/dev/pipes.h> … … 56 56 printf("Usage: %s [options] device [device [device [ ... ]]]\n", 57 57 app_name); 58 printf(_INDENT "The device is a devman path to the device.\n"); 58 printf(_INDENT "The device can be specified in two ways.\n"); 59 printf(_INDENT " o Using its devman path, e.g. /hw/pci0/.../usb00_a1.\n"); 60 printf(_INDENT " o Or using BUS.ADDR numbers as printed by lsusb.\n"); 59 61 60 62 _OPTION("-h --help", "Print this help and exit."); … … 65 67 _OPTION("-s --strings", "Try to print all string descriptors."); 66 68 _OPTION("-S --status", "Get status of the device."); 69 _OPTION("-r --hid-report", "Dump HID report descriptor."); 70 _OPTION("-r --hid-report-usages", "Dump usages of HID report."); 67 71 68 72 printf("\n"); … … 82 86 {"strings", no_argument, NULL, 's'}, 83 87 {"status", no_argument, NULL, 'S'}, 88 {"hid-report", no_argument, NULL, 'r'}, 89 {"hid-report-usages", no_argument, NULL, 'R'}, 84 90 {0, 0, NULL, 0} 85 91 }; 86 static const char *short_options = "himtTsS ";92 static const char *short_options = "himtTsSrR"; 87 93 88 94 static usbinfo_action_t actions[] = { … … 115 121 .opt = 'S', 116 122 .action = dump_status, 123 .active = false 124 }, 125 { 126 .opt = 'r', 127 .action = dump_hidreport_raw, 128 .active = false 129 }, 130 { 131 .opt = 'R', 132 .action = dump_hidreport_usages, 117 133 .active = false 118 134 }, -
uspace/app/usbinfo/usbinfo.h
rd2c67e7 r8ff0bd2 85 85 void dump_strings(usbinfo_device_t *); 86 86 void dump_status(usbinfo_device_t *); 87 void dump_hidreport_raw(usbinfo_device_t *); 88 void dump_hidreport_usages(usbinfo_device_t *); 87 89 88 90 -
uspace/app/vuhid/Makefile
rd2c67e7 r8ff0bd2 36 36 $(LIBUSBHID_PREFIX)/libusbhid.a \ 37 37 $(LIBUSBDEV_PREFIX)/libusbdev.a \ 38 $(LIBUSB_PREFIX)/libusb.a 38 $(LIBUSB_PREFIX)/libusb.a \ 39 $(LIBDRV_PREFIX)/libdrv.a 39 40 EXTRA_CFLAGS = \ 40 41 -I$(LIBUSB_PREFIX)/include \
Note:
See TracChangeset
for help on using the changeset viewer.
