Remove dependency from Cygwin internal code.
* Makefile.in (CYGWIN_OBJS): Remove smallprint.o. (cygserver.exe): Remove strfuncs.o (strfuncs.o): Drop rule. * bsd_log.cc (_vlog): Use snprintf/vsnprintf instead of __small_sprintf/__small_vsprintf. * sysv_sem.cc (seminit): Use sys_malloc instead of malloc. Use snprintf instead of __small_sprintf. (semunload): Free the above allocated sema_mtx names here.
This commit is contained in:
		@@ -1,3 +1,15 @@
 | 
			
		||||
2008-02-06  Corinna Vinschen  <corinna@vinschen.de>
 | 
			
		||||
 | 
			
		||||
	Remove dependency from Cygwin internal code.
 | 
			
		||||
	* Makefile.in (CYGWIN_OBJS): Remove smallprint.o.
 | 
			
		||||
	(cygserver.exe): Remove strfuncs.o
 | 
			
		||||
	(strfuncs.o): Drop rule.
 | 
			
		||||
	* bsd_log.cc (_vlog): Use snprintf/vsnprintf instead of
 | 
			
		||||
	__small_sprintf/__small_vsprintf.
 | 
			
		||||
	* sysv_sem.cc (seminit): Use sys_malloc instead of malloc.  Use
 | 
			
		||||
	snprintf instead of __small_sprintf.
 | 
			
		||||
	(semunload): Free the above allocated sema_mtx names here.
 | 
			
		||||
 | 
			
		||||
2008-02-03  Brian Dessent  <brian@dessent.net>
 | 
			
		||||
 | 
			
		||||
	* Makefile.in: Don't link strfuncs.o from the Cygwin build dir.
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ OBJS:=	cygserver.o client.o process.o msg.o sem.o shm.o threaded_queue.o \
 | 
			
		||||
	sysv_msg.o sysv_sem.o sysv_shm.o
 | 
			
		||||
LIBOBJS:=${patsubst %.o,lib%.o,$(OBJS)}
 | 
			
		||||
 | 
			
		||||
CYGWIN_OBJS:=$(cygwin_build)/smallprint.o $(cygwin_build)/version.o
 | 
			
		||||
CYGWIN_OBJS:=$(cygwin_build)/version.o
 | 
			
		||||
 | 
			
		||||
CYGWIN_LIB:=$(cygwin_build)/libcygwin.a
 | 
			
		||||
 | 
			
		||||
@@ -67,7 +67,7 @@ libclean:
 | 
			
		||||
 | 
			
		||||
fullclean: clean libclean
 | 
			
		||||
 | 
			
		||||
cygserver.exe: $(CYGWIN_LIB) $(OBJS) $(CYGWIN_OBJS) strfuncs.o
 | 
			
		||||
cygserver.exe: $(CYGWIN_LIB) $(OBJS) $(CYGWIN_OBJS)
 | 
			
		||||
	$(CXX) -o $@ ${wordlist 2,999,$^} -L$(cygwin_build) -lntdll
 | 
			
		||||
 | 
			
		||||
$(cygwin_build)/%.o: $(cygwin_source)/%.cc
 | 
			
		||||
@@ -81,9 +81,6 @@ Makefile: Makefile.in configure
 | 
			
		||||
lib%.o: %.cc
 | 
			
		||||
	${filter-out -D__OUTSIDE_CYGWIN__, $(COMPILE_CXX)} -I$(updir)/cygwin -o $(@D)/${basename $(@F)}$o $<
 | 
			
		||||
 | 
			
		||||
strfuncs.o: $(cygwin_source)/strfuncs.cc
 | 
			
		||||
	$(COMPILE_CXX) -I$(updir)/cygwin -o $(@D)/$(*F)$o $<
 | 
			
		||||
 | 
			
		||||
libcygserver.a: $(LIBOBJS)
 | 
			
		||||
	$(AR) crus $@ $?
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,6 @@ details. */
 | 
			
		||||
#include "woutsup.h"
 | 
			
		||||
#define _KERNEL 1
 | 
			
		||||
#define __BSD_VISIBLE 1
 | 
			
		||||
#include <sys/smallprint.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
@@ -53,14 +52,15 @@ _vlog (const char *file, int line, int level,
 | 
			
		||||
	const char *fmt, va_list ap)
 | 
			
		||||
{
 | 
			
		||||
  char buf[16384];
 | 
			
		||||
  char *pos;
 | 
			
		||||
 | 
			
		||||
  if ((level == LOG_DEBUG && log_debug != TUN_TRUE)
 | 
			
		||||
      || (level != LOG_DEBUG && level >= log_level))
 | 
			
		||||
    return;
 | 
			
		||||
  strcpy (buf, "cygserver: ");
 | 
			
		||||
  pos = stpcpy (buf, "cygserver: ");
 | 
			
		||||
  if (file && log_debug == TUN_TRUE)
 | 
			
		||||
    __small_sprintf (strchr (buf, '\0'), "%s, line %d: ", file, line);
 | 
			
		||||
  __small_vsprintf (strchr (buf, '\0'), fmt, ap);
 | 
			
		||||
    pos += snprintf (pos, 16384 - (pos - buf), "%s, line %d: ", file, line);
 | 
			
		||||
  vsnprintf (pos, 16384 - (pos - buf), fmt, ap);
 | 
			
		||||
  if (log_syslog == TUN_TRUE && level != LOG_DEBUG)
 | 
			
		||||
    syslog (level, buf);
 | 
			
		||||
  if (log_stderr == TUN_TRUE || level == LOG_DEBUG)
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@
 | 
			
		||||
 | 
			
		||||
#ifdef __OUTSIDE_CYGWIN__
 | 
			
		||||
#include "woutsup.h"
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <sys/cygwin.h>
 | 
			
		||||
#include <sys/cdefs.h>
 | 
			
		||||
#ifndef __FBSDID
 | 
			
		||||
@@ -247,8 +248,8 @@ seminit(void)
 | 
			
		||||
	}
 | 
			
		||||
	for (i = 0; i < seminfo.semmni; i++)
 | 
			
		||||
	{
 | 
			
		||||
	   char *buf = (char *)malloc (16);
 | 
			
		||||
	   __small_sprintf (buf, "semid[%d]", i);
 | 
			
		||||
		char *buf = (char *) sys_malloc(16, M_SEM, M_WAITOK);
 | 
			
		||||
		snprintf(buf, 16, "semid[%d]", i);
 | 
			
		||||
		mtx_init(&sema_mtx[i], buf, NULL, MTX_DEF);
 | 
			
		||||
	}
 | 
			
		||||
	for (i = 0; i < seminfo.semmnu; i++) {
 | 
			
		||||
@@ -280,8 +281,10 @@ semunload(void)
 | 
			
		||||
	sys_free(sem, M_SEM);
 | 
			
		||||
	sys_free(sema, M_SEM);
 | 
			
		||||
	sys_free(semu, M_SEM);
 | 
			
		||||
	for (int i = 0; i < seminfo.semmni; i++)
 | 
			
		||||
	for (int i = 0; i < seminfo.semmni; i++) {
 | 
			
		||||
		sys_free((void *) sema_mtx[i].name, M_SEM);
 | 
			
		||||
		mtx_destroy(&sema_mtx[i]);
 | 
			
		||||
	}
 | 
			
		||||
	mtx_destroy(&sem_mtx);
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user