diff --git a/Makefile b/Makefile index f1ba4720..aa9f9058 100644 --- a/Makefile +++ b/Makefile @@ -181,9 +181,9 @@ SERVER_OBJS = \ # POSIX platform objects POSIX_OBJS = \ - build/posix/net_udp.o \ + build/posix/network.o \ build/posix/posix.o \ - build/posix/sys_linux.o \ + build/posix/system.o \ build/posix/vid_menu.o \ build/posix/vid_so.o \ build/posix/glob/glob.o \ @@ -355,13 +355,13 @@ build/server/sv_world.o : src/server/sv_world.c # ---------- # POSIX build -build/posix/net_udp.o : src/platforms/posix/net_udp.c +build/posix/network.o : src/platforms/posix/network.c $(CC) $(CFLAGS_CLIENT) -o $@ -c $< build/posix/posix.o : src/platforms/posix/posix.c $(CC) $(CFLAGS_CLIENT) -o $@ -c $< -build/posix/sys_linux.o : src/platforms/posix/sys_linux.c +build/posix/system.o : src/platforms/posix/system.c $(CC) $(CFLAGS_CLIENT) -o $@ -c $< build/posix/vid_menu.o : src/platforms/posix/vid_menu.c diff --git a/src/platforms/posix/net_udp.c b/src/platforms/posix/network.c similarity index 100% rename from src/platforms/posix/net_udp.c rename to src/platforms/posix/network.c diff --git a/src/platforms/posix/rw_linux.h b/src/platforms/posix/posix.h similarity index 100% rename from src/platforms/posix/rw_linux.h rename to src/platforms/posix/posix.h diff --git a/src/platforms/posix/sys_linux.c b/src/platforms/posix/system.c similarity index 72% rename from src/platforms/posix/sys_linux.c rename to src/platforms/posix/system.c index ad511f9a..a2e6f5b4 100644 --- a/src/platforms/posix/sys_linux.c +++ b/src/platforms/posix/system.c @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../../common/qcommon.h" -#include "rw_linux.h" +#include "posix.h" cvar_t *nostdout; @@ -92,9 +92,6 @@ void Sys_Quit (void) void Sys_Init(void) { -#if id386 -// Sys_SetFPCW(); -#endif } void Sys_Error (char *error, ...) @@ -102,7 +99,7 @@ void Sys_Error (char *error, ...) va_list argptr; char string[1024]; -// change stdin to non blocking + // change stdin to non blocking fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); CL_Shutdown (); @@ -147,7 +144,6 @@ int Sys_FileTime (char *path) void floating_point_exception_handler(int whatever) { -// Sys_Warn("floating point exception\n"); signal(SIGFPE, floating_point_exception_handler); } @@ -215,19 +211,7 @@ void *Sys_GetGameAPI (void *parms) char name[MAX_OSPATH]; char *path; char *str_p; -#if defined __i386__ - const char *gamename = "gamei386.so"; -#elif defined __x86_64__ - const char *gamename = "gamex86_64.so"; -#elif defined __alpha__ - const char *gamename = "gameaxp.so"; -#elif defined __powerpc__ - const char *gamename = "gameppc.so"; -#elif defined __sparc__ - const char *gamename = "gamesparc.so"; -#else -#error Unknown arch -#endif + const char *gamename = "game.so"; setreuid(getuid(), getuid()); setegid(getgid()); @@ -262,7 +246,7 @@ void *Sys_GetGameAPI (void *parms) { Com_Printf ("LoadLibrary (%s):", name); - path = dlerror(); + path = (char *)dlerror(); str_p = strchr(path, ':'); // skip the path (already shown) if (str_p == NULL) str_p = path; @@ -326,7 +310,7 @@ int main (int argc, char **argv) oldtime = Sys_Milliseconds (); while (1) { -// find time spent rendering last frame + // find time spent rendering last frame do { newtime = Sys_Milliseconds (); time = newtime - oldtime; @@ -336,82 +320,3 @@ int main (int argc, char **argv) } } -#if 0 -void Sys_CopyProtect(void) -{ - FILE *mnt; - struct mntent *ent; - char path[MAX_OSPATH]; - struct stat st; - qboolean found_cd = false; - - static qboolean checked = false; - - if (checked) - return; - - if ((mnt = setmntent("/etc/mtab", "r")) == NULL) - Com_Error(ERR_FATAL, "Can't read mount table to determine mounted cd location."); - - while ((ent = getmntent(mnt)) != NULL) { - if (strcmp(ent->mnt_type, "iso9660") == 0) { - // found a cd file system - found_cd = true; - sprintf(path, "%s/%s", ent->mnt_dir, "install/data/quake2.exe"); - if (stat(path, &st) == 0) { - // found it - checked = true; - endmntent(mnt); - return; - } - sprintf(path, "%s/%s", ent->mnt_dir, "Install/Data/quake2.exe"); - if (stat(path, &st) == 0) { - // found it - checked = true; - endmntent(mnt); - return; - } - sprintf(path, "%s/%s", ent->mnt_dir, "quake2.exe"); - if (stat(path, &st) == 0) { - // found it - checked = true; - endmntent(mnt); - return; - } - } - } - endmntent(mnt); - - if (found_cd) - Com_Error (ERR_FATAL, "Could not find a Quake2 CD in your CD drive."); - Com_Error (ERR_FATAL, "Unable to find a mounted iso9660 file system.\n" - "You must mount the Quake2 CD in a cdrom drive in order to play."); -} -#endif - -#if 0 -/* -================ -Sys_MakeCodeWriteable -================ -*/ -void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) -{ - - int r; - unsigned long addr; - int psize = getpagesize(); - - addr = (startaddr & ~(psize-1)) - psize; - -// fprintf(stderr, "writable code %lx(%lx)-%lx, length=%lx\n", startaddr, -// addr, startaddr+length, length); - - r = mprotect((char*)addr, length + startaddr - addr + psize, 7); - - if (r < 0) - Sys_Error("Protection change failed\n"); - -} - -#endif