From 3c4a24c3e329ccca86629ed694b9756309b00113 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 15 Feb 2013 11:41:35 +1100 Subject: - (dtucker) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] Use getpgrp() if we don't have getpgid() (old BSDs, maybe others). --- openbsd-compat/bsd-misc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'openbsd-compat/bsd-misc.c') diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 3ef373f56..0cff2e423 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -247,3 +247,16 @@ int isblank(int c) return (c == ' ' || c == '\t'); } #endif + +#ifndef HAVE_GETPGID +pid_t +getpgid(pid_t pid) +{ +#ifdef HAVE_GETPGRP + if (pid == 0) + return getpgrp(); +#endif + errno = ESRCH; + return -1; +} +#endif -- cgit v1.2.3 From 62e4edc797a284f551e7faa616af06f8c3c24015 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 15 Feb 2013 11:50:03 +1100 Subject: spacing --- openbsd-compat/bsd-misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'openbsd-compat/bsd-misc.c') diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 0cff2e423..ad524b8b7 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -242,7 +242,8 @@ strdup(const char *str) #endif #ifndef HAVE_ISBLANK -int isblank(int c) +int +isblank(int c) { return (c == ' ' || c == '\t'); } -- cgit v1.2.3 From 2991d288db4355a54f0860be184c31343cb2c139 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 15 Feb 2013 14:55:38 +1100 Subject: - (dtucker) [openbsd-compat/bsd-misc.c] Handle the case where setpgrp() takes an argument. Pointed out by djm. --- ChangeLog | 2 ++ openbsd-compat/bsd-misc.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'openbsd-compat/bsd-misc.c') diff --git a/ChangeLog b/ChangeLog index 88e4fe267..8dd37b2c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ platforms that don't have it. - (dtucker) [openbsd-compat/openbsd-compat.h] Add prototype for strtoul, group strto* function prototypes together. + - (dtucker) [openbsd-compat/bsd-misc.c] Handle the case where setpgrp() takes + an argument. Pointed out by djm. - (djm) OpenBSD CVS Sync - djm@cvs.openbsd.org 2013/02/14 21:35:59 [auth2-pubkey.c] diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index ad524b8b7..8dc7d02d1 100644 --- a/openbsd-compat/bsd-misc.c +++ b/openbsd-compat/bsd-misc.c @@ -253,10 +253,13 @@ isblank(int c) pid_t getpgid(pid_t pid) { -#ifdef HAVE_GETPGRP +#if defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID) + return getpgrp(pid); +#elif defined(HAVE_GETPGRP) if (pid == 0) return getpgrp(); #endif + errno = ESRCH; return -1; } -- cgit v1.2.3 From f4db77d7668104c1237636781cfbd59ef30f79b0 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 15 Mar 2013 10:34:25 +1100 Subject: - (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] Add a usleep replacement for platforms that lack it; ok dtucker --- ChangeLog | 2 ++ configure.ac | 5 +++-- openbsd-compat/bsd-misc.c | 11 +++++++++++ openbsd-compat/bsd-misc.h | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) (limited to 'openbsd-compat/bsd-misc.c') diff --git a/ChangeLog b/ChangeLog index 635c4cd0c..9f6fc7058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ - (djm) [configure.ac] Disable utmp, wtmp and/or lastlog if the platform is unable to successfully compile them. Based on patch from des AT des.no + - (djm) [configure.ac openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h] + Add a usleep replacement for platforms that lack it; ok dtucker 20120312 - (dtucker) [regress/Makefile regress/cipher-speed.sh regress/test-exec.sh] diff --git a/configure.ac b/configure.ac index bf161b257..907192d60 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.515 2013/03/14 23:23:07 djm Exp $ +# $Id: configure.ac,v 1.516 2013/03/14 23:34:25 djm Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) -AC_REVISION($Revision: 1.515 $) +AC_REVISION($Revision: 1.516 $) AC_CONFIG_SRCDIR([ssh.c]) AC_LANG([C]) @@ -1604,6 +1604,7 @@ AC_CHECK_FUNCS([ \ unsetenv \ updwtmpx \ user_from_uid \ + usleep \ vasprintf \ vhangup \ vsnprintf \ diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c index 8dc7d02d1..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) } #endif +#if !defined(HAVE_USLEEP) +int usleep(unsigned int useconds) +{ + struct timespec ts; + + ts.tv_sec = useconds / 1000000; + ts.tv_nsec = (useconds % 1000000) * 1000; + return nanosleep(&ts, NULL); +} +#endif + #ifndef HAVE_TCGETPGRP pid_t tcgetpgrp(int fd) diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index de8367386..430066376 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h @@ -1,4 +1,4 @@ -/* $Id: bsd-misc.h,v 1.22 2013/02/15 00:41:36 dtucker Exp $ */ +/* $Id: bsd-misc.h,v 1.23 2013/03/14 23:34:27 djm Exp $ */ /* * Copyright (c) 1999-2004 Damien Miller @@ -80,6 +80,10 @@ struct timespec { int nanosleep(const struct timespec *, struct timespec *); #endif +#ifndef HAVE_USLEEP +int usleep(unsigned int useconds); +#endif + #ifndef HAVE_TCGETPGRP pid_t tcgetpgrp(int); #endif -- cgit v1.2.3