
Raymond Toy pushed to branch issue-393-os-common-getpwuid at cmucl / cmucl Commits: 11294c70 by Raymond Toy at 2025-03-28T13:39:34-07:00 Rename unix-passwd to os-unix-info Also update comments in unix.lisp about os-unix-info to match what it really is. - - - - - 2 changed files: - src/code/unix.lisp - src/lisp/os-common.c Changes: ===================================== src/code/unix.lisp ===================================== @@ -2413,16 +2413,10 @@ (dir "" :type string) (shell "" :type string)) -;; See <pwd.h> -;; -;; While each OS may contain additional fields, we only need the ones -;; that are used the user-info structure. -;; -;; NOTE: This may NOT be the actual OS-defined passwd structure. It -;; is the structure returned by os_getpwuid (in unix-getpwuid). - +;; The C structure that is returned by os_getpwuid containing the info +;; that we use to fill the user-info object. (def-alien-type nil - (struct unix-passwd + (struct os-unix-info (pw-name (* char)) ; user's login name (pw-passwd (* char)) ; no longer used (pw-uid uid-t) ; user id ===================================== src/lisp/os-common.c ===================================== @@ -950,7 +950,7 @@ os_get_user_homedir(const char* name, int *status) /* * This MUST match the definition in code/unix.lisp. */ -struct unix_passwd +struct os_user_info { char* pw_name; char* pw_passwd; @@ -961,7 +961,7 @@ struct unix_passwd char* pw_shell; }; -struct unix_passwd* +struct os_user_info* os_getpwuid(uid_t uid) { char initial[1024]; @@ -969,7 +969,7 @@ os_getpwuid(uid_t uid) size_t size; struct passwd pwd; struct passwd *ppwd; - struct unix_passwd *result = NULL; + struct os_user_info *result = NULL; buffer = initial; obuffer = NULL; @@ -988,7 +988,7 @@ again: * that. */ if (ppwd != NULL) { - result = (struct unix_passwd*) malloc(sizeof(pwd)); + result = (struct os_user_info*) malloc(sizeof(*result)); result->pw_name = strdup(pwd.pw_name); result->pw_passwd = strdup(pwd.pw_passwd); result->pw_uid = pwd.pw_uid; @@ -1025,7 +1025,7 @@ again: * os_getpwuid(). */ void -os_free_getpwuid(struct passwd* pwd) +os_free_getpwuid(struct os_user_info* pwd) { free(pwd->pw_name); free(pwd->pw_passwd); View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/11294c709e1e9ed724bef649... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/11294c709e1e9ed724bef649... You're receiving this email because of your account on gitlab.common-lisp.net.