Computers/Linux System Programming

ch6. system data file and system information

emzei 2013. 4. 28. 10:13

//passwd

◆ getpwuid

#include<pwd.h>

 struct passwd* getpwuid(uid_t uid);

(ret)  success :  포인터

                       failed : NULL

 

 

◆ getpwnam

 

#include<pwd.h>

 struct passwd* getpwnam(const char *name);

(ret)  success :  포인터

                       failed : NULL

 

 

 

◆ getpwent

 

#include<pwd.h>

 struct passwd* getpwent(void);

(ret)  success :  포인터, 파일 끝이면 NULL

                       failed : NULL

 

 

◆ setpwent

 

#include<pwd.h>

void setpwent(void);

 

 

◆ endpwent

 

#include<pwd.h>

 void endpwent(void);

 

 

 


 

 

 

//shadow

◆ getspnam

 

#include<shadow.h>

 struct spwd* getspname( const char *name);

(ret)  success :  포인터

                       failed : NULL

 

 

◆ getspent

 

#include<shadow.h>

 struct spwd* getspent(void);

(ret)  success :  포인터

                       failed : NULL

 

 

◆ setspent

#include<shadow.h>

 void setspent(void);

 

 

◆ endspent

#include<shadow.h>

 void endspent(void);

 

 

◆ getgrgid

 

#include<grp.h>

 struct group* getgrgid(gid_t gid);

(ret)  success :  포인터

                       failed :  NULL

 

 

◆ getgrnam

 

#include<grp.h>

 struct group* getgrnam(const char *name);

(ret)  success :  포인터

                       failed :  NULL

 

 

◆ getgrent

 

#include<grp.h>

 struct group* getgrent(void);

(ret)  success :  포인터, 파일 끝이면 NULL

                       failed : NULL

 

 

◆ setgrent

 

#include<grp.h>

 void setgrent(void);

 

 

 

◆ endgrent

 

#include<grp.h>

 void endgrent(void);

 

 

 

◆ getgroups

 

#include<unistd.h>

 int getgroups(int gidsetsize, gid_t grouplist[]);

(ret)  success :  추가 그룹 ID 개수

                       failed : -1

 

 

◆ setgroups

 

#include<unistd.h>

#include<grp.h>

int setgroups(int ngroups, const gid_t grouplist[]);

(ret)  success :  0

                       failed : -1

 

 

◆ initgroups

 

#include<unistd.h>

#include<grp.h>

 int initgroups(const char *username, gid_t basegid);

(ret)  success :  0

                       failed : -1

 

 

 

◆ uname

 

#include<sys/utsname.h>

int uname(struct utsname *name);

(ret)  success :  음이 아닌 값

                       failed :  -1

 

 

◆ gethostname

 

#include<unistd.h>

 int gethostname(char *name, int namelen);

(ret)  success :  0

                       failed : -1

 

 

◆ time

 

#include<time.h>

 time_t time(time_t *calptr);

(ret)  success :  시간 값

                       failed :  -1

 

 

◆ gettimeofday

 

#include<sys/time.h>

 int gettimeofday(struct timeval *restrict fp, void *restrict tzp);

(ret)  항상 0

 

 

◆ gmtime

#include<time.h>

 struct tm* gmtime(const time_t *calptr);

(ret)  분할된 시간을 가리키는 포인터

 

◆ localtime

#include<time.>

 struct tm* localtime(const time_t *calptr);

(ret)  분할된 시간을 가리키는 포인터

 

◆ mktime

#include<time.h>

 time_t mktime(struct tm *tmptr);

(ret)  success :  달력 시간

                       failed : -1

 

◆ asctime

#include<time.h>

 char* asctime(const struct tm* tmptr);

(ret)  NULL 종료 문자열을 가리키는 포인터

 

◆ ctime

#include<time.h>

 char* ctime(const time_t *calptr);

(ret)  NULL 종료 문자열을 가리키는 포인터

 

◆ strftime

 

#include<time.h>

 char* strftime(char *restrict buf, size_t maxsize, const char *restrict format, const struct tm *restrict tmptr);

(ret)  success :  버퍼가 넉넉한 경우 배열에 저장된 문자열 개수

                       failed :  그렇지 않을 경우 0

'Computers > Linux System Programming' 카테고리의 다른 글

ch8. process control  (0) 2013.04.28
ch7. process environment  (0) 2013.04.28
ch5. standard I/O library  (0) 2013.04.28
ch4. file & directory  (0) 2013.04.27
ch3. file I/O  (0) 2013.04.27