31 static void close_on_exec(
int fd)
34 int flags = fcntl(fd, F_GETFD);
35 fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
70 G_debug(3,
"G_GISRC_MODE_MEMORY\n");
72 G_putenv(
"GRASS_DB_DRIVER_GISRC_MODE", ebuf);
89 G_putenv(
"GRASS_DB_DRIVER_GISRC_MODE", ebuf);
97 if (name[0] ==
'\0') {
104 for (cur = list; cur; cur = cur->
next)
111 sprintf(msg,
"%s: no such driver available", name);
118 if (driver ==
NULL) {
133 #define pipe(fds) _pipe(fds, 250000, _O_BINARY | _O_NOINHERIT) 137 if ((pipe(p1) < 0) || (pipe(p2) < 0)) {
142 close_on_exec(p1[
READ]);
143 close_on_exec(p1[
WRITE]);
144 close_on_exec(p2[READ]);
145 close_on_exec(p2[WRITE]);
168 driver->
send = fdopen(p1[WRITE],
"wb");
169 driver->
recv = fdopen(p2[READ],
"rb");
172 #ifndef USE_BUFFERED_IO
int db_get_connection(dbConnection *)
Get default DB connection settings for the current mapset.
void G_putenv(const char *, const char *)
Sets the UNIX environment variable name to value.
int G_get_gisrc_mode(void)
Get info where variables are stored.
#define SF_REDIRECT_DESCRIPTOR
void db_syserror(const char *)
Report system error.
void db_copy_dbmscap_entry(dbDbmscap *, dbDbmscap *)
Copy dbmscap entry.
int G_spawn_ex(const char *command,...)
Spawn new process based on command.
#define G_GISRC_MODE_FILE
int db__recv_return_code(int *)
Receive return code.
const struct driver * driver
void db_free_dbmscap(dbDbmscap *)
Free dbmscap.
void db_error(const char *)
Report error message.
#define G_GISRC_MODE_MEMORY
dbDbmscap * db_read_dbmscap(void)
Read dbmscap.
#define SF_CLOSE_DESCRIPTOR
const char * G_getenv_nofatal(const char *)
Get environment variable.
void * db_malloc(int)
Allocate memory.
void db__set_protocol_fds(FILE *, FILE *)
?
dbDriver * db_start_driver(const char *name)
Initialize a new dbDriver for db transaction.
int G_debug(int, const char *,...) __attribute__((format(printf