MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / pwrite

Function pwrite

src/jrd/os/posix/unix.cpp:1128–1158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1126}
1127
1128static SLONG pwrite(int fd, SCHAR* buf, SLONG nbytes, SLONG offset)
1129/**************************************
1130 *
1131 * p w r i t e
1132 *
1133 **************************************
1134 *
1135 * Functional description
1136 *
1137 * This function uses Asynchronous I/O calls to implement
1138 * positioned write from a given offset
1139 **************************************/
1140{
1141 struct aiocb io;
1142 io.aio_fildes = fd;
1143 io.aio_offset = offset;
1144 io.aio_buf = buf;
1145 io.aio_nbytes = nbytes;
1146 io.aio_reqprio = 0;
1147 io.aio_sigevent.sigev_notify = SIGEV_NONE;
1148 int err = aio_write(&io); // atomically reads at offset
1149 if (err != 0)
1150 return (err); // errno is set
1151
1152 struct aiocb *list[1];
1153 list[0] = &io;
1154 err = aio_suspend(list, 1, NULL); // wait for I/O to complete
1155 if (err != 0)
1156 return (err); // errno is set
1157 return (aio_return(&io)); // return I/O status
1158}
1159
1160#endif // !(HAVE_PREAD && HAVE_PWRITE)
1161

Callers 2

PIO_init_dataFunction · 0.70
PIO_writeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected