2013-04-17 00:00:59 -04:00
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
# ident "$Id$"
# ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
# ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11 / 760379 and to the patents and / or patent applications resulting from it."
2013-04-17 00:00:25 -04:00
# include <config.h>
2013-04-16 23:57:27 -04:00
# include <stdio.h>
2013-04-16 23:57:54 -04:00
# include <toku_stdint.h>
2013-04-16 23:57:27 -04:00
# include <unistd.h>
2013-04-16 23:58:56 -04:00
# include <toku_assert.h>
2013-04-16 23:57:28 -04:00
# include "toku_os.h"
2013-04-17 00:00:25 -04:00
# if defined(HAVE_SYSCALL_H)
# include <syscall.h>
2013-04-17 00:01:11 -04:00
# endif
# if defined(HAVE_SYS_SYSCALL_H)
2013-04-17 00:00:25 -04:00
# include <sys / syscall.h>
2013-04-17 00:01:11 -04:00
# endif
# if defined(HAVE_PTHREAD_NP_H)
# include <pthread_np.h>
2013-04-17 00:00:25 -04:00
# endif
2013-04-16 23:57:27 -04:00
2013-04-17 00:01:11 -04:00
// since we implement the same thing here as in toku_os_gettid, this test
// is pretty pointless
2013-04-16 23:57:27 -04:00
static int gettid ( void ) {
2013-04-17 00:01:11 -04:00
# if defined(__NR_gettid)
2013-04-16 23:57:27 -04:00
return syscall ( __NR_gettid ) ;
2013-04-17 00:01:11 -04:00
# elif defined(SYS_gettid)
return syscall ( SYS_gettid ) ;
# elif defined(HAVE_PTHREAD_GETTHREADID_NP)
return pthread_getthreadid_np ( ) ;
# else
# error "no implementation of gettid available"
# endif
2013-04-16 23:57:27 -04:00
}
int main ( void ) {
2013-04-16 23:57:28 -04:00
assert ( toku_os_getpid ( ) = = getpid ( ) ) ;
assert ( toku_os_gettid ( ) = = gettid ( ) ) ;
2013-04-16 23:57:27 -04:00
return 0 ;
}