src/xcalls/x_create.c File Reference

x_create implementation. More...

#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <misc/debug.h>
#include <core/tx.h>
#include <core/config.h>
#include <core/koa.h>
#include <core/buffer.h>
#include <core/stats.h>
#include <libc/syscalls.h>
#include <core/txdesc.h>
#include <xcalls/xcalls.h>

Go to the source code of this file.

Classes

struct  x_create_case1_commit_undo_args_s
struct  x_create_case2_commit_undo_args_s

Typedefs

typedef x_create_case1_commit_undo_args_s x_create_case1_commit_undo_args_t
typedef x_create_case2_commit_undo_args_s x_create_case2_commit_undo_args_t

Functions

int XCALL_DEF() x_create (const char *pathname, mode_t mode, int *result)
 Creates a file.


Detailed Description

x_create implementation.

Definition in file x_create.c.


Typedef Documentation

typedef struct x_create_case1_commit_undo_args_s x_create_case1_commit_undo_args_t

INVARIANT: Files never disappear until commit. This simplifies conflict detection since we can acquire sentinels on inode numbers.

Definition at line 30 of file x_create.c.


Function Documentation

int XCALL_DEF() x_create ( const char *  pathname,
mode_t  mode,
int *  result 
)

Creates a file.

Creates a file using the creation flags: O_CREAT| O_NOCTTY| O_TRUNC| O_RDWR. If a file already exists then it is renamed and removed if transaction finally commits.

Execution : in-place

Asynchronous failures : commit, abort

Parameters:
[in] pathname Path to the file to be created.
[in] mode Permissions.
[out] result Where to store any asynchronous failures.
Returns:
The new file descriptor on success, or -1 if a synchronous failure occurred (in which case, errno is set appropriately).

Definition at line 150 of file x_create.c.

References x_create_case1_commit_undo_args_s::fd, x_create_case2_commit_undo_args_s::fd, x_create_case1_commit_undo_args_s::koa, x_create_case2_commit_undo_args_s::koa, x_create_case2_commit_undo_args_s::original_pathname, x_create_case1_commit_undo_args_s::pathname, x_create_case2_commit_undo_args_s::temp_pathname, TXC_ASSERT, txc_buffer_linear_malloc(), TXC_DEBUG_PRINT, TXC_DEBUG_XCALL, txc_g_koamgr, TXC_INTERNALERROR, txc_koa_alias_cache_lookup_inode(), txc_koa_attach_fd(), txc_koa_create(), TXC_KOA_CREATE_COMMIT_ACTION_ORDER, TXC_KOA_CREATE_UNDO_ACTION_ORDER, txc_koa_get_sentinel(), TXC_KOA_IS_FILE, txc_koa_lock_alias_cache(), txc_koa_lock_fd(), txc_koa_lock_fds_refby_koa(), txc_koa_path2inode(), txc_koa_unlock_alias_cache(), txc_koa_unlock_fd(), txc_koa_unlock_fds_refby_koa(), TXC_R_BUSYSENTINEL, TXC_R_NOTEXISTS, TXC_R_SUCCESS, txc_sentinel_tryacquire(), txc_stats_txstat_increment, txc_tx_abort_transaction(), txc_tx_get_txd(), txc_tx_get_xactstate(), txc_tx_register_commit_action(), txc_tx_register_undo_action(), and x_create().


Generated on Wed Dec 9 20:32:41 2009 for xCalls by  doxygen 1.4.7