Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX 10.12 compilation warning: syscall is deprecated #185

Closed
pwnall opened this issue May 7, 2017 · 5 comments · Fixed by #685
Closed

OSX 10.12 compilation warning: syscall is deprecated #185

pwnall opened this issue May 7, 2017 · 5 comments · Fixed by #685
Labels
Milestone

Comments

@pwnall
Copy link
Member

pwnall commented May 7, 2017

The relevant snippets are below.

/Users/pwnall/workspace/glog/src/raw_logging.cc:153:3: warning: 'syscall' is deprecated: first deprecated in
      macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use
      kdebug_signpost(). [-Wdeprecated-declarations]
  safe_write(STDERR_FILENO, buffer, strlen(buffer));
  ^
/Users/pwnall/workspace/glog/src/raw_logging.cc:63:34: note: expanded from macro 'safe_write'
# define safe_write(fd, s, len)  syscall(SYS_write, fd, s, len)
                                 ^
/usr/include/unistd.h:733:6: note: 'syscall' has been explicitly marked deprecated here
int      syscall(int, ...);
         ^
1 warning generated.
/Users/pwnall/workspace/glog/src/utilities.cc:254:17: warning: 'syscall' is deprecated: first deprecated in
      macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use
      kdebug_signpost(). [-Wdeprecated-declarations]
    pid_t tid = syscall(__NR_gettid);
                ^
/usr/include/unistd.h:733:6: note: 'syscall' has been explicitly marked deprecated here
int      syscall(int, ...);
         ^
1 warning generated.
@sergiud sergiud added the bug label Nov 4, 2017
@laramiel
Copy link

For the __NR_gettid we may need something like this:

#include <pthread.h>

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
uint64_t tid64;
pthread_threadid_np(NULL, &tid64);
pid_t tid = (pid_t)tid64;
#else
pid_t tid = syscall(__NR_gettid);
#endif

For the write call, perhaps just replace with the libc write call:

#define safe_write(fd, s, len) write(fd, s, len)

@yesudeep
Copy link

Still get this warning.

INFO: From Compiling external/com_google_glog/src/raw_logging.cc:
external/com_google_glog/src/raw_logging.cc:139:3: warning: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Wdeprecated-declarations]
  safe_write(STDERR_FILENO, buffer, strlen(buffer));
  ^
external/com_google_glog/src/raw_logging.cc:63:34: note: expanded from macro 'safe_write'
# define safe_write(fd, s, len)  syscall(SYS_write, fd, s, len)
                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:742:6: note: 'syscall' has been explicitly marked deprecated here
int      syscall(int, ...);
         ^
1 warning generated.
INFO: From Compiling external/com_google_glog/src/utilities.cc:
external/com_google_glog/src/utilities.cc:251:17: warning: 'syscall' is deprecated: first deprecated in macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost(). [-Wdeprecated-declarations]
    pid_t tid = syscall(__NR_gettid);
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:742:6: note: 'syscall' has been explicitly marked deprecated here
int      syscall(int, ...);
         ^
1 warning generated.

@sergiud sergiud closed this as completed Mar 30, 2021
@z-aki
Copy link
Contributor

z-aki commented Apr 14, 2021

@sergiud Hi, have these warnings been fixed ? Do you intend to do so, if not ?

@sergiud
Copy link
Collaborator

sergiud commented Apr 14, 2021

I've closed the issue due to inactivity. You're welcome to contribute.

@z-aki
Copy link
Contributor

z-aki commented Jul 13, 2021

@sergiud Please see #685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants