/freebsd/usr.sbin/daemon/tests/ |
H A D | daemon_test.sh | 30 atf_set "descr" "daemon should write pid files for itself and its child" 33 daemon -P daemon.pid -p sleep.pid sleep 300 34 atf_check -s exit:0 test -f daemon.pid 35 atf_check -s exit:0 -o match:"daemon: sleep" ps -p `cat daemon.pid` 36 atf_check -s exit:0 test -f sleep.pid 37 atf_check -s exit:0 -o match:"[0-9] sleep 300$" ps -p `cat sleep.pid` 40 if [ -f daemon.pid ]; then 41 daemon_pid=`cat daemon.pid` 44 sleep_pid=`cat sleep.pid` 58 daemon -p ${PWD}/sleep.pid -c bin/sleep 300 [all …]
|
/freebsd/usr.bin/renice/tests/ |
H A D | renice_test.sh | 16 local pid=$1 18 local actual="$(ps -o nice= -p $pid)" 27 local pid nice incr 29 pid=$! 30 nice="$(ps -o nice= -p $pid)" 32 _renice $((nice+incr)) $pid 33 atf_check_nice_value $pid $((nice+incr)) 34 kill $pid 42 local pid nice incr 44 pid=$! [all …]
|
/freebsd/contrib/netbsd-tests/bin/ps/ |
H A D | t_ps.sh | 94 default_keywords='pid tty stat time command' 95 j_keywords='user pid ppid pgid sess jobc state tt time command' 96 l_keywords='uid pid ppid cpu pri nice vsz rss wchan state tt time command' 97 s_keywords='uid pid ppid cpu lid nlwp pri nice vsz rss wchan lstate tt ltime command' 98 u_keywords='user pid %cpu %mem vsz rss tt state start time command' 99 v_keywords='pid state time sl re pagein vsz rss lim tsiz %cpu %mem command' 102 # Convert a list of keywords like "pid comm" to a regexp 103 # like " *PID COMMAND *" 203 "the pid column" 209 "$(echo "${default_keywords}" | sed -e 's/pid/pid %cpu %mem/')" [all …]
|
/freebsd/bin/pkill/tests/ |
H A D | pkill-j_test.sh | 24 command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & 27 command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & 48 ! test -f "${PWD}/${base}_1_1.pid" && 49 ! test -f "${PWD}/${base}_1_2.pid" ; then 54 [ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)" 55 [ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)" 61 command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & 64 command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount & 70 ! test -f ${PWD}/${base}_2_1.pid && 71 ! test -f ${PWD}/${base}_2_2.pid && kill $chpid3; then [all …]
|
H A D | pgrep-j_test.sh | 24 command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & 27 command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & 44 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \ 45 "$(cat ${PWD}/${base}_1_2.pid)" | sort) 51 [ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)" 52 [ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)" 58 command=daemon -p ${PWD}/${base}_2_1.pid $sleep $sleep_amount & 61 command=daemon -p ${PWD}/${base}_2_2.pid $sleep $sleep_amount & 65 pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \ 66 "$(cat ${PWD}/${base}_2_2.pid)" | sort) [all …]
|
/freebsd/tests/sys/audit/ |
H A D | process-control.c | 51 static pid_t pid; variable 67 pid = getpid(); in ATF_TC_BODY() 68 snprintf(pcregex, sizeof(pcregex), "fork.*%d.*return,success", pid); in ATF_TC_BODY() 72 ATF_REQUIRE((pid = fork()) != -1); in ATF_TC_BODY() 73 if (pid) in ATF_TC_BODY() 100 ATF_REQUIRE((pid = fork()) != -1); in ATF_TC_BODY() 101 if (pid) { in ATF_TC_BODY() 102 snprintf(pcregex, sizeof(pcregex), "exit.*%d.*success", pid); in ATF_TC_BODY() 128 pid = getpid(); in ATF_TC_BODY() 129 snprintf(pcregex, sizeof(pcregex), "rfork.*%d.*return,success", pid); in ATF_TC_BODY() [all …]
|
H A D | administrative.c | 48 static pid_t pid; variable 69 pid = getpid(); in ATF_TC_BODY() 70 snprintf(adregex, sizeof(adregex), "settimeofday.*%d.*success", pid); in ATF_TC_BODY() 97 pid = getpid(); in ATF_TC_BODY() 98 snprintf(adregex, sizeof(adregex), "settimeofday.*%d.*failure", pid); in ATF_TC_BODY() 126 pid = getpid(); in ATF_TC_BODY() 127 snprintf(adregex, sizeof(adregex), "clock_settime.*%d.*success", pid); in ATF_TC_BODY() 153 pid = getpid(); in ATF_TC_BODY() 154 snprintf(adregex, sizeof(adregex), "clock_settime.*%d.*failure", pid); in ATF_TC_BODY() 180 pid = getpid(); in ATF_TC_BODY() [all …]
|
/freebsd/contrib/netbsd-tests/lib/libc/sys/ |
H A D | t_wait.c | 80 pid_t pid; in ATF_TC_BODY() local 82 switch (pid = fork()) { in ATF_TC_BODY() 84 ATF_REQUIRE(pid > 0); in ATF_TC_BODY() 89 ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid); in ATF_TC_BODY() 92 ATF_REQUIRE(si.si_pid == pid); in ATF_TC_BODY() 115 pid_t pid; in ATF_TC_BODY() local 117 switch (pid = fork()) { in ATF_TC_BODY() 122 ATF_REQUIRE(pid > 0); in ATF_TC_BODY() 124 ATF_REQUIRE(kill(pid, SIGTERM) == 0); in ATF_TC_BODY() 125 ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid); in ATF_TC_BODY() [all …]
|
/freebsd/tools/test/ptrace/ |
H A D | scescx.c | 150 get_pathname(pid_t pid) in get_pathname() argument 159 name[3] = pid; in get_pathname() 166 pid, strerror(errno)); in get_pathname() 169 fprintf(stderr, "pid %d exited\n", pid); in get_pathname() 173 fprintf(stderr, "No cached pathname for process %d\n", pid); in get_pathname() 176 printf(TRACE "pid %d path %s\n", pid, pathname); in get_pathname() 180 wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo) in wait_info() argument 185 printf(TRACE "pid %d wait %s", pid, in wait_info() 218 trace_sc(int pid) in trace_sc() argument 224 if (ptrace(PT_TO_SCE, pid, (caddr_t)1, 0) < 0) { in trace_sc() [all …]
|
/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/ |
H A D | tst.printtype.ksh | 38 pid=$! 41 pid$pid::ff_getgameid:entry 44 print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)))); 49 pid$pid::ff_getpartysize:entry 52 print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)))); 57 pid$pid::ff_getsummons:entry 60 print(*(pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)))); 67 kill -9 $pid
|
H A D | tst.chasestrings.ksh | 39 pid=$! 42 pid$pid::has_princess:entry 45 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 52 pid$pid::has_dungeons:entry 55 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 62 pid$pid::has_villain:entry 65 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 74 kill -9 $pid
|
/freebsd/contrib/bmake/unit-tests/ |
H A D | opt-debug-jobs.exp | 2 TokenPool_Take: pid <pid>, aborting NONE, running 0 3 TokenPool_Take: pid <pid> took a token 17 JobExec: target all, pid <pid> added to jobs table 19 job 0, status running, flags ---, pid <pid> 23 Process with pid <pid> exited/stopped with status 0. 24 JobFinish: target all, pid <pid>, status 0 25 TokenPool_Take: pid <pid>, aborting NONE, running 0 26 TokenPool_Take: pid <pid> took a token
|
H A D | opt-tracefile.exp | 4 <timestamp> 0 BEG <make-pid> <curdir> 5 <timestamp> 1 JOB <make-pid> <curdir> dependency1 <job-pid> --- OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS… 6 <timestamp> 1 DON <make-pid> <curdir> dependency1 <job-pid> --- OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS… 7 <timestamp> 1 JOB <make-pid> <curdir> dependency2 <job-pid> --- OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS… 8 <timestamp> 1 DON <make-pid> <curdir> dependency2 <job-pid> --- OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS… 9 <timestamp> 1 JOB <make-pid> <curdir> trace <job-pid> --- OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DE… 10 <timestamp> 1 DON <make-pid> <curdir> trace <job-pid> --- OP_DEPENDS|OP_PHONY|OP_HAS_COMMANDS|OP_DE… 11 <timestamp> 0 END <make-pid> <curdir>
|
H A D | sh-errctl.exp | 2 TokenPool_Take: pid <pid>, aborting NONE, running 0 3 TokenPool_Take: pid <pid> took a token 19 JobExec: target all, pid <pid> added to jobs table 21 job 0, status running, flags ---, pid <pid> 25 TokenPool_Take: pid <pid>, aborting NONE, running 0 26 TokenPool_Take: pid <pid> took a token
|
/freebsd/contrib/bsnmp/snmpd/ |
H A D | snmpd.sh | 35 PID=/var/run/snmpd.pid 41 if [ -r ${PID} ] ; then 42 if kill -0 `cat ${PID}` ; then 43 echo "snmpd already running -- pid `cat ${PID}`" >/dev/stderr 46 rm -f ${PID} 48 if ${SNMPD} -c ${CONF} -p ${PID} ; then 54 if [ -r ${PID} ] ; then 55 if kill -0 `cat ${PID}` ; then 56 if kill -15 `cat ${PID}` ; then 63 echo "stale pid file -- removing" >/dev/stderr [all …]
|
/freebsd/contrib/capsicum-test/ |
H A D | procdesc.cc | 25 // see and reap any specific pid. Define this to nothing for platforms 38 pid_t pid = -1; in pdwait4_() 39 int rc = pdgetpid(pd, &pid); in pdwait4_() 44 return wait4(pid, status, options, ru); in pdwait4_() 81 void CheckChildFinished(pid_t pid, bool signaled=false) { in CheckChildFinished() argument 86 rc = waitpid(pid, &status, __WALL); in CheckChildFinished() 91 } else if (rc == pid) { in CheckChildFinished() 95 EXPECT_EQ(pid, rc); in CheckChildFinished() 96 if (rc == pid) { in CheckChildFinished() 114 int pid = pdfork(&pd, 0); in TEST() local [all …]
|
/freebsd/sys/compat/linux/ |
H A D | linux_ptrace.c | 122 linux_ptrace_status(struct thread *td, pid_t pid, int status) in linux_ptrace_status() argument 130 error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); in linux_ptrace_status() 160 linux_ptrace_peek(struct thread *td, pid_t pid, void *addr, void *data) in linux_ptrace_peek() argument 164 error = kern_ptrace(td, PT_READ_I, pid, addr, 0); in linux_ptrace_peek() 175 linux_ptrace_setoptions(struct thread *td, pid_t pid, l_ulong data) in linux_ptrace_setoptions() argument 225 return (kern_ptrace(td, PT_SET_EVENT_MASK, pid, &mask, sizeof(mask))); in linux_ptrace_setoptions() 229 linux_ptrace_geteventmsg(struct thread *td, pid_t pid, l_ulong data) in linux_ptrace_geteventmsg() argument 237 linux_ptrace_getsiginfo(struct thread *td, pid_t pid, l_ulong data) in linux_ptrace_getsiginfo() argument 243 error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); in linux_ptrace_getsiginfo() 263 linux_ptrace_getregs(struct thread *td, pid_t pid, void *data) in linux_ptrace_getregs() argument [all …]
|
/freebsd/usr.sbin/autofs/ |
H A D | popen.c | 58 struct pid { struct 59 SLIST_ENTRY(pid) next; 61 pid_t pid; argument 64 static SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist); argument 77 struct pid *cur, *p; in auto_popen() 78 pid_t pid; in auto_popen() local 90 cur = malloc(sizeof(struct pid)); in auto_popen() 112 switch (pid = fork()) { in auto_popen() 131 log_debugx("executing \"%s\" as pid %d", command, pid); in auto_popen() 139 cur->pid = pid; in auto_popen() [all …]
|
/freebsd/contrib/netbsd-tests/lib/libutil/ |
H A D | t_pidfile.c | 74 int pid; in check_pidfile() local 81 if (fscanf(file, "%d", &pid) == -1) in check_pidfile() 82 errx(EXIT_FAILURE, "Failed to read pid from pidfile '%s'", in check_pidfile() 85 printf("Read pid %d, current pid %d\n", pid, getpid()); in check_pidfile() 86 if (pid != getpid()) in check_pidfile() 87 errx(EXIT_FAILURE, "Pid in pidfile (%d) does not match " in check_pidfile() 88 "current pid (%d)", pid, getpid()); in check_pidfile() 110 pid_t pid; in run_child() local 112 pid = fork(); in run_child() 113 ATF_REQUIRE(pid != -1); in run_child() [all …]
|
/freebsd/tests/sys/kern/ |
H A D | reaper.c | 45 pid_t parent, child, grandchild, pid; in ATF_TC_BODY() local 50 pid = waitpid(-1, NULL, WNOHANG); in ATF_TC_BODY() 51 ATF_REQUIRE(pid == -1 && errno == ECHILD); in ATF_TC_BODY() 78 pid = waitpid(child, &status, 0); in ATF_TC_BODY() 79 ATF_REQUIRE_EQ(child, pid); in ATF_TC_BODY() 86 pid = waitpid(-1, &status, 0); in ATF_TC_BODY() 87 ATF_REQUIRE(pid > 0 && pid != child); in ATF_TC_BODY() 98 pid_t parent, child, grandchild, pid; in ATF_TC_BODY() local 102 pid = waitpid(-1, NULL, WNOHANG); in ATF_TC_BODY() 103 ATF_REQUIRE(pid == -1 && errno == ECHILD); in ATF_TC_BODY() [all …]
|
/freebsd/usr.bin/mail/ |
H A D | popen.c | 45 pid_t pid; member 51 pid_t pid; member 100 pid_t pid; in Popen() local 117 pid = start_command(value("SHELL"), &nset, fd0, fd1, "-c", cmd, NULL); in Popen() 118 if (pid < 0) { in Popen() 125 register_file(fp, 1, pid); in Popen() 159 register_file(FILE *fp, int pipe, pid_t pid) in register_file() argument 167 fpp->pid = pid; in register_file() 194 return (p->pid); in file_pid() 210 pid_t pid; in start_commandv() local [all …]
|
/freebsd/lib/libc/tests/stdlib/ |
H A D | libc_exit_test.c | 59 pid_t pid; in ATF_TC_BODY() local 62 pid = fork(); in ATF_TC_BODY() 63 if (pid == 0) { in ATF_TC_BODY() 71 ATF_REQUIRE_MSG(pid > 0, in ATF_TC_BODY() 73 ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0), in ATF_TC_BODY() 91 pid_t pid; in ATF_TC_BODY() local 94 pid = fork(); in ATF_TC_BODY() 95 if (pid == 0) { in ATF_TC_BODY() 99 ATF_REQUIRE_MSG(pid > 0, in ATF_TC_BODY() 101 ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0), in ATF_TC_BODY() [all …]
|
/freebsd/usr.bin/proccontrol/ |
H A D | proccontrol.c | 86 warnx("non-numeric pid"); in str2pid() 97 "(-p pid | command)\n"); in usage() 98 fprintf(stderr, " proccontrol -m mode -q [-p pid]\n"); in usage() 110 pid_t pid; in main() local 115 pid = -1; in main() 140 pid = str2pid(optarg); in main() 155 if (pid != -1 || query) in main() 157 pid = getpid(); in main() 158 } else if (pid == -1) { in main() 161 pid = getpid(); in main() [all …]
|
/freebsd/lib/libsys/ |
H A D | sched_setparam.2 | 37 .Fn sched_setparam "pid_t pid" "const struct sched_param *param" 39 .Fn sched_getparam "pid_t pid" "struct sched_param *param" 44 .Fa pid 55 .Fa pid . 59 .Fa pid 63 .Fa pid 66 .Fa pid . 69 .Fa pid 82 .Fa pid 86 .Fa pid [all …]
|
/freebsd/lib/libutil++/ |
H A D | freebsd__pidfile.3 | 12 .Nd own a PID file handle 43 Each instance of this class owns a PID file handle created by 53 The currently-owned PID file is removed by invoking 56 The currently-owned PID file is also removed if it is replaced by the 62 method relinquishes ownership of the current PID file handle and returns the 63 value of the previously-owned PID file handle. 67 method writes out the PID of the current process to the PID file via 72 method closes the current PID file without removing it via 74 If the close succeeds, the PID file handle is no longer valid. 78 method returns the underlying file descriptor for the current PID file via [all …]
|