/freebsd/usr.sbin/daemon/tests/ |
H A D | daemon_test.sh | 3 # SPDX-License-Identifier: BSD-2-Clause 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` 43 if [ -f sleep_pid ]; then [all …]
|
/freebsd/usr.bin/renice/tests/ |
H A D | renice_test.sh | 2 # Copyright (c) 2022-2023 Klara, Inc. 4 # SPDX-License-Identifier: BSD-2-Clause 7 # Name of user to use for -u tests when running as root. Beware that 12 atf_check -o empty -e ignore -s exit:0 renice "$@" 16 local pid=$1 18 local actual="$(ps -o nice= -p $pid)" 19 atf_check test "$actual" -eq "$expected" 27 local pid nice incr 29 pid=$! 30 nice="$(ps -o nice= -p $pid)" [all …]
|
/freebsd/contrib/netbsd-tests/bin/ps/ |
H A D | t_ps.sh | 43 # for regular expressions to match the text in left- or 44 # right-justified columns. 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 *" [all …]
|
/freebsd/bin/pkill/tests/ |
H A D | pkill-j_test.sh | 6 jls -j "$check_name" -s | tr ' ' '\n' | grep jid= | sed -e 's/.*=//g' 11 if [ "$(id -u)" -ne 0 ]; then 19 ln -sf /bin/sleep $sleep 21 name="pkill -j <jid>" 23 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ 24 command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & 26 jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ 27 command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & 36 [0-9]*,[0-9]*) 47 if pkill -f -j "$jid" $sleep && sleep 0.5 && [all …]
|
H A D | pgrep-j_test.sh | 6 jls -j "$check_name" -s | tr ' ' '\n' | grep jid= | sed -e 's/.*=//g' 11 if [ "$(id -u)" -ne 0 ]; then 19 ln -sf /bin/sleep $sleep 21 name="pgrep -j <jid>" 23 jail -c path=/ name=${base}_1_1 ip4.addr=127.0.0.1 \ 24 command=daemon -p ${PWD}/${base}_1_1.pid $sleep $sleep_amount & 26 jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ 27 command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & 35 [0-9]*,[0-9]*) 43 pid1="$(pgrep -f -x -j "$jid" "$sleep $sleep_amount" | sort)" [all …]
|
/freebsd/tests/sys/audit/ |
H A D | process-control.c | 1 /*- 40 #include <atf-c.h> 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() [all …]
|
H A D | administrative.c | 1 /*- 39 #include <atf-c.h> 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() 105 tp.tv_sec = -1; in ATF_TC_BODY() 107 ATF_REQUIRE_EQ(-1, settimeofday(&tp, &tzp)); in ATF_TC_BODY() 126 pid = getpid(); in ATF_TC_BODY() [all …]
|
/freebsd/tools/test/ptrace/ |
H A D | scescx.c | 1 /*- 109 flags = lwpinfo->pl_flags; in decode_pl_flags() 137 switch (lwpinfo->pl_event) { in decode_pl_event() 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 [all …]
|
/freebsd/contrib/bsnmp/snmpd/ |
H A D | snmpd.sh | 3 # Copyright (c) 2001-2003 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 [all …]
|
/freebsd/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/uctf/ |
H A D | tst.chasestrings.ksh | 24 echo expected one argument: '<'dtrace-path'>' 32 elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf' 33 if [[ $? -ne 0 ]]; then 39 pid=$! 41 $dtrace -qs /dev/stdin <<EOF 42 pid$pid::has_princess:entry 45 this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t))); 47 copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons, 48 copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda); 52 pid$pid::has_dungeons:entry [all …]
|
H A D | tst.printtype.ksh | 23 echo expected one argument: '<'dtrace-path'>' 31 elfdump -c "./$exe" | grep -Fq 'sh_name: .SUNW_ctf' 32 if [[ $? -ne 0 ]]; then 38 pid=$! 40 $dtrace -qs /dev/stdin <<EOF 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 [all …]
|
/freebsd/contrib/netbsd-tests/lib/libc/sys/ |
H A D | t_wait.c | 3 /*- 50 #include <atf-c.h> 64 ATF_REQUIRE(wait6(P_ALL, 0, &st, 0, &wru, &si) == -1 in ATF_TC_BODY() 80 pid_t pid; in ATF_TC_BODY() local 82 switch (pid = fork()) { in ATF_TC_BODY() 83 case -1: 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 [all …]
|
/freebsd/contrib/capsicum-test/ |
H A D | procdesc.cc | 21 #include "capsicum-test.h" 25 // see and reap any specific pid. Define this to nothing for platforms 30 //------------------------------------------------ 38 pid_t pid = -1; in pdwait4_() 39 int rc = pdgetpid(pd, &pid); in pdwait4_() 44 return wait4(pid, status, options, ru); in pdwait4_() 49 fprintf(f, " User CPU time=%ld.%06ld\n", (long)ru->ru_utime.tv_sec, (long)ru->ru_utime.tv_usec); in print_rusage() 50 …fprintf(f, " System CPU time=%ld.%06ld\n", (long)ru->ru_stime.tv_sec, (long)ru->ru_stime.tv_usec); in print_rusage() 51 fprintf(f, " Max RSS=%ld\n", ru->ru_maxrss); in print_rusage() 62 (long)stat->st_dev, (long)stat->st_ino, stat->st_mode, in print_stat() [all …]
|
/freebsd/sys/compat/linux/ |
H A D | linux_ptrace.c | 1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 7 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 122 linux_ptrace_status(struct thread *td, pid_t pid, int status) in linux_ptrace_status() argument 129 saved_retval = td->td_retval[0]; in linux_ptrace_status() 130 error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); in linux_ptrace_status() 131 td->td_retval[0] = saved_retval; in linux_ptrace_status() 137 pem = pem_find(td->td_proc); in linux_ptrace_status() 141 if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && in linux_ptrace_status() 144 if ((pem->ptrace_flags & LINUX_PTRACE_O_TRACESYSGOOD) && in linux_ptrace_status() [all …]
|
/freebsd/usr.sbin/autofs/ |
H A D | popen.c | 2 * SPDX-License-Identifier: BSD-3-Clause 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 71 * Error handling is built in - if it returns, then it succeeded. 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() 110 cur->command = checked_strdup(command); in auto_popen() [all …]
|
/freebsd/contrib/netbsd-tests/lib/libutil/ |
H A D | t_pidfile.c | 63 #include <atf-c.h> 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() 96 if (access(path, R_OK) != -1) { in ensure_deleted() 110 pid_t pid; in run_child() local [all …]
|
/freebsd/usr.bin/mail/ |
H A D | popen.c | 1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause 45 pid_t pid; member 51 pid_t pid; member 100 pid_t pid; in Popen() local 114 fd1 = -1; in Popen() 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() 152 if (fp_head->pipe) in close_all_files() [all …]
|
/freebsd/tests/sys/kern/ |
H A D | reaper.c | 1 /*- 32 #include <atf-c.h> 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() 61 ATF_REQUIRE(child != -1); in ATF_TC_BODY() 66 if (grandchild == -1) in ATF_TC_BODY() 78 pid = waitpid(child, &status, 0); in ATF_TC_BODY() 79 ATF_REQUIRE_EQ(child, pid); in ATF_TC_BODY() 80 r = WIFEXITED(status) ? WEXITSTATUS(status) : -1; in ATF_TC_BODY() [all …]
|
H A D | ktrace_test.c | 1 /*- 46 #include <atf-c.h> 125 O_RDONLY | O_CREAT | O_TRUNC, 0600)) != -1); in trace_child() 126 ATF_REQUIRE_MSG(ktrace("ktrace.out", KTROP_SET, facility, cpid) != -1, in trace_child() 129 ATF_REQUIRE(kill(cpid, SIGUSR1) != -1); in trace_child() 131 ATF_REQUIRE(waitpid(cpid, &error, 0) != -1); in trace_child() 152 ATF_REQUIRE((n = read(fd, &header, sizeof(header))) != -1); in cap_trace_child() 158 sizeof(*v))) != -1); in cap_trace_child() 161 ATF_REQUIRE(close(fd) != -1); in cap_trace_child() 174 pid_t pid; in ATF_TC_BODY() local [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 74 .St -p1003.1b-93 75 as a write-style operation. [all …]
|
/freebsd/usr.bin/proccontrol/ |
H A D | proccontrol.c | 1 /*- 86 warnx("non-numeric pid"); in str2pid() 87 return (-1); in str2pid() 96 fprintf(stderr, " proccontrol -m mode -s (enable|disable) " in usage() 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() 117 while ((ch = getopt(argc, argv, "m:qs:p:")) != -1) { in main() 140 pid = str2pid(optarg); in main() [all …]
|
/freebsd/lib/libc/tests/stdlib/ |
H A D | libc_exit_test.c | 1 /*- 4 * SPDX-License-Identifier: BSD-2-Clause 14 #include <atf-c.h> 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() [all …]
|
/freebsd/tools/test/stress2/misc/ |
H A D | kevent12.sh | 4 # SPDX-License-Identifier: BSD-2-Clause 30 # Bug 228858 - panic when delivering knote to a process who has opened a 43 mycc -o kevent12 -Wall -Wextra -O2 -g kevent12.c || exit 1 44 rm -f kevent12.c 47 (cd $odir/../testcases/swap; ./swap -t 5m -i 20 -l 100 > /dev/null 2>&1) & 48 pid=$! 50 while pgrep -q swap; do 51 pkill -9 swap 53 wait $pid 55 rm -f /tmp/kevent12 [all …]
|
/freebsd/contrib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ |
H A D | GDBRemoteCommunicationServerPlatform.cpp | 1 //===-- GDBRemoteCommunicationServerPlatform.cpp --------------------------===// 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7 //===----------------------------------------------------------------------===// 77 uint16_t port, lldb::pid_t pid) { in AssociatePortWithProcess() argument 80 pos->second = pid; in AssociatePortWithProcess() 89 pos->second = LLDB_INVALID_PROCESS_ID; in FreePort() 96 lldb::pid_t pid) { in FreePortForProcess() argument 99 if (pair.second == pid) { in FreePortForProcess() 118 m_pending_gdb_server.pid = LLDB_INVALID_PROCESS_ID; in GDBRemoteCommunicationServerPlatform() 163 const lldb_private::Args &args, std::string hostname, lldb::pid_t &pid, in LaunchGDBServer() argument [all …]
|
/freebsd/tests/sys/kern/tty/ |
H A D | test_sti.c | 1 /*- 4 * SPDX-License-Identifier: BSD-2-Clause 19 #include <atf-c.h> 66 return (-1); in inject() 75 * and returns the pid. 0 for the child, >0 for the parent, as usual. 84 int pid; in init_pty() local 86 pid = forkpty(termfd, NULL, NULL, NULL); in init_pty() 87 ATF_REQUIRE(pid != -1); in init_pty() 89 if (pid == 0) { in init_pty() 96 if (tcgetattr(STDIN_FILENO, &term) == -1) in init_pty() [all …]
|