On 01/03/2013 04:18 PM, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgra...@ubuntu.com):
>> This adds code detecting the presence of utmpx.h and in its absence, turns 
>> the
>> utmp related functions into no-ops.
>>
>> Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
>> ---
>>  configure.ac   | 2 +-
>>  src/lxc/utmp.c | 7 +++++++
>>  src/lxc/utmp.h | 9 +++++++++
>>  3 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 2905aee..5b7573a 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -211,7 +211,7 @@ AM_CONDITIONAL([IS_BIONIC], [test "x$libc_type" = 
>> "xbionic"])
>>  AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
>>  
>>  # Check for some headers
>> -AC_CHECK_HEADERS([sys/signalfd.h sys/personality.h sys/capability.h pty.h])
>> +AC_CHECK_HEADERS([sys/signalfd.h sys/personality.h sys/capability.h pty.h 
>> utmpx.h])
>>  
>>  # Check for some functions
>>  AC_CHECK_FUNCS([getline fgetln openpty setns pivot_root sethostname 
>> unshare])
>> diff --git a/src/lxc/utmp.c b/src/lxc/utmp.c
>> index a7b9b52..16d1b5d 100644
>> --- a/src/lxc/utmp.c
>> +++ b/src/lxc/utmp.c
>> @@ -21,6 +21,10 @@
>>   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>>   */
>>  
>> +#include "config.h"
>> +
>> +#ifdef HAVE_UTMPX_H
>> +
>>  #include <stdio.h>
>>  #include <unistd.h>
>>  #include <errno.h>
>> @@ -37,6 +41,7 @@
>>  #include "mainloop.h"
>>  #include "lxc.h"
>>  #include "log.h"
>> +
>>  #define __USE_GNU
>>  #include <utmpx.h>
>>  #undef __USE_GNU
>> @@ -410,3 +415,5 @@ int lxc_utmp_del_timer(struct lxc_epoll_descr *descr,
>>      else
>>              return 0;
>>  }
>> +
>> +#endif
>> diff --git a/src/lxc/utmp.h b/src/lxc/utmp.h
>> index ac3eee4..ad4a8ab 100644
>> --- a/src/lxc/utmp.h
>> +++ b/src/lxc/utmp.h
>> @@ -21,8 +21,17 @@
>>   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>>   */
>>  
>> +#include "config.h"
>> +
>>  struct lxc_handler;
>>  struct lxc_epoll_descr;
>>  
>> +#ifdef HAVE_UTMPX_H
>>  int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
>>                        struct lxc_handler *handler);
>> +#else
>> +static inline int lxc_utmp_mainloop_add(struct lxc_epoll_descr *descr,
>> +                      struct lxc_handler *handler) {
>> +            return 0;
> 
> Would it be better to return -1 here?  This will only be called if
> the containerized reboot isn't available, in which case not having
> the utmp watcher to fall back on rather sucks.
> 
> I guess it's not that big a deal, just makes reboot/shutdown in
> the container not work...

Fixed, thanks.

>> +}
>> +#endif
>> -- 
>> 1.8.0
>>
>>
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. ON SALE this month only -- learn more at:
>> http://p.sf.net/sfu/learnmore_122712
>> _______________________________________________
>> Lxc-devel mailing list
>> Lxc-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/lxc-devel


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to