Skip to content

Instantly share code, notes, and snippets.

# logger.rb - simple logging utility
# Copyright (C) 2000-2003, 2005, 2008 NAKAMURA, Hiroshi <[email protected]>.
#
# Author:: NAKAMURA, Hiroshi <[email protected]>
# Documentation:: NAKAMURA, Hiroshi and Gavin Sinclair
# License::
# You can redistribute it and/or modify it under the same terms of Ruby's
# license; either the dual license version in 2003, or any later version.
# Revision:: $Id: logger.rb 25413 2009-10-20 15:08:38Z nahi $
#
From 4d05ee7e1a8be2464e12027f3b2687accd4fc7a1 Mon Sep 17 00:00:00 2001
From: mpage <[email protected]>
Date: Sat, 30 Apr 2011 13:50:44 -0700
Subject: [PATCH] Fix runtimes for rails3 staging
---
cloud_controller/staging/rails3/plugin.rb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cloud_controller/staging/rails3/plugin.rb b/cloud_controller/staging/rails3/plugin.rb
#include <assert.h>
#include <errno.h>
#include <fstab.h>
#include <inttypes.h>
#include <malloc.h>
#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/quota.h>
@mpage
mpage / report_quotas.c
Created December 7, 2011 21:47
Simple utility to report quota information (potentially a replacement for repquota)
#include <assert.h>
#include <errno.h>
#include <fstab.h>
#include <inttypes.h>
#include <malloc.h>
#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/quota.h>
int sd = GetSocket();
<SNIP>
for (int i=0; i < 10; i++) {
// Don't read just one buffer and then move on. This is faster
// if there is a lot of incoming.
// But don't read indefinitely. Give other sockets a chance to run.
// NOTICE, we're reading one less than the buffer size.
// That's so we can put a guard byte at the end of what we send
2011-12-21 19:11:10,536 DEBUG : Calling bootstrap method in context plugin VMBuilder.plugins.ubuntu.distro.
2011-12-21 19:11:10,537 DEBUG : ['mount', '-o', 'loop', '-t', 'iso9660', '/var/tmp/ubuntu.iso', '/tmp/tmp4V4Gb4']
2011-12-21 19:11:10,543 DEBUG : ['/usr/sbin/debootstrap', '--arch=amd64', 'lucid', '/tmp/tmpevT0kp', 'file:///tmp/tmp4V4Gb4']
<SNIP>
2011-12-21 19:11:53,359 INFO : Calling hook: configure_os
2011-12-21 19:11:53,418 DEBUG : Output from template '/workspace/scratch/VMBuilder-0.12.4/VMBuilder/plugins/ubuntu/templates/sources.list.tmpl':
deb http://archive.ubuntu.com/ubuntu lucid main universe multiverse
deb http://archive.ubuntu.com/ubuntu lucid-updates main universe multiverse
deb http://security.ubuntu.com/ubuntu lucid-security main universe multiverse
2011-12-21 19:11:53,418 DEBUG : ['chroot', '/tmp/tmpevT0kp', 'apt-get', 'update']
---
distro: lucid
arch: amd64
kernel: lts-backport-natty
groups:
admin:
system: true
users:
root:
password: ca$hcow
DKMS make.log for open-vm-tools-2010.02.23 for kernel 2.6.38-13-server (x86_64)
Thu Jan 5 22:34:20 UTC 2012
Using 2.6.x kernel build system.
Building VMCI Sockets without VMCI module symbols.
make: Entering directory `/var/lib/dkms/open-vm-tools/2010.02.23/build/vsock'
make -C /lib/modules/2.6.38-13-server/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR=/var/lib/dkms/open-vm-tools/2010.02.23/build modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.38-13-server'
CC [M] /var/lib/dkms/open-vm-tools/2010.02.23/build/vsock/linux/af_vsock.o
/var/lib/dkms/open-vm-tools/2010.02.23/build/vsock/linux/af_vsock.c:273: warning: initialization from incompatible pointer type
require 'tempfile'
require 'thread'
$stdout_mutex = Mutex.new
def thread_log(msg)
$stdout_mutex.synchronize do
puts "#{Time.now} #{Thread.current} -- #{msg}"
STDOUT.flush
end
> ruby /tmp/flock_test.rb
2012-01-06 13:42:23 -0800 #<Thread:0x0000000159fe88> -- Acquiring lock
2012-01-06 13:42:23 -0800 #<Thread:0x0000000159fd98> -- Acquiring lock
2012-01-06 13:42:23 -0800 #<Thread:0x0000000159fca8> -- Still active
2012-01-06 13:42:23 -0800 #<Thread:0x0000000159fe88> -- Acquired lock
2012-01-06 13:42:23 -0800 #<Thread:0x0000000159fe88> -- Sleeping 10
2012-01-06 13:42:24 -0800 #<Thread:0x0000000159fca8> -- Still active
2012-01-06 13:42:25 -0800 #<Thread:0x0000000159fca8> -- Still active
2012-01-06 13:42:26 -0800 #<Thread:0x0000000159fca8> -- Still active
2012-01-06 13:42:27 -0800 #<Thread:0x0000000159fca8> -- Still active