Write a single character c (interpreted as an unsigned char) to the stdio stream file without locking the file stream. This operation must only be used while the file stream has been locked by calling flockfile, or when you know that no other thread may access the file stream concurrently. Returns the character or the value EOF if an error occurred.

References: 6.4.2 Headers: 

Hint: Replace old calls to putc to retain fastest access.

putchar_unlocked

int putchar_unlocked (

int c);

Write a single character c (interpreted as an unsigned char) to the stdio stream stdout without locking the file stream. This operation must only be used while the file stream has been locked by calling flockfile, or when you know that no other thread may access the file stream concurrently. Returns the character or the value EOF if an error occurred.

References: 6.4.2 Headers: 

Hint: Replace old calls to putchar to retain fastest access.

<p>9.3.11 Thread-safe functions</p>

Thread-safe functions provide improved access to traditional features of ANSI C and POSIX that cannot be effectively made thread-safe without interface changes. These routines are designated by the "_r" suffix added to the traditional function name they replace, for example, getlogin_r for getlogin.

getlogin_r

int getlogin_r (

char *name,

size_t namesize);

Write the user name associated with the current process into the buffer pointed to by name. The buffer is namesize bytes long, and should have space for the name and a terminating null character. The maximum size of the login name is LOGIN_

NAME_MAX.

References: 6.5.1 Headers: 

readdir_r

int readdir_r (

DIR *dirp,

struct dirent *entry, struct dirent **result);

Return a pointer (result) to the directory entry at the current position in the directory stream to which dirp refers. Whereas readdir retains the current position using a static variable, readdir_r uses the entry parameter, supplied by the caller.

References: 6.5.2

Headers: ,

Errors: [EBADF] dirp is not an open directory stream.

strtok_r

char *strtok_r (

char *s,

const char *sep,

char **lasts);

Return a pointer to the next token in the strings. Whereas strtok retains the current position within a string using a static variable, strtok_r uses the lasts parameter, supplied by the caller.

References: 6.5.3 Headers: 

asctime_r

char *asctime_r (

const struct tm*tm,

char *buf);

Convert the "broken-down" time in the structure pointed to by tm into a string, which is stored in the buffer pointed to by buf. The buffer pointed to by buf must

contain at least 26 bytes. The function returns a pointer to the buffer on success, or NULL on failure.

References: 6.5.4 Headers: 

ctime_r

char *ctime_r (

const time_t *clock, char *buf);

Convert the calendar time pointed to by clock into a string representing the local time, which is stored in the buffer pointed to by buf. The buffer pointed to by buf must contain at least 26 bytes. The function returns a pointer to the buffer on success, or NULL on failure.

References: 6.5.4 Headers: 

gmtime_r

struct tm *gmtime_r (

const time_t *clock, struct tm *result);

Convert the calendar time pointed to by clock into a "broken-down time" expressed as Coordinated Universal Time (UTC), which is stored in the structure pointed to by result. The function returns a pointer to the structure on success, or NULL on failure.

References: 6.5.4 Headers: 

localtime_r

struct tm *localtime_r (

const time_t *clock, struct tm *result);

Convert the calendar time pointed to by clock into a "broken-down time" expressed as local time, which is stored in the structure pointed to by result. The function returns a pointer to the structure on success, or NULL on failure.

References: 6.5.4 Headers:

rand_r

int rand_r (

unsigned int *seed);

Return the next value in a sequence of pseudorandom integers in the range of 0 to RAND_MAX. Whereas rand uses a static variable to maintain the context between a series of calls, rand_r uses the value pointed to by seed, which is supplied by the caller.

References: 6.5.5 Headers: 

getgrgid_r

int getgrgid_r (

gid_t gid,

struct group *group,

char *buffer,

size_t bufsize,

struct group **result);

Locate an entry from the group database with a group id matching the gid argument. The group entry is stored in the memory pointed to by buffer, which contains bufsize bytes, and a pointer to the entry is stored at the address pointed to by result. The maximum buffer size required can be determined by calling sysconf with the _SC_GETGR_R_SIZE_MAX parameter.

References: 6.5.6

Headers: ,

Errors: [ERANGE] the specified buffer is too small.

| getgrnam

r

int getgrnam_r (

const char *name,

struct group *group,

char *buffer,

size_t bufsize,

struct group **result);

Перейти на страницу:

Похожие книги