[prev in list] [next in list] [prev in thread] [next in thread]
List: ltp-cvs
Subject: [Ltp-cvs] ltp/testcases/kernel/syscalls/epoll CheckVer.c,NONE,1.1 Makefile,1.2,1.3
From: Martin Ridgeway <mridge () users ! sourceforge ! net>
Date: 2004-04-22 19:16:43
Message-ID: E1BGjgh-0000Ok-Fg () sc8-pr-cvs1 ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/epoll
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1412
Modified Files:
Makefile
Added Files:
CheckVer.c
Log Message:
Changes to detect glibc versions.
--- NEW FILE: CheckVer.c ---
/******************************************************************************/
/* */
/* Copyright (c) International Business Machines Corp., 2001 */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
/* the GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* */
/******************************************************************************/
/******************************************************************************
File: CheckVer.c
Description: Takes version numbers of software (or anything else for that matter)
Compares them and then returns:
0 - Older - The version passed is older than the required version
1 - Newer or matching - The version passed is at least the required version
-1 - some kind of error condition
This is a very simple program so very little error checking is done.
mridge@us.ibm.com - Initial version
******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#define DEBUG 1
#define MIN_ARGS 2
#define MIN_VER_LEN 255 // Seems like that should be enough
#define JUMP_POINT 2
int main (int argc, char *argv[])
{
int version = 1;
int BaseVerLen, CurrentVerLen, i = 0;
char BaseVersion[MIN_VER_LEN];
char CurrentVersion[MIN_VER_LEN];
if (argc < MIN_ARGS) {
printf("Returning not enough params\n");
exit (2);
}
strcpy(BaseVersion, argv[1]);
strcpy(CurrentVersion, argv[2]);
BaseVerLen = strlen(BaseVersion);
CurrentVerLen = strlen(CurrentVersion);
if (DEBUG) {
printf("BaseVersion = %s \n", BaseVersion);
printf("CurrentVersion = %s \n", CurrentVersion);
}
if (BaseVersion[i] > CurrentVersion[i]) {
printf("Way too old\n");
version = 0;
}
i+=JUMP_POINT;
if (i <= BaseVerLen && i < CurrentVerLen) {
if (version && BaseVersion[i] > CurrentVersion[i]) {
printf("Just too old\n");
version = 0;
}
}
else if (BaseVerLen > CurrentVerLen){
printf("Not enough points\n");
version = 0;
}
i+=JUMP_POINT;
if (i <= BaseVerLen && i < CurrentVerLen) {
if (version && BaseVersion[i] > CurrentVersion[i]) {
printf("Just a little too old\n");
version = 0;
}
}
else if (BaseVerLen > CurrentVerLen){
printf("Not enough points\n");
version = 0;
}
i+=JUMP_POINT;
if (i <= BaseVerLen && i < CurrentVerLen) {
if (version && BaseVersion[i] > CurrentVersion[i]) {
printf("Just a smidge too old\n");
version = 0;
}
}
else if (BaseVerLen > CurrentVerLen){
printf("Not enough points\n");
version = 0;
}
if (DEBUG) {
printf("Returning %d \n", version);
}
exit (version);
}
Index: Makefile
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/epoll/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile 11 Mar 2004 16:10:37 -0000 1.2
--- Makefile 22 Apr 2004 19:16:40 -0000 1.3
***************
*** 1,6 ****
CFLAGS+= -Wall -O -g -I../../../../include
LDLIBS+= -L /lib -L../../../../lib -lepoll -lltp
! TARGETS=epoll-ltp
SRCS=$(wildcard *.c)
OBJS=$(patsubst %.c,%.o,$(SRCS))
--- 1,19 ----
CFLAGS+= -Wall -O -g -I../../../../include
+
+ LIBC_VER=$(shell ldd --version | grep libc | cut -d " " -f4)
+ CUR_LIBC_VER:=$(LIBC_VER)
+ EPOLL_INC:=2.3.2
+ VER_LEVEL=$(shell ./CheckVer $(EPOLL_INC) $(CUR_LIBC_VER) | grep Return | cut -d " " -f2)
+ BASE_VER=1
+
+ ifneq (${BASE_VER},${VER_LEVEL})
LDLIBS+= -L /lib -L../../../../lib -lepoll -lltp
+ else
+ LDLIBS+= -lltp
+ endif
!
!
! TARGETS=CheckVer epoll-ltp
SRCS=$(wildcard *.c)
OBJS=$(patsubst %.c,%.o,$(SRCS))
***************
*** 9,13 ****
epoll-ltp: epoll-ltp.o
! $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
install:
--- 22,29 ----
epoll-ltp: epoll-ltp.o
! $(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
!
! CheckVer: CheckVer.o
! $(CC) -o $@ $^ $(CFLAGS)
install:
***************
*** 16,17 ****
--- 32,34 ----
clean:
rm -f $(OBJS) $(TARGETS)
+
-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
Ltp-cvs mailing list
Ltp-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic