freebsd

c, function definition following struct

落爺英雄遲暮 提交于 2019-12-01 21:52:59
问题 675 * Check the validity of an ACL for a file. 676 */ 677 int 678 ufs_aclcheck(ap) 679 struct vop_aclcheck_args /* { 680 struct vnode *vp; 681 acl_type_t type; 682 struct acl *aclp; 683 struct ucred *cred; 684 struct thread *td; 685 } */ *ap; 686 { 687 688 if ((ap->a_vp->v_mount->mnt_flag & (MNT_ACLS | MNT_NFS4ACLS)) == 0) 689 return (EOPNOTSUPP); 690 691 if (ap->a_type == ACL_TYPE_NFS4) 692 return (ufs_aclcheck_nfs4(ap)); 693 694 return (ufs_aclcheck_posix1e(ap)); 695 } 696 697 #endif /*

how to disable creating java heap dump after VM crashes?

北城余情 提交于 2019-12-01 21:45:12
JVM runs on FreeBSD with 18Gb memory. creating core file takes about hour, which is very slow, so i need some way to disable it. If this is an OS crash dump then use ulimit to set the maximum core size to 0. I'm not sure this will work, but if you're using the HotSpot VM, try this in the arguments to the java command: -XX:HeapDumpPath=/dev/null If you want to turn off core dumps altogether, you can use the ulimit approach (make sure to use the -H flag to set the hard limit): ulimit -c -H 0 If you really mean a core file, and not something specific to java, then you need to use the ulimit

FreeBSD 安装vim 并配置

[亡魂溺海] 提交于 2019-12-01 12:22:31
pkg 镜像源安装 1 pkg install vim 查看 vim信息 1 root@FreeBSD:~ # pkg info vim 2 vim-8.1.1954 3 Name : vim 4 Version : 8.1.1954 5 Installed on : Wed Oct 16 22:05:07 2019 CST 6 Origin : editors/vim 7 Architecture : FreeBSD:12:amd64 8 Prefix : /usr/local 9 Categories : editors 10 Licenses : VIM 11 Maintainer : adamw@FreeBSD.org 12 WWW : http://www.vim.org/ 13 Comment : Improved version of the vi editor 14 Options : 15 ATHENA : off 16 CONSOLE : off 17 CSCOPE : on 18 CTAGS_BASE : off 19 CTAGS_EXUBERANT: on 20 CTAGS_UNIVERSAL: off 21 DEFAULT_VIMRC : on 22 GNOME : off 23 GTK2 : off 24 GTK3 : on 25 LUA : off

How to create a library which uses mutexes only if pthread is linked?

感情迁移 提交于 2019-12-01 09:44:57
问题 I'm creating a C library on Linux which has several functions, which together operate upon some global data. In order for these functions to be thread safe, they must employ mutexes at the appropriate points in the code. In Linux, in order to use pthreads in an application, one needs to link in the appropriate library, -lpthread . In the case of my library once compiled, I'd like to make it work both if the user of it decided to use pthreads in their application, as well as if they don't. In

How to create a library which uses mutexes only if pthread is linked?

五迷三道 提交于 2019-12-01 09:30:42
I'm creating a C library on Linux which has several functions, which together operate upon some global data. In order for these functions to be thread safe, they must employ mutexes at the appropriate points in the code. In Linux, in order to use pthreads in an application, one needs to link in the appropriate library, -lpthread . In the case of my library once compiled, I'd like to make it work both if the user of it decided to use pthreads in their application, as well as if they don't. In the case where a developer does not use threads in their application, they will not link against

Insert newline (\\n) using sed

旧巷老猫 提交于 2019-12-01 02:56:38
I am trying to scrub some lists into a properly formatted CSV file for database import. My starting file, looks something like this with what is supposed to be each "line" spanning multiple lines like below Mr. John Doe Exclusively Stuff, 186 Caravelle Drive, Ponte Vedra 33487. I created a sed script that cleans up the the file (there's lots of "dirty" formatting like double spaces and spaces before/after commas). The problem is the Zip with the period. I would like to change that period for a new line, but I cannot get it to work. The command that I use is: sed -E -f scrub.sed test.txt and

Installing Python on FreeBSD 8.1

帅比萌擦擦* 提交于 2019-12-01 02:09:58
So I installed python on my FreeBSD box with these commans: #portsnap fetch #portsnap extract #portsnap update #cd /usr/ports/lang/python32 #make install clean Everything worked and I got no error messages. Installation went smoothly. However when I type python in shell, I get: python: Command not found. Help? You can search it: find /usr/bin /bin/ /usr/local/bin -iname 'python*' I know it's an old post but it is still not completely answered. Command in accepted answer from guettli will return something like this: $ find /usr/bin /bin/ /usr/local/bin -iname 'python*' /usr/local/bin/python2.7

FreeBSD Here is how to upgrade

浪尽此生 提交于 2019-11-30 21:16:14
freebsd-version or uname -mrs freebsd-update fetch install pkg update && pkg upgrade -y freebsd-update -r xx.x-RELEASE upgrade freebsd-update install reboot freebsd-update install pkg-static install -f pkg pkg update && pkg upgrade -y ps aux sockstat -l sockstat -4 sockstat -6 netstat -a -n | grep LISTEN top tail -f /var/log/messages grep error /path/to/app egrep -i 'err|warn|cri' /var/log/messages freebsd-version or uname -mrs 来源: https://www.cnblogs.com/defifind/p/11640763.html

How to close a non-blocking socket?

本秂侑毒 提交于 2019-11-30 14:32:38
I believe that if we call close system call on a non-blocking socket it returns immediately, then how to handle the response? whether it is closed or not? in other words what is the behavior of the socket system call close on a non-blocking socket? if we call close system call on a non-blocking socket it returns immediately The socket is always closed: the connection may still be writing to the peer. But your question embodies a fallacy: if you call close() on any socket it will return immediately. Closing and writing to a socket is asynchronous. You can control that with SO_LINGER as per the

Where is stdarg.h?

Deadly 提交于 2019-11-30 12:39:13
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?). <stdarg.h> , even more than most C library headers, tends to be very compiler-specific. As such, each of the compilers on OS X has it's own