31 static void close_on_exec(
int fd)
34 int flags = fcntl(fd, F_GETFD);
36 fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
73 G_debug(3,
"G_GISRC_MODE_MEMORY\n");
75 G_putenv(
"GRASS_DB_DRIVER_GISRC_MODE",
94 G_putenv(
"GRASS_DB_DRIVER_GISRC_MODE", ebuf);
109 for (cur =
list; cur; cur = cur->
next)
116 sprintf(msg,
"%s: no such driver available",
name);
131 startup =
driver->dbmscap.startup;
140 #define pipe(fds) _pipe(fds, 250000, _O_BINARY | _O_NOINHERIT)
144 if ((pipe(p1) < 0) || (pipe(p2) < 0)) {
149 close_on_exec(p1[
READ]);
150 close_on_exec(p1[
WRITE]);
151 close_on_exec(p2[
READ]);
152 close_on_exec(p2[
WRITE]);
177 #ifndef USE_BUFFERED_IO
void db_copy_dbmscap_entry(dbDbmscap *, dbDbmscap *)
Copy dbmscap entry.
int db_get_connection(dbConnection *)
Get default DB connection settings for the current mapset.
void db__set_protocol_fds(FILE *, FILE *)
?
void db_error(const char *)
Report error message.
void db_syserror(const char *)
Report system error.
void db_free_dbmscap(dbDbmscap *)
Free dbmscap.
dbDbmscap * db_read_dbmscap(void)
Read dbmscap.
void * db_malloc(int)
Allocate memory.
int db__recv_return_code(int *)
Receive return code.
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.
int G_debug(int, const char *,...) __attribute__((format(printf
const char * G_getenv_nofatal(const char *)
Get environment variable.
int G_spawn_ex(const char *command,...)
Spawn new process based on command.
const struct driver * driver
#define G_GISRC_MODE_FILE
#define G_GISRC_MODE_MEMORY
#define SF_CLOSE_DESCRIPTOR
#define SF_REDIRECT_DESCRIPTOR
dbDriver * db_start_driver(const char *name)
Initialize a new dbDriver for db transaction.