Hoja de ayuda. Curso 2010-2011 void (* signal (int sig, void (*handler) ())) (); void handler (int sig [, int code, struct sigcontext *scp]); unsigned int alarm (unsigned int seconds); int atexit(void (*func)(void)); int atoi(const char *str); int close (int fd); int closedir(DIR *dir); int dup(int fildes); int dup2(int fildes, int fildes2); int execl (const char *path, const char *arg0, ..., const char *argn, char * /*NULL*/); int execle (const char *path, const char *arg0, ..., const char *argn, char * /*NULL*/, char *const envp[]); int execlp (const char *file, const char *arg0,...,const char *argn, char * /*NULL*/); int execv (const char *path, char *const argv[]); int execve (const char *path, char *const argv[], char *const envp[]); int execvp (const char *file, char *const argv[]); void exit (int status); int fclose(FILE *stream); FILE * fdopen (int fd, char *mode); FILE * fopen(const char *filename, const char *mode); pid_t fork(void); int fprintf(FILE *stream, const char *format, /* args*/...); size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream); int fscanf(FILE*stream, const char *format, ...); int fstat(int filedes, struct stat *buf); key_t ftok(const char *path, int id); size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream); char * getcwd(char *buf, size_t size); char * getenv(const char *nombre); pid_t getpid(void); pid_t getppid(void); uid_t getuid(void); int kill(pid_t pid, int sig); int lstat(const char *file_name, struct stat *buf); int open (char *name, int how_to_open, int mode); DIR * opendir(const char *name); int pause(void); int pipe (int fildes[2]); int printf(const char *format, /* args*/ ...); int raise(int sig); ssize_t read (int fd, void *buffer, size_t num_bytes); struct dirent *readdir(DIR *dir); void rewinddir(DIR *dir); int scanf(const char *format, ...); int semctl(int semid, int semnum, int cmd, /* union semun arg */...); int semget(key_t key, int nsems, int semflg); int semop (int semd, struct sembuf *sops, int nsops); unsigned int sleep(unsigned int seconds) ; int sprintf(char *s, const char *format, /* args*/ ...); int snprintf(char *s, int tam, const char *format, /* args*/ ...); int sscanf(const char *s, const char *format, ...); int stat(const char *file_name, struct stat *buf); char * strcat(char *s1, const char *s2); int strcmp(const char *s1, const char *s2); char * strcpy(char *s1, const char *s2); int system(const char *string); pid_t wait(int *stat_loc); pid_t waitpid(pid_t pid, int *stat_loc, int options); ssize_t write (int fd, void *buffer, size_t num_bytes); Puede tratar los valores almacenados en variables de tipo key_t, pid_t, size_t y ssize_t como números enteros. /* Definiciones de estructuras struct dirent { ino_t d_ino; off_t d_off; unsigned short d_reclen; */ /* Número de i-nodo */ /* Offset de la siguiente ent. */ /* Longitud de la estructura de la entrada de directorio */ d_name[MAXNAMELEN]; /* Nombre del archivo*/ char }; struct stat { dev_t st_dev; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; dev_t st_rdev; off_t st_size; unsigned long st_blksize; unsigned long st_blocks; time_t st_atime; time_t st_mtime; time_t st_ctime; }; struct sembuf { ushort_t short short }; sem_num; sem_op; sem_flg; /* /* /* /* /* /* /* /* /* /* /* /* /* device */ inode */ protection */ number of hard links */ user ID of owner */ group ID of owner */ device type (if inode device) */ total size, in bytes */ blocksize for filesystem I/O */ number of blocks allocated */ time of last access */ time of last modification */ time of last change */ /* semaphore # */ /* semaphore operation */ /* operation flags */ /* Definiciones de constantes */ #define O_RDONLY 0 #define O_WRONLY 1 #define O_RDWR 2 #define O_APPEND 0x08 #define O_CREAT 0x100 #define O_TRUNC 0x200 #define O_EXCL 0x400 #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define S_IFMT S_IAMB S_IFIFO S_IFCHR S_IFDIR S_IFBLK S_IFREG S_IFLNK S_IFSOCK S_IFDOOR S_ISUID S_ISGID S_ISVTX S_IREAD S_IWRITE S_IEXEC S_IRUSR S_IWUSR 0xF000 0x1FF 0x1000 0x2000 0x4000 0x6000 0x8000 0xA000 0xC000 0xD000 0x800 0x400 0x200 00400 00200 00100 00400 00200 /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* type of file */ access mode bits */ fifo */ character special */ directory */ block special */ regular */ symbolic link */ socket */ door */ set user id on execution */ set group id on execution */ save swapped text even after use */ read permission, owner */ write permission, owner */ execute/search permission, owner */ read permission: owner */ write permission: owner */ #define #define #define #define #define S_IRGRP S_IWGRP S_IROTH S_IWOTH S_ENFMT /* Códigos de error */ #define EINTR 4 00040 00020 00004 00002 S_ISGID /* /* /* /* /* read permission: group */ write permission: group */ read permission: other */ write permission: other */ record locking enforcement flag */ /* interrupted system call /* Constantes de manejo de señales */ SIG_DFL SIG_IGN SIG_ERR /* Constantes de mecanismos IPC de comunicación entre procesos */ IPC_PRIVATE IPC_CREAT IPC_EXCL IPC_NOWAIT SEM_UNDO IPC_STAT IPC_SET IPC_RMID /* Librería de semáforos */ typedef int Semaph; int Semaph_Create (char nombre_sem[], int valor_ini); void Semaph_Destroy(char nombre_sem[],int sem); void Semaph_Down (int sem); void Semaph_Up (int sem); void Semaph_Set (int sem, int val); int Semaph_Get (int sem); int Semaph_Print (int sem); */