diff options
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r-- | openbsd-compat/bsd-misc.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 3ef373f56..d75854e83 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c | |||
@@ -165,6 +165,17 @@ int nanosleep(const struct timespec *req, struct timespec *rem) | |||
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #if !defined(HAVE_USLEEP) | ||
169 | int usleep(unsigned int useconds) | ||
170 | { | ||
171 | struct timespec ts; | ||
172 | |||
173 | ts.tv_sec = useconds / 1000000; | ||
174 | ts.tv_nsec = (useconds % 1000000) * 1000; | ||
175 | return nanosleep(&ts, NULL); | ||
176 | } | ||
177 | #endif | ||
178 | |||
168 | #ifndef HAVE_TCGETPGRP | 179 | #ifndef HAVE_TCGETPGRP |
169 | pid_t | 180 | pid_t |
170 | tcgetpgrp(int fd) | 181 | tcgetpgrp(int fd) |
@@ -242,8 +253,25 @@ strdup(const char *str) | |||
242 | #endif | 253 | #endif |
243 | 254 | ||
244 | #ifndef HAVE_ISBLANK | 255 | #ifndef HAVE_ISBLANK |
245 | int isblank(int c) | 256 | int |
257 | isblank(int c) | ||
246 | { | 258 | { |
247 | return (c == ' ' || c == '\t'); | 259 | return (c == ' ' || c == '\t'); |
248 | } | 260 | } |
249 | #endif | 261 | #endif |
262 | |||
263 | #ifndef HAVE_GETPGID | ||
264 | pid_t | ||
265 | getpgid(pid_t pid) | ||
266 | { | ||
267 | #if defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID) | ||
268 | return getpgrp(pid); | ||
269 | #elif defined(HAVE_GETPGRP) | ||
270 | if (pid == 0) | ||
271 | return getpgrp(); | ||
272 | #endif | ||
273 | |||
274 | errno = ESRCH; | ||
275 | return -1; | ||
276 | } | ||
277 | #endif | ||