svr4_misc.c (150663) | svr4_misc.c (151463) |
---|---|
1/*- 2 * Copyright (c) 1998 Mark Newton 3 * Copyright (c) 1994 Christos Zoulas 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28/* 29 * SVR4 compatibility module. 30 * 31 * SVR4 system calls that are implemented differently in BSD are 32 * handled here. 33 */ 34 35#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1998 Mark Newton 3 * Copyright (c) 1994 Christos Zoulas 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 19 unchanged lines hidden (view full) --- 28/* 29 * SVR4 compatibility module. 30 * 31 * SVR4 system calls that are implemented differently in BSD are 32 * handled here. 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_misc.c 150663 2005-09-28 07:03:03Z rwatson $"); | 36__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_misc.c 151463 2005-10-19 09:33:15Z davidxu $"); |
37 38#include "opt_mac.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/dirent.h> 43#include <sys/fcntl.h> 44#include <sys/filedesc.h> --- 1089 unchanged lines hidden (view full) --- 1134 svr4_siginfo_t *s; 1135{ 1136 struct timeval utime, stime; 1137 svr4_siginfo_t i; 1138 int sig; 1139 1140 memset(&i, 0, sizeof(i)); 1141 | 37 38#include "opt_mac.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/dirent.h> 43#include <sys/fcntl.h> 44#include <sys/filedesc.h> --- 1089 unchanged lines hidden (view full) --- 1134 svr4_siginfo_t *s; 1135{ 1136 struct timeval utime, stime; 1137 svr4_siginfo_t i; 1138 int sig; 1139 1140 memset(&i, 0, sizeof(i)); 1141 |
1142 i.si_signo = SVR4_SIGCHLD; 1143 i.si_errno = 0; /* XXX? */ | 1142 i.svr4_si_signo = SVR4_SIGCHLD; 1143 i.svr4_si_errno = 0; /* XXX? */ |
1144 1145 if (p) { | 1144 1145 if (p) { |
1146 i.si_pid = p->p_pid; | 1146 i.svr4_si_pid = p->p_pid; |
1147 PROC_LOCK(p); 1148 calcru(p, &utime, &stime); 1149 PROC_UNLOCK(p); | 1147 PROC_LOCK(p); 1148 calcru(p, &utime, &stime); 1149 PROC_UNLOCK(p); |
1150 i.si_stime = stime.tv_sec; 1151 i.si_utime = utime.tv_sec; | 1150 i.svr4_si_stime = stime.tv_sec; 1151 i.svr4_si_utime = utime.tv_sec; |
1152 } 1153 1154 if (WIFEXITED(st)) { | 1152 } 1153 1154 if (WIFEXITED(st)) { |
1155 i.si_status = WEXITSTATUS(st); 1156 i.si_code = SVR4_CLD_EXITED; | 1155 i.svr4_si_status = WEXITSTATUS(st); 1156 i.svr4_si_code = SVR4_CLD_EXITED; |
1157 } else if (WIFSTOPPED(st)) { 1158 sig = WSTOPSIG(st); 1159 if (sig >= 0 && sig < NSIG) | 1157 } else if (WIFSTOPPED(st)) { 1158 sig = WSTOPSIG(st); 1159 if (sig >= 0 && sig < NSIG) |
1160 i.si_status = SVR4_BSD2SVR4_SIG(sig); | 1160 i.svr4_si_status = SVR4_BSD2SVR4_SIG(sig); |
1161 | 1161 |
1162 if (i.si_status == SVR4_SIGCONT) 1163 i.si_code = SVR4_CLD_CONTINUED; | 1162 if (i.svr4_si_status == SVR4_SIGCONT) 1163 i.svr4_si_code = SVR4_CLD_CONTINUED; |
1164 else | 1164 else |
1165 i.si_code = SVR4_CLD_STOPPED; | 1165 i.svr4_si_code = SVR4_CLD_STOPPED; |
1166 } else { 1167 sig = WTERMSIG(st); 1168 if (sig >= 0 && sig < NSIG) | 1166 } else { 1167 sig = WTERMSIG(st); 1168 if (sig >= 0 && sig < NSIG) |
1169 i.si_status = SVR4_BSD2SVR4_SIG(sig); | 1169 i.svr4_si_status = SVR4_BSD2SVR4_SIG(sig); |
1170 1171 if (WCOREDUMP(st)) | 1170 1171 if (WCOREDUMP(st)) |
1172 i.si_code = SVR4_CLD_DUMPED; | 1172 i.svr4_si_code = SVR4_CLD_DUMPED; |
1173 else | 1173 else |
1174 i.si_code = SVR4_CLD_KILLED; | 1174 i.svr4_si_code = SVR4_CLD_KILLED; |
1175 } 1176 1177 DPRINTF(("siginfo [pid %ld signo %d code %d errno %d status %d]\n", | 1175 } 1176 1177 DPRINTF(("siginfo [pid %ld signo %d code %d errno %d status %d]\n", |
1178 i.si_pid, i.si_signo, i.si_code, i.si_errno, i.si_status)); | 1178 i.svr4_si_pid, i.svr4_si_signo, i.svr4_si_code, i.svr4_si_errno, 1179 i.svr4_si_status)); |
1179 1180 return copyout(&i, s, sizeof(i)); 1181} 1182 1183 1184int 1185svr4_sys_waitsys(td, uap) 1186 struct thread *td; --- 483 unchanged lines hidden --- | 1180 1181 return copyout(&i, s, sizeof(i)); 1182} 1183 1184 1185int 1186svr4_sys_waitsys(td, uap) 1187 struct thread *td; --- 483 unchanged lines hidden --- |