|
|
便利なツール Emacs らくらく 入門
|
|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
||||||||||||||||||||||||||||||||||||||||||||||||||
2014年06月27日(金) 旧暦 [n年日記] [更新:"2014/06/27 23:14:48"]#1 [debug] fgetc Segmentation Fault at malloc#0 0x00007f7ff789df92 in ?? () from /usr/lib/libc.so.12 #1 0x00007f7ff789e3d0 in ?? () from /usr/lib/libc.so.12 #2 0x00007f7ff789e689 in malloc () from /usr/lib/libc.so.12 #3 0x00007f7ff78ed28c in __smakebuf () from /usr/lib/libc.so.12 #4 0x00007f7ff78e24f8 in __srefill () from /usr/lib/libc.so.12 #5 0x00007f7ff78e2384 in __srget () from /usr/lib/libc.so.12 #6 0x00007f7ff7843997 in fgetc () from /usr/lib/libc.so.12これはどういう時かな。確かに読んでいるファイルは大きいのだけれど。 % wc hoge.5itmp 43213 152201 1897759 hoge.5itmp1.9MByte かな。でもそんなにやたらに大きということでもないと思う 次のような文字を教えても google は見向きもしない(ようだ) in malloc () in __smakebuf () in __srefill () in __srget () in fgetc () fromちなみに、次のところで説明されている問題は、まだ理解出来ていない。 fgetc が malloc を(勝手に)呼んでいるとして、そのメモリは、いつ free されるのだろうか ?
上記の答えは、「file descriptor を close すれば、開放される」
112 typedef struct __sFILE {
113 unsigned char *_p; /* current position in (some) buffer */
114 int _r; /* read space left for getc() */
115 int _w; /* write space left for putc() */
116 unsigned short _flags; /* flags, below; this FILE is free if 0 */
117 short _file; /* fileno, if Unix descriptor, else -1 */
118 struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
119 int _lbfsize; /* 0 or -_bf._size, for inline putc */
120
121 /* operations */
122 void *_cookie; /* cookie passed to io functions */
123 int (*_close)(void *);
124 int (*_read) (void *, char *, int);
125 __off_t (*_seek) (void *, __off_t, int);
126 int (*_write)(void *, const char *, int);
127
128 /* file extension */
129 struct __sbuf _ext;
130
131 /* separate buffer for long sequences of ungetc() */
132 unsigned char *_up; /* saved _p when _p is doing ungetc data */
133 int _ur; /* saved _r when _r is counting ungetc data */
134
135 /* tricks to meet minimum requirements even when malloc() fails */
136 unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
137 unsigned char _nbuf[1]; /* guarantee a getc() buffer */
138
139 /* Formerly used by fgetln/fgetwln; kept for binary compatibility */
140 struct __sbuf _lb__unused;
141
142 /* Unix stdio files get aligned to block boundaries on fseek() */
143 int _blksize; /* stat.st_blksize (may be != _bf._size) */
144 __off_t _offset; /* current lseek offset */
145 } FILE;
146
lib/libc/stdio/makebuf.c
55 /*
56 * Allocate a file buffer, or switch to unbuffered I/O.
57 * Per the ANSI C standard, ALL tty devices default to line buffered.
58 *
59 * As a side effect, we set __SOPT or __SNPT (en/dis-able fseek
60 * optimisation) right after the fstat() that finds the buffer size.
61 */
62 void
63 __smakebuf(fp)
64 FILE *fp;
65 {
66 void *p;
67 int flags;
68 size_t size;
69 int couldbetty;
70
71 _DIAGASSERT(fp != NULL);
72
73 if (fp->_flags & __SNBF) {
74 fp->_bf._base = fp->_p = fp->_nbuf;
75 fp->_bf._size = 1;
76 return;
77 }
78 flags = __swhatbuf(fp, &size, &couldbetty);
79 if ((p = malloc(size)) == NULL) {
80 fp->_flags |= __SNBF;
81 fp->_bf._base = fp->_p = fp->_nbuf;
82 fp->_bf._size = 1;
83 return;
84 }
85 __cleanup = _cleanup;
86 flags |= __SMBF;
87 fp->_bf._base = fp->_p = p;
88 fp->_bf._size = size;
89 if (couldbetty && isatty(__sfileno(fp)))
90 flags |= __SLBF;
91 fp->_flags |= flags;
92 }
上の中で size が気になる時には __swhatbuf も見る必要がある
94 /*
95 * Internal routine to determine `proper' buffering for a file.
96 */
97 int
98 __swhatbuf(fp, bufsize, couldbetty)
99 FILE *fp;
100 size_t *bufsize;
101 int *couldbetty;
102 {
103 struct stat st;
104
105 _DIAGASSERT(fp != NULL);
106 _DIAGASSERT(bufsize != NULL);
107 _DIAGASSERT(couldbetty != NULL);
108
109 if (__sfileno(fp) == -1 || fstat(__sfileno(fp), &st) < 0) {
110 *couldbetty = 0;
111 *bufsize = BUFSIZ;
112 return (__SNPT);
113 }
114
115 /* could be a tty iff it is a character device */
116 *couldbetty = S_ISCHR(st.st_mode);
117 if (st.st_blksize == 0) {
118 *bufsize = BUFSIZ;
119 return (__SNPT);
120 }
121
122 /*
123 * Optimise fseek() only if it is a regular file. (The test for
124 * __sseek is mainly paranoia.) It is safe to set _blksize
125 * unconditionally; it will only be used if __SOPT is also set.
126 */
127 *bufsize = st.st_blksize;
128 fp->_blksize = st.st_blksize;
129 return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ?
130 __SOPT : __SNPT);
131 }
st というのは
103 行目
にあるが struct stat の構成要素(member)だ
modena@makoto 23:14:17/140627(/export/src)% (cd include;mkid; gid BUFSIZ) stdio.h:181:#define BUFSIZ 1024 /* size of buffer used by setbuf */というのもある ( つっこみ )
2011年06月27日(月) 旧暦 [n年日記] [更新:"2011/06/29 09:40:11"]#3 [pkgsrc] xdvi での日本語表示
2011/03/01
に続いて、きょうも色々調べて見たが、進展はなかった。
print/ja-vfxdvi print/xdvik wip-jp/ja-xdvik主に最低限 wip-jp/ja-xdvik を compile 出来るようにしておきたいと 思ったが、png-1.5 問題を解決出来なかった。 (どうも TeXlive の 2011 を見れば良い気がしたが、一年の変化だと、 そう簡単に一部を取込むというのは出来そうになかった) ( つっこみ )
#2 [日本語入力] 最近漢直 Win から入力出来ない気がする
最近漢直 Win から入力出来ない気がする
(Windows XP, Windows 2000) 1.27f
( つっこみ )
#1 [無線] JARL から QSL Card 370g
2011/04/30
の 350 g から少し増えた。
( つっこみ )
2004年06月27日(日) 旧暦 [n年日記]#1 [pkgsrc] Mozilla のないくらし
www/mozilla/work/mozilla
で ./configure ってやると、正常終了。続けて gmake
../../dist/bin/libxpcom.so: undefined reference to `nsXPTCStubBase::Stub229()'(ここまで 1.6) ここから 1.7 ( つっこみ )
2001年06月27日(水) 旧暦 [n年日記]#1 [inn] inn-2.3.2 を組立てる
を見ながら。SS-10 は遅いなぁ。
1056.634u 122.278s 22:16.89 88.1% 0+0k 1028+10411io 205pf+0wspool と history を分けた方がいいと思うので、 2036 cyl を 1400+636 に分けて、 c: 2052288 0 unknown # (Cyl. 0 - 2035) d: 1411200 0 4.2BSD 512 4096 16 # (Cyl. 0 - 1399) e: 641088 1411200 4.2BSD 1024 8192 16 # (Cyl. 1400 - 2035) newfs -m 2 -f 512 -b 4096 /dev/sd4d newfs -m 2 /dev/sd4ecyl は 1600+436 くらいの方が良かったかな。やり直し。 c: 2052288 0 unknown # (Cyl. 0 - 2035) d: 1612800 0 4.2BSD 512 4096 16 # (Cyl. 0 - 1599) e: 439488 1612800 4.2BSD 1024 8192 16 # (Cyl. 1600 - 2035)make install すると Do not forget to update your cron entries, and also run makedbz if you need to. If this is a first-time installation a minimal active file has been installed. You will need to touch history and run "makedbz -i" to initialize the history database. See INSTALL for more information. と表示される /dev/sd4d 757582 12544 729886 1% /usr/local/news /dev/sd4e 212559 3 208304 0% /usr/local/news/dbactive は出来ている。 ~news/.cshrc に set path = ( /usr/local/news/bin /usr/bin /bin /usr/local/bin )と書いておいて
6 22:02 touch db/history
7 22:02 makedbz -i
> ls -l db
total 6
-rw-r--r-- 1 news news 225 Jun 27 21:28 active
-rw-r--r-- 1 news news 0 Jun 27 21:56 active.times
-rw-r--r-- 1 news news 0 Jun 27 22:02 history
-rw-r--r-- 1 news news 41 Jun 27 22:02 history.n.dir
-rw-r--r-- 1 news news 0 Jun 27 22:02 history.n.hash
-rw-r--r-- 1 news news 0 Jun 27 22:02 history.n.index
-rw-r--r-- 1 news news 333 Jun 27 21:28 newsgroups
> inndstart
> ps ax | grep inn
動いていない。/var/log/message を見ると
milano innd: SERVER cant dbzinit /usr/local/news/db/history No such file or directoryとある。良く見たら history の名前が一時名だった。名前を変えて > mv history.n.hash history.hash > mv history.n.dir history.dir > mv history.n.index history.index > inndstart > !ps ps ax | grep inn 17805 ?? Ss 0:00.22 /usr/local/news/bin/innd -p4これで一応動いた。 active を同期させるのは ? actsync というのがあるはずだけれど、簡単には分らないので 接続先から list active で持って来た。 script しておいて、その記録を
> tr -d '\015' < /tmp/active \
| awk '{print "ctlinnd newgroup", $1, $4}' > /tmp/1
して、少し前後を削り、
> vi /tmp/1
sh /tmp/1
@ incoming.conf に追加:@ innfeed.conf:@ expire.ctl:@ /usr/local/news/bin/innd -p4 -c 2000:
古めの記事が来ているようなので、どうせならと 2000 日。
( つっこみ )
2000年06月27日(火) 旧暦 [n年日記]
5161歩
#3 [NetBSD] shared library
僕は「多分 libtool を使うのだろう」という言葉しか
考えがうかばない。(それ以上知らないということ)
(hns-2.00 って、枝番の付け方が違う ? もしそうだとすると、 入替えた時に、以前の参照 (LINK) が狂ってしまう ? ) ( つっこみ )
#2 [音訳誹語] その一security 安全 trade off 天びん ( つっこみ )
#1 [Mailing-List] Debian は Majordomo に安全上問題があり、契約文の上でも変更も許されないので削除
debian-security-announce-00/msg00007.html
だそうです。
僕は、はっきり言って fml はきらいです。理由は、もしかしたら 誤解かも知れないけれど、あまりにも何でも設定出来ることです。 例えば、投稿先に # bye なんて送ることが出来るような設定も 出来るとか。 ( つっこみ )
|
最近の日記 2025年10月25日 ・recover from disk error 2025年10月23日 ・dd does not duplicate Windows 11 boot disk ? 2025年10月13日 ・missing package 2025年10月04日 ・pkgin search pkgname segfaults 2025年08月16日 ・installboot (Although it’s too late) | ||