⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwcache.c

📁 openmosix使用工具.mtop, mosmon, mps等。用于控制openmosix。openmosix 使用工具.mtop, mosmon, mps等。用于控制openmosix。openm
💻 C
字号:
/***********************************************************************\*   Copyright (C) 1992-1998 by Michael K. Johnson, johnsonm@redhat.com	**									**	This file is placed under the conditions of the GNU Library	**	General Public License, version 2, or any later version.	**	See file ../COPYING.LIB	for information on distribution		**	conditions.							*\***********************************************************************/#include <stdio.h>#include <stdlib.h>#include <pwd.h>#include "ps.h"#define	HASHSIZE	16			/* power of 2 */#define	HASH(x)		((x) & (HASHSIZE - 1))static struct pwbuf {    int uid;    char name[12];    struct pwbuf *next;} *pwhash[HASHSIZE];char *user_from_uid(int uid){    struct pwbuf **p;    struct passwd *pw;    p = &pwhash[HASH(uid)];    while (*p) {	if ((*p)->uid == uid)	    return((*p)->name);	p = &(*p)->next;    }    *p = (struct pwbuf *) xmalloc(sizeof(struct pwbuf));    (*p)->uid = uid;    if ((pw = getpwuid(uid)) == NULL)	sprintf((*p)->name, "#%d", uid);    else	sprintf((*p)->name, "%-.8s", pw->pw_name);    (*p)->next = NULL;    return((*p)->name);}void bad_user_access_length() { }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -