Skip to content

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

Merged
matthiasblaesing merged 1 commit into
java-native-access:masterfrom
dbwiddis:mac-systemb
Aug 13, 2018
Merged

Add macOS methods and structures for processes, memory, networks#995
matthiasblaesing merged 1 commit into
java-native-access:masterfrom
dbwiddis:mac-systemb

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Aug 6, 2018

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

twall commented Aug 13, 2018 via email

Copy link
Copy Markdown
Contributor

@matthiasblaesing

Copy link
Copy Markdown
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