diff --git a/include/tlibio.h b/include/tlibio.h
index 12649cf5..4f462ff1 100644
--- a/include/tlibio.h
+++ b/include/tlibio.h
@@ -11,7 +11,7 @@
 #define LIO_IO_SYNCV            00020   /* single-buffer readv/writev */
 #define LIO_IO_SYNCP            00040   /* pread/pwrite */
 
-#ifdef linux
+#ifdef __linux__
 #define LIO_IO_TYPES            00021   /* all io types */
 #endif /* linux */
 
@@ -21,14 +21,14 @@
 #define LIO_WAIT_SIGPAUSE       00100000 /* call pause */
 #define LIO_WAIT_SIGACTIVE      00200000 /* spin waiting for signal */
 
-#ifdef linux
+#ifdef __linux__
 #define LIO_WAIT_TYPES          00300000 /* all wait types, except nowait */
 #endif /* linux */
 
 /* meta wait io  */
 /*  00  000 0000 */
 
-#ifdef linux
+#ifdef __linux__
 /* all signal wait types */
 #define LIO_WAIT_SIGTYPES	(LIO_WAIT_SIGPAUSE)
 #endif /* linux */
diff --git a/include/write_log.h b/include/write_log.h
index 025ebac0..6b088416 100644
--- a/include/write_log.h
+++ b/include/write_log.h
@@ -79,7 +79,7 @@ struct wlog_rec {
  */
 
 struct wlog_rec_disk {
-#ifdef linux
+#ifdef __linux__
     uint    w_offset    : 32;	    /* file offset  	    	    */
     uint    w_extra0    : 32;       /* EXTRA BITS IN WORD 0         */
 #endif
diff --git a/lib/str_to_bytes.c b/lib/str_to_bytes.c
index 2f6b2b92..89bc7d31 100644
--- a/lib/str_to_bytes.c
+++ b/lib/str_to_bytes.c
@@ -31,7 +31,7 @@
  *
  ****************************************************************************/
 
-#if linux
+#ifdef __linux__
 #define B_MULT	DEV_BSIZE	/* block size */
 #endif
 
diff --git a/lib/tlibio.c b/lib/tlibio.c
index 5b810059..ae936f41 100644
--- a/lib/tlibio.c
+++ b/lib/tlibio.c
@@ -74,7 +74,7 @@
 #endif
 
 
-#ifndef linux
+#ifndef __linux__
 static void lio_async_signal_handler();
 #endif
 
@@ -351,7 +351,7 @@ lio_help2(char *prefix)
     return;
 }
 
-#ifndef linux
+#ifndef __linux__
 /***********************************************************************
  * This is an internal signal handler.
  * If the handler is called, it will increment the Received_signal
@@ -453,7 +453,7 @@ char **errmsg;	/* char pointer that will be updated to point to err message */
 long wrd;	/* to allow future features, use zero for now */
 {
     int ret = 0;	/* syscall return or used to get random method */
-#ifndef linux
+#ifndef __linux__
     int omethod = method;
     int listio_cmd;		/* Holds the listio/lio_listio cmd */
 #endif
@@ -650,7 +650,7 @@ char **errmsg;	/* char pointer that will be updated to point to err message */
 long wrd;	/* to allow future features, use zero for now */
 {
     int ret = 0;	/* syscall return or used to get random method */
-#ifndef linux
+#ifndef __linux__
     int listio_cmd;		/* Holds the listio/lio_listio cmd */
     int omethod = method;
 #endif
@@ -797,7 +797,7 @@ long wrd;	/* to allow future features, use zero for now */
 }	/* end of lio_read_buffer */
 
 
-#ifndef linux
+#ifndef __linux__
 /***********************************************************************
  * This function will check that async io was successful.
  * It can also be used to check sync listio since it uses the
@@ -998,7 +998,7 @@ lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp)
 
 } /* end of lio_wait4asyncio */
 
-#endif /* ifndef linux */
+#endif /* ifndef __linux__ */
 
 #if UNIT_TEST
 /***********************************************************************
diff --git a/lib/write_log.c b/lib/write_log.c
index cdc72593..7c58a95f 100644
--- a/lib/write_log.c
+++ b/lib/write_log.c
@@ -49,7 +49,7 @@
 #include "write_log.h"
 
 #ifndef BSIZE
-#ifdef linux
+#ifdef __linux__
 #define BSIZE DEV_BSIZE
 #else
 #define BSIZE BBSIZE
diff --git a/ltp/doio.c b/ltp/doio.c
index fd64df0f..ba080a0b 100644
--- a/ltp/doio.c
+++ b/ltp/doio.c
@@ -222,7 +222,7 @@ int     parse_cmdline( int, char **, char * );
 int     lock_file_region( char *, int, int, int, int );
 struct	fd_cache *alloc_fdcache(char *, int);
 int     aio_register( int, int, int );
-#ifndef linux
+#ifndef __linux__
 int aio_wait(int);
 #endif
 
@@ -1990,7 +1990,7 @@ do_rw(req)
 		/*
 		 * If the syscall was async, wait for I/O to complete
 		 */
-#ifndef linux
+#ifndef __linux__
 		if(sy->sy_flags & SY_ASYNC) {
 			for(i=0; i < nents; i++) {
 				aio_wait(s->aioid[i]);
@@ -2425,7 +2425,7 @@ int nbytes;
 	static int	mturn = 0;	/* which memory type to use */
 	struct memalloc	*M;
 	char		filename[255];
-#ifdef linux
+#ifdef __linux__
 	struct shmid_ds shm_ds;
 	bzero( &shm_ds, sizeof(struct shmid_ds) );
 #endif
@@ -2997,7 +2997,7 @@ int	aio_id;
 	return 0;
 }
 
-#ifndef linux
+#ifndef __linux__
 int
 aio_wait(aio_id)
 int	aio_id;
diff --git a/ltp/iogen.c b/ltp/iogen.c
index 0c8b97e9..416dedbc 100644
--- a/ltp/iogen.c
+++ b/ltp/iogen.c
@@ -128,7 +128,7 @@ void	startup_info(FILE *stream, int seed);
  */
 
 struct strmap	Aio_Strat_Map[] = {
-#ifndef linux
+#ifndef __linux__
 	{ "poll",	A_POLL		},
 	{ "signal",	A_SIGNAL	},
 #else
@@ -1610,7 +1610,7 @@ FILE	*stream;
 {
     usage(stream);
     fprintf(stream, "\n");
-#ifndef linux
+#ifndef __linux__
     fprintf(stream, "\t-a aio_type,...  Async io completion types to choose.  Supported types\n");
     fprintf(stream, "\t                 are:  poll, signal, suspend, and callback.\n");
     fprintf(stream, "\t                 Default is all of the above.\n");
@@ -1643,7 +1643,7 @@ FILE	*stream;
     fprintf(stream, "\t-q               Quiet mode.  Normally iogen spits out info\n");
     fprintf(stream, "\t                 about test files, options, etc. before starting.\n");
     fprintf(stream, "\t-s syscall,...   Syscalls to do.  Supported syscalls are\n");
-#ifdef linux
+#ifdef __linux__
     fprintf(stream, "\t                 read, write, pread, pwrite, readv, writev,\n");
     fprintf(stream, "\t                 mmread, mmwrite, fsync2, fdatasync,\n");
     fprintf(stream, "\t                 Default is 'read,write,readv,writev,mmread,mmwrite'.\n");
