freebsd

lsof should give all open files for a set of pids

a 夏天 提交于 2019-11-30 11:59:51
I have 30 instances of a process running on a server and want to log open files for each process for analysis. I ran the following command: * ps auwwx | grep PROG_NAME | awk '{print $2}' | xargs lsof -p | less It complaints that, "lsof: status error on : No such file or directory" However, if I run lsof -p < pid > it gives me the list of open files for that process . How can I get a list of all open files for all 30 instances of the process on a FreeBSD machine. Moreover, I do not want the shared libraries to be listed. If I do -d "^txt" it isn't showing some other db files which I want to be

mktime and tm_isdst

落花浮王杯 提交于 2019-11-30 11:36:42
I saw a lot of different views so thought of asking here. I read man mktime : (A positive or zero value for tm_isdst causes mktime() to presume initially that summer time (for example, Daylight Saving Time) is or is not in effect for the specified time, respectively. A negative value for tm_isdst causes the mktime() function to attempt to divine whether summer time is in effect for the specified time. My question is, shouldn't tm_isdst be kept as -1 to let the system decide if its dst or not and that way the code becomes dst agnostic? Am I missing something? I believe the original reason for

Problem porting PHP crypt() function to C#

﹥>﹥吖頭↗ 提交于 2019-11-30 09:58:17
问题 Im working on porting some old ALP user accounts to a new ASP.Net solution, and I would like for the users to be able to use their old passwords. However, in order for that to work, I need to be able to compare the old hashes to a newly calculated one, based on a newly typed password. I searched around, and found this as the implementation of crypt() called by PHP: char * crypt_md5(const char *pw, const char *salt) { MD5_CTX ctx,ctx1; unsigned long l; int sl, pl; u_int i; u_char final[MD5

FreeBSD 10 + Nginx 1.4.4 + PHP 5.5.9 + MySQL 5.6.1

跟風遠走 提交于 2019-11-30 09:38:21
FreeBSD 10 + Nginx 1.4.4 + PHP 5.5.9 + MySQL 5.6.15 How to Install Nginx and PHP-FPM on FreeBSD 10 Mr . Neo Chen (netkiller) , 陈景峰(BG7NYT) 中国 广东省 深圳市 龙华新区民治街道溪山美地 518131 +86 13113668890 +86 755 29812080 < netkiller@msn.com > $Id$ 版权 © 2011, 2012, 2013, 2014 http://netkiller.github.io $Date$ 摘要 FreeBSD 10.0 的 pkg 无法安装php-fpm 最终采用 posts 编译安装 http://netkiller.github.io/journal/freebsd.php.html 我的系列文档 Netkiller Architect 手札 Netkiller Developer 手札 Netkiller PHP 手札 Netkiller Python 手札 Netkiller Testing 手札 Netkiller Cryptography 手札 Netkiller Linux 手札 Netkiller Debian 手札 Netkiller CentOS 手札 Netkiller

Displaying each assembly instruction executed in gdb

笑着哭i 提交于 2019-11-30 07:02:59
I currently have a tricky bug that occurs in a place where I don't have access to source or symbols, i.e. I can see the instruction and its address where the crash occurs, but that's about it. What I'd like to do is have gdb run without requiring interaction and display every instruction as it does so , but I've yet to find a way to do it. What I'm hoping to achieve is something like this: (gdb) /* some command */ 0x2818a7c0: push %ebp 0x2818a7c1: mov %esp,%ebp 0x2818a7c3: push %ebx 0x2818a7c4: sub $0x4,%esp ... 0x28563622: mov %esi,0x0(%eax) Program received signal SIGSEGV, Segmentation fault

How to make my python script easy portable? or how to compile into binary with all module dependencies?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 02:05:49
Is there any way to compile python script into binary? I have one file python script which uses a lot of modules. What I would like is to have its copy on other machines (freebsd) but without installing all needed modules on every host. What are possible solutions in such cases? Programs that can do what you ask for are: PyInstaller: http://www.pyinstaller.org/ [Windows, Linux, OS X] cx_freeze: http://cx-freeze.sourceforge.net/ [Windows, Linux] py2exe: http://www.py2exe.org/ [Windows] py2app: http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html [os x] But as mentioned you can also

Using VisualVM to connect to a remote jstatd instance through a firewall [duplicate]

我是研究僧i 提交于 2019-11-29 22:30:57
Possible Duplicate: VisualVM over ssh I'm writing this question and answering it because I spent a few hours getting this to work today and no answer I found on here worked for me. Hopefully this is helpful for others. If you have another solution than the one I ended up using, please feel free to answer the question as well. If yours is better I'll accept yours instead. The problem: I'm trying to monitor some home made java applications on my FreeBSD server (this should apply to Linux servers as well) using VisualVM and jstatd, but I can't get VisualVM to list the processes on the server even

Question about writing my own system call in FreeBSD

走远了吗. 提交于 2019-11-29 22:16:09
问题 OK, so I just finish reading the implementation of kill(2) of FreeBSD, and am trying to write my own "kill". This system call takes uid and signum and sends the signal to processes owned by uid, excluding the calling process. How can I pass uid to the system call? In kill(2), pid is in argument struct kill_args . Is there a structure that contains uid the way that struct kill_args contains pid ? If not, can I define a structure outside the kernel? 回答1: It's easy, but kind of an involved

Where is stdarg.h?

陌路散爱 提交于 2019-11-29 18:24:20
问题 On my system (Mac OS 10.6) /usr/include/stdarg.h is: /* This file is public domain. */ /* GCC uses its own copy of this header */ #if defined(__GNUC__) #include_next <stdarg.h> #elif defined(__MWERKS__) #include "mw_stdarg.h" #else #error "This header only supports __MWERKS__." #endif So, if GCC uses its own copy of stdarg.h , where is it? I have no idea on what that #include_next means (maybe a GCC extension?), nor something about "MWERKS" (a compiler?). 回答1: <stdarg.h> , even more than most

Problem porting PHP crypt() function to C#

懵懂的女人 提交于 2019-11-29 17:54:38
Im working on porting some old ALP user accounts to a new ASP.Net solution, and I would like for the users to be able to use their old passwords. However, in order for that to work, I need to be able to compare the old hashes to a newly calculated one, based on a newly typed password. I searched around, and found this as the implementation of crypt() called by PHP: char * crypt_md5(const char *pw, const char *salt) { MD5_CTX ctx,ctx1; unsigned long l; int sl, pl; u_int i; u_char final[MD5_SIZE]; static const char *sp, *ep; static char passwd[120], *p; static const char *magic = "$1$"; /*