Changeset 2906
- Timestamp:
- Dec 26, 2006, 3:00:06 AM (19 years ago)
- Location:
- trunk/libc
- Files:
-
- 2 added
- 5 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/Makefile.kmk
r2901 r2906 42 42 include $(wildcard $(PATH_LIBC_SRC)/Makefile.kmk) 43 43 44 45 # 46 # libc .a47 # 48 LIBRARIES += libc 49 libc_ TEMPLATE = libc50 libc_ SOURCES = \44 45 # 46 # libc_frontend.a 47 # 48 LIBRARIES += libc_frontend 49 libc_frontend_TEMPLATE = libc 50 libc_frontend_SOURCES = \ 51 51 $(TARGET_libc_libc) \ 52 52 $(TARGET_libc_fbsdlibc) \ 53 53 $(TARGET_libc_glibc) \ 54 $(TARGET_libc_msun) \ 55 $(TARGET_libc_kNIX) 54 $(TARGET_libc_msun) 56 55 libc_SOURCES.os2 = \ 57 56 $(TARGET_libc_libsocket) \ … … 60 59 61 60 ifdef CFG_LIBC_LOGSTRICT_LIBS 62 LIBRARIES += libc_ l63 libc_ l_TEMPLATE = libc.profiled64 libc_ l_SOURCES = \61 LIBRARIES += libc_frontend_l 62 libc_frontend_l_TEMPLATE = libc.profiled 63 libc_frontend_l_SOURCES = \ 65 64 $(TARGET_libc_libc_l) \ 66 65 $(TARGET_libc_fbsdlibc_l) \ 67 66 $(TARGET_libc_glibc_l) \ 68 $(TARGET_libc_msun_l) \ 69 $(TARGET_libc_kNIX_l) 70 libc_l_SOURCES.os2 = \ 67 $(TARGET_libc_msun_l) 68 libc_frontend_l_SOURCES.os2 = \ 71 69 $(TARGET_libc_libsocket_l) \ 72 70 $(TARGET_libc_libsyslog_l) … … 74 72 75 73 ifdef CFG_LIBC_PROFILED_LIBS 76 LIBRARIES += libc_ p77 libc_ p_TEMPLATE = libc.profiled78 libc_ p_SOURCES = \74 LIBRARIES += libc_frontend_p 75 libc_frontend_p_TEMPLATE = libc.profiled 76 libc_frontend_p_SOURCES = \ 79 77 $(TARGET_libc_libc_p) \ 80 78 $(TARGET_libc_fbsdlibc_p) \ 81 79 $(TARGET_libc_glibc_p) \ 82 $(TARGET_libc_msun_p) \ 83 $(TARGET_libc_kNIX_p) 84 libc_p_SOURCES.os2 = \ 80 $(TARGET_libc_msun_p) 81 libc_frontend_p_SOURCES.os2 = \ 85 82 $(TARGET_libc_libsocket_p) \ 86 83 $(TARGET_libc_libsyslog_p) … … 91 88 # libc_asm.a 92 89 # 93 LIBRARIES += libc_ asm94 libc_ asm_TEMPLATE = libcasm95 libc_ asm_SOURCES = \90 LIBRARIES += libc_frontend_asm 91 libc_frontend_asm_TEMPLATE = libcasm 92 libc_frontend_asm_SOURCES = \ 96 93 $(TARGET_libc_libc_asm) \ 97 94 $(TARGET_libc_fbsdlibc_asm) \ 98 95 $(TARGET_libc_glibc_asm) \ 99 $(TARGET_libc_msun_asm) \ 100 $(TARGET_libc_kNIX_asm) 96 $(TARGET_libc_msun_asm) 101 97 102 98 ifdef CFG_LIBC_LOGSTRICT_LIBS 103 LIBRARIES += libc_ asm_l104 libc_ asm_l_TEMPLATE = libcasm.logstrict105 libc_ asm_l_SOURCES = \99 LIBRARIES += libc_frontend_asm_l 100 libc_frontend_asm_l_TEMPLATE = libcasm.logstrict 101 libc_frontend_asm_l_SOURCES = \ 106 102 $(TARGET_libc_libc_asm_l) \ 107 103 $(TARGET_libc_fbsdlibc_asm_l) \ … … 112 108 113 109 ifdef CFG_LIBC_PROFILED_LIBS 110 LIBRARIES += libc_frontend_asm_p 111 libc_frontend_asm_p_TEMPLATE = libcasm.profiled 112 libc_frontend_asm_p_SOURCES = \ 113 $(TARGET_libc_libc_asm_p) \ 114 $(TARGET_libc_fbsdlibc_asm_p) \ 115 $(TARGET_libc_glibc_asm_p) \ 116 $(TARGET_libc_msun_asm_p) 117 endif 118 119 120 # 121 # libc.a 122 # 123 LIBRARIES += libc 124 libc_TEMPLATE = libc 125 libc_SOURCES = \ 126 $(TARGET_libc_frontend) \ 127 $(TARGET_libc_kNIX) 128 libc_SOURCES.nt = $(TARGET_kNIX.nt) 129 130 ifdef CFG_LIBC_LOGSTRICT_LIBS 131 LIBRARIES += libc_l 132 libc_l_TEMPLATE = libc.profiled 133 libc_l_SOURCES = \ 134 $(TARGET_libc_frontend_l) \ 135 $(TARGET_libc_kNIX_l) 136 libc_l_SOURCES.nt = $(TARGET_kNIX_l.nt) 137 endif 138 139 ifdef CFG_LIBC_PROFILED_LIBS 140 LIBRARIES += libc_p 141 libc_p_TEMPLATE = libc.profiled 142 libc_p_SOURCES = \ 143 $(TARGET_libc_frontend_p) \ 144 $(TARGET_libc_kNIX_p) 145 libc_p_SOURCES.nt = $(TARGET_kNIX_p.nt) 146 endif 147 148 149 # 150 # libc_asm.a 151 # 152 LIBRARIES += libc_asm 153 libc_asm_TEMPLATE = libcasm 154 libc_asm_SOURCES = \ 155 $(TARGET_libc_frontend_asm) \ 156 $(TARGET_libc_kNIX_asm) 157 158 ifdef CFG_LIBC_LOGSTRICT_LIBS 159 LIBRARIES += libc_asm_l 160 libc_asm_l_TEMPLATE = libcasm.logstrict 161 libc_asm_l_SOURCES = \ 162 $(TARGET_libc_frontend_asm_l) \ 163 $(TARGET_libc_kNIX_asm_l) 164 endif 165 166 ifdef CFG_LIBC_PROFILED_LIBS 114 167 LIBRARIES += libc_asm_p 115 168 libc_asm_p_TEMPLATE = libcasm.profiled 116 169 libc_asm_p_SOURCES = \ 117 $(TARGET_libc_libc_asm_p) \ 118 $(TARGET_libc_fbsdlibc_asm_p) \ 119 $(TARGET_libc_glibc_asm_p) \ 120 $(TARGET_libc_msun_asm_p) \ 170 $(TARGET_libc_frontend_asm_p) \ 121 171 $(TARGET_libc_kNIX_asm_p) 122 172 endif … … 167 217 168 218 ifdef CFG_LIBC_PROFILED_LIBS 169 DLLS.os2 += libc07.profiled219 #DLLS.os2 += libc07.profiled 170 220 libc07.profiled_TEMPLATE = libc.profiled 171 221 libc07.profiled_TOOL = GCC3 -
trunk/libc/include/klibc/backend.h
r2901 r2906 535 535 */ 536 536 ssize_t __libc_Back_ioDirGetEntries(int fh, void *pvBuf, size_t cbBuf, __off_t *poff); 537 538 /** 539 * Get the TTY of a TTY device. 540 * 541 * @returns 0 on success. 542 * @returns Negative error code (errno.h) on failure. 543 * 544 * @param fh The file handle. 545 * @param pszNameBuf Where to store the name. 546 * @param cchNameBuf The size of the name buf. 547 */ 548 int __libc_Back_ioTTYName(int fh, char *pszNameBuf, size_t cchNameBuf); 537 549 538 550 /** -
trunk/libc/include/klibc/logstrict.h
r2805 r2906 169 169 /** Macro to log a pointer return and do the return. */ 170 170 #define LIBCLOG_RETURN_P(rc) LIBCLOG_RETURN_MSG((rc), "ret %p\n", (void*)(rc)) 171 /** Macro to log a string pointer return and do the return. */ 172 #define LIBCLOG_RETURN_PSZ(psz) LIBCLOG_RETURN_MSG((psz), "ret %p:{%s}\n", (void*)(psz), (psz)) 171 173 172 174 -
trunk/libc/include/unistd.h
r2672 r2906 578 578 char *get_current_dir_name(void); 579 579 #endif 580 580 int ttyname_r(int, char *, size_t); 581 581 582 582 /* -
trunk/libc/src/kNIX/Makefile.kmk
r2903 r2906 35 35 libc_kNIX_SOURCES = \ 36 36 $(PATH_LIBC_SRC)/kNIX/b_ioClose.c \ 37 $(PATH_LIBC_SRC)/kNIX/b_ioFileSizeSet.c \ 37 38 $(PATH_LIBC_SRC)/kNIX/b_ioRead.c \ 39 $(PATH_LIBC_SRC)/kNIX/b_ioSeek.c \ 40 $(PATH_LIBC_SRC)/kNIX/b_ioTTYName.c \ 38 41 $(PATH_LIBC_SRC)/kNIX/b_ioWrite.c \ 39 $(PATH_LIBC_SRC)/kNIX/b_ioSeek.c \40 $(PATH_LIBC_SRC)/kNIX/b_ioFileSizeSet.c \41 42 $(PATH_LIBC_SRC)/kNIX/b_mmanBrk.c \ 42 43 $(PATH_LIBC_SRC)/kNIX/b_mmanSBrk.c \ … … 55 56 56 57 libc_kNIX_SOURCES.os2 = \ 57 $(PATH_LIBC_SRC)/kNIX/os2/brk.c \58 58 $(PATH_LIBC_SRC)/kNIX/os2/b_dir.c \ 59 59 $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirChangeRoot.c \ … … 150 150 $(PATH_LIBC_SRC)/kNIX/os2/resource.c \ 151 151 $(PATH_LIBC_SRC)/kNIX/os2/safesems.c \ 152 $(PATH_LIBC_SRC)/kNIX/os2/sbrk.c \153 152 $(PATH_LIBC_SRC)/kNIX/os2/scrsize.c \ 154 153 $(PATH_LIBC_SRC)/kNIX/os2/seterrno.c \ -
trunk/libc/src/libc/io/Makefile.kmk
r2717 r2906 125 125 $(PATH_LIBC_SRC)/libc/io/truncate.c \ 126 126 $(PATH_LIBC_SRC)/libc/io/ttyname.c \ 127 $(PATH_LIBC_SRC)/libc/io/ttyname_r.c \ 127 128 $(PATH_LIBC_SRC)/libc/io/ungetc.c \ 128 129 $(PATH_LIBC_SRC)/libc/io/unlink.c \ -
trunk/libc/src/libc/io/ttyname.c
r1287 r2906 1 /* ttyname.c (emx+gcc) -- Copyright (c) 1995-1996 by Eberhard Mattes */ 1 /* $Id: $ */ 2 /** @file 3 * 4 * kLIBC - ttyname(). 5 * 6 * Copyright (c) 2006 knut st. osmundsen <bird-srcspam@anduin.net> 7 * 8 * 9 * This file is part of kLIBC. 10 * 11 * kLIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kLIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with kLIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 2 26 3 27 #include "libc-alias.h" 4 28 #include <unistd.h> 5 #include <emx/syscalls.h> 6 #include <InnoTekLIBC/thread.h> 29 #include <errno.h> 30 #include <klibc/backend.h> 31 #include <klibc/thread.h> 32 #define __LIBC_LOG_GROUP __LIBC_LOG_GRP_IO 33 #include <klibc/logstrict.h> 7 34 8 char *_STD(ttyname) (int handle)35 char *_STD(ttyname)(int fd) 9 36 { 10 __LIBC_PTHREAD pThrd = __libc_threadCurrent (); 37 LIBCLOG_ENTER("fd=%d\n", fd); 38 __LIBC_PTHREAD pThrd = __libc_threadCurrent(); 39 int rc = __libc_Back_ioTTYName(fd, pThrd->szTTYNameBuf, sizeof(pThrd->szTTYNameBuf)); 40 if (!rc) 41 LIBCLOG_RETURN_PSZ(pThrd->szTTYNameBuf); 42 errno = -rc; 43 LIBCLOG_ERROR_RETURN_P(NULL); 44 } 11 45 12 if (__ttyname (handle, pThrd->szTTYNameBuf, sizeof (pThrd->szTTYNameBuf)) == 0)13 return pThrd->szTTYNameBuf;14 else15 return NULL;16 }
Note:
See TracChangeset
for help on using the changeset viewer.