当前位置: 技术问答>linux和unix
有谁帮忙贴一些unix/linux的系统函数(与windows的signal、semaphore、task类似的)
来源: 互联网 发布时间:2014-11-13
本文导语: 多谢谢了! | int accept(int sockfd, struct sockaddr* client_addr, int* addrlen); int access(char* pathname, int mode); unsigned int alarm(unsigned int seocnds); int atexit(void (*func)(void)); int bind(int sockfd, const struct...
多谢谢了!
|
int accept(int sockfd, struct sockaddr* client_addr, int* addrlen);
int access(char* pathname, int mode);
unsigned int alarm(unsigned int seocnds);
int atexit(void (*func)(void));
int bind(int sockfd, const struct sckaddr* my_addr, int addrlen);
int chmod(char* pathname, mode_t mode);
int chown(const char* pathname, uid_t owner, gie_t group);
void clearerr(FILE *fp);
int close(int fd);
int closedir(DIR* dp);
void closelog(void);
int connect(int sockfd, const struct sockaddr* serv_addr, int addrlen);
int creat(const char* pathname, mode_t mode);
int dup(int fd);
int dup2(int fd,int fd2);
int execl(const char* pathname, const char* arg0, ...);
int execle(const char* pathname, const char* arg0, ...);
int execlp(const char* pathname, const char* arg0, ...);
int execv(const char* pathname, char* const argv[]);
int execve(const char* pathname, char* const argv[], char* const envp[]);
int execvp(const char* filename, char* const argv[]);
void exit(int status);
void _exit(int status);
int fchmod(int fd, mode_t mode);
int fchown(int fd, uid_t owner, gid_t group);
int fclose(FILE* fp);
int fcntl(int fd, int cmd);
int fcntl(int fd, int cmd, long setval);
FILE *fdopen(int filedes, const char* type);
int feof(FILE *fp);
int ferror(FILE *fp);
int fflush(FILE *fp);
int fgetc(FILE *fp);
int fgetpos(FILE *fp, fpos_t* pos);
char* fgets(char* buf, int n, FILE *fp);
FILE *fopen(const char* pathname, const char* type);
pid_t fork(void);
int fprintf(FILE *fp, const char *format, ...);
int fpurge(FILE *fp);
int fputc(int c, FILE *fp);
int fputs(const char* str, FILE *fp);
size_t fread(void* ptr, size_t size, size_t nobj, FILE *fp);
FILE* freopen(const char* pathname, const char* type, FILE *fp);
int fscanf(FILE* fp, const char *format, ...);
int fseek(FILE* fp, long offset, int whence);
int fsetpos(FILE *fp, const fpos_t* pos);
int fstat(int fd, struct stat* sbuf);
long ftell(FILE *fp);
int ftruncate(int fd, size_t len);
size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE *fp);
int getc(FILE *fp);
int getchar(void);
uid_t getepid(void);
uid_t geteuid(void);
int gethostname(char* name, int* len);
int getpeername(int sockfd, struct sockaddr* addr, int* len);
pid_t getpgrp(void);
uid_t getpid(void);
pid_t getppid(void);
char* gets(char* buf);
struct servent* getservbyname(const char* servname, const char* protoname);
struct servent* getservbyport(int port, const char* protoname);
int getsockname(int sockfd, struct sockaddr* addr, int* len);
uid_t getuid(void);
int kill(pid_t pid, int signumber);
int link(char* pathname1,char* pathname2);
int listen(int sockfd, int backlog);
off_t lseek(int fd, off_t offset, int whence);
int lstat(char* pathname, stat* sbuf);
int mkdir(const char* pathname, mode_t mode);
int mkfifo(const char* pathname, mode_t mode);
int msgctl(int msqid, int cmd, struct msqid_ds* buf);
int msgget(key_t key, int flag);
int msgrcv(int msqid, void* ptr, size_t nbytes, long type, int flag);
int msgsnd(int msqid, const void* ptr, size_t nbytes, int flag);
int open(const char* pathname, int oflag, ...);
DIR* opendir(const char* pathname);
void openlog(char* indent, int option, int facility);
int pause(void);
int raise(int signumber);
int pclose(FILE* fp);
int pipe(int filedes[2]);
FILE *popen(const char* cmdstring, const char* type);
int printf(const char* format, ...);
int putc(int c, FILE* fp);
int putchar(int c);
int puts(const char *str);
ssize_tread(int fd, void* buf, size_t nbytes);
struct dirent* readdir(DIR *dp);
int readlink(const char* pathname, char* buf, int bufsize);
int recv(int sockfd, void* buf, int len, undigned int flags);
int recvfrom(int sockfd, void* buf, int len, int flags, struct sockaddr* formaddr, int* addrlen);
int rename(const char* oldname, const char* newname);
void rewind(FILE *fp);
int rmdir( const char* pathname);
int scanf(const char* format, ...);
int select(int maxfd, fd_set* readset, fd_set* writeset, fd_set* exceptset, const struct timeval* timeout);
int send(int sockfd, const void* msg, int len, int flags);
int sendto(int sockfd, void* mes, int len, int flags, struct sockaddr* toaddr, int addrlen);
int semctl(int nsems, int flag);
int semget(key_t key, int nsems, int flag);
int semop(int semid, struct sembuf semoparray[], size_t nops);
int setbuf(FILE* fp, char* buf);
int setbuffer(FILE *fp, char* buf);
int setgid(gid_t gid);
int setegid(gid_t gid);
int seteuid(uid_t uid);
int setlinebuf(FILE* fp);
int setpgid(pid_t pid, pid_t pgid);
int setregid(gid_t rgid, gid_t egid);
pid_t setsid(void);
int setuid(uid_t uid);
int setvbuf(FILE *fp, char* buf, int mode, size_t size);
void* shmat(int shmid, void* addr, int flag);
int shmctl(int shmid, int cmd, shmid_ds* buf);
int shmdt(void* addr);
int shmget(key_t key, int size, int flag);
int shutdown(int sockfd, int how);
int sigaction(int signumber, const struct sigaction* act, struct sigaction* oact);
void (*signal(int signumber, void (*func)(int)))(int);
int sigpending(sigset_t* set);
int sigprocmask(int how, const sigset_t* set, sigset_t* oset);
int sigsetjmp(sigjmp_buf env, int savemask);
int sigsuspend(const sigset_t* sigmask);
int socket(sa_family_t family, int type, int protocol);
int sprintf(char* buf, const char* format, ...);
int sscanf(const char* buf, const char* format, ...);
int stat(char* pathname, stat* sbuf);
int symlink(const char* actualpath, const char* sympath);
void syslog(int priority, char* format, ...);
int system(const char* cmdstring);
pid_t tcgetpgrp(int filedes);
int tcsetpgrp(int filedes, pid_t pgrpid);
char* tempnam(const char* directory, const char* prefix);
FILE* tmpfile(void);
char* tmpnam(char* ptr);
mode_t umask(mode_t mask);
int uname(struct utsname* name);
int ungetc(int c, FILE *fp);
int unlink(char* pathname);
pid_t vfork(void);
pid_t wait(int(* statloc);
pid_t waitpid(pid_t pid, int *statloc, int options)
ssize_t write(int fd, const void* buf, size_t nbytes);
int access(char* pathname, int mode);
unsigned int alarm(unsigned int seocnds);
int atexit(void (*func)(void));
int bind(int sockfd, const struct sckaddr* my_addr, int addrlen);
int chmod(char* pathname, mode_t mode);
int chown(const char* pathname, uid_t owner, gie_t group);
void clearerr(FILE *fp);
int close(int fd);
int closedir(DIR* dp);
void closelog(void);
int connect(int sockfd, const struct sockaddr* serv_addr, int addrlen);
int creat(const char* pathname, mode_t mode);
int dup(int fd);
int dup2(int fd,int fd2);
int execl(const char* pathname, const char* arg0, ...);
int execle(const char* pathname, const char* arg0, ...);
int execlp(const char* pathname, const char* arg0, ...);
int execv(const char* pathname, char* const argv[]);
int execve(const char* pathname, char* const argv[], char* const envp[]);
int execvp(const char* filename, char* const argv[]);
void exit(int status);
void _exit(int status);
int fchmod(int fd, mode_t mode);
int fchown(int fd, uid_t owner, gid_t group);
int fclose(FILE* fp);
int fcntl(int fd, int cmd);
int fcntl(int fd, int cmd, long setval);
FILE *fdopen(int filedes, const char* type);
int feof(FILE *fp);
int ferror(FILE *fp);
int fflush(FILE *fp);
int fgetc(FILE *fp);
int fgetpos(FILE *fp, fpos_t* pos);
char* fgets(char* buf, int n, FILE *fp);
FILE *fopen(const char* pathname, const char* type);
pid_t fork(void);
int fprintf(FILE *fp, const char *format, ...);
int fpurge(FILE *fp);
int fputc(int c, FILE *fp);
int fputs(const char* str, FILE *fp);
size_t fread(void* ptr, size_t size, size_t nobj, FILE *fp);
FILE* freopen(const char* pathname, const char* type, FILE *fp);
int fscanf(FILE* fp, const char *format, ...);
int fseek(FILE* fp, long offset, int whence);
int fsetpos(FILE *fp, const fpos_t* pos);
int fstat(int fd, struct stat* sbuf);
long ftell(FILE *fp);
int ftruncate(int fd, size_t len);
size_t fwrite(const void* ptr, size_t size, size_t nobj, FILE *fp);
int getc(FILE *fp);
int getchar(void);
uid_t getepid(void);
uid_t geteuid(void);
int gethostname(char* name, int* len);
int getpeername(int sockfd, struct sockaddr* addr, int* len);
pid_t getpgrp(void);
uid_t getpid(void);
pid_t getppid(void);
char* gets(char* buf);
struct servent* getservbyname(const char* servname, const char* protoname);
struct servent* getservbyport(int port, const char* protoname);
int getsockname(int sockfd, struct sockaddr* addr, int* len);
uid_t getuid(void);
int kill(pid_t pid, int signumber);
int link(char* pathname1,char* pathname2);
int listen(int sockfd, int backlog);
off_t lseek(int fd, off_t offset, int whence);
int lstat(char* pathname, stat* sbuf);
int mkdir(const char* pathname, mode_t mode);
int mkfifo(const char* pathname, mode_t mode);
int msgctl(int msqid, int cmd, struct msqid_ds* buf);
int msgget(key_t key, int flag);
int msgrcv(int msqid, void* ptr, size_t nbytes, long type, int flag);
int msgsnd(int msqid, const void* ptr, size_t nbytes, int flag);
int open(const char* pathname, int oflag, ...);
DIR* opendir(const char* pathname);
void openlog(char* indent, int option, int facility);
int pause(void);
int raise(int signumber);
int pclose(FILE* fp);
int pipe(int filedes[2]);
FILE *popen(const char* cmdstring, const char* type);
int printf(const char* format, ...);
int putc(int c, FILE* fp);
int putchar(int c);
int puts(const char *str);
ssize_tread(int fd, void* buf, size_t nbytes);
struct dirent* readdir(DIR *dp);
int readlink(const char* pathname, char* buf, int bufsize);
int recv(int sockfd, void* buf, int len, undigned int flags);
int recvfrom(int sockfd, void* buf, int len, int flags, struct sockaddr* formaddr, int* addrlen);
int rename(const char* oldname, const char* newname);
void rewind(FILE *fp);
int rmdir( const char* pathname);
int scanf(const char* format, ...);
int select(int maxfd, fd_set* readset, fd_set* writeset, fd_set* exceptset, const struct timeval* timeout);
int send(int sockfd, const void* msg, int len, int flags);
int sendto(int sockfd, void* mes, int len, int flags, struct sockaddr* toaddr, int addrlen);
int semctl(int nsems, int flag);
int semget(key_t key, int nsems, int flag);
int semop(int semid, struct sembuf semoparray[], size_t nops);
int setbuf(FILE* fp, char* buf);
int setbuffer(FILE *fp, char* buf);
int setgid(gid_t gid);
int setegid(gid_t gid);
int seteuid(uid_t uid);
int setlinebuf(FILE* fp);
int setpgid(pid_t pid, pid_t pgid);
int setregid(gid_t rgid, gid_t egid);
pid_t setsid(void);
int setuid(uid_t uid);
int setvbuf(FILE *fp, char* buf, int mode, size_t size);
void* shmat(int shmid, void* addr, int flag);
int shmctl(int shmid, int cmd, shmid_ds* buf);
int shmdt(void* addr);
int shmget(key_t key, int size, int flag);
int shutdown(int sockfd, int how);
int sigaction(int signumber, const struct sigaction* act, struct sigaction* oact);
void (*signal(int signumber, void (*func)(int)))(int);
int sigpending(sigset_t* set);
int sigprocmask(int how, const sigset_t* set, sigset_t* oset);
int sigsetjmp(sigjmp_buf env, int savemask);
int sigsuspend(const sigset_t* sigmask);
int socket(sa_family_t family, int type, int protocol);
int sprintf(char* buf, const char* format, ...);
int sscanf(const char* buf, const char* format, ...);
int stat(char* pathname, stat* sbuf);
int symlink(const char* actualpath, const char* sympath);
void syslog(int priority, char* format, ...);
int system(const char* cmdstring);
pid_t tcgetpgrp(int filedes);
int tcsetpgrp(int filedes, pid_t pgrpid);
char* tempnam(const char* directory, const char* prefix);
FILE* tmpfile(void);
char* tmpnam(char* ptr);
mode_t umask(mode_t mask);
int uname(struct utsname* name);
int ungetc(int c, FILE *fp);
int unlink(char* pathname);
pid_t vfork(void);
pid_t wait(int(* statloc);
pid_t waitpid(pid_t pid, int *statloc, int options)
ssize_t write(int fd, const void* buf, size_t nbytes);
|
您要的是IPC调用吧。列在下面:
System V IPC:
信号量相关:semget(),semctl(),semop();
共享内存:shmget(),shmat(),shmdt(),shmctl();
消息队列:msgget(),msgctl(),msgsnd(),msgrcv();
关于信号的太多了,可参考LDP 中的The Linux Programmer's Guide。
System V IPC:
信号量相关:semget(),semctl(),semop();
共享内存:shmget(),shmat(),shmdt(),shmctl();
消息队列:msgget(),msgctl(),msgsnd(),msgrcv();
关于信号的太多了,可参考LDP 中的The Linux Programmer's Guide。
|
参考《linux程序设计权威指南》