- Timestamp:
- 2009-11-16T21:24:28Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 18baf9c0
- Parents:
- 5f678b1c (diff), 9c70ed6 (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
- Files:
-
- 68 added
- 68 edited
-
Makefile (modified) (2 diffs)
-
app/bdsh/Makefile (modified) (1 diff)
-
app/bdsh/Makefile.build (added)
-
app/bdsh/Makefile.common (added)
-
app/bdsh/scli.c (modified) (1 diff)
-
app/bdsh/scli.h (modified) (1 diff)
-
app/edit/Makefile (modified) (2 diffs)
-
app/edit/Makefile.build (added)
-
app/edit/Makefile.common (added)
-
app/edit/edit.c (modified) (1 diff)
-
app/getvc/Makefile (modified) (2 diffs)
-
app/getvc/Makefile.build (added)
-
app/getvc/Makefile.common (added)
-
app/getvc/getvc.c (modified) (4 diffs)
-
app/init/Makefile (modified) (2 diffs)
-
app/init/Makefile.build (added)
-
app/init/Makefile.common (added)
-
app/init/init.c (modified) (1 diff)
-
app/klog/Makefile (modified) (2 diffs)
-
app/klog/Makefile.build (added)
-
app/klog/Makefile.common (added)
-
app/redir/Makefile (added)
-
app/redir/Makefile.build (added)
-
app/redir/Makefile.common (added)
-
app/redir/redir.c (added)
-
app/tester/Makefile (modified) (2 diffs)
-
app/tester/Makefile.build (added)
-
app/tester/Makefile.common (added)
-
app/tetris/Makefile (modified) (1 diff)
-
app/tetris/Makefile.build (added)
-
app/tetris/Makefile.common (added)
-
app/trace/Makefile (modified) (2 diffs)
-
app/trace/Makefile.build (added)
-
app/trace/Makefile.common (added)
-
lib/libblock/Makefile (modified) (1 diff)
-
lib/libblock/Makefile.build (added)
-
lib/libblock/Makefile.common (added)
-
lib/libc/Makefile (modified) (1 diff)
-
lib/libc/Makefile.build (added)
-
lib/libc/Makefile.common (added)
-
lib/libc/Makefile.toolchain (modified) (1 diff)
-
lib/libc/arch/ia32/include/syscall.h (modified) (1 diff)
-
lib/libc/arch/ia32/src/entry.s (modified) (3 diffs)
-
lib/libc/arch/ia32/src/syscall.S (modified) (3 diffs)
-
lib/libc/generic/io/klog.c (modified) (1 diff)
-
lib/libc/generic/libc.c (modified) (1 diff)
-
lib/libc/generic/loader.c (modified) (1 diff)
-
lib/libc/generic/malloc.c (modified) (1 diff)
-
lib/libc/generic/task.c (modified) (2 diffs)
-
lib/libc/generic/vfs/vfs.c (modified) (7 diffs)
-
lib/libc/include/fcntl.h (modified) (1 diff)
-
lib/libc/include/ipc/loader.h (modified) (1 diff)
-
lib/libc/include/ipc/vfs.h (modified) (1 diff)
-
lib/libc/include/loader/loader.h (modified) (1 diff)
-
lib/libc/include/loader/pcb.h (modified) (1 diff)
-
lib/libc/include/malloc.h (modified) (1 diff)
-
lib/libc/include/unistd.h (modified) (1 diff)
-
lib/libfs/Makefile (modified) (1 diff)
-
lib/libfs/Makefile.build (added)
-
lib/libfs/Makefile.common (added)
-
lib/libfs/libfs.c (modified) (1 diff)
-
lib/softfloat/Makefile (modified) (2 diffs)
-
lib/softfloat/Makefile.build (added)
-
lib/softfloat/Makefile.common (added)
-
lib/softint/Makefile (modified) (2 diffs)
-
lib/softint/Makefile.build (added)
-
lib/softint/Makefile.common (added)
-
srv/bd/ata_bd/Makefile (modified) (2 diffs)
-
srv/bd/ata_bd/Makefile.build (added)
-
srv/bd/ata_bd/Makefile.common (added)
-
srv/bd/file_bd/Makefile (modified) (2 diffs)
-
srv/bd/file_bd/Makefile.build (added)
-
srv/bd/file_bd/Makefile.common (added)
-
srv/bd/gxe_bd/Makefile (modified) (2 diffs)
-
srv/bd/gxe_bd/Makefile.build (added)
-
srv/bd/gxe_bd/Makefile.common (added)
-
srv/bd/rd/Makefile (modified) (2 diffs)
-
srv/bd/rd/Makefile.build (added)
-
srv/bd/rd/Makefile.common (added)
-
srv/cir/fhc/Makefile (modified) (2 diffs)
-
srv/cir/fhc/Makefile.build (added)
-
srv/cir/fhc/Makefile.common (added)
-
srv/cir/obio/Makefile (modified) (2 diffs)
-
srv/cir/obio/Makefile.build (added)
-
srv/cir/obio/Makefile.common (added)
-
srv/console/Makefile (modified) (2 diffs)
-
srv/console/Makefile.build (added)
-
srv/console/Makefile.common (added)
-
srv/console/console.c (modified) (2 diffs)
-
srv/console/keybuffer.c (modified) (1 diff)
-
srv/console/screenbuffer.c (modified) (1 diff)
-
srv/devmap/Makefile (modified) (2 diffs)
-
srv/devmap/Makefile.build (added)
-
srv/devmap/Makefile.common (added)
-
srv/fb/Makefile (modified) (2 diffs)
-
srv/fb/Makefile.build (added)
-
srv/fb/Makefile.common (added)
-
srv/fs/devfs/Makefile (modified) (2 diffs)
-
srv/fs/devfs/Makefile.build (added)
-
srv/fs/devfs/Makefile.common (added)
-
srv/fs/fat/Makefile (modified) (2 diffs)
-
srv/fs/fat/Makefile.build (added)
-
srv/fs/fat/Makefile.common (added)
-
srv/fs/fat/fat_ops.c (modified) (12 diffs)
-
srv/fs/tmpfs/Makefile (modified) (2 diffs)
-
srv/fs/tmpfs/Makefile.build (added)
-
srv/fs/tmpfs/Makefile.common (added)
-
srv/kbd/Makefile (modified) (2 diffs)
-
srv/kbd/Makefile.build (added)
-
srv/kbd/Makefile.common (added)
-
srv/loader/Makefile (modified) (2 diffs)
-
srv/loader/Makefile.build (added)
-
srv/loader/Makefile.common (added)
-
srv/loader/arch/ia32/ia32.s (modified) (1 diff)
-
srv/loader/main.c (modified) (4 diffs)
-
srv/ns/Makefile (modified) (2 diffs)
-
srv/ns/Makefile.build (added)
-
srv/ns/Makefile.common (added)
-
srv/ns/service.c (modified) (2 diffs)
-
srv/part/mbr_part/Makefile (modified) (2 diffs)
-
srv/part/mbr_part/Makefile.build (added)
-
srv/part/mbr_part/Makefile.common (added)
-
srv/pci/Makefile (modified) (2 diffs)
-
srv/pci/Makefile.build (added)
-
srv/pci/Makefile.common (added)
-
srv/pci/libpci/Makefile (modified) (1 diff)
-
srv/pci/libpci/Makefile.build (added)
-
srv/pci/libpci/Makefile.common (added)
-
srv/vfs/Makefile (modified) (2 diffs)
-
srv/vfs/Makefile.build (added)
-
srv/vfs/Makefile.common (added)
-
srv/vfs/vfs.c (modified) (1 diff)
-
srv/vfs/vfs.h (modified) (2 diffs)
-
srv/vfs/vfs_file.c (modified) (4 diffs)
-
srv/vfs/vfs_lookup.c (modified) (1 diff)
-
srv/vfs/vfs_ops.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/Makefile
r5f678b1c r5a4fef9 55 55 app/init \ 56 56 app/getvc \ 57 app/redir \ 57 58 app/bdsh 58 59 … … 86 87 .PHONY: all $(LIBC_BUILD) $(LIBS_BUILD) $(BUILDS) $(CLEANS) clean 87 88 88 all: ../Makefile.config ../config.h ../config.defs$(BUILDS)89 all: $(BUILDS) 89 90 90 91 clean: $(CLEANS) -
uspace/app/bdsh/Makefile
r5f678b1c r5a4fef9 1 # Copyright (c) 2005, Martin Decky2 # All rights reserved.3 # Copyright (c) 200 8, Tim Post <tinkertim@gmail.com>1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 4 4 # All rights reserved. 5 5 # 6 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions are met: 7 # modification, are permitted provided that the following conditions 8 # are met: 8 9 # 9 # Redistributions of source code must retain the above copyright notice, this 10 # 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. 11 17 # 12 # Redistributions in binary form must reproduce the above copyright notice, 13 # this list of conditions and the following disclaimer in the documentation 14 # and/or other materials provided with the distribution. 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. 15 28 # 16 # Neither the name of the original program's authors nor the names of its17 # contributors may be used to endorse or promote products derived from this18 # software without specific prior written permission.19 #20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE24 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE30 # POSSIBILITY OF SUCH DAMAGE.31 29 32 include ../../../version30 include Makefile.common 33 31 34 LIBC_PREFIX = ../../lib/libc 35 SOFTINT_PREFIX = ../../lib/softint 36 LIBBLOCK_PREFIX = ../../lib/libblock 32 .PHONY: all clean 37 33 38 include $(LIBC_PREFIX)/Makefile.toolchain 39 40 CFLAGS += -I../../srv/kbd/include -I$(LIBBLOCK_PREFIX) 41 42 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a 43 DEFS += -DRELEASE=$(RELEASE) 44 45 PROGRAM = bdsh 46 47 # Any directory that cleaning targets should know about 48 SUBDIRS = \ 49 ./ \ 50 cmds/ \ 51 cmds/modules/ \ 52 cmds/modules/help/ \ 53 cmds/modules/mkdir/ \ 54 cmds/modules/rm/ \ 55 cmds/modules/bdd/ \ 56 cmds/modules/cat/ \ 57 cmds/modules/touch/ \ 58 cmds/modules/ls/ \ 59 cmds/modules/pwd/ \ 60 cmds/modules/sleep/ \ 61 cmds/modules/cp/ \ 62 cmds/modules/mv/ \ 63 cmds/modules/mount/ \ 64 cmds/modules/kcon/ \ 65 cmds/builtins/ \ 66 cmds/builtins/exit/\ 67 cmds/builtins/cd/ 68 69 SOURCES = \ 70 cmds/modules/help/help.c \ 71 cmds/modules/mkdir/mkdir.c \ 72 cmds/modules/rm/rm.c \ 73 cmds/modules/bdd/bdd.c \ 74 cmds/modules/cat/cat.c \ 75 cmds/modules/touch/touch.c \ 76 cmds/modules/ls/ls.c \ 77 cmds/modules/pwd/pwd.c \ 78 cmds/modules/sleep/sleep.c \ 79 cmds/modules/cp/cp.c \ 80 cmds/modules/mv/mv.c \ 81 cmds/modules/mount/mount.c \ 82 cmds/modules/kcon/kcon.c \ 83 cmds/builtins/exit/exit.c \ 84 cmds/builtins/cd/cd.c \ 85 cmds/mod_cmds.c \ 86 cmds/builtin_cmds.c \ 87 errors.c \ 88 input.c \ 89 util.c \ 90 exec.c \ 91 scli.c 92 93 CFLAGS += -I. -Icmds/ -Icmds/builtins -Icmds/modules 94 95 OBJECTS = $(SOURCES:.c=.o) 96 97 # For easy cleaning, *.o is already handled 98 CLEANDIRS := $(addsuffix *~,$(SUBDIRS)) 99 CLEANDIRS += $(addsuffix *.bak,$(SUBDIRS)) 100 CLEANDIRS += $(addsuffix *.tmp,$(SUBDIRS)) 101 CLEANDIRS += $(addsuffix *.out,$(SUBDIRS)) 102 CLEANDIRS += $(addsuffix *.d,$(SUBDIRS)) 103 CLEANDIRS += $(addsuffix *.gch,$(SUBDIRS) ) 104 105 %.o: %.S 106 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 107 108 %.o: %.s 109 $(AS) $(AFLAGS) $< -o $@ 110 111 %.o: %.c 112 $(CC) $(CFLAGS) $(INC) -c $< -o $@ 113 @$(CC) -M $(CFLAGS) $(INC) $*.c > $*.d 114 115 $(PROGRAM): $(OBJECTS) $(LIBS) 116 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(PROGRAM).map 117 118 # Everything else is a phony target 119 .PHONY: all clean distclean depend 120 121 all: $(PROGRAM) $(PROGRAM).disasm 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 122 37 123 38 clean: 124 @-rm -f $(OBJECTS) 125 @-rm -f $(PROGRAM) 126 @-rm -f $(PROGRAM).map 127 @-rm -f $(PROGRAM).disasm 128 @-rm -f $(CLEANDIRS) 129 130 depend: 131 @echo '' 132 133 $(PROGRAM).disasm: $(PROGRAM) 134 $(OBJDUMP) -d $< > $@ 135 136 distclean: clean 137 138 # Do not delete - dependencies 139 -include $(OBJECTS:.o=.d) 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/bdsh/scli.c
r5f678b1c r5a4fef9 61 61 usr->line = (char *) NULL; 62 62 usr->name = "root"; 63 usr->home = "/";64 63 usr->cwd = (char *) NULL; 65 64 usr->prompt = (char *) NULL; 66 chdir(usr->home);67 65 usr->lasterr = 0; 68 66 return (int) cli_set_prompt(usr); -
uspace/app/bdsh/scli.h
r5f678b1c r5a4fef9 7 7 typedef struct { 8 8 char *name; 9 char *home;10 9 char *line; 11 10 char *cwd; -
uspace/app/edit/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 CFLAGS += -I../../.. 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = edit 44 SOURCES = \ 45 edit.c \ 46 sheet.c 47 48 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 49 50 .PHONY: all clean depend 51 52 all: $(OUTPUT) $(OUTPUT).disasm 53 54 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 55 37 56 38 clean: 57 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 58 59 depend: 60 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 61 62 $(OUTPUT): $(OBJECTS) $(LIBS) 63 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 64 65 $(OUTPUT).disasm: $(OUTPUT) 66 $(OBJDUMP) -d $< > $@ 67 68 %.o: %.S 69 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 70 71 %.o: %.s 72 $(AS) $(AFLAGS) $< -o $@ 73 74 %.o: %.c 75 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/edit/edit.c
r5f678b1c r5a4fef9 665 665 666 666 sheet_get_num_rows(&doc.sh, &num_rows); 667 coord.row = num_rows ;667 coord.row = num_rows + 1; 668 668 coord.column = 1; 669 669 -
uspace/app/getvc/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2009 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 include ../../../version30 include Makefile.common 30 31 31 ## Setup toolchain 32 # 32 .PHONY: all clean 33 33 34 LIBC_PREFIX = ../../lib/libc 35 SOFTINT_PREFIX = ../../lib/softint 36 37 include $(LIBC_PREFIX)/Makefile.toolchain 38 39 LIBS = $(LIBC_PREFIX)/libc.a 40 DEFS += -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" 41 42 ## Sources 43 # 44 45 OUTPUT = getvc 46 SOURCES = \ 47 getvc.c \ 48 version.c 49 50 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 51 52 .PHONY: all clean depend 53 54 all: $(OUTPUT) $(OUTPUT).disasm 55 56 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../version $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 57 37 58 38 clean: 59 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 60 61 depend: 62 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 63 64 $(OUTPUT): $(OBJECTS) $(LIBS) 65 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 66 67 $(OUTPUT).disasm: $(OUTPUT) 68 $(OBJDUMP) -d $< > $@ 69 70 %.o: %.S 71 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 72 73 %.o: %.s 74 $(AS) $(AFLAGS) $< -o $@ 75 76 %.o: %.c 77 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/getvc/getvc.c
r5f678b1c r5a4fef9 36 36 37 37 #include <sys/types.h> 38 #include <fcntl.h> 38 39 #include <unistd.h> 39 40 #include <stdio.h> … … 46 47 } 47 48 48 static void closeall(void)49 static void reopen(FILE **stream, int fd, const char *path, int flags, const char *mode) 49 50 { 50 fclose(stdin); 51 fclose(stdout); 52 fclose(stderr); 51 if (fclose(*stream)) 52 return; 53 53 54 close(0); 55 close(1); 56 close(2); 54 *stream = NULL; 55 56 int oldfd = open(path, flags); 57 if (oldfd < 0) 58 return; 59 60 if (oldfd != fd) { 61 if (dup2(oldfd, fd) != fd) 62 return; 63 64 if (close(oldfd)) 65 return; 66 } 67 68 *stream = fdopen(fd, mode); 57 69 } 58 70 59 71 static task_id_t spawn(char *fname) 60 72 { 61 char *arg v[2];73 char *args[2]; 62 74 63 arg v[0] = fname;64 arg v[1] = NULL;75 args[0] = fname; 76 args[1] = NULL; 65 77 66 task_id_t id = task_spawn(fname, arg v);78 task_id_t id = task_spawn(fname, args); 67 79 68 80 if (id == 0) … … 74 86 int main(int argc, char *argv[]) 75 87 { 76 task_exit_t texit;77 int retval;78 79 88 if (argc < 3) { 80 89 usage(); … … 82 91 } 83 92 84 closeall(); 93 reopen(&stdin, 0, argv[1], O_RDONLY, "r"); 94 reopen(&stdout, 1, argv[1], O_WRONLY, "w"); 95 reopen(&stderr, 2, argv[1], O_WRONLY, "w"); 85 96 86 stdin = fopen(argv[1], "r");87 stdout = fopen(argv[1], "w");88 stderr = fopen(argv[1], "w");89 90 97 /* 91 * FIXME: f open() should actually detect that we are opening a console98 * FIXME: fdopen() should actually detect that we are opening a console 92 99 * and it should set line-buffering mode automatically. 93 100 */ 94 101 setvbuf(stdout, NULL, _IOLBF, BUFSIZ); 95 102 96 if ((stdin == NULL) 97 || (stdout == NULL) 98 || (stderr == NULL)) 103 if (stdin == NULL) 99 104 return -2; 105 106 if (stdout == NULL) 107 return -3; 108 109 if (stderr == NULL) 110 return -4; 100 111 101 112 version_print(argv[1]); 102 113 task_id_t id = spawn(argv[2]); 103 task_wait(id, &texit, &retval);104 114 105 return 0; 115 if (id != 0) { 116 task_exit_t texit; 117 int retval; 118 task_wait(id, &texit, &retval); 119 120 return 0; 121 } 122 123 return -5; 106 124 } 107 125 -
uspace/app/init/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 CFLAGS += -I../../.. 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = init 44 SOURCES = \ 45 init.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/init/init.c
r5f678b1c r5a4fef9 48 48 #include <string.h> 49 49 #include <devmap.h> 50 #include <config.h>51 50 #include "init.h" 52 51 -
uspace/app/klog/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 LIBS = $(LIBC_PREFIX)/libc.a 38 39 ## Sources 40 # 41 42 OUTPUT = klog 43 SOURCES = \ 44 klog.c 45 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/tester/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 CFLAGS += -I../../srv/kbd/include 38 39 LIBS = $(LIBC_PREFIX)/libc.a 40 41 ## Sources 42 # 43 44 OUTPUT = tester 45 SOURCES = tester.c \ 46 thread/thread1.c \ 47 print/print1.c \ 48 print/print2.c \ 49 print/print3.c \ 50 print/print4.c \ 51 console/console1.c \ 52 stdio/stdio1.c \ 53 stdio/stdio2.c \ 54 fault/fault1.c \ 55 fault/fault2.c \ 56 vfs/vfs1.c \ 57 ipc/ping_pong.c \ 58 ipc/register.c \ 59 ipc/connect.c \ 60 loop/loop1.c \ 61 mm/malloc1.c 62 63 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 64 65 .PHONY: all clean depend disasm 66 67 all: $(OUTPUT) $(OUTPUT).disasm 68 69 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 70 37 71 38 clean: 72 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 73 74 depend: 75 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 76 77 $(OUTPUT): $(OBJECTS) $(LIBS) 78 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 79 80 $(OUTPUT).disasm: $(OUTPUT) 81 $(OBJDUMP) -d $< > $@ 82 83 %.o: %.S 84 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 85 86 %.o: %.s 87 $(AS) $(AFLAGS) $< -o $@ 88 89 %.o: %.c 90 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/tetris/Makefile
r5f678b1c r5a4fef9 1 LIBC_PREFIX = ../../lib/libc 2 SOFTINT_PREFIX = ../../lib/softint 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions 8 # are met: 9 # 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. 17 # 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. 28 # 3 29 4 include $(LIBC_PREFIX)/Makefile.toolchain30 include Makefile.common 5 31 6 LIBS = $(LIBC_PREFIX)/libc.a 32 .PHONY: all clean 7 33 8 OUTPUT = tetris 9 SOURCES = shapes.c scores.c input.c tetris.c screen.c 10 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 11 12 .PHONY: all clean depend 13 14 all: $(OUTPUT) $(OUTPUT).disasm 15 16 -include Makefile.depend 17 18 depend: 19 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 20 21 $(OUTPUT): $(OBJECTS) $(LIBS) 22 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 23 37 24 38 clean: 25 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend *.o 26 27 $(OUTPUT).disasm: $(OUTPUT) 28 $(OBJDUMP) -d $< > $@ 29 30 %.o: %.S 31 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 32 33 %.o: %.s 34 $(AS) $(AFLAGS) $< -o $@ 35 36 %.o: %.c 37 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/app/trace/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 CFLAGS += -I../../srv/kbd/include 38 39 LIBS = $(LIBC_PREFIX)/libc.a 40 41 ## Sources 42 # 43 44 OUTPUT = trace 45 SOURCES = trace.c \ 46 syscalls.c \ 47 ipcp.c \ 48 ipc_desc.c \ 49 proto.c \ 50 errors.c 51 52 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 53 54 .PHONY: all clean depend 55 56 all: $(OUTPUT) $(OUTPUT).disasm 57 58 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 59 37 60 38 clean: 61 -rm -f $(OUTPUT) $(OBJECTS) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend 62 63 depend: 64 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 65 66 $(OUTPUT): $(OBJECTS) $(LIBS) 67 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 68 69 $(OUTPUT).disasm: $(OUTPUT) 70 $(OBJDUMP) -d $< > $@ 71 72 %.o: %.S 73 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 74 75 %.o: %.s 76 $(AS) $(AFLAGS) $< -o $@ 77 78 %.o: %.c 79 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/lib/libblock/Makefile
r5f678b1c r5a4fef9 28 28 # 29 29 30 ## Common compiler flags 31 # 30 include Makefile.common 32 31 33 LIBC_PREFIX = ../libc 32 .PHONY: all clean 34 33 35 ## Setup toolchain 36 # 37 38 include $(LIBC_PREFIX)/Makefile.toolchain 39 40 CFLAGS += -Iinclude 41 42 ## Sources 43 # 44 45 SOURCES = \ 46 libblock.c 47 48 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 49 50 .PHONY: all clean depend 51 52 all: libblock.a 53 54 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBC_PREFIX)/libc.a 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 55 37 56 38 clean: 57 -rm -f libblock.a Makefile.depend39 rm -f $(DEPEND) $(DEPEND_PREV) $(LIBBLOCK) 58 40 find . -name '*.o' -follow -exec rm \{\} \; 59 60 depend:61 -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null62 63 libblock.a: depend $(OBJECTS)64 $(AR) rc libblock.a $(OBJECTS)65 66 %.o: %.c67 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ -
uspace/lib/libc/Makefile
r5f678b1c r5a4fef9 27 27 # 28 28 29 ## Common compiler flags 30 # 29 include Makefile.common 31 30 32 LIBC_PREFIX = $(shell pwd) 33 SOFTINT_PREFIX = ../softint 31 .PHONY: all clean 34 32 35 36 ## Setup toolchain 37 # 38 39 include $(LIBC_PREFIX)/Makefile.toolchain 40 41 42 ## Sources 43 # 44 45 GENERIC_SOURCES = \ 46 generic/libc.c \ 47 generic/ddi.c \ 48 generic/as.c \ 49 generic/cap.c \ 50 generic/devmap.c \ 51 generic/event.c \ 52 generic/errno.c \ 53 generic/mem.c \ 54 generic/string.c \ 55 generic/fibril.c \ 56 generic/fibril_sync.c \ 57 generic/pcb.c \ 58 generic/smc.c \ 59 generic/thread.c \ 60 generic/tls.c \ 61 generic/task.c \ 62 generic/futex.c \ 63 generic/io/asprintf.c \ 64 generic/io/io.c \ 65 generic/io/printf.c \ 66 generic/io/klog.c \ 67 generic/io/snprintf.c \ 68 generic/io/vprintf.c \ 69 generic/io/vsnprintf.c \ 70 generic/io/printf_core.c \ 71 generic/io/console.c \ 72 generic/malloc.c \ 73 generic/sysinfo.c \ 74 generic/ipc.c \ 75 generic/async.c \ 76 generic/loader.c \ 77 generic/getopt.c \ 78 generic/adt/list.o \ 79 generic/adt/hash_table.o \ 80 generic/time.c \ 81 generic/err.c \ 82 generic/stdlib.c \ 83 generic/mman.c \ 84 generic/udebug.c \ 85 generic/vfs/vfs.c \ 86 generic/vfs/canonify.c 87 88 ARCH_SOURCES += \ 89 arch/$(UARCH)/src/entry.s \ 90 arch/$(UARCH)/src/thread_entry.s 91 92 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 93 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 94 OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) 95 96 .PHONY: all clean depend kerninc 97 98 all: libc.a 99 100 -include Makefile.depend 33 all: ../../../Makefile.config ../../../config.h ../../../config.defs 34 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 35 $(MAKE) -f Makefile.build 101 36 102 37 clean: 103 -rm -f include/kernel include/arch include/libarch libc.a arch/$(UARCH)/_link.ld Makefile.depend 104 find generic/ arch/$(UARCH)/ -name '*.o' -follow -exec rm \{\} \; 105 106 depend: kerninc arch/$(UARCH)/_link.ld 107 -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null 108 109 libc.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 110 $(AR) rc libc.a $(LIBS) $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 111 112 kerninc: 113 ln -sfn ../../../../kernel/generic/include include/kernel 114 ln -sfn kernel/arch include/arch 115 ln -sfn ../arch/$(UARCH)/include include/libarch 116 117 arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in 118 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@ 119 120 %.o: %.S 121 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 122 123 %.o: %.s 124 $(AS) $(AFLAGS) $< -o $@ 125 126 %.o: %.c 127 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 38 rm -f $(DEPEND) $(DEPEND_PREV) $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(LIBC) arch/*/_link.ld 39 find generic/ arch/*/ -name '*.o' -follow -exec rm \{\} \; -
uspace/lib/libc/Makefile.toolchain
r5f678b1c r5a4fef9 59 59 # 60 60 61 -include $(LIBC_PREFIX)/../../../Makefile.config62 -include $(LIBC_PREFIX)/../../../config.defs63 -include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.inc61 include $(LIBC_PREFIX)/../../../Makefile.config 62 include $(LIBC_PREFIX)/../../../config.defs 63 include $(LIBC_PREFIX)/arch/$(UARCH)/Makefile.inc 64 64 65 65 ## Simple detection of the host system -
uspace/lib/libc/arch/ia32/include/syscall.h
r5f678b1c r5a4fef9 40 40 #include <kernel/syscall/syscall.h> 41 41 42 #define __syscall0 __syscall_ sysenter43 #define __syscall1 __syscall_ sysenter44 #define __syscall2 __syscall_ sysenter45 #define __syscall3 __syscall_ sysenter46 #define __syscall4 __syscall_ sysenter47 #define __syscall5 __syscall_ int48 #define __syscall6 __syscall_ int42 #define __syscall0 __syscall_fast_func 43 #define __syscall1 __syscall_fast_func 44 #define __syscall2 __syscall_fast_func 45 #define __syscall3 __syscall_fast_func 46 #define __syscall4 __syscall_fast_func 47 #define __syscall5 __syscall_slow 48 #define __syscall6 __syscall_slow 49 49 50 50 extern sysarg_t 51 __syscall_sysenter(const sysarg_t,const sysarg_t, const sysarg_t, const sysarg_t,52 const sysarg_t, const sysarg_t, const syscall_t);51 (* __syscall_fast_func)(const sysarg_t, const sysarg_t, const sysarg_t, 52 const sysarg_t, const sysarg_t, const sysarg_t, const syscall_t); 53 53 54 54 extern sysarg_t 55 __syscall_ int(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t,56 const sysarg_t, const sysarg_t, const syscall_t);55 __syscall_slow(const sysarg_t, const sysarg_t, const sysarg_t, const sysarg_t, 56 const sysarg_t, const sysarg_t, const syscall_t); 57 57 58 58 #endif -
uspace/lib/libc/arch/ia32/src/entry.s
r5f678b1c r5a4fef9 27 27 # 28 28 29 INTEL_CPUID_STANDARD = 1 30 INTEL_SEP = 11 31 29 32 .section .init, "ax" 30 33 … … 35 38 ## User-space task entry point 36 39 # 37 # %e bxcontains the PCB pointer40 # %edi contains the PCB pointer 38 41 # 39 42 __entry: … … 44 47 # Do not set %gs, it contains descriptor that can see TLS 45 48 49 # Detect the mechanism used for making syscalls 50 movl $(INTEL_CPUID_STANDARD), %eax 51 cpuid 52 bt $(INTEL_SEP), %edx 53 jnc 0f 54 leal __syscall_fast_func, %eax 55 movl $__syscall_fast, (%eax) 56 0: 57 46 58 # Pass the PCB pointer to __main as the first argument 47 pushl %e bx59 pushl %edi 48 60 call __main 49 61 -
uspace/lib/libc/arch/ia32/src/syscall.S
r5f678b1c r5a4fef9 27 27 # 28 28 29 .data 30 31 .global __syscall_fast_func 32 __syscall_fast_func: 33 .long __syscall_slow 34 29 35 .text 30 36 … … 35 41 * could benefit from this and not save unused registers on the stack. 36 42 */ 37 .global __syscall_ int38 __syscall_ int:43 .global __syscall_slow 44 __syscall_slow: 39 45 pushl %ebx 40 46 pushl %esi … … 64 70 * segment, otherwise the SYSENTER wouldn't work in the first place). 65 71 */ 66 .global __syscall_ sysenter67 __syscall_ sysenter:72 .global __syscall_fast 73 __syscall_fast: 68 74 pushl %ebx 69 75 pushl %esi -
uspace/lib/libc/generic/io/klog.c
r5f678b1c r5a4fef9 42 42 size_t klog_write(const void *buf, size_t size) 43 43 { 44 return (size_t) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, size); 44 ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, size); 45 46 if (ret >= 0) 47 return (size_t) ret; 48 49 return 0; 45 50 } 46 51 -
uspace/lib/libc/generic/libc.c
r5f678b1c r5a4fef9 83 83 argv = __pcb->argv; 84 84 __stdio_init(__pcb->filc, __pcb->filv); 85 (void) chdir(__pcb->cwd); 85 86 } 86 87 -
uspace/lib/libc/generic/loader.c
r5f678b1c r5a4fef9 101 101 } 102 102 103 /** Set current working directory for the loaded task. 104 * 105 * Sets the current working directory for the loaded task. 106 * 107 * @param ldr Loader connection structure. 108 * 109 * @return Zero on success or negative error code. 110 * 111 */ 112 int loader_set_cwd(loader_t *ldr) 113 { 114 char *cwd; 115 size_t len; 116 117 cwd = (char *) malloc(MAX_PATH_LEN + 1); 118 if (!cwd) 119 return ENOMEM; 120 if (!getcwd(cwd, MAX_PATH_LEN + 1)) 121 str_cpy(cwd, MAX_PATH_LEN + 1, "/"); 122 len = str_length(cwd); 123 124 ipc_call_t answer; 125 aid_t req = async_send_0(ldr->phone_id, LOADER_SET_CWD, &answer); 126 int rc = async_data_write_start(ldr->phone_id, cwd, len); 127 free(cwd); 128 if (rc != EOK) { 129 async_wait_for(req, NULL); 130 return rc; 131 } 132 133 ipcarg_t retval; 134 async_wait_for(req, &retval); 135 return (int) retval; 136 } 137 103 138 /** Set pathname of the program to load. 104 139 * -
uspace/lib/libc/generic/malloc.c
r5f678b1c r5a4fef9 353 353 } 354 354 355 void *calloc(const size_t nmemb, const size_t size) 356 { 357 void *block = malloc(nmemb * size); 358 if (block == NULL) 359 return NULL; 360 361 memset(block, 0, nmemb * size); 362 return block; 363 } 364 355 365 void *malloc(const size_t size) 356 366 { -
uspace/lib/libc/generic/task.c
r5f678b1c r5a4fef9 89 89 goto error; 90 90 91 /* Send spawner's current working directory. */ 92 rc = loader_set_cwd(ldr); 93 if (rc != EOK) 94 goto error; 95 91 96 /* Send program pathname. */ 92 97 rc = loader_set_pathname(ldr, path); … … 98 103 if (rc != EOK) 99 104 goto error; 100 101 105 102 106 /* Send default files */ -
uspace/lib/libc/generic/vfs/vfs.c
r5f678b1c r5a4fef9 57 57 static futex_t cwd_futex = FUTEX_INITIALIZER; 58 58 59 DIR *cwd_dir = NULL;60 char *cwd_path = NULL;61 s ize_t cwd_size = 0;59 static int cwd_fd = -1; 60 static char *cwd_path = NULL; 61 static size_t cwd_size = 0; 62 62 63 63 char *absolutize(const char *path, size_t *retlen) … … 197 197 } 198 198 199 static int _open(const char *path, int lflag, int oflag, ...) 200 { 201 ipcarg_t rc; 199 static int open_internal(const char *abs, size_t abs_size, int lflag, int oflag) 200 { 201 futex_down(&vfs_phone_futex); 202 async_serialize_start(); 203 vfs_connect(); 204 202 205 ipc_call_t answer; 203 aid_t req; 204 205 size_t pa_size; 206 char *pa = absolutize(path, &pa_size); 207 if (!pa) 208 return ENOMEM; 209 210 futex_down(&vfs_phone_futex); 211 async_serialize_start(); 212 vfs_connect(); 213 214 req = async_send_3(vfs_phone, VFS_IN_OPEN, lflag, oflag, 0, &answer); 215 rc = async_data_write_start(vfs_phone, pa, pa_size); 206 aid_t req = async_send_3(vfs_phone, VFS_IN_OPEN, lflag, oflag, 0, &answer); 207 ipcarg_t rc = async_data_write_start(vfs_phone, abs, abs_size); 208 216 209 if (rc != EOK) { 217 210 ipcarg_t rc_orig; 218 219 async_wait_for(req, &rc_orig);220 async_serialize_end(); 221 futex_up(&vfs_phone_futex); 222 free(pa);223 if (rc_orig == EOK) 224 return (int) rc; 225 else 226 return (int) rc_orig; 227 } 228 async_wait_for(req, &rc);229 async_ serialize_end();230 futex_up(&vfs_phone_futex);231 f ree(pa);211 async_wait_for(req, &rc_orig); 212 213 async_serialize_end(); 214 futex_up(&vfs_phone_futex); 215 216 if (rc_orig == EOK) 217 return (int) rc; 218 else 219 return (int) rc_orig; 220 } 221 222 async_wait_for(req, &rc); 223 async_serialize_end(); 224 futex_up(&vfs_phone_futex); 232 225 233 226 if (rc != EOK) … … 239 232 int open(const char *path, int oflag, ...) 240 233 { 241 return _open(path, L_FILE, oflag); 234 size_t abs_size; 235 char *abs = absolutize(path, &abs_size); 236 if (!abs) 237 return ENOMEM; 238 239 int ret = open_internal(abs, abs_size, L_FILE, oflag); 240 free(abs); 241 242 return ret; 242 243 } 243 244 … … 471 472 if (!dirp) 472 473 return NULL; 473 dirp->fd = _open(dirname, L_DIRECTORY, 0); 474 if (dirp->fd < 0) { 474 475 size_t abs_size; 476 char *abs = absolutize(dirname, &abs_size); 477 if (!abs) { 478 free(dirp); 479 return ENOMEM; 480 } 481 482 int ret = open_internal(abs, abs_size, L_DIRECTORY, 0); 483 free(abs); 484 485 if (ret < 0) { 475 486 free(dirp); 476 487 return NULL; 477 488 } 489 490 dirp->fd = ret; 478 491 return dirp; 479 492 } … … 636 649 int chdir(const char *path) 637 650 { 638 size_t pa_size; 639 char *pa = absolutize(path, &pa_size); 640 if (!pa) 641 return ENOMEM; 642 643 DIR *d = opendir(pa); 644 if (!d) { 645 free(pa); 651 size_t abs_size; 652 char *abs = absolutize(path, &abs_size); 653 if (!abs) 654 return ENOMEM; 655 656 int fd = open_internal(abs, abs_size, L_DIRECTORY, O_DESC); 657 658 if (fd < 0) { 659 free(abs); 646 660 return ENOENT; 647 661 } 648 662 649 663 futex_down(&cwd_futex); 650 if (cwd_dir) { 651 closedir(cwd_dir); 652 cwd_dir = NULL; 653 free(cwd_path); 654 cwd_path = NULL; 655 cwd_size = 0; 656 } 657 cwd_dir = d; 658 cwd_path = pa; 659 cwd_size = pa_size; 664 665 if (cwd_fd >= 0) 666 close(cwd_fd); 667 668 669 if (cwd_path) 670 free(cwd_path); 671 672 cwd_fd = fd; 673 cwd_path = abs; 674 cwd_size = abs_size; 675 660 676 futex_up(&cwd_futex); 661 677 return EOK; … … 664 680 char *getcwd(char *buf, size_t size) 665 681 { 666 if ( !size)682 if (size == 0) 667 683 return NULL; 684 668 685 futex_down(&cwd_futex); 669 if (size < cwd_size + 1) { 686 687 if ((cwd_size == 0) || (size < cwd_size + 1)) { 670 688 futex_up(&cwd_futex); 671 689 return NULL; 672 690 } 691 673 692 str_cpy(buf, size, cwd_path); 674 693 futex_up(&cwd_futex); 694 675 695 return buf; 676 696 } … … 705 725 } 706 726 727 int dup2(int oldfd, int newfd) 728 { 729 futex_down(&vfs_phone_futex); 730 async_serialize_start(); 731 vfs_connect(); 732 733 ipcarg_t ret; 734 ipcarg_t rc = async_req_2_1(vfs_phone, VFS_IN_DUP, oldfd, newfd, &ret); 735 736 async_serialize_end(); 737 futex_up(&vfs_phone_futex); 738 739 if (rc == EOK) 740 return (int) ret; 741 742 return (int) rc; 743 } 744 707 745 /** @} 708 746 */ -
uspace/lib/libc/include/fcntl.h
r5f678b1c r5a4fef9 43 43 #define O_RDWR 32 44 44 #define O_WRONLY 64 45 #define O_DESC 128 45 46 46 47 extern int open(const char *, int, ...); -
uspace/lib/libc/include/ipc/loader.h
r5f678b1c r5a4fef9 41 41 LOADER_HELLO = IPC_FIRST_USER_METHOD, 42 42 LOADER_GET_TASKID, 43 LOADER_SET_CWD, 43 44 LOADER_SET_PATHNAME, 44 45 LOADER_SET_ARGS, -
uspace/lib/libc/include/ipc/vfs.h
r5f678b1c r5a4fef9 73 73 VFS_IN_UNLINK, 74 74 VFS_IN_RENAME, 75 VFS_IN_STAT 75 VFS_IN_STAT, 76 VFS_IN_DUP 76 77 } vfs_in_request_t; 77 78 -
uspace/lib/libc/include/loader/loader.h
r5f678b1c r5a4fef9 49 49 extern loader_t *loader_connect(void); 50 50 extern int loader_get_task_id(loader_t *, task_id_t *); 51 extern int loader_set_cwd(loader_t *); 51 52 extern int loader_set_pathname(loader_t *, const char *); 52 53 extern int loader_set_args(loader_t *, char *const[]); -
uspace/lib/libc/include/loader/pcb.h
r5f678b1c r5a4fef9 52 52 /** Program entry point. */ 53 53 entry_point_t entry; 54 55 /** Current working directory. */ 56 char *cwd; 54 57 55 58 /** Number of command-line arguments. */ -
uspace/lib/libc/include/malloc.h
r5f678b1c r5a4fef9 42 42 43 43 extern void *malloc(const size_t size); 44 extern void *calloc(const size_t nmemb, const size_t size); 44 45 extern void *memalign(const size_t align, const size_t size); 45 46 extern void *realloc(const void *addr, const size_t size); -
uspace/lib/libc/include/unistd.h
r5f678b1c r5a4fef9 51 51 #endif 52 52 53 extern int dup2(int oldfd, int newfd); 54 53 55 extern ssize_t write(int, const void *, size_t); 54 56 extern ssize_t read(int, void *, size_t); -
uspace/lib/libfs/Makefile
r5f678b1c r5a4fef9 28 28 # 29 29 30 ## Common compiler flags 31 # 30 include Makefile.common 32 31 33 LIBC_PREFIX = ../libc 32 .PHONY: all clean 34 33 35 ## Setup toolchain 36 # 37 38 include $(LIBC_PREFIX)/Makefile.toolchain 39 40 CFLAGS += -Iinclude 41 42 ## Sources 43 # 44 45 SOURCES = \ 46 libfs.c 47 48 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 49 50 .PHONY: all clean depend 51 52 all: libfs.a 53 54 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBC_PREFIX)/libc.a 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 55 37 56 38 clean: 57 -rm -f libfs.a Makefile.depend39 rm -f $(DEPEND) $(DEPEND_PREV) $(LIBFS) 58 40 find . -name '*.o' -follow -exec rm \{\} \; 59 60 depend:61 -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > Makefile.depend 2> /dev/null62 63 libfs.a: depend $(OBJECTS)64 $(AR) rc libfs.a $(OBJECTS)65 66 %.o: %.c67 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ -
uspace/lib/libfs/libfs.c
r5f678b1c r5a4fef9 531 531 } 532 532 533 ipc_answer_ 5(rid, EOK, fs_handle, dev_handle, index, ops->size_get(fn),534 ops->lnkcnt_get(fn));533 ipc_answer_3(rid, EOK, ops->size_get(fn), ops->lnkcnt_get(fn), 534 (ops->is_file(fn) ? L_FILE : 0) | (ops->is_directory(fn) ? L_DIRECTORY : 0)); 535 535 536 536 (void) ops->node_put(fn); -
uspace/lib/softfloat/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Common compiler flags 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../libc 32 .PHONY: all clean 33 33 34 ## Setup toolchain 35 # 36 37 include $(LIBC_PREFIX)/Makefile.toolchain 38 39 CFLAGS += -Iinclude -Iarch/$(UARCH)/include/ 40 41 ## Sources 42 # 43 44 GENERIC_SOURCES = \ 45 generic/add.c \ 46 generic/common.c \ 47 generic/comparison.c \ 48 generic/conversion.c \ 49 generic/div.c \ 50 generic/mul.c \ 51 generic/other.c \ 52 generic/softfloat.c \ 53 generic/sub.c 54 55 ARCH_SOURCES = 56 57 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 58 59 .PHONY: all clean depend 60 61 all: libsoftfloat.a 62 63 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBC_PREFIX)/libc.a 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 64 37 65 38 clean: 66 -rm -f libsoftfloat.a Makefile.depend 67 find generic/ -name '*.o' -follow -exec rm \{\} \; 68 69 depend: 70 -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null 71 72 libsoftfloat.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 73 $(AR) rc libsoftfloat.a $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 74 75 %.o: %.S 76 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 77 78 %.o: %.s 79 $(AS) $(AFLAGS) $< -o $@ 80 81 %.o: %.c 82 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(LIBSOFTFLOAT) 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/lib/softint/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Common compiler flags 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../libc 32 .PHONY: all clean 33 33 34 ## Setup toolchain 35 # 36 37 include $(LIBC_PREFIX)/Makefile.toolchain 38 39 CFLAGS += -Iinclude 40 41 ## Sources 42 # 43 44 ARCH_SOURCES = 45 46 GENERIC_SOURCES = \ 47 generic/division.c\ 48 generic/multiplication.c 49 50 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 51 52 .PHONY: all clean depend 53 54 all: libsoftint.a 55 56 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBC_PREFIX)/libc.a 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 57 37 58 38 clean: 59 -rm -f libsoftint.a Makefile.depend 60 find generic/ -name '*.o' -follow -exec rm \{\} \; 61 62 depend: 63 -makedepend -f - -- $(DEPEMD_DEFS) $(CFLAGS) -- $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null 64 65 libsoftint.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 66 $(AR) rc libsoftint.a $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 67 68 %.o: %.S 69 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 70 71 %.o: %.s 72 $(AS) $(AFLAGS) $< -o $@ 73 74 %.o: %.c 75 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(LIBSOFTINT) 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/bd/ata_bd/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = ata_bd 44 SOURCES = \ 45 ata_bd.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/bd/file_bd/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = file_bd 44 SOURCES = \ 45 file_bd.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/bd/gxe_bd/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = gxe_bd 44 SOURCES = \ 45 gxe_bd.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/bd/rd/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = rd 44 SOURCES = \ 45 rd.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/cir/fhc/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = fhc 44 SOURCES = \ 45 fhc.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/cir/obio/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = obio 44 SOURCES = \ 45 obio.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 54 37 55 38 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 57 58 depend: 59 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 64 $(OUTPUT).disasm: $(OUTPUT) 65 $(OBJDUMP) -d $< > $@ 66 67 %.o: %.S 68 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 69 70 %.o: %.s 71 $(AS) $(AFLAGS) $< -o $@ 72 73 %.o: %.c 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/console/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 CFLAGS += -I. 38 39 LIBS = $(LIBC_PREFIX)/libc.a 40 41 ## Sources 42 # 43 44 OUTPUT = console 45 46 GENERIC_SOURCES = \ 47 console.c \ 48 screenbuffer.c \ 49 keybuffer.c \ 50 gcons.c 51 52 IMAGES = \ 53 gfx/helenos.ppm \ 54 gfx/nameic.ppm \ 55 gfx/cons_selected.ppm \ 56 gfx/cons_idle.ppm \ 57 gfx/cons_has_data.ppm \ 58 gfx/cons_kernel.ppm \ 59 gfx/anim_1.ppm \ 60 gfx/anim_2.ppm \ 61 gfx/anim_3.ppm \ 62 gfx/anim_4.ppm 63 64 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) \ 65 $(addsuffix .o,$(basename $(IMAGES))) 66 67 OBJECTS := $(GENERIC_OBJECTS) 68 69 .PHONY: all clean depend 70 71 all: $(OUTPUT) $(OUTPUT).disasm 72 73 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 74 37 75 38 clean: 76 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 77 78 depend: 79 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 80 81 $(OUTPUT): $(OBJECTS) $(LIBS) 82 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 83 84 $(OUTPUT).disasm: $(OUTPUT) 85 $(OBJDUMP) -d $< > $@ 86 87 %.o: %.S 88 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 89 90 %.o: %.s 91 $(AS) $(AFLAGS) $< -o $@ 92 93 %.o: %.c 94 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 95 96 %.o: %.ppm 97 $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) $< $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/console/console.c
r5f678b1c r5a4fef9 40 40 #include <ipc/services.h> 41 41 #include <errno.h> 42 #include <keybuffer.h>43 42 #include <ipc/console.h> 44 43 #include <unistd.h> … … 55 54 #include "console.h" 56 55 #include "gcons.h" 56 #include "keybuffer.h" 57 57 #include "screenbuffer.h" 58 58 -
uspace/srv/console/keybuffer.c
r5f678b1c r5a4fef9 35 35 */ 36 36 37 #include <keybuffer.h>38 37 #include <futex.h> 38 #include "keybuffer.h" 39 39 40 40 atomic_t keybuffer_futex = FUTEX_INITIALIZER; -
uspace/srv/console/screenbuffer.c
r5f678b1c r5a4fef9 33 33 */ 34 34 35 #include <screenbuffer.h>36 35 #include <io/style.h> 37 36 #include <malloc.h> 38 37 #include <unistd.h> 38 #include "screenbuffer.h" 39 39 40 40 /** Store one character to screenbuffer. -
uspace/srv/devmap/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 LIBS = $(LIBC_PREFIX)/libc.a 38 39 ## Sources 40 # 41 42 OUTPUT = devmap 43 SOURCES = \ 44 devmap.c 45 46 CFLAGS += -D$(UARCH) 47 48 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 49 50 .PHONY: all clean depend 51 52 all: $(OUTPUT) $(OUTPUT).disasm 53 54 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 55 37 56 38 clean: 57 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 58 59 depend: 60 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 61 62 $(OUTPUT): $(OBJECTS) $(LIBS) 63 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 64 65 $(OUTPUT).disasm: $(OUTPUT) 66 $(OBJDUMP) -d $< > $@ 67 68 %.o: %.S 69 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 70 71 %.o: %.s 72 $(AS) $(AFLAGS) $< -o $@ 73 74 %.o: %.c 75 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/fb/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 LIBS = $(LIBC_PREFIX)/libc.a 38 39 ## Sources 40 # 41 42 OUTPUT = fb 43 SOURCES = \ 44 main.c \ 45 ppm.c 46 47 ifneq ($(UARCH),ia64) 48 SOURCES += fb.c \ 49 font-8x16.c 50 CFLAGS += -DFB_ENABLED 51 endif 52 53 ifeq ($(UARCH),ia32) 54 SOURCES += ega.c 55 CFLAGS += -DEGA_ENABLED 56 endif 57 58 ifeq ($(UARCH),ia64) 59 SOURCES += ega.c \ 60 ski.c \ 61 serial_console.c 62 CFLAGS += -DSKI_ENABLED 63 CFLAGS += -DEGA_ENABLED 64 endif 65 66 ifeq ($(UARCH),amd64) 67 SOURCES += ega.c 68 CFLAGS += -DEGA_ENABLED 69 endif 70 71 ifeq ($(UARCH),mips32) 72 SOURCES += msim.c \ 73 serial_console.c 74 CFLAGS += -DMSIM_ENABLED 75 endif 76 77 ifeq ($(UARCH),sparc64) 78 SOURCES += sgcn.c \ 79 serial_console.c 80 CFLAGS += -DSGCN_ENABLED 81 endif 82 83 CFLAGS += -D$(UARCH) 84 85 86 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 87 88 .PHONY: all clean depend 89 90 all: $(OUTPUT) $(OUTPUT).disasm 91 92 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 93 37 94 38 clean: 95 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 96 97 depend: 98 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 99 100 $(OUTPUT): $(OBJECTS) $(LIBS) 101 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 102 103 $(OUTPUT).disasm: $(OUTPUT) 104 $(OBJDUMP) -d $< > $@ 105 106 %.o: %.S 107 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 108 109 %.o: %.s 110 $(AS) $(AFLAGS) $< -o $@ 111 112 %.o: %.c 113 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/fs/devfs/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../../lib/libc 33 LIBFS_PREFIX = ../../../lib/libfs 34 SOFTINT_PREFIX = ../../../lib/softint 32 .PHONY: all clean 35 33 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 CFLAGS += -I $(LIBFS_PREFIX) 39 40 LIBS = \ 41 $(LIBFS_PREFIX)/libfs.a \ 42 $(LIBC_PREFIX)/libc.a 43 44 ## Sources 45 # 46 47 OUTPUT = devfs 48 SOURCES = \ 49 devfs.c \ 50 devfs_ops.c 51 52 53 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 54 55 .PHONY: all clean depend 56 57 all: $(OUTPUT) $(OUTPUT).disasm 58 59 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 60 37 61 38 clean: 62 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 63 64 depend: 65 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 66 67 $(OUTPUT): $(OBJECTS) $(LIBS) 68 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 69 70 $(OUTPUT).disasm: $(OUTPUT) 71 $(OBJDUMP) -d $< > $@ 72 73 %.o: %.S 74 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 75 76 %.o: %.s 77 $(AS) $(AFLAGS) $< -o $@ 78 79 %.o: %.c 80 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/fs/fat/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../../lib/libc 33 LIBFS_PREFIX = ../../../lib/libfs 34 LIBBLOCK_PREFIX = ../../../lib/libblock 35 SOFTINT_PREFIX = ../../../lib/softint 32 .PHONY: all clean 36 33 37 include $(LIBC_PREFIX)/Makefile.toolchain 38 39 CFLAGS += -I $(LIBFS_PREFIX) -I $(LIBBLOCK_PREFIX) 40 41 LIBS = \ 42 $(LIBFS_PREFIX)/libfs.a \ 43 $(LIBBLOCK_PREFIX)/libblock.a \ 44 $(LIBC_PREFIX)/libc.a 45 46 ## Sources 47 # 48 49 OUTPUT = fat 50 SOURCES = \ 51 fat.c \ 52 fat_ops.c \ 53 fat_idx.c \ 54 fat_dentry.c \ 55 fat_fat.c 56 57 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 58 59 .PHONY: all clean depend 60 61 all: $(OUTPUT) $(OUTPUT).disasm 62 63 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 64 37 65 38 clean: 66 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 67 68 depend: 69 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 70 71 $(OUTPUT): $(OBJECTS) $(LIBS) 72 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 73 74 $(OUTPUT).disasm: $(OUTPUT) 75 $(OBJDUMP) -d $< > $@ 76 77 %.o: %.S 78 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 79 80 %.o: %.s 81 $(AS) $(AFLAGS) $< -o $@ 82 83 %.o: %.c 84 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/fs/fat/fat_ops.c
r5f678b1c r5a4fef9 363 363 } 364 364 rc = fat_node_get_core(&nodep, idx); 365 assert(rc == EOK);366 365 fibril_mutex_unlock(&idx->lock); 367 (void) block_put(b); 366 if (rc != EOK) { 367 (void) block_put(b); 368 return rc; 369 } 368 370 *rfn = FS_NODE(nodep); 369 return EOK; 371 rc = block_put(b); 372 if (rc != EOK) 373 (void) fat_node_put(*rfn); 374 return rc; 370 375 } 371 376 } … … 1072 1077 rc = fat_block_get(&b, bs, nodep, pos / bps, 1073 1078 BLOCK_FLAGS_NONE); 1074 assert(rc == EOK); 1079 if (rc != EOK) { 1080 fat_node_put(fn); 1081 ipc_answer_0(callid, rc); 1082 ipc_answer_0(rid, rc); 1083 return; 1084 } 1075 1085 (void) async_data_read_finalize(callid, b->data + pos % bps, 1076 1086 bytes); 1077 1087 rc = block_put(b); 1078 assert(rc == EOK); 1088 if (rc != EOK) { 1089 fat_node_put(fn); 1090 ipc_answer_0(rid, rc); 1091 return; 1092 } 1079 1093 } 1080 1094 } else { … … 1100 1114 rc = fat_block_get(&b, bs, nodep, bnum, 1101 1115 BLOCK_FLAGS_NONE); 1102 assert(rc == EOK); 1116 if (rc != EOK) 1117 goto err; 1103 1118 for (o = pos % (bps / sizeof(fat_dentry_t)); 1104 1119 o < bps / sizeof(fat_dentry_t); … … 1111 1126 case FAT_DENTRY_LAST: 1112 1127 rc = block_put(b); 1113 assert(rc == EOK); 1128 if (rc != EOK) 1129 goto err; 1114 1130 goto miss; 1115 1131 default: … … 1117 1133 fat_dentry_name_get(d, name); 1118 1134 rc = block_put(b); 1119 assert(rc == EOK); 1135 if (rc != EOK) 1136 goto err; 1120 1137 goto hit; 1121 1138 } 1122 1139 } 1123 1140 rc = block_put(b); 1124 assert(rc == EOK); 1141 if (rc != EOK) 1142 goto err; 1125 1143 bnum++; 1126 1144 } 1127 1145 miss: 1128 fat_node_put(fn); 1129 ipc_answer_0(callid, ENOENT); 1130 ipc_answer_1(rid, ENOENT, 0); 1131 return; 1146 rc = fat_node_put(fn); 1147 ipc_answer_0(callid, rc != EOK ? rc : ENOENT); 1148 ipc_answer_1(rid, rc != EOK ? rc : ENOENT, 0); 1149 return; 1150 1151 err: 1152 (void) fat_node_put(fn); 1153 ipc_answer_0(callid, rc); 1154 ipc_answer_0(rid, rc); 1155 return; 1156 1132 1157 hit: 1133 1158 (void) async_data_read_finalize(callid, name, str_size(name) + 1); … … 1135 1160 } 1136 1161 1137 fat_node_put(fn);1138 ipc_answer_1(rid, EOK, (ipcarg_t)bytes);1162 rc = fat_node_put(fn); 1163 ipc_answer_1(rid, rc, (ipcarg_t)bytes); 1139 1164 } 1140 1165 … … 1147 1172 fat_node_t *nodep; 1148 1173 fat_bs_t *bs; 1149 size_t bytes ;1174 size_t bytes, size; 1150 1175 block_t *b; 1151 1176 uint16_t bps; … … 1170 1195 size_t len; 1171 1196 if (!async_data_write_receive(&callid, &len)) { 1172 fat_node_put(fn);1197 (void) fat_node_put(fn); 1173 1198 ipc_answer_0(callid, EINVAL); 1174 1199 ipc_answer_0(rid, EINVAL); … … 1201 1226 */ 1202 1227 rc = fat_fill_gap(bs, nodep, FAT_CLST_RES0, pos); 1203 assert(rc == EOK); 1228 if (rc != EOK) { 1229 (void) fat_node_put(fn); 1230 ipc_answer_0(callid, rc); 1231 ipc_answer_0(rid, rc); 1232 return; 1233 } 1204 1234 rc = fat_block_get(&b, bs, nodep, pos / bps, flags); 1205 assert(rc == EOK); 1235 if (rc != EOK) { 1236 (void) fat_node_put(fn); 1237 ipc_answer_0(callid, rc); 1238 ipc_answer_0(rid, rc); 1239 return; 1240 } 1206 1241 (void) async_data_write_finalize(callid, b->data + pos % bps, 1207 1242 bytes); 1208 1243 b->dirty = true; /* need to sync block */ 1209 1244 rc = block_put(b); 1210 assert(rc == EOK); 1245 if (rc != EOK) { 1246 (void) fat_node_put(fn); 1247 ipc_answer_0(rid, rc); 1248 return; 1249 } 1211 1250 if (pos + bytes > nodep->size) { 1212 1251 nodep->size = pos + bytes; 1213 1252 nodep->dirty = true; /* need to sync node */ 1214 1253 } 1215 ipc_answer_2(rid, EOK, bytes, nodep->size); 1216 fat_node_put(fn); 1254 size = nodep->size; 1255 rc = fat_node_put(fn); 1256 ipc_answer_2(rid, rc, bytes, nodep->size); 1217 1257 return; 1218 1258 } else { … … 1221 1261 * clusters for the node and zero them out. 1222 1262 */ 1223 int status;1224 1263 unsigned nclsts; 1225 1264 fat_cluster_t mcl, lcl; … … 1227 1266 nclsts = (ROUND_UP(pos + bytes, bpc) - boundary) / bpc; 1228 1267 /* create an independent chain of nclsts clusters in all FATs */ 1229 status= fat_alloc_clusters(bs, dev_handle, nclsts, &mcl, &lcl);1230 if ( status!= EOK) {1268 rc = fat_alloc_clusters(bs, dev_handle, nclsts, &mcl, &lcl); 1269 if (rc != EOK) { 1231 1270 /* could not allocate a chain of nclsts clusters */ 1232 fat_node_put(fn);1233 ipc_answer_0(callid, status);1234 ipc_answer_0(rid, status);1271 (void) fat_node_put(fn); 1272 ipc_answer_0(callid, rc); 1273 ipc_answer_0(rid, rc); 1235 1274 return; 1236 1275 } 1237 1276 /* zero fill any gaps */ 1238 1277 rc = fat_fill_gap(bs, nodep, mcl, pos); 1239 assert(rc == EOK); 1278 if (rc != EOK) { 1279 (void) fat_free_clusters(bs, dev_handle, mcl); 1280 (void) fat_node_put(fn); 1281 ipc_answer_0(callid, rc); 1282 ipc_answer_0(rid, rc); 1283 return; 1284 } 1240 1285 rc = _fat_block_get(&b, bs, dev_handle, lcl, (pos / bps) % spc, 1241 1286 flags); 1242 assert(rc == EOK); 1287 if (rc != EOK) { 1288 (void) fat_free_clusters(bs, dev_handle, mcl); 1289 (void) fat_node_put(fn); 1290 ipc_answer_0(callid, rc); 1291 ipc_answer_0(rid, rc); 1292 return; 1293 } 1243 1294 (void) async_data_write_finalize(callid, b->data + pos % bps, 1244 1295 bytes); 1245 1296 b->dirty = true; /* need to sync block */ 1246 1297 rc = block_put(b); 1247 assert(rc == EOK); 1298 if (rc != EOK) { 1299 (void) fat_free_clusters(bs, dev_handle, mcl); 1300 (void) fat_node_put(fn); 1301 ipc_answer_0(rid, rc); 1302 return; 1303 } 1248 1304 /* 1249 1305 * Append the cluster chain starting in mcl to the end of the … … 1251 1307 */ 1252 1308 rc = fat_append_clusters(bs, nodep, mcl); 1253 assert(rc == EOK); 1254 nodep->size = pos + bytes; 1309 if (rc != EOK) { 1310 (void) fat_free_clusters(bs, dev_handle, mcl); 1311 (void) fat_node_put(fn); 1312 ipc_answer_0(rid, rc); 1313 return; 1314 } 1315 nodep->size = size = pos + bytes; 1255 1316 nodep->dirty = true; /* need to sync node */ 1256 ipc_answer_2(rid, EOK, bytes, nodep->size);1257 fat_node_put(fn);1317 rc = fat_node_put(fn); 1318 ipc_answer_2(rid, rc, bytes, size); 1258 1319 return; 1259 1320 } -
uspace/srv/fs/tmpfs/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../../lib/libc 33 LIBFS_PREFIX = ../../../lib/libfs 34 LIBBLOCK_PREFIX = ../../../lib/libblock 35 SOFTINT_PREFIX = ../../../lib/softint 32 .PHONY: all clean 36 33 37 include $(LIBC_PREFIX)/Makefile.toolchain 38 39 CFLAGS += -I $(LIBFS_PREFIX) -I $(LIBBLOCK_PREFIX) 40 41 LIBS = \ 42 $(LIBFS_PREFIX)/libfs.a \ 43 $(LIBBLOCK_PREFIX)/libblock.a \ 44 $(LIBC_PREFIX)/libc.a 45 46 ## Sources 47 # 48 49 OUTPUT = tmpfs 50 SOURCES = \ 51 tmpfs.c \ 52 tmpfs_ops.c \ 53 tmpfs_dump.c 54 55 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 56 57 .PHONY: all clean depend 58 59 all: $(OUTPUT) $(OUTPUT).disasm 60 61 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 62 37 63 38 clean: 64 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 65 66 depend: 67 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 68 69 $(OUTPUT): $(OBJECTS) $(LIBS) 70 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 71 72 $(OUTPUT).disasm: $(OUTPUT) 73 $(OBJDUMP) -d $< > $@ 74 75 %.o: %.S 76 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 77 78 %.o: %.s 79 $(AS) $(AFLAGS) $< -o $@ 80 81 %.o: %.c 82 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/kbd/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 CFLAGS += -Iinclude 38 39 LIBS = $(LIBC_PREFIX)/libc.a 40 41 ## Sources 42 # 43 44 OUTPUT = kbd 45 GENERIC_SOURCES = \ 46 generic/kbd.c \ 47 genarch/gsp.c \ 48 genarch/stroke.c 49 50 ARCH_SOURCES = 51 GENARCH_SOURCES = \ 52 layout/cz.c \ 53 layout/us_qwerty.c \ 54 layout/us_dvorak.c 55 56 ifeq ($(UARCH), amd64) 57 GENARCH_SOURCES += \ 58 port/i8042.c \ 59 ctl/pc.c 60 endif 61 62 ifeq ($(UARCH), arm32) 63 ifeq ($(MACHINE), testarm) 64 GENARCH_SOURCES += \ 65 port/gxemul.c 66 67 ifeq ($(CONFIG_FB), y) 68 GENARCH_SOURCES += \ 69 ctl/gxe_fb.c 70 else 71 GENARCH_SOURCES += \ 72 ctl/stty.c 73 endif 74 endif 75 ifeq ($(MACHINE), integratorcp) 76 GENARCH_SOURCES += \ 77 port/pl050.c \ 78 ctl/pl050.c 79 endif 80 endif 81 82 ifeq ($(UARCH), ia32) 83 GENARCH_SOURCES += \ 84 port/i8042.c \ 85 ctl/pc.c 86 endif 87 88 ifeq ($(MACHINE), i460GX) 89 GENARCH_SOURCES += \ 90 port/i8042.c \ 91 ctl/pc.c 92 endif 93 94 ifeq ($(MACHINE), ski) 95 GENARCH_SOURCES += \ 96 port/ski.c \ 97 ctl/stty.c 98 endif 99 100 ifeq ($(MACHINE), msim) 101 GENARCH_SOURCES += \ 102 port/msim.c \ 103 ctl/stty.c 104 endif 105 106 ifeq ($(MACHINE), lgxemul) 107 GENARCH_SOURCES += \ 108 port/gxemul.c 109 110 ifeq ($(CONFIG_FB), y) 111 GENARCH_SOURCES += \ 112 ctl/gxe_fb.c 113 else 114 GENARCH_SOURCES += \ 115 ctl/stty.c 116 endif 117 endif 118 119 ifeq ($(MACHINE), bgxemul) 120 GENARCH_SOURCES += \ 121 port/gxemul.c 122 123 ifeq ($(CONFIG_FB), y) 124 GENARCH_SOURCES += \ 125 ctl/gxe_fb.c 126 else 127 GENARCH_SOURCES += \ 128 ctl/stty.c 129 endif 130 endif 131 132 ifeq ($(UARCH), ppc32) 133 GENARCH_SOURCES += \ 134 port/dummy.c \ 135 ctl/stty.c 136 endif 137 138 ifeq ($(UARCH), sparc64) 139 ifeq ($(MACHINE),serengeti) 140 GENARCH_SOURCES += \ 141 port/sgcn.c \ 142 ctl/stty.c 143 else 144 GENARCH_SOURCES += \ 145 port/sun.c \ 146 port/z8530.c \ 147 port/ns16550.c \ 148 ctl/sun.c 149 endif 150 endif 151 152 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 153 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 154 GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) 155 156 OBJECTS := $(ARCH_OBJECTS) $(GENERIC_OBJECTS) $(GENARCH_OBJECTS) 157 158 .PHONY: all clean depend 159 160 all: $(OUTPUT) $(OUTPUT).disasm 161 162 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 163 37 164 38 clean: 165 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 166 167 depend: 168 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 169 170 $(OUTPUT): $(OBJECTS) $(LIBS) 171 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 172 173 $(OUTPUT).disasm: $(OUTPUT) 174 $(OBJDUMP) -d $< > $@ 175 176 %.o: %.S 177 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 178 179 %.o: %.s 180 $(AS) $(AFLAGS) $< -o $@ 181 182 %.o: %.c 183 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/loader/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 200 8 Jiri Svoboda3 # Copyright (c) 2007 Jakub Jermar 4 4 # All rights reserved. 5 5 # … … 28 28 # 29 29 30 ## Setup toolchain 31 # 30 include Makefile.common 32 31 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 35 33 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 include arch/$(UARCH)/Makefile.inc 38 39 CFLAGS += -Iinclude 40 41 LIBS = $(LIBC_PREFIX)/libc.a $(SOFTINT_PREFIX)/libsoftint.a 42 43 ## Sources 44 # 45 46 OUTPUT = loader 47 GENERIC_SOURCES = \ 48 main.c \ 49 elf_load.c \ 50 interp.s 51 52 SOURCES := $(GENERIC_SOURCES) $(ARCH_SOURCES) 53 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 54 55 .PHONY: all clean depend 56 57 all: $(OUTPUT) $(OUTPUT).disasm 58 59 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 60 37 61 38 clean: 62 -rm -f $(OUTPUT) $(OBJECTS) $(OUTPUT).map $(OUTPUT).disasm arch/$(UARCH)/_link.ld Makefile.depend 63 64 depend: 65 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 66 67 $(OUTPUT): $(OBJECTS) $(LIBS) arch/$(UARCH)/_link.ld 68 $(LD) -T arch/$(UARCH)/_link.ld $(LFLAGS) $(OBJECTS) $(LIBS) -o $@ -Map $(OUTPUT).map 69 70 $(OUTPUT).disasm: $(OUTPUT) 71 $(OBJDUMP) -d $< > $@ 72 73 arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in 74 $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@ 75 76 %.o: %.S 77 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 78 79 %.o: %.s 80 $(AS) $(AFLAGS) $< -o $@ 81 82 %.o: %.c 83 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm arch/*/_link.ld 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/loader/arch/ia32/ia32.s
r5f678b1c r5a4fef9 40 40 movl 0x8(%ebp), %eax 41 41 42 # %e bx:= pcb43 # pcb is passed to the entry point in t %ebx44 mov 0xc(%ebp), %e bx42 # %edi := pcb 43 # pcb is passed to the entry point in %edi 44 mov 0xc(%ebp), %edi 45 45 46 46 # Save a tiny bit of stack space -
uspace/srv/loader/main.c
r5f678b1c r5a4fef9 72 72 static pcb_t pcb; 73 73 74 /** Current working directory */ 75 static char *cwd = NULL; 76 74 77 /** Number of arguments */ 75 78 static int argc = 0; … … 115 118 } 116 119 120 /** Receive a call setting the current working directory. 121 * 122 * @param rid 123 * @param request 124 */ 125 static void ldr_set_cwd(ipc_callid_t rid, ipc_call_t *request) 126 { 127 ipc_callid_t callid; 128 size_t len; 129 130 if (!async_data_write_receive(&callid, &len)) { 131 ipc_answer_0(callid, EINVAL); 132 ipc_answer_0(rid, EINVAL); 133 return; 134 } 135 136 cwd = malloc(len + 1); 137 if (!cwd) { 138 ipc_answer_0(callid, ENOMEM); 139 ipc_answer_0(rid, ENOMEM); 140 return; 141 } 142 143 async_data_write_finalize(callid, cwd, len); 144 cwd[len] = '\0'; 145 146 ipc_answer_0(rid, EOK); 147 } 117 148 118 149 /** Receive a call setting pathname of the program to execute. … … 313 344 elf_create_pcb(&prog_info, &pcb); 314 345 346 pcb.cwd = cwd; 347 315 348 pcb.argc = argc; 316 349 pcb.argv = argv; … … 406 439 case LOADER_GET_TASKID: 407 440 ldr_get_taskid(callid, &call); 441 continue; 442 case LOADER_SET_CWD: 443 ldr_set_cwd(callid, &call); 408 444 continue; 409 445 case LOADER_SET_PATHNAME: -
uspace/srv/ns/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 LIBS = $(LIBC_PREFIX)/libc.a 38 39 ## Sources 40 # 41 42 OUTPUT = ns 43 SOURCES = \ 44 ns.c \ 45 service.c \ 46 clonable.c \ 47 task.c 48 49 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 50 51 .PHONY: all clean depend 52 53 all: $(OUTPUT) $(OUTPUT).disasm 54 55 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 56 37 57 38 clean: 58 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 59 60 depend: 61 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 62 63 $(OUTPUT): $(OBJECTS) $(LIBS) 64 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 65 66 $(OUTPUT).disasm: $(OUTPUT) 67 $(OBJDUMP) -d $< > $@ 68 69 %.o: %.S 70 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 71 72 %.o: %.s 73 $(AS) $(AFLAGS) $< -o $@ 74 75 %.o: %.c 76 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/ns/service.c
r5f678b1c r5a4fef9 156 156 157 157 hashed_service_t *hs = hash_table_get_instance(link, hashed_service_t, link); 158 ipcarg_t retval = ipc_forward_fast(pr->callid, hs->phone, 159 pr->arg2, pr->arg3, 0, IPC_FF_NONE); 160 161 if (!(pr->callid & IPC_CALLID_NOTIFICATION)) 162 ipc_answer_0(pr->callid, retval); 158 (void) ipc_forward_fast(pr->callid, hs->phone, pr->arg2, 159 pr->arg3, 0, IPC_FF_NONE); 163 160 164 161 list_remove(cur); … … 242 239 243 240 hashed_service_t *hs = hash_table_get_instance(link, hashed_service_t, link); 244 retval =ipc_forward_fast(callid, hs->phone, IPC_GET_ARG2(*call),241 (void) ipc_forward_fast(callid, hs->phone, IPC_GET_ARG2(*call), 245 242 IPC_GET_ARG3(*call), 0, IPC_FF_NONE); 243 return; 246 244 247 245 out: -
uspace/srv/part/mbr_part/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 2006 Martin Decky 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 .PHONY: all clean 32 33 33 LIBC_PREFIX = ../../../lib/libc 34 SOFTINT_PREFIX = ../../../lib/softint 35 LIBBLOCK_PREFIX = ../../../lib/libblock 36 37 include $(LIBC_PREFIX)/Makefile.toolchain 38 39 CFLAGS += -I$(LIBBLOCK_PREFIX) 40 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a 41 42 ## Sources 43 # 44 45 OUTPUT = mbr_part 46 SOURCES = \ 47 mbr_part.c 48 49 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 50 51 .PHONY: all clean depend 52 53 all: $(OUTPUT) $(OUTPUT).disasm 54 55 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 56 37 57 38 clean: 58 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 59 60 depend: 61 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 62 63 $(OUTPUT): $(OBJECTS) $(LIBS) 64 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 65 66 $(OUTPUT).disasm: $(OUTPUT) 67 $(OBJDUMP) -d $< > $@ 68 69 %.o: %.S 70 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 71 72 %.o: %.s 73 $(AS) $(AFLAGS) $< -o $@ 74 75 %.o: %.c 76 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/pci/Makefile
r5f678b1c r5a4fef9 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ## Setup toolchain 30 # 30 include Makefile.common 31 31 32 LIBC_PREFIX = ../../lib/libc 33 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 34 33 35 include $(LIBC_PREFIX)/Makefile.toolchain 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 36 37 37 38 LIBS = libpci/libpci.a $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = pci 44 SOURCES = \ 45 pci.c 46 47 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 48 49 .PHONY: all clean depend 50 51 all: $(OUTPUT) $(OUTPUT).disasm 52 53 -include Makefile.depend 38 $(LIBPCI): 39 $(MAKE) -C libpci 54 40 55 41 clean: 56 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS)57 42 $(MAKE) -C libpci clean 58 59 depend: 60 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 61 62 $(OUTPUT): $(OBJECTS) $(LIBS) 63 $(MAKE) -C libpci 64 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 65 66 $(OUTPUT).disasm: $(OUTPUT) 67 $(OBJDUMP) -d $< > $@ 68 69 %.o: %.S 70 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 71 72 %.o: %.s 73 $(AS) $(AFLAGS) $< -o $@ 74 75 %.o: %.c 76 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 77 78 libpci/libpci.a: 79 $(MAKE) -C libpci 43 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 44 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/pci/libpci/Makefile
r5f678b1c r5a4fef9 1 # Makefile for The PCI Library 2 # (c) 1999 Martin Mares <mj@ucw.cz> 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 4 # All rights reserved. 5 # 6 # Redistribution and use in source and binary forms, with or without 7 # modification, are permitted provided that the following conditions 8 # are met: 9 # 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. 17 # 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. 28 # 3 29 4 # Modified and ported to HelenOS by Jakub Jermar 30 include Makefile.common 5 31 6 LIBC_PREFIX=$(shell cd ../../../lib/libc; pwd) 32 .PHONY: all clean 7 33 8 include $(LIBC_PREFIX)/Makefile.toolchain 9 10 LIBS = $(LIBC_PREFIX)/libc.a 11 CFLAGS += -I$(LIBC_PREFIX)/include -trigraphs 12 13 OBJS=access.o generic.o names.o 14 INCL=internal.h pci.h header.h sysdep.h types.h pci_ids.h 15 16 PCILIB=libpci.a 17 18 OBJS += i386-ports.o 19 20 all: $(PCILIB) 21 22 $(PCILIB): $(OBJS) 23 $(AR) rc $@ $(OBJS) 24 25 %.o: %.c $(INCL) 26 $(CC) $(CFLAGS) -c $< -o $@ 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBC_PREFIX)/libc.a 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 27 37 28 38 clean: 29 -rm *.o libpci.a 39 rm -f $(DEPEND) $(DEPEND_PREV) $(LIBPCI) 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/vfs/Makefile
r5f678b1c r5a4fef9 1 1 # 2 # Copyright (c) 200 6Martin Decky3 # Copyright (c) 200 8Jakub Jermar2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 4 4 # All rights reserved. 5 5 # … … 28 28 # 29 29 30 ## Setup toolchain 31 # 30 include Makefile.common 32 31 33 LIBC_PREFIX = ../../lib/libc 34 SOFTINT_PREFIX = ../../lib/softint 32 .PHONY: all clean 35 33 36 include $(LIBC_PREFIX)/Makefile.toolchain 37 38 LIBS = $(LIBC_PREFIX)/libc.a 39 40 ## Sources 41 # 42 43 OUTPUT = vfs 44 SOURCES = \ 45 vfs.c \ 46 vfs_node.c \ 47 vfs_file.c \ 48 vfs_ops.c \ 49 vfs_lookup.c \ 50 vfs_register.c 51 52 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) 53 54 .PHONY: all clean depend 55 56 all: $(OUTPUT) $(OUTPUT).disasm 57 58 -include Makefile.depend 34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS) 35 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 36 $(MAKE) -f Makefile.build 59 37 60 38 clean: 61 -rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend $(OBJECTS) 62 63 depend: 64 $(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend 65 66 $(OUTPUT): $(OBJECTS) $(LIBS) 67 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 68 69 $(OUTPUT).disasm: $(OUTPUT) 70 $(OBJDUMP) -d $< > $@ 71 72 %.o: %.S 73 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 74 75 %.o: %.s 76 $(AS) $(AFLAGS) $< -o $@ 77 78 %.o: %.c 79 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 39 rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm 40 find . -name '*.o' -follow -exec rm \{\} \; -
uspace/srv/vfs/vfs.c
r5f678b1c r5a4fef9 126 126 vfs_sync(callid, &call); 127 127 break; 128 case VFS_IN_DUP: 129 vfs_dup(callid, &call); 128 130 default: 129 131 ipc_answer_0(callid, ENOTSUP); -
uspace/srv/vfs/vfs.h
r5f678b1c r5a4fef9 186 186 extern bool vfs_files_init(void); 187 187 extern vfs_file_t *vfs_file_get(int); 188 extern int vfs_fd_alloc(void); 188 extern int vfs_fd_assign(vfs_file_t *file, int fd); 189 extern int vfs_fd_alloc(bool desc); 189 190 extern int vfs_fd_free(int); 190 191 … … 200 201 extern void vfs_open_node(ipc_callid_t, ipc_call_t *); 201 202 extern void vfs_sync(ipc_callid_t, ipc_call_t *); 203 extern void vfs_dup(ipc_callid_t, ipc_call_t *); 202 204 extern void vfs_close(ipc_callid_t, ipc_call_t *); 203 205 extern void vfs_read(ipc_callid_t, ipc_call_t *); -
uspace/srv/vfs/vfs_file.c
r5f678b1c r5a4fef9 76 76 /** Allocate a file descriptor. 77 77 * 78 * @return First available file descriptor or a negative error 79 * code. 80 */ 81 int vfs_fd_alloc(void) 78 * @param desc If true, look for an available file descriptor 79 * in a descending order. 80 * 81 * @return First available file descriptor or a negative error 82 * code. 83 */ 84 int vfs_fd_alloc(bool desc) 82 85 { 83 86 if (!vfs_files_init()) … … 85 88 86 89 unsigned int i; 87 for (i = 0; i < MAX_OPEN_FILES; i++) { 90 if (desc) 91 i = MAX_OPEN_FILES - 1; 92 else 93 i = 0; 94 95 while (true) { 88 96 if (!files[i]) { 89 97 files[i] = (vfs_file_t *) malloc(sizeof(vfs_file_t)); … … 96 104 return (int) i; 97 105 } 106 107 if (desc) { 108 if (i == 0) 109 break; 110 111 i--; 112 } else { 113 if (i == MAX_OPEN_FILES - 1) 114 break; 115 116 i++; 117 } 98 118 } 99 119 … … 118 138 vfs_file_delref(files[fd]); 119 139 files[fd] = NULL; 140 141 return EOK; 142 } 143 144 /** Assign a file to a file descriptor. 145 * 146 * @param file File to assign. 147 * @param fd File descriptor to assign to. 148 * 149 * @return EOK on success or EINVAL if fd is an invalid or already 150 * used file descriptor. 151 * 152 */ 153 int vfs_fd_assign(vfs_file_t *file, int fd) 154 { 155 if (!vfs_files_init()) 156 return ENOMEM; 157 158 if ((fd < 0) || (fd >= MAX_OPEN_FILES) || (files[fd] != NULL)) 159 return EINVAL; 160 161 files[fd] = file; 162 vfs_file_addref(files[fd]); 120 163 121 164 return EOK; -
uspace/srv/vfs/vfs_lookup.c
r5f678b1c r5a4fef9 209 209 (ipcarg_t) result->triplet.index, &answer); 210 210 211 212 211 ipcarg_t rc; 213 212 async_wait_for(req, &rc); -
uspace/srv/vfs/vfs_ops.c
r5f678b1c r5a4fef9 543 543 * structure. 544 544 */ 545 int fd = vfs_fd_alloc( );545 int fd = vfs_fd_alloc((oflag & O_DESC) != 0); 546 546 if (fd < 0) { 547 547 vfs_node_put(node); … … 620 620 * structure. 621 621 */ 622 int fd = vfs_fd_alloc( );622 int fd = vfs_fd_alloc((oflag & O_DESC) != 0); 623 623 if (fd < 0) { 624 624 vfs_node_put(node); … … 679 679 } 680 680 681 static int vfs_close_internal(vfs_file_t *file) 682 { 683 /* 684 * Lock the open file structure so that no other thread can manipulate 685 * the same open file at a time. 686 */ 687 fibril_mutex_lock(&file->lock); 688 689 if (file->refcnt <= 1) { 690 /* Only close the file on the destination FS server 691 if there are no more file descriptors (except the 692 present one) pointing to this file. */ 693 694 int fs_phone = vfs_grab_phone(file->node->fs_handle); 695 696 /* Make a VFS_OUT_CLOSE request at the destination FS server. */ 697 aid_t msg; 698 ipc_call_t answer; 699 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->dev_handle, 700 file->node->index, &answer); 701 702 /* Wait for reply from the FS server. */ 703 ipcarg_t rc; 704 async_wait_for(msg, &rc); 705 706 vfs_release_phone(fs_phone); 707 fibril_mutex_unlock(&file->lock); 708 709 return IPC_GET_ARG1(answer); 710 } 711 712 fibril_mutex_unlock(&file->lock); 713 return EOK; 714 } 715 681 716 void vfs_close(ipc_callid_t rid, ipc_call_t *request) 682 717 { … … 690 725 } 691 726 692 /* 693 * Lock the open file structure so that no other thread can manipulate 694 * the same open file at a time. 695 */ 696 fibril_mutex_lock(&file->lock); 697 int fs_phone = vfs_grab_phone(file->node->fs_handle); 698 699 /* Make a VFS_OUT_CLOSE request at the destination FS server. */ 700 aid_t msg; 701 ipc_call_t answer; 702 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->dev_handle, 703 file->node->index, &answer); 704 705 /* Wait for reply from the FS server. */ 706 ipcarg_t rc; 707 async_wait_for(msg, &rc); 708 709 vfs_release_phone(fs_phone); 710 fibril_mutex_unlock(&file->lock); 711 712 int retval = IPC_GET_ARG1(answer); 713 if (retval != EOK) 714 ipc_answer_0(rid, retval); 715 716 retval = vfs_fd_free(fd); 717 ipc_answer_0(rid, retval); 727 int ret = vfs_close_internal(file); 728 if (ret != EOK) 729 ipc_answer_0(rid, ret); 730 731 ret = vfs_fd_free(fd); 732 ipc_answer_0(rid, ret); 718 733 } 719 734 … … 1310 1325 } 1311 1326 1327 void vfs_dup(ipc_callid_t rid, ipc_call_t *request) 1328 { 1329 int oldfd = IPC_GET_ARG1(*request); 1330 int newfd = IPC_GET_ARG2(*request); 1331 1332 /* Lookup the file structure corresponding to oldfd. */ 1333 vfs_file_t *oldfile = vfs_file_get(oldfd); 1334 if (!oldfile) { 1335 ipc_answer_0(rid, EBADF); 1336 return; 1337 } 1338 1339 /* If the file descriptors are the same, do nothing. */ 1340 if (oldfd == newfd) { 1341 ipc_answer_1(rid, EOK, newfd); 1342 return; 1343 } 1344 1345 /* 1346 * Lock the open file structure so that no other thread can manipulate 1347 * the same open file at a time. 1348 */ 1349 fibril_mutex_lock(&oldfile->lock); 1350 1351 /* Lookup an open file structure possibly corresponding to newfd. */ 1352 vfs_file_t *newfile = vfs_file_get(newfd); 1353 if (newfile) { 1354 /* Close the originally opened file. */ 1355 int ret = vfs_close_internal(newfile); 1356 if (ret != EOK) { 1357 ipc_answer_0(rid, ret); 1358 return; 1359 } 1360 1361 ret = vfs_fd_free(newfd); 1362 if (ret != EOK) { 1363 ipc_answer_0(rid, ret); 1364 return; 1365 } 1366 } 1367 1368 /* Assign the old file to newfd. */ 1369 int ret = vfs_fd_assign(oldfile, newfd); 1370 fibril_mutex_unlock(&oldfile->lock); 1371 1372 if (ret != EOK) 1373 ipc_answer_0(rid, ret); 1374 else 1375 ipc_answer_1(rid, EOK, newfd); 1376 } 1377 1312 1378 /** 1313 1379 * @}
Note:
See TracChangeset
for help on using the changeset viewer.
