11 Nov, 2014, gauden wrote in the 1st comment:
Votes: 0
Hi,
Out of curiosity I tried to compile an old code that sent me a friend. This code has been modified to compile with gcc-4.x, but…

[root@server src]# make
g++48 -Wno-write-strings -g -o .obj/act_comm.o -c act_comm.cpp
g++48 -Wno-write-strings -g -o .obj/act_info.o -c act_info.cpp
g++48 -Wno-write-strings -g -o .obj/act_move.o -c act_move.cpp
g++48 -Wno-write-strings -g -o .obj/act_obj.o -c act_obj.cpp
g++48 -Wno-write-strings -g -o .obj/act_wiz.o -c act_wiz.cpp
g++48 -Wno-write-strings -g -o .obj/buffer.o -c buffer.cpp
g++48 -Wno-write-strings -g -o .obj/cajas.o -c cajas.cpp
g++48 -Wno-write-strings -g -o .obj/clean.o -c clean.cpp
g++48 -Wno-write-strings -g -o .obj/comm.o -c comm.cpp
comm.cpp: In function int main(int, char**):
comm.cpp:218:37: error: cannot convert unsigned int* to const sigset_t* {aka const __sigset_t*} for argument 2 to int sigprocmask(int, const sigset_t*, sigset_t*)
sigprocmask(SIG_SETMASK,&SigON,0);
^
make: *** [.obj/comm.o] Error 1

The part of code is:

unsigned int SigON;

#define g_s(x) (1<<(x-1))

int main( int argc, char **argv )
{
struct timeval now_time;
int port;

SigON=g_s(SIGALRM)|g_s(SIGSEGV)|g_s(SIGTERM)|g_s(SIGINT)
|g_s(SIGUSR1)|g_s(SIGUSR2)|g_s(SIGQUIT)|g_s(SIGFPE);
SigON=~SigON;
sigprocmask(SIG_SETMASK,&SigON,0);


Someone can help me? I use a 64-bit pc.
If I comment the line

sigprocmask(SIG_SETMASK,&SigON,0);

the compiler returns an error about 64-bit support and does not create the executable.
11 Nov, 2014, Pymeus wrote in the 2nd comment:
Votes: 0
Try this:

sigset_t SigON;

#define g_s(x) (1<<(x-1))

int main( int argc, char **argv )
{
struct timeval now_time;
int port;

sigfillset( &SigON );
sigdelset( &SigON, SIGALRM );
sigdelset( &SigON, SIGSEGV );
sigdelset( &SigON, SIGTERM );
sigdelset( &SigON, SIGINT );
sigdelset( &SigON, SIGUSR1 );
sigdelset( &SigON, SIGUSR2 );
sigdelset( &SigON, SIGQUIT );
sigdelset( &SigON, SIGFPE );
sigprocmask(SIG_SETMASK,&SigON,0);
11 Nov, 2014, gauden wrote in the 3rd comment:
Votes: 0
Thanks you.
I managed to compile that part. Now I have the following error, related to 64-bits. I've never seen anything like this in any mud, and I have several codes.
[root@server src]# make
g++48 -Wno-write-strings -g -o .obj/comm.o -c comm.cpp
g++48 -Wno-write-strings -g -o .obj/const.o -c const.cpp
g++48 -Wno-write-strings -g -o .obj/db.o -c db.cpp
g++48 -Wno-write-strings -g -o .obj/editarea.o -c editarea.cpp
g++48 -Wno-write-strings -g -o .obj/fight.o -c fight.cpp
g++48 -Wno-write-strings -g -o .obj/grep.o -c grep.cpp
g++48 -Wno-write-strings -g -o .obj/handler.o -c handler.cpp
handler.cpp: Assembler messages:
handler.cpp:1954: Error: suffix or operands invalid for `pop'
handler.cpp:1973: Error: suffix or operands invalid for `pop'
handler.cpp:1996: Error: `pusha' is not supported in 64-bit mode
handler.cpp:2001: Error: `popa' is not supported in 64-bit mode
handler.cpp:2012: Error: `pusha' is not supported in 64-bit mode
handler.cpp:2017: Error: `popa' is not supported in 64-bit mode
make: *** [.obj/handler.o] Error 1

The code is
void bug_close(int num)
{
signal(SIGSEGV,rutina_senyal);
fprintf(stderr,"BUG-CLOSE:f_close ha generado un SIG_SEGV!!!!\n");

__asm__("movl _dirbp,%eax");
__asm__("movl $6,%ecx");
__asm__(".buc:");
__asm__("movl %ebp,%esp");
__asm__("popl %ebp");
__asm__("decl %ecx");
__asm__("je .fin");
__asm__("cmpl %ebp,%eax");
__asm__("jne .buc");
__asm__(".fin:");
__asm__("ret");

}

void bug_malloc(int num)
{
signal(SIGSEGV,rutina_senyal);
fprintf(stderr,"BUG-MALLOC:un malloc ha generado un SIG_SEGV!!!!\n");

__asm__("movl _dirbp,%eax");
__asm__("movl $6,%ecx");
__asm__(".buc2:");
__asm__("movl %ebp,%esp");
__asm__("popl %ebp");
__asm__("decl %ecx");
__asm__("je .fin2");
__asm__("cmpl %ebp,%eax");
__asm__("jne .buc2");
__asm__(".fin2:");
__asm__("ret");

}


int retc;

int f_close(FILE *f)
{
retc=-1;
COUNT_OPEN–;
if (COUNT_OPEN<0)
{
fprintf(stderr,"BUG:Mas closes que Opens!!!\n");
COUNT_OPEN=0;
}
signal(SIGSEGV,bug_close);
__asm__("pushal");
__asm__("movl %esp,_dirp");
__asm__("movl %ebp,_dirbp");
retc=fclose(f);
__asm__("movl _dirp,%esp");
__asm__("popal");
signal(SIGSEGV,rutina_senyal);
return retc;
}

void *retm;

void *m_alloc(size_t t)
{
retm=0;
signal(SIGSEGV,bug_malloc);
__asm__("pushal");
__asm__("movl %esp,_dirp");
__asm__("movl %ebp,_dirbp");
retm=calloc(1,t);
__asm__("movl _dirp,%esp");
__asm__("popal");
signal(SIGSEGV,rutina_senyal);
return retm;
}
11 Nov, 2014, plamzi wrote in the 4th comment:
Votes: 0
With some quick googley-do:

http://stackoverflow.com/questions/68373...

Looks like you're going to have to do some superficial rewriting if you want to keep these routines in Assembly (hardcore!).

I gather this is some sort of old-school bug tracing voodoo hooked on to memory allocating and file opens / closes. It's entirely possible that you no longer need it and can just use tools like valgrind instead.
11 Nov, 2014, gauden wrote in the 5th comment:
Votes: 0
My solution:
Surely there will be nicer solutions, but it works.

First I edited the Makefile and added the -m32 flag.
After I installed some libraries. Now, the mud compiles.
0.0/5