head 1.4; access; symbols pkgsrc-2013Q2:1.4.0.26 pkgsrc-2013Q2-base:1.4 pkgsrc-2012Q4:1.4.0.24 pkgsrc-2012Q4-base:1.4 pkgsrc-2011Q4:1.4.0.22 pkgsrc-2011Q4-base:1.4 pkgsrc-2011Q2:1.4.0.20 pkgsrc-2011Q2-base:1.4 pkgsrc-2009Q4:1.4.0.18 pkgsrc-2009Q4-base:1.4 pkgsrc-2008Q4:1.4.0.16 pkgsrc-2008Q4-base:1.4 pkgsrc-2008Q3:1.4.0.14 pkgsrc-2008Q3-base:1.4 cube-native-xorg:1.4.0.12 cube-native-xorg-base:1.4 pkgsrc-2008Q2:1.4.0.10 pkgsrc-2008Q2-base:1.4 pkgsrc-2008Q1:1.4.0.8 pkgsrc-2008Q1-base:1.4 pkgsrc-2007Q4:1.4.0.6 pkgsrc-2007Q4-base:1.4 pkgsrc-2007Q3:1.4.0.4 pkgsrc-2007Q3-base:1.4 pkgsrc-2007Q2:1.4.0.2 pkgsrc-2007Q2-base:1.4 pkgsrc-2007Q1:1.2.0.4 pkgsrc-2007Q1-base:1.2 pkgsrc-2006Q4:1.2.0.2 pkgsrc-2006Q4-base:1.2 pkgsrc-2006Q3:1.1.1.1.0.2 pkgsrc-2006Q3-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.4 date 2007.06.14.19.44.50; author bouyer; state dead; branches; next 1.3; 1.3 date 2007.04.28.17.14.51; author bouyer; state Exp; branches; next 1.2; 1.2 date 2006.10.19.22.57.13; author bouyer; state Exp; branches; next 1.1; 1.1 date 2006.07.02.16.49.31; author bouyer; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2006.07.02.16.49.31; author bouyer; state Exp; branches; next ; desc @@ 1.4 log @Renamed xen*30 to xen*3 @ text @$NetBSD: patch-ad,v 1.3 2007/04/28 17:14:51 bouyer Exp $ --- libxc/xc_private.c.orig 2007-01-08 16:00:49.000000000 +0100 +++ libxc/xc_private.c 2007-04-25 23:06:39.000000000 +0200 @@@@ -10,7 +10,12 @@@@ #include #include -static __thread xc_error last_error = { XC_ERROR_NONE, ""}; +static pthread_key_t last_error_pkey; +static pthread_once_t last_error_pkey_once = PTHREAD_ONCE_INIT; + +static pthread_key_t errbuf_pkey; +static pthread_once_t errbuf_pkey_once = PTHREAD_ONCE_INIT; + #if DEBUG static xc_error_handler error_handler = xc_default_error_handler; #else @@@@ -23,15 +28,44 @@@@ fprintf(stderr, "ERROR %s: %s\n", desc, err->message); } +static void +_xc_clean_last_error(void *m) +{ + if (m) + free(m); + pthread_setspecific(last_error_pkey, NULL); +} + +static void +_xc_init_last_error(void) +{ + pthread_key_create(&last_error_pkey, _xc_clean_last_error); +} + +static xc_error * +_xc_get_last_error(void) { + xc_error *last_error; + + pthread_once(&last_error_pkey_once, _xc_init_last_error); + + last_error = pthread_getspecific(last_error_pkey); + if (last_error == NULL) { + last_error = malloc(sizeof(xc_error)); + pthread_setspecific(last_error_pkey, last_error); + } + return last_error; +} + const xc_error const *xc_get_last_error(void) { - return &last_error; + return _xc_get_last_error(); } void xc_clear_last_error(void) { - last_error.code = XC_ERROR_NONE; - last_error.message[0] = '\0'; + xc_error *last_error = _xc_get_last_error(); + last_error->code = XC_ERROR_NONE; + last_error->message[0] = '\0'; } const char *xc_error_code_to_desc(int code) @@@@ -60,9 +94,10 @@@@ static void _xc_set_error(int code, const char *msg) { - last_error.code = code; - strncpy(last_error.message, msg, XC_MAX_ERROR_MSG_LEN - 1); - last_error.message[XC_MAX_ERROR_MSG_LEN-1] = '\0'; + xc_error *last_error = _xc_get_last_error(); + last_error->code = code; + strncpy(last_error->message, msg, XC_MAX_ERROR_MSG_LEN - 1); + last_error->message[XC_MAX_ERROR_MSG_LEN-1] = '\0'; } void xc_set_error(int code, const char *fmt, ...) @@@@ -80,23 +115,29 @@@@ errno = saved_errno; - if ( error_handler != NULL ) - error_handler(&last_error); + if ( error_handler != NULL ) { + xc_error *last_error = _xc_get_last_error(); + error_handler(last_error); + } } int lock_pages(void *addr, size_t len) { int e = 0; + void *laddr = (void *)((u_long)addr & ~0xfffUL); + size_t llen = (len + 0xfffUL) & ~0xfffUL; #ifndef __sun__ - e = mlock(addr, len); + e = mlock(laddr, llen); #endif return (e); } void unlock_pages(void *addr, size_t len) { + void *laddr = (void *)((u_long)addr & ~0xfffUL); + size_t llen = (len + 0xfffUL) & ~0xfffUL; #ifndef __sun__ - safe_munlock(addr, len); + safe_munlock(laddr, llen); #endif } @@@@ -483,20 +524,43 @@@@ return new_mfn; } +static void +_xc_clean_errbuf(void * m) +{ + if (m) + free(m); + pthread_setspecific(errbuf_pkey, NULL); +} + +static void +_xc_init_errbuf(void) +{ + pthread_key_create(&errbuf_pkey, _xc_clean_errbuf); +} + char *safe_strerror(int errcode) { - static __thread char errbuf[32]; +#define XS_BUFSIZE 32 + char *errbuf; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; char *strerror_str; + pthread_once(&errbuf_pkey_once, _xc_init_errbuf); + + errbuf = pthread_getspecific(errbuf_pkey); + if (errbuf == NULL) { + errbuf = malloc(XS_BUFSIZE); + pthread_setspecific(errbuf_pkey, errbuf); + } + /* * Thread-unsafe strerror() is protected by a local mutex. We copy * the string to a thread-private buffer before releasing the mutex. */ pthread_mutex_lock(&mutex); strerror_str = strerror(errcode); - strncpy(errbuf, strerror_str, sizeof(errbuf)); - errbuf[sizeof(errbuf)-1] = '\0'; + strncpy(errbuf, strerror_str, XS_BUFSIZE); + errbuf[XS_BUFSIZE-1] = '\0'; pthread_mutex_unlock(&mutex); return errbuf; @ 1.3 log @Update xen 3.0 packages to 3.0.4. pksgrc changes: install man pages for xm, xend-config.sxp and xmdomain.cfg. Should fix pkg/36190. Main changes: This is largely an opportunistic stabilising release for HVM guests, due to the large amount of work in that area of the code since 3.0.3. These enhancements have in particular improved support for SMP and ACPI Linux and Windows operating systems. @ text @d1 1 a1 1 $NetBSD: patch-ad,v 1.2 2006/10/19 22:57:13 bouyer Exp $ @ 1.2 log @Update to 3.0.3. I don't have a comprehensive list of changes, only "many new features". One looks promising: - a new easy-to-use CPU scheduler which includes weights, caps, and automatic SMP load-balancing; pkgsrc changes: - remove patches against unused files - add a netbsd-specific example with verbose comments - add a vif script for ip-routing based setups @ text @d1 1 a1 1 $NetBSD: $ d3 5 a7 21 --- libxc/xc_domain.c.orig 2006-10-04 04:28:15.000000000 +0200 +++ libxc/xc_domain.c 2006-10-18 15:20:13.000000000 +0200 @@@@ -212,8 +212,10 @@@@ { int ret = 0; DECLARE_SYSCTL; + caddr_t info_addr = (caddr_t)((u_long)info & ~0xfffUL); + u_long len = (max_domains*sizeof(xc_domaininfo_t) + 0xfffUL) & ~0xfffUL; - if ( mlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 ) + if ( mlock(info_addr, len) != 0 ) return -1; sysctl.cmd = XEN_SYSCTL_getdomaininfolist; @@@@ -226,8 +228,7 @@@@ else ret = sysctl.u.getdomaininfolist.num_domains; - if ( munlock(info, max_domains*sizeof(xc_domaininfo_t)) != 0 ) - ret = -1; + (void)munlock(info_addr, len); /* XXX munlock fails; why ? */ d9 12 a20 1 return ret; d22 140 @ 1.1 log @Initial revision @ text @d1 1 a1 1 $NetBSD$ d3 8 a10 4 --- blktap/ublkback/Makefile.orig 2006-01-31 17:09:20.000000000 +0100 +++ blktap/ublkback/Makefile @@@@ -29,7 +29,7 @@@@ all: $(IBIN) LINUX_ROOT := $(wildcard $(XEN_ROOT)/linux-2.6.*-xen-sparse) d12 3 a14 5 install: - $(INSTALL_PROG) $(IBIN) $(DESTDIR)$(INSTALL_DIR) + $(BSD_INSTALL_PROGRAM) $(IBIN) $(PREFIX)/sbin clean: rm -rf *.o*~ $(DEPS) xen TAGS $(IBIN) d16 11 @ 1.1.1.1 log @Initial import of a packages for Xen 3.0 domain0 tools. @ text @@