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

Add macOS methods and structures for processes, memory, networks #995

Merged
merged 1 commit into from
Aug 13, 2018

Conversation

dbwiddis
Copy link
Contributor

@dbwiddis dbwiddis commented Aug 6, 2018

No description provided.

@dbwiddis dbwiddis force-pushed the mac-systemb branch 3 times, most recently from 9d3c2da to 9d1c48a Compare August 6, 2018 06:31
@matthiasblaesing
Copy link
Member

I don't have access to Mac OS X and zero experience there, so I only gleamed at the bindings. In gernal they look sane, one thing I noticed, that sometimes NativeLong and sometimes long is used for the structure definitions. Is that intended?

@dbwiddis
Copy link
Contributor Author

OS X is my primary development environment and I've had those structures in my project reporting sane information for a few years now, just finally got around to submitting here. In general most of the time you see long it's mapped from uint64_t. The Passwd structure pw_change and pw_expire fields are time_t which is native long. Similarly the seconds field of Timeval is __darwin_time_t which eventually is defined as a long.

The only mappings I might not be 100% sure of are where I have used String for things like char *foo. I think that's correct on *nix but not on Windows... Here's the actual header for Passwd:

	   struct passwd {
		   char    *pw_name;	   /* user name */
		   char    *pw_passwd;	   /* encrypted password */
		   uid_t   pw_uid;	   /* user uid */
		   gid_t   pw_gid;	   /* user gid */
		   time_t  pw_change;	   /* password change time */
		   char    *pw_class;	   /* user access class */
		   char    *pw_gecos;	   /* Honeywell login info */
		   char    *pw_dir;	   /* home directory */
		   char    *pw_shell;	   /* default shell */
		   time_t  pw_expire;	   /* account expiration */
		   int	   pw_fields;	   /* internal: fields filled in */
	   };

Most of the proc-* headers can be seen here. I can dig into my own machine's header files if you have any specific questions...

@twall
Copy link
Contributor

twall commented Aug 13, 2018 via email

@matthiasblaesing
Copy link
Member

The unittests run clean, the sample is sound, the reply is too. Thank you!

@matthiasblaesing matthiasblaesing merged commit 45c2bb8 into java-native-access:master Aug 13, 2018
@dbwiddis dbwiddis deleted the mac-systemb branch February 18, 2019 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants